components.js 2.0 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504
  1. /******/ (function() { // webpackBootstrap
  2. /******/ var __webpack_modules__ = ({
  3. /***/ 4403:
  4. /***/ (function(module, exports) {
  5. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  6. Copyright (c) 2018 Jed Watson.
  7. Licensed under the MIT License (MIT), see
  8. http://jedwatson.github.io/classnames
  9. */
  10. /* global define */
  11. (function () {
  12. 'use strict';
  13. var hasOwn = {}.hasOwnProperty;
  14. var nativeCodeString = '[native code]';
  15. function classNames() {
  16. var classes = [];
  17. for (var i = 0; i < arguments.length; i++) {
  18. var arg = arguments[i];
  19. if (!arg) continue;
  20. var argType = typeof arg;
  21. if (argType === 'string' || argType === 'number') {
  22. classes.push(arg);
  23. } else if (Array.isArray(arg)) {
  24. if (arg.length) {
  25. var inner = classNames.apply(null, arg);
  26. if (inner) {
  27. classes.push(inner);
  28. }
  29. }
  30. } else if (argType === 'object') {
  31. if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
  32. classes.push(arg.toString());
  33. continue;
  34. }
  35. for (var key in arg) {
  36. if (hasOwn.call(arg, key) && arg[key]) {
  37. classes.push(key);
  38. }
  39. }
  40. }
  41. }
  42. return classes.join(' ');
  43. }
  44. if ( true && module.exports) {
  45. classNames.default = classNames;
  46. module.exports = classNames;
  47. } else if (true) {
  48. // register as 'classnames', consistent with npm package name
  49. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  50. return classNames;
  51. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  52. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  53. } else {}
  54. }());
  55. /***/ }),
  56. /***/ 1345:
  57. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  58. "use strict";
  59. var util = __webpack_require__(5022);
  60. function scrollIntoView(elem, container, config) {
  61. config = config || {};
  62. // document 归一化到 window
  63. if (container.nodeType === 9) {
  64. container = util.getWindow(container);
  65. }
  66. var allowHorizontalScroll = config.allowHorizontalScroll;
  67. var onlyScrollIfNeeded = config.onlyScrollIfNeeded;
  68. var alignWithTop = config.alignWithTop;
  69. var alignWithLeft = config.alignWithLeft;
  70. var offsetTop = config.offsetTop || 0;
  71. var offsetLeft = config.offsetLeft || 0;
  72. var offsetBottom = config.offsetBottom || 0;
  73. var offsetRight = config.offsetRight || 0;
  74. allowHorizontalScroll = allowHorizontalScroll === undefined ? true : allowHorizontalScroll;
  75. var isWin = util.isWindow(container);
  76. var elemOffset = util.offset(elem);
  77. var eh = util.outerHeight(elem);
  78. var ew = util.outerWidth(elem);
  79. var containerOffset = undefined;
  80. var ch = undefined;
  81. var cw = undefined;
  82. var containerScroll = undefined;
  83. var diffTop = undefined;
  84. var diffBottom = undefined;
  85. var win = undefined;
  86. var winScroll = undefined;
  87. var ww = undefined;
  88. var wh = undefined;
  89. if (isWin) {
  90. win = container;
  91. wh = util.height(win);
  92. ww = util.width(win);
  93. winScroll = {
  94. left: util.scrollLeft(win),
  95. top: util.scrollTop(win)
  96. };
  97. // elem 相对 container 可视视窗的距离
  98. diffTop = {
  99. left: elemOffset.left - winScroll.left - offsetLeft,
  100. top: elemOffset.top - winScroll.top - offsetTop
  101. };
  102. diffBottom = {
  103. left: elemOffset.left + ew - (winScroll.left + ww) + offsetRight,
  104. top: elemOffset.top + eh - (winScroll.top + wh) + offsetBottom
  105. };
  106. containerScroll = winScroll;
  107. } else {
  108. containerOffset = util.offset(container);
  109. ch = container.clientHeight;
  110. cw = container.clientWidth;
  111. containerScroll = {
  112. left: container.scrollLeft,
  113. top: container.scrollTop
  114. };
  115. // elem 相对 container 可视视窗的距离
  116. // 注意边框, offset 是边框到根节点
  117. diffTop = {
  118. left: elemOffset.left - (containerOffset.left + (parseFloat(util.css(container, 'borderLeftWidth')) || 0)) - offsetLeft,
  119. top: elemOffset.top - (containerOffset.top + (parseFloat(util.css(container, 'borderTopWidth')) || 0)) - offsetTop
  120. };
  121. diffBottom = {
  122. left: elemOffset.left + ew - (containerOffset.left + cw + (parseFloat(util.css(container, 'borderRightWidth')) || 0)) + offsetRight,
  123. top: elemOffset.top + eh - (containerOffset.top + ch + (parseFloat(util.css(container, 'borderBottomWidth')) || 0)) + offsetBottom
  124. };
  125. }
  126. if (diffTop.top < 0 || diffBottom.top > 0) {
  127. // 强制向上
  128. if (alignWithTop === true) {
  129. util.scrollTop(container, containerScroll.top + diffTop.top);
  130. } else if (alignWithTop === false) {
  131. util.scrollTop(container, containerScroll.top + diffBottom.top);
  132. } else {
  133. // 自动调整
  134. if (diffTop.top < 0) {
  135. util.scrollTop(container, containerScroll.top + diffTop.top);
  136. } else {
  137. util.scrollTop(container, containerScroll.top + diffBottom.top);
  138. }
  139. }
  140. } else {
  141. if (!onlyScrollIfNeeded) {
  142. alignWithTop = alignWithTop === undefined ? true : !!alignWithTop;
  143. if (alignWithTop) {
  144. util.scrollTop(container, containerScroll.top + diffTop.top);
  145. } else {
  146. util.scrollTop(container, containerScroll.top + diffBottom.top);
  147. }
  148. }
  149. }
  150. if (allowHorizontalScroll) {
  151. if (diffTop.left < 0 || diffBottom.left > 0) {
  152. // 强制向上
  153. if (alignWithLeft === true) {
  154. util.scrollLeft(container, containerScroll.left + diffTop.left);
  155. } else if (alignWithLeft === false) {
  156. util.scrollLeft(container, containerScroll.left + diffBottom.left);
  157. } else {
  158. // 自动调整
  159. if (diffTop.left < 0) {
  160. util.scrollLeft(container, containerScroll.left + diffTop.left);
  161. } else {
  162. util.scrollLeft(container, containerScroll.left + diffBottom.left);
  163. }
  164. }
  165. } else {
  166. if (!onlyScrollIfNeeded) {
  167. alignWithLeft = alignWithLeft === undefined ? true : !!alignWithLeft;
  168. if (alignWithLeft) {
  169. util.scrollLeft(container, containerScroll.left + diffTop.left);
  170. } else {
  171. util.scrollLeft(container, containerScroll.left + diffBottom.left);
  172. }
  173. }
  174. }
  175. }
  176. }
  177. module.exports = scrollIntoView;
  178. /***/ }),
  179. /***/ 5425:
  180. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  181. "use strict";
  182. module.exports = __webpack_require__(1345);
  183. /***/ }),
  184. /***/ 5022:
  185. /***/ (function(module) {
  186. "use strict";
  187. 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; };
  188. 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; };
  189. var RE_NUM = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source;
  190. function getClientPosition(elem) {
  191. var box = undefined;
  192. var x = undefined;
  193. var y = undefined;
  194. var doc = elem.ownerDocument;
  195. var body = doc.body;
  196. var docElem = doc && doc.documentElement;
  197. // 根据 GBS 最新数据,A-Grade Browsers 都已支持 getBoundingClientRect 方法,不用再考虑传统的实现方式
  198. box = elem.getBoundingClientRect();
  199. // 注:jQuery 还考虑减去 docElem.clientLeft/clientTop
  200. // 但测试发现,这样反而会导致当 html 和 body 有边距/边框样式时,获取的值不正确
  201. // 此外,ie6 会忽略 html 的 margin 值,幸运地是没有谁会去设置 html 的 margin
  202. x = box.left;
  203. y = box.top;
  204. // In IE, most of the time, 2 extra pixels are added to the top and left
  205. // due to the implicit 2-pixel inset border. In IE6/7 quirks mode and
  206. // IE6 standards mode, this border can be overridden by setting the
  207. // document element's border to zero -- thus, we cannot rely on the
  208. // offset always being 2 pixels.
  209. // In quirks mode, the offset can be determined by querying the body's
  210. // clientLeft/clientTop, but in standards mode, it is found by querying
  211. // the document element's clientLeft/clientTop. Since we already called
  212. // getClientBoundingRect we have already forced a reflow, so it is not
  213. // too expensive just to query them all.
  214. // ie 下应该减去窗口的边框吧,毕竟默认 absolute 都是相对窗口定位的
  215. // 窗口边框标准是设 documentElement ,quirks 时设置 body
  216. // 最好禁止在 body 和 html 上边框 ,但 ie < 9 html 默认有 2px ,减去
  217. // 但是非 ie 不可能设置窗口边框,body html 也不是窗口 ,ie 可以通过 html,body 设置
  218. // 标准 ie 下 docElem.clientTop 就是 border-top
  219. // ie7 html 即窗口边框改变不了。永远为 2
  220. // 但标准 firefox/chrome/ie9 下 docElem.clientTop 是窗口边框,即使设了 border-top 也为 0
  221. x -= docElem.clientLeft || body.clientLeft || 0;
  222. y -= docElem.clientTop || body.clientTop || 0;
  223. return {
  224. left: x,
  225. top: y
  226. };
  227. }
  228. function getScroll(w, top) {
  229. var ret = w['page' + (top ? 'Y' : 'X') + 'Offset'];
  230. var method = 'scroll' + (top ? 'Top' : 'Left');
  231. if (typeof ret !== 'number') {
  232. var d = w.document;
  233. // ie6,7,8 standard mode
  234. ret = d.documentElement[method];
  235. if (typeof ret !== 'number') {
  236. // quirks mode
  237. ret = d.body[method];
  238. }
  239. }
  240. return ret;
  241. }
  242. function getScrollLeft(w) {
  243. return getScroll(w);
  244. }
  245. function getScrollTop(w) {
  246. return getScroll(w, true);
  247. }
  248. function getOffset(el) {
  249. var pos = getClientPosition(el);
  250. var doc = el.ownerDocument;
  251. var w = doc.defaultView || doc.parentWindow;
  252. pos.left += getScrollLeft(w);
  253. pos.top += getScrollTop(w);
  254. return pos;
  255. }
  256. function _getComputedStyle(elem, name, computedStyle_) {
  257. var val = '';
  258. var d = elem.ownerDocument;
  259. var computedStyle = computedStyle_ || d.defaultView.getComputedStyle(elem, null);
  260. // https://github.com/kissyteam/kissy/issues/61
  261. if (computedStyle) {
  262. val = computedStyle.getPropertyValue(name) || computedStyle[name];
  263. }
  264. return val;
  265. }
  266. var _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+$', 'i');
  267. var RE_POS = /^(top|right|bottom|left)$/;
  268. var CURRENT_STYLE = 'currentStyle';
  269. var RUNTIME_STYLE = 'runtimeStyle';
  270. var LEFT = 'left';
  271. var PX = 'px';
  272. function _getComputedStyleIE(elem, name) {
  273. // currentStyle maybe null
  274. // http://msdn.microsoft.com/en-us/library/ms535231.aspx
  275. var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name];
  276. // 当 width/height 设置为百分比时,通过 pixelLeft 方式转换的 width/height 值
  277. // 一开始就处理了! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19
  278. // 在 ie 下不对,需要直接用 offset 方式
  279. // borderWidth 等值也有问题,但考虑到 borderWidth 设为百分比的概率很小,这里就不考虑了
  280. // From the awesome hack by Dean Edwards
  281. // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
  282. // If we're not dealing with a regular pixel number
  283. // but a number that has a weird ending, we need to convert it to pixels
  284. // exclude left right for relativity
  285. if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) {
  286. // Remember the original values
  287. var style = elem.style;
  288. var left = style[LEFT];
  289. var rsLeft = elem[RUNTIME_STYLE][LEFT];
  290. // prevent flashing of content
  291. elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT];
  292. // Put in the new values to get a computed value out
  293. style[LEFT] = name === 'fontSize' ? '1em' : ret || 0;
  294. ret = style.pixelLeft + PX;
  295. // Revert the changed values
  296. style[LEFT] = left;
  297. elem[RUNTIME_STYLE][LEFT] = rsLeft;
  298. }
  299. return ret === '' ? 'auto' : ret;
  300. }
  301. var getComputedStyleX = undefined;
  302. if (typeof window !== 'undefined') {
  303. getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE;
  304. }
  305. function each(arr, fn) {
  306. for (var i = 0; i < arr.length; i++) {
  307. fn(arr[i]);
  308. }
  309. }
  310. function isBorderBoxFn(elem) {
  311. return getComputedStyleX(elem, 'boxSizing') === 'border-box';
  312. }
  313. var BOX_MODELS = ['margin', 'border', 'padding'];
  314. var CONTENT_INDEX = -1;
  315. var PADDING_INDEX = 2;
  316. var BORDER_INDEX = 1;
  317. var MARGIN_INDEX = 0;
  318. function swap(elem, options, callback) {
  319. var old = {};
  320. var style = elem.style;
  321. var name = undefined;
  322. // Remember the old values, and insert the new ones
  323. for (name in options) {
  324. if (options.hasOwnProperty(name)) {
  325. old[name] = style[name];
  326. style[name] = options[name];
  327. }
  328. }
  329. callback.call(elem);
  330. // Revert the old values
  331. for (name in options) {
  332. if (options.hasOwnProperty(name)) {
  333. style[name] = old[name];
  334. }
  335. }
  336. }
  337. function getPBMWidth(elem, props, which) {
  338. var value = 0;
  339. var prop = undefined;
  340. var j = undefined;
  341. var i = undefined;
  342. for (j = 0; j < props.length; j++) {
  343. prop = props[j];
  344. if (prop) {
  345. for (i = 0; i < which.length; i++) {
  346. var cssProp = undefined;
  347. if (prop === 'border') {
  348. cssProp = prop + which[i] + 'Width';
  349. } else {
  350. cssProp = prop + which[i];
  351. }
  352. value += parseFloat(getComputedStyleX(elem, cssProp)) || 0;
  353. }
  354. }
  355. }
  356. return value;
  357. }
  358. /**
  359. * A crude way of determining if an object is a window
  360. * @member util
  361. */
  362. function isWindow(obj) {
  363. // must use == for ie8
  364. /* eslint eqeqeq:0 */
  365. return obj != null && obj == obj.window;
  366. }
  367. var domUtils = {};
  368. each(['Width', 'Height'], function (name) {
  369. domUtils['doc' + name] = function (refWin) {
  370. var d = refWin.document;
  371. return Math.max(
  372. // firefox chrome documentElement.scrollHeight< body.scrollHeight
  373. // ie standard mode : documentElement.scrollHeight> body.scrollHeight
  374. d.documentElement['scroll' + name],
  375. // quirks : documentElement.scrollHeight 最大等于可视窗口多一点?
  376. d.body['scroll' + name], domUtils['viewport' + name](d));
  377. };
  378. domUtils['viewport' + name] = function (win) {
  379. // pc browser includes scrollbar in window.innerWidth
  380. var prop = 'client' + name;
  381. var doc = win.document;
  382. var body = doc.body;
  383. var documentElement = doc.documentElement;
  384. var documentElementProp = documentElement[prop];
  385. // 标准模式取 documentElement
  386. // backcompat 取 body
  387. return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp;
  388. };
  389. });
  390. /*
  391. 得到元素的大小信息
  392. @param elem
  393. @param name
  394. @param {String} [extra] 'padding' : (css width) + padding
  395. 'border' : (css width) + padding + border
  396. 'margin' : (css width) + padding + border + margin
  397. */
  398. function getWH(elem, name, extra) {
  399. if (isWindow(elem)) {
  400. return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem);
  401. } else if (elem.nodeType === 9) {
  402. return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem);
  403. }
  404. var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];
  405. var borderBoxValue = name === 'width' ? elem.offsetWidth : elem.offsetHeight;
  406. var computedStyle = getComputedStyleX(elem);
  407. var isBorderBox = isBorderBoxFn(elem, computedStyle);
  408. var cssBoxValue = 0;
  409. if (borderBoxValue == null || borderBoxValue <= 0) {
  410. borderBoxValue = undefined;
  411. // Fall back to computed then un computed css if necessary
  412. cssBoxValue = getComputedStyleX(elem, name);
  413. if (cssBoxValue == null || Number(cssBoxValue) < 0) {
  414. cssBoxValue = elem.style[name] || 0;
  415. }
  416. // Normalize '', auto, and prepare for extra
  417. cssBoxValue = parseFloat(cssBoxValue) || 0;
  418. }
  419. if (extra === undefined) {
  420. extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX;
  421. }
  422. var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox;
  423. var val = borderBoxValue || cssBoxValue;
  424. if (extra === CONTENT_INDEX) {
  425. if (borderBoxValueOrIsBorderBox) {
  426. return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle);
  427. }
  428. return cssBoxValue;
  429. }
  430. if (borderBoxValueOrIsBorderBox) {
  431. var padding = extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle);
  432. return val + (extra === BORDER_INDEX ? 0 : padding);
  433. }
  434. return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle);
  435. }
  436. var cssShow = {
  437. position: 'absolute',
  438. visibility: 'hidden',
  439. display: 'block'
  440. };
  441. // fix #119 : https://github.com/kissyteam/kissy/issues/119
  442. function getWHIgnoreDisplay(elem) {
  443. var val = undefined;
  444. var args = arguments;
  445. // in case elem is window
  446. // elem.offsetWidth === undefined
  447. if (elem.offsetWidth !== 0) {
  448. val = getWH.apply(undefined, args);
  449. } else {
  450. swap(elem, cssShow, function () {
  451. val = getWH.apply(undefined, args);
  452. });
  453. }
  454. return val;
  455. }
  456. function css(el, name, v) {
  457. var value = v;
  458. if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') {
  459. for (var i in name) {
  460. if (name.hasOwnProperty(i)) {
  461. css(el, i, name[i]);
  462. }
  463. }
  464. return undefined;
  465. }
  466. if (typeof value !== 'undefined') {
  467. if (typeof value === 'number') {
  468. value += 'px';
  469. }
  470. el.style[name] = value;
  471. return undefined;
  472. }
  473. return getComputedStyleX(el, name);
  474. }
  475. each(['width', 'height'], function (name) {
  476. var first = name.charAt(0).toUpperCase() + name.slice(1);
  477. domUtils['outer' + first] = function (el, includeMargin) {
  478. return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX);
  479. };
  480. var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];
  481. domUtils[name] = function (elem, val) {
  482. if (val !== undefined) {
  483. if (elem) {
  484. var computedStyle = getComputedStyleX(elem);
  485. var isBorderBox = isBorderBoxFn(elem);
  486. if (isBorderBox) {
  487. val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle);
  488. }
  489. return css(elem, name, val);
  490. }
  491. return undefined;
  492. }
  493. return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX);
  494. };
  495. });
  496. // 设置 elem 相对 elem.ownerDocument 的坐标
  497. function setOffset(elem, offset) {
  498. // set position first, in-case top/left are set even on static elem
  499. if (css(elem, 'position') === 'static') {
  500. elem.style.position = 'relative';
  501. }
  502. var old = getOffset(elem);
  503. var ret = {};
  504. var current = undefined;
  505. var key = undefined;
  506. for (key in offset) {
  507. if (offset.hasOwnProperty(key)) {
  508. current = parseFloat(css(elem, key)) || 0;
  509. ret[key] = current + offset[key] - old[key];
  510. }
  511. }
  512. css(elem, ret);
  513. }
  514. module.exports = _extends({
  515. getWindow: function getWindow(node) {
  516. var doc = node.ownerDocument || node;
  517. return doc.defaultView || doc.parentWindow;
  518. },
  519. offset: function offset(el, value) {
  520. if (typeof value !== 'undefined') {
  521. setOffset(el, value);
  522. } else {
  523. return getOffset(el);
  524. }
  525. },
  526. isWindow: isWindow,
  527. each: each,
  528. css: css,
  529. clone: function clone(obj) {
  530. var ret = {};
  531. for (var i in obj) {
  532. if (obj.hasOwnProperty(i)) {
  533. ret[i] = obj[i];
  534. }
  535. }
  536. var overflow = obj.overflow;
  537. if (overflow) {
  538. for (var i in obj) {
  539. if (obj.hasOwnProperty(i)) {
  540. ret.overflow[i] = obj.overflow[i];
  541. }
  542. }
  543. }
  544. return ret;
  545. },
  546. scrollLeft: function scrollLeft(w, v) {
  547. if (isWindow(w)) {
  548. if (v === undefined) {
  549. return getScrollLeft(w);
  550. }
  551. window.scrollTo(v, getScrollTop(w));
  552. } else {
  553. if (v === undefined) {
  554. return w.scrollLeft;
  555. }
  556. w.scrollLeft = v;
  557. }
  558. },
  559. scrollTop: function scrollTop(w, v) {
  560. if (isWindow(w)) {
  561. if (v === undefined) {
  562. return getScrollTop(w);
  563. }
  564. window.scrollTo(getScrollLeft(w), v);
  565. } else {
  566. if (v === undefined) {
  567. return w.scrollTop;
  568. }
  569. w.scrollTop = v;
  570. }
  571. },
  572. viewportWidth: 0,
  573. viewportHeight: 0
  574. }, domUtils);
  575. /***/ }),
  576. /***/ 9214:
  577. /***/ (function(__unused_webpack_module, exports) {
  578. "use strict";
  579. var __webpack_unused_export__;
  580. /** @license React v17.0.2
  581. * react-is.production.min.js
  582. *
  583. * Copyright (c) Facebook, Inc. and its affiliates.
  584. *
  585. * This source code is licensed under the MIT license found in the
  586. * LICENSE file in the root directory of this source tree.
  587. */
  588. 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;
  589. 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")}
  590. 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;
  591. __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};
  592. __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};
  593. __webpack_unused_export__=y;
  594. /***/ }),
  595. /***/ 2797:
  596. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  597. "use strict";
  598. if (true) {
  599. /* unused reexport */ __webpack_require__(9214);
  600. } else {}
  601. /***/ }),
  602. /***/ 7115:
  603. /***/ (function(__unused_webpack_module, exports) {
  604. // Copyright (c) 2014 Rafael Caricio. All rights reserved.
  605. // Use of this source code is governed by a BSD-style license that can be
  606. // found in the LICENSE file.
  607. var GradientParser = {};
  608. GradientParser.parse = (function() {
  609. var tokens = {
  610. linearGradient: /^(\-(webkit|o|ms|moz)\-)?(linear\-gradient)/i,
  611. repeatingLinearGradient: /^(\-(webkit|o|ms|moz)\-)?(repeating\-linear\-gradient)/i,
  612. radialGradient: /^(\-(webkit|o|ms|moz)\-)?(radial\-gradient)/i,
  613. repeatingRadialGradient: /^(\-(webkit|o|ms|moz)\-)?(repeating\-radial\-gradient)/i,
  614. sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|left|right|top|bottom)/i,
  615. extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,
  616. positionKeywords: /^(left|center|right|top|bottom)/i,
  617. pixelValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,
  618. percentageValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,
  619. emValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,
  620. angleValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,
  621. startCall: /^\(/,
  622. endCall: /^\)/,
  623. comma: /^,/,
  624. hexColor: /^\#([0-9a-fA-F]+)/,
  625. literalColor: /^([a-zA-Z]+)/,
  626. rgbColor: /^rgb/i,
  627. rgbaColor: /^rgba/i,
  628. number: /^(([0-9]*\.[0-9]+)|([0-9]+\.?))/
  629. };
  630. var input = '';
  631. function error(msg) {
  632. var err = new Error(input + ': ' + msg);
  633. err.source = input;
  634. throw err;
  635. }
  636. function getAST() {
  637. var ast = matchListDefinitions();
  638. if (input.length > 0) {
  639. error('Invalid input not EOF');
  640. }
  641. return ast;
  642. }
  643. function matchListDefinitions() {
  644. return matchListing(matchDefinition);
  645. }
  646. function matchDefinition() {
  647. return matchGradient(
  648. 'linear-gradient',
  649. tokens.linearGradient,
  650. matchLinearOrientation) ||
  651. matchGradient(
  652. 'repeating-linear-gradient',
  653. tokens.repeatingLinearGradient,
  654. matchLinearOrientation) ||
  655. matchGradient(
  656. 'radial-gradient',
  657. tokens.radialGradient,
  658. matchListRadialOrientations) ||
  659. matchGradient(
  660. 'repeating-radial-gradient',
  661. tokens.repeatingRadialGradient,
  662. matchListRadialOrientations);
  663. }
  664. function matchGradient(gradientType, pattern, orientationMatcher) {
  665. return matchCall(pattern, function(captures) {
  666. var orientation = orientationMatcher();
  667. if (orientation) {
  668. if (!scan(tokens.comma)) {
  669. error('Missing comma before color stops');
  670. }
  671. }
  672. return {
  673. type: gradientType,
  674. orientation: orientation,
  675. colorStops: matchListing(matchColorStop)
  676. };
  677. });
  678. }
  679. function matchCall(pattern, callback) {
  680. var captures = scan(pattern);
  681. if (captures) {
  682. if (!scan(tokens.startCall)) {
  683. error('Missing (');
  684. }
  685. result = callback(captures);
  686. if (!scan(tokens.endCall)) {
  687. error('Missing )');
  688. }
  689. return result;
  690. }
  691. }
  692. function matchLinearOrientation() {
  693. return matchSideOrCorner() ||
  694. matchAngle();
  695. }
  696. function matchSideOrCorner() {
  697. return match('directional', tokens.sideOrCorner, 1);
  698. }
  699. function matchAngle() {
  700. return match('angular', tokens.angleValue, 1);
  701. }
  702. function matchListRadialOrientations() {
  703. var radialOrientations,
  704. radialOrientation = matchRadialOrientation(),
  705. lookaheadCache;
  706. if (radialOrientation) {
  707. radialOrientations = [];
  708. radialOrientations.push(radialOrientation);
  709. lookaheadCache = input;
  710. if (scan(tokens.comma)) {
  711. radialOrientation = matchRadialOrientation();
  712. if (radialOrientation) {
  713. radialOrientations.push(radialOrientation);
  714. } else {
  715. input = lookaheadCache;
  716. }
  717. }
  718. }
  719. return radialOrientations;
  720. }
  721. function matchRadialOrientation() {
  722. var radialType = matchCircle() ||
  723. matchEllipse();
  724. if (radialType) {
  725. radialType.at = matchAtPosition();
  726. } else {
  727. var defaultPosition = matchPositioning();
  728. if (defaultPosition) {
  729. radialType = {
  730. type: 'default-radial',
  731. at: defaultPosition
  732. };
  733. }
  734. }
  735. return radialType;
  736. }
  737. function matchCircle() {
  738. var circle = match('shape', /^(circle)/i, 0);
  739. if (circle) {
  740. circle.style = matchLength() || matchExtentKeyword();
  741. }
  742. return circle;
  743. }
  744. function matchEllipse() {
  745. var ellipse = match('shape', /^(ellipse)/i, 0);
  746. if (ellipse) {
  747. ellipse.style = matchDistance() || matchExtentKeyword();
  748. }
  749. return ellipse;
  750. }
  751. function matchExtentKeyword() {
  752. return match('extent-keyword', tokens.extentKeywords, 1);
  753. }
  754. function matchAtPosition() {
  755. if (match('position', /^at/, 0)) {
  756. var positioning = matchPositioning();
  757. if (!positioning) {
  758. error('Missing positioning value');
  759. }
  760. return positioning;
  761. }
  762. }
  763. function matchPositioning() {
  764. var location = matchCoordinates();
  765. if (location.x || location.y) {
  766. return {
  767. type: 'position',
  768. value: location
  769. };
  770. }
  771. }
  772. function matchCoordinates() {
  773. return {
  774. x: matchDistance(),
  775. y: matchDistance()
  776. };
  777. }
  778. function matchListing(matcher) {
  779. var captures = matcher(),
  780. result = [];
  781. if (captures) {
  782. result.push(captures);
  783. while (scan(tokens.comma)) {
  784. captures = matcher();
  785. if (captures) {
  786. result.push(captures);
  787. } else {
  788. error('One extra comma');
  789. }
  790. }
  791. }
  792. return result;
  793. }
  794. function matchColorStop() {
  795. var color = matchColor();
  796. if (!color) {
  797. error('Expected color definition');
  798. }
  799. color.length = matchDistance();
  800. return color;
  801. }
  802. function matchColor() {
  803. return matchHexColor() ||
  804. matchRGBAColor() ||
  805. matchRGBColor() ||
  806. matchLiteralColor();
  807. }
  808. function matchLiteralColor() {
  809. return match('literal', tokens.literalColor, 0);
  810. }
  811. function matchHexColor() {
  812. return match('hex', tokens.hexColor, 1);
  813. }
  814. function matchRGBColor() {
  815. return matchCall(tokens.rgbColor, function() {
  816. return {
  817. type: 'rgb',
  818. value: matchListing(matchNumber)
  819. };
  820. });
  821. }
  822. function matchRGBAColor() {
  823. return matchCall(tokens.rgbaColor, function() {
  824. return {
  825. type: 'rgba',
  826. value: matchListing(matchNumber)
  827. };
  828. });
  829. }
  830. function matchNumber() {
  831. return scan(tokens.number)[1];
  832. }
  833. function matchDistance() {
  834. return match('%', tokens.percentageValue, 1) ||
  835. matchPositionKeyword() ||
  836. matchLength();
  837. }
  838. function matchPositionKeyword() {
  839. return match('position-keyword', tokens.positionKeywords, 1);
  840. }
  841. function matchLength() {
  842. return match('px', tokens.pixelValue, 1) ||
  843. match('em', tokens.emValue, 1);
  844. }
  845. function match(type, pattern, captureIndex) {
  846. var captures = scan(pattern);
  847. if (captures) {
  848. return {
  849. type: type,
  850. value: captures[captureIndex]
  851. };
  852. }
  853. }
  854. function scan(regexp) {
  855. var captures,
  856. blankCaptures;
  857. blankCaptures = /^[\n\r\t\s]+/.exec(input);
  858. if (blankCaptures) {
  859. consume(blankCaptures[0].length);
  860. }
  861. captures = regexp.exec(input);
  862. if (captures) {
  863. consume(captures[0].length);
  864. }
  865. return captures;
  866. }
  867. function consume(size) {
  868. input = input.substr(size);
  869. }
  870. return function(code) {
  871. input = code.toString();
  872. return getAST();
  873. };
  874. })();
  875. exports.parse = (GradientParser || {}).parse;
  876. /***/ }),
  877. /***/ 3138:
  878. /***/ (function(module) {
  879. module.exports =
  880. /******/ (function(modules) { // webpackBootstrap
  881. /******/ // The module cache
  882. /******/ var installedModules = {};
  883. /******/
  884. /******/ // The require function
  885. /******/ function __nested_webpack_require_187__(moduleId) {
  886. /******/
  887. /******/ // Check if module is in cache
  888. /******/ if(installedModules[moduleId])
  889. /******/ return installedModules[moduleId].exports;
  890. /******/
  891. /******/ // Create a new module (and put it into the cache)
  892. /******/ var module = installedModules[moduleId] = {
  893. /******/ exports: {},
  894. /******/ id: moduleId,
  895. /******/ loaded: false
  896. /******/ };
  897. /******/
  898. /******/ // Execute the module function
  899. /******/ modules[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_187__);
  900. /******/
  901. /******/ // Flag the module as loaded
  902. /******/ module.loaded = true;
  903. /******/
  904. /******/ // Return the exports of the module
  905. /******/ return module.exports;
  906. /******/ }
  907. /******/
  908. /******/
  909. /******/ // expose the modules object (__webpack_modules__)
  910. /******/ __nested_webpack_require_187__.m = modules;
  911. /******/
  912. /******/ // expose the module cache
  913. /******/ __nested_webpack_require_187__.c = installedModules;
  914. /******/
  915. /******/ // __webpack_public_path__
  916. /******/ __nested_webpack_require_187__.p = "";
  917. /******/
  918. /******/ // Load entry module and return exports
  919. /******/ return __nested_webpack_require_187__(0);
  920. /******/ })
  921. /************************************************************************/
  922. /******/ ([
  923. /* 0 */
  924. /***/ (function(module, exports, __nested_webpack_require_1468__) {
  925. module.exports = __nested_webpack_require_1468__(1);
  926. /***/ }),
  927. /* 1 */
  928. /***/ (function(module, exports, __nested_webpack_require_1587__) {
  929. 'use strict';
  930. Object.defineProperty(exports, "__esModule", {
  931. value: true
  932. });
  933. var _utils = __nested_webpack_require_1587__(2);
  934. Object.defineProperty(exports, 'combineChunks', {
  935. enumerable: true,
  936. get: function get() {
  937. return _utils.combineChunks;
  938. }
  939. });
  940. Object.defineProperty(exports, 'fillInChunks', {
  941. enumerable: true,
  942. get: function get() {
  943. return _utils.fillInChunks;
  944. }
  945. });
  946. Object.defineProperty(exports, 'findAll', {
  947. enumerable: true,
  948. get: function get() {
  949. return _utils.findAll;
  950. }
  951. });
  952. Object.defineProperty(exports, 'findChunks', {
  953. enumerable: true,
  954. get: function get() {
  955. return _utils.findChunks;
  956. }
  957. });
  958. /***/ }),
  959. /* 2 */
  960. /***/ (function(module, exports) {
  961. 'use strict';
  962. Object.defineProperty(exports, "__esModule", {
  963. value: true
  964. });
  965. /**
  966. * Creates an array of chunk objects representing both higlightable and non highlightable pieces of text that match each search word.
  967. * @return Array of "chunks" (where a Chunk is { start:number, end:number, highlight:boolean })
  968. */
  969. var findAll = exports.findAll = function findAll(_ref) {
  970. var autoEscape = _ref.autoEscape,
  971. _ref$caseSensitive = _ref.caseSensitive,
  972. caseSensitive = _ref$caseSensitive === undefined ? false : _ref$caseSensitive,
  973. _ref$findChunks = _ref.findChunks,
  974. findChunks = _ref$findChunks === undefined ? defaultFindChunks : _ref$findChunks,
  975. sanitize = _ref.sanitize,
  976. searchWords = _ref.searchWords,
  977. textToHighlight = _ref.textToHighlight;
  978. return fillInChunks({
  979. chunksToHighlight: combineChunks({
  980. chunks: findChunks({
  981. autoEscape: autoEscape,
  982. caseSensitive: caseSensitive,
  983. sanitize: sanitize,
  984. searchWords: searchWords,
  985. textToHighlight: textToHighlight
  986. })
  987. }),
  988. totalLength: textToHighlight ? textToHighlight.length : 0
  989. });
  990. };
  991. /**
  992. * Takes an array of {start:number, end:number} objects and combines chunks that overlap into single chunks.
  993. * @return {start:number, end:number}[]
  994. */
  995. var combineChunks = exports.combineChunks = function combineChunks(_ref2) {
  996. var chunks = _ref2.chunks;
  997. chunks = chunks.sort(function (first, second) {
  998. return first.start - second.start;
  999. }).reduce(function (processedChunks, nextChunk) {
  1000. // First chunk just goes straight in the array...
  1001. if (processedChunks.length === 0) {
  1002. return [nextChunk];
  1003. } else {
  1004. // ... subsequent chunks get checked to see if they overlap...
  1005. var prevChunk = processedChunks.pop();
  1006. if (nextChunk.start <= prevChunk.end) {
  1007. // It may be the case that prevChunk completely surrounds nextChunk, so take the
  1008. // largest of the end indeces.
  1009. var endIndex = Math.max(prevChunk.end, nextChunk.end);
  1010. processedChunks.push({ highlight: false, start: prevChunk.start, end: endIndex });
  1011. } else {
  1012. processedChunks.push(prevChunk, nextChunk);
  1013. }
  1014. return processedChunks;
  1015. }
  1016. }, []);
  1017. return chunks;
  1018. };
  1019. /**
  1020. * Examine text for any matches.
  1021. * If we find matches, add them to the returned array as a "chunk" object ({start:number, end:number}).
  1022. * @return {start:number, end:number}[]
  1023. */
  1024. var defaultFindChunks = function defaultFindChunks(_ref3) {
  1025. var autoEscape = _ref3.autoEscape,
  1026. caseSensitive = _ref3.caseSensitive,
  1027. _ref3$sanitize = _ref3.sanitize,
  1028. sanitize = _ref3$sanitize === undefined ? defaultSanitize : _ref3$sanitize,
  1029. searchWords = _ref3.searchWords,
  1030. textToHighlight = _ref3.textToHighlight;
  1031. textToHighlight = sanitize(textToHighlight);
  1032. return searchWords.filter(function (searchWord) {
  1033. return searchWord;
  1034. }) // Remove empty words
  1035. .reduce(function (chunks, searchWord) {
  1036. searchWord = sanitize(searchWord);
  1037. if (autoEscape) {
  1038. searchWord = escapeRegExpFn(searchWord);
  1039. }
  1040. var regex = new RegExp(searchWord, caseSensitive ? 'g' : 'gi');
  1041. var match = void 0;
  1042. while (match = regex.exec(textToHighlight)) {
  1043. var _start = match.index;
  1044. var _end = regex.lastIndex;
  1045. // We do not return zero-length matches
  1046. if (_end > _start) {
  1047. chunks.push({ highlight: false, start: _start, end: _end });
  1048. }
  1049. // Prevent browsers like Firefox from getting stuck in an infinite loop
  1050. // See http://www.regexguru.com/2008/04/watch-out-for-zero-length-matches/
  1051. if (match.index === regex.lastIndex) {
  1052. regex.lastIndex++;
  1053. }
  1054. }
  1055. return chunks;
  1056. }, []);
  1057. };
  1058. // Allow the findChunks to be overridden in findAll,
  1059. // but for backwards compatibility we export as the old name
  1060. exports.findChunks = defaultFindChunks;
  1061. /**
  1062. * Given a set of chunks to highlight, create an additional set of chunks
  1063. * to represent the bits of text between the highlighted text.
  1064. * @param chunksToHighlight {start:number, end:number}[]
  1065. * @param totalLength number
  1066. * @return {start:number, end:number, highlight:boolean}[]
  1067. */
  1068. var fillInChunks = exports.fillInChunks = function fillInChunks(_ref4) {
  1069. var chunksToHighlight = _ref4.chunksToHighlight,
  1070. totalLength = _ref4.totalLength;
  1071. var allChunks = [];
  1072. var append = function append(start, end, highlight) {
  1073. if (end - start > 0) {
  1074. allChunks.push({
  1075. start: start,
  1076. end: end,
  1077. highlight: highlight
  1078. });
  1079. }
  1080. };
  1081. if (chunksToHighlight.length === 0) {
  1082. append(0, totalLength, false);
  1083. } else {
  1084. var lastIndex = 0;
  1085. chunksToHighlight.forEach(function (chunk) {
  1086. append(lastIndex, chunk.start, false);
  1087. append(chunk.start, chunk.end, true);
  1088. lastIndex = chunk.end;
  1089. });
  1090. append(lastIndex, totalLength, false);
  1091. }
  1092. return allChunks;
  1093. };
  1094. function defaultSanitize(string) {
  1095. return string;
  1096. }
  1097. function escapeRegExpFn(string) {
  1098. return string.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
  1099. }
  1100. /***/ })
  1101. /******/ ]);
  1102. /***/ }),
  1103. /***/ 1281:
  1104. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  1105. "use strict";
  1106. var reactIs = __webpack_require__(338);
  1107. /**
  1108. * Copyright 2015, Yahoo! Inc.
  1109. * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
  1110. */
  1111. var REACT_STATICS = {
  1112. childContextTypes: true,
  1113. contextType: true,
  1114. contextTypes: true,
  1115. defaultProps: true,
  1116. displayName: true,
  1117. getDefaultProps: true,
  1118. getDerivedStateFromError: true,
  1119. getDerivedStateFromProps: true,
  1120. mixins: true,
  1121. propTypes: true,
  1122. type: true
  1123. };
  1124. var KNOWN_STATICS = {
  1125. name: true,
  1126. length: true,
  1127. prototype: true,
  1128. caller: true,
  1129. callee: true,
  1130. arguments: true,
  1131. arity: true
  1132. };
  1133. var FORWARD_REF_STATICS = {
  1134. '$$typeof': true,
  1135. render: true,
  1136. defaultProps: true,
  1137. displayName: true,
  1138. propTypes: true
  1139. };
  1140. var MEMO_STATICS = {
  1141. '$$typeof': true,
  1142. compare: true,
  1143. defaultProps: true,
  1144. displayName: true,
  1145. propTypes: true,
  1146. type: true
  1147. };
  1148. var TYPE_STATICS = {};
  1149. TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
  1150. TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
  1151. function getStatics(component) {
  1152. // React v16.11 and below
  1153. if (reactIs.isMemo(component)) {
  1154. return MEMO_STATICS;
  1155. } // React v16.12 and above
  1156. return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
  1157. }
  1158. var defineProperty = Object.defineProperty;
  1159. var getOwnPropertyNames = Object.getOwnPropertyNames;
  1160. var getOwnPropertySymbols = Object.getOwnPropertySymbols;
  1161. var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  1162. var getPrototypeOf = Object.getPrototypeOf;
  1163. var objectPrototype = Object.prototype;
  1164. function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
  1165. if (typeof sourceComponent !== 'string') {
  1166. // don't hoist over string (html) components
  1167. if (objectPrototype) {
  1168. var inheritedComponent = getPrototypeOf(sourceComponent);
  1169. if (inheritedComponent && inheritedComponent !== objectPrototype) {
  1170. hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
  1171. }
  1172. }
  1173. var keys = getOwnPropertyNames(sourceComponent);
  1174. if (getOwnPropertySymbols) {
  1175. keys = keys.concat(getOwnPropertySymbols(sourceComponent));
  1176. }
  1177. var targetStatics = getStatics(targetComponent);
  1178. var sourceStatics = getStatics(sourceComponent);
  1179. for (var i = 0; i < keys.length; ++i) {
  1180. var key = keys[i];
  1181. if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
  1182. var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
  1183. try {
  1184. // Avoid failures from read-only properties
  1185. defineProperty(targetComponent, key, descriptor);
  1186. } catch (e) {}
  1187. }
  1188. }
  1189. }
  1190. return targetComponent;
  1191. }
  1192. module.exports = hoistNonReactStatics;
  1193. /***/ }),
  1194. /***/ 9756:
  1195. /***/ (function(module) {
  1196. /**
  1197. * Memize options object.
  1198. *
  1199. * @typedef MemizeOptions
  1200. *
  1201. * @property {number} [maxSize] Maximum size of the cache.
  1202. */
  1203. /**
  1204. * Internal cache entry.
  1205. *
  1206. * @typedef MemizeCacheNode
  1207. *
  1208. * @property {?MemizeCacheNode|undefined} [prev] Previous node.
  1209. * @property {?MemizeCacheNode|undefined} [next] Next node.
  1210. * @property {Array<*>} args Function arguments for cache
  1211. * entry.
  1212. * @property {*} val Function result.
  1213. */
  1214. /**
  1215. * Properties of the enhanced function for controlling cache.
  1216. *
  1217. * @typedef MemizeMemoizedFunction
  1218. *
  1219. * @property {()=>void} clear Clear the cache.
  1220. */
  1221. /**
  1222. * Accepts a function to be memoized, and returns a new memoized function, with
  1223. * optional options.
  1224. *
  1225. * @template {Function} F
  1226. *
  1227. * @param {F} fn Function to memoize.
  1228. * @param {MemizeOptions} [options] Options object.
  1229. *
  1230. * @return {F & MemizeMemoizedFunction} Memoized function.
  1231. */
  1232. function memize( fn, options ) {
  1233. var size = 0;
  1234. /** @type {?MemizeCacheNode|undefined} */
  1235. var head;
  1236. /** @type {?MemizeCacheNode|undefined} */
  1237. var tail;
  1238. options = options || {};
  1239. function memoized( /* ...args */ ) {
  1240. var node = head,
  1241. len = arguments.length,
  1242. args, i;
  1243. searchCache: while ( node ) {
  1244. // Perform a shallow equality test to confirm that whether the node
  1245. // under test is a candidate for the arguments passed. Two arrays
  1246. // are shallowly equal if their length matches and each entry is
  1247. // strictly equal between the two sets. Avoid abstracting to a
  1248. // function which could incur an arguments leaking deoptimization.
  1249. // Check whether node arguments match arguments length
  1250. if ( node.args.length !== arguments.length ) {
  1251. node = node.next;
  1252. continue;
  1253. }
  1254. // Check whether node arguments match arguments values
  1255. for ( i = 0; i < len; i++ ) {
  1256. if ( node.args[ i ] !== arguments[ i ] ) {
  1257. node = node.next;
  1258. continue searchCache;
  1259. }
  1260. }
  1261. // At this point we can assume we've found a match
  1262. // Surface matched node to head if not already
  1263. if ( node !== head ) {
  1264. // As tail, shift to previous. Must only shift if not also
  1265. // head, since if both head and tail, there is no previous.
  1266. if ( node === tail ) {
  1267. tail = node.prev;
  1268. }
  1269. // Adjust siblings to point to each other. If node was tail,
  1270. // this also handles new tail's empty `next` assignment.
  1271. /** @type {MemizeCacheNode} */ ( node.prev ).next = node.next;
  1272. if ( node.next ) {
  1273. node.next.prev = node.prev;
  1274. }
  1275. node.next = head;
  1276. node.prev = null;
  1277. /** @type {MemizeCacheNode} */ ( head ).prev = node;
  1278. head = node;
  1279. }
  1280. // Return immediately
  1281. return node.val;
  1282. }
  1283. // No cached value found. Continue to insertion phase:
  1284. // Create a copy of arguments (avoid leaking deoptimization)
  1285. args = new Array( len );
  1286. for ( i = 0; i < len; i++ ) {
  1287. args[ i ] = arguments[ i ];
  1288. }
  1289. node = {
  1290. args: args,
  1291. // Generate the result from original function
  1292. val: fn.apply( null, args ),
  1293. };
  1294. // Don't need to check whether node is already head, since it would
  1295. // have been returned above already if it was
  1296. // Shift existing head down list
  1297. if ( head ) {
  1298. head.prev = node;
  1299. node.next = head;
  1300. } else {
  1301. // If no head, follows that there's no tail (at initial or reset)
  1302. tail = node;
  1303. }
  1304. // Trim tail if we're reached max size and are pending cache insertion
  1305. if ( size === /** @type {MemizeOptions} */ ( options ).maxSize ) {
  1306. tail = /** @type {MemizeCacheNode} */ ( tail ).prev;
  1307. /** @type {MemizeCacheNode} */ ( tail ).next = null;
  1308. } else {
  1309. size++;
  1310. }
  1311. head = node;
  1312. return node.val;
  1313. }
  1314. memoized.clear = function() {
  1315. head = null;
  1316. tail = null;
  1317. size = 0;
  1318. };
  1319. if ( false ) {}
  1320. // Ignore reason: There's not a clear solution to create an intersection of
  1321. // the function with additional properties, where the goal is to retain the
  1322. // function signature of the incoming argument and add control properties
  1323. // on the return value.
  1324. // @ts-ignore
  1325. return memoized;
  1326. }
  1327. module.exports = memize;
  1328. /***/ }),
  1329. /***/ 5372:
  1330. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  1331. "use strict";
  1332. /**
  1333. * Copyright (c) 2013-present, Facebook, Inc.
  1334. *
  1335. * This source code is licensed under the MIT license found in the
  1336. * LICENSE file in the root directory of this source tree.
  1337. */
  1338. var ReactPropTypesSecret = __webpack_require__(9567);
  1339. function emptyFunction() {}
  1340. function emptyFunctionWithReset() {}
  1341. emptyFunctionWithReset.resetWarningCache = emptyFunction;
  1342. module.exports = function() {
  1343. function shim(props, propName, componentName, location, propFullName, secret) {
  1344. if (secret === ReactPropTypesSecret) {
  1345. // It is still safe when called from React.
  1346. return;
  1347. }
  1348. var err = new Error(
  1349. 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
  1350. 'Use PropTypes.checkPropTypes() to call them. ' +
  1351. 'Read more at http://fb.me/use-check-prop-types'
  1352. );
  1353. err.name = 'Invariant Violation';
  1354. throw err;
  1355. };
  1356. shim.isRequired = shim;
  1357. function getShim() {
  1358. return shim;
  1359. };
  1360. // Important!
  1361. // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
  1362. var ReactPropTypes = {
  1363. array: shim,
  1364. bigint: shim,
  1365. bool: shim,
  1366. func: shim,
  1367. number: shim,
  1368. object: shim,
  1369. string: shim,
  1370. symbol: shim,
  1371. any: shim,
  1372. arrayOf: getShim,
  1373. element: shim,
  1374. elementType: shim,
  1375. instanceOf: getShim,
  1376. node: shim,
  1377. objectOf: getShim,
  1378. oneOf: getShim,
  1379. oneOfType: getShim,
  1380. shape: getShim,
  1381. exact: getShim,
  1382. checkPropTypes: emptyFunctionWithReset,
  1383. resetWarningCache: emptyFunction
  1384. };
  1385. ReactPropTypes.PropTypes = ReactPropTypes;
  1386. return ReactPropTypes;
  1387. };
  1388. /***/ }),
  1389. /***/ 2652:
  1390. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  1391. /**
  1392. * Copyright (c) 2013-present, Facebook, Inc.
  1393. *
  1394. * This source code is licensed under the MIT license found in the
  1395. * LICENSE file in the root directory of this source tree.
  1396. */
  1397. if (false) { var throwOnDirectAccess, ReactIs; } else {
  1398. // By explicitly using `prop-types` you are opting into new production behavior.
  1399. // http://fb.me/prop-types-in-prod
  1400. module.exports = __webpack_require__(5372)();
  1401. }
  1402. /***/ }),
  1403. /***/ 9567:
  1404. /***/ (function(module) {
  1405. "use strict";
  1406. /**
  1407. * Copyright (c) 2013-present, Facebook, Inc.
  1408. *
  1409. * This source code is licensed under the MIT license found in the
  1410. * LICENSE file in the root directory of this source tree.
  1411. */
  1412. var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
  1413. module.exports = ReactPropTypesSecret;
  1414. /***/ }),
  1415. /***/ 4821:
  1416. /***/ (function(__unused_webpack_module, exports) {
  1417. "use strict";
  1418. /** @license React v16.13.1
  1419. * react-is.production.min.js
  1420. *
  1421. * Copyright (c) Facebook, Inc. and its affiliates.
  1422. *
  1423. * This source code is licensed under the MIT license found in the
  1424. * LICENSE file in the root directory of this source tree.
  1425. */
  1426. 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?
  1427. 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;
  1428. 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;
  1429. 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};
  1430. 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};
  1431. 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;
  1432. /***/ }),
  1433. /***/ 338:
  1434. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  1435. "use strict";
  1436. if (true) {
  1437. module.exports = __webpack_require__(4821);
  1438. } else {}
  1439. /***/ }),
  1440. /***/ 4793:
  1441. /***/ (function(module) {
  1442. var characterMap = {
  1443. "À": "A",
  1444. "Á": "A",
  1445. "Â": "A",
  1446. "Ã": "A",
  1447. "Ä": "A",
  1448. "Å": "A",
  1449. "Ấ": "A",
  1450. "Ắ": "A",
  1451. "Ẳ": "A",
  1452. "Ẵ": "A",
  1453. "Ặ": "A",
  1454. "Æ": "AE",
  1455. "Ầ": "A",
  1456. "Ằ": "A",
  1457. "Ȃ": "A",
  1458. "Ç": "C",
  1459. "Ḉ": "C",
  1460. "È": "E",
  1461. "É": "E",
  1462. "Ê": "E",
  1463. "Ë": "E",
  1464. "Ế": "E",
  1465. "Ḗ": "E",
  1466. "Ề": "E",
  1467. "Ḕ": "E",
  1468. "Ḝ": "E",
  1469. "Ȇ": "E",
  1470. "Ì": "I",
  1471. "Í": "I",
  1472. "Î": "I",
  1473. "Ï": "I",
  1474. "Ḯ": "I",
  1475. "Ȋ": "I",
  1476. "Ð": "D",
  1477. "Ñ": "N",
  1478. "Ò": "O",
  1479. "Ó": "O",
  1480. "Ô": "O",
  1481. "Õ": "O",
  1482. "Ö": "O",
  1483. "Ø": "O",
  1484. "Ố": "O",
  1485. "Ṍ": "O",
  1486. "Ṓ": "O",
  1487. "Ȏ": "O",
  1488. "Ù": "U",
  1489. "Ú": "U",
  1490. "Û": "U",
  1491. "Ü": "U",
  1492. "Ý": "Y",
  1493. "à": "a",
  1494. "á": "a",
  1495. "â": "a",
  1496. "ã": "a",
  1497. "ä": "a",
  1498. "å": "a",
  1499. "ấ": "a",
  1500. "ắ": "a",
  1501. "ẳ": "a",
  1502. "ẵ": "a",
  1503. "ặ": "a",
  1504. "æ": "ae",
  1505. "ầ": "a",
  1506. "ằ": "a",
  1507. "ȃ": "a",
  1508. "ç": "c",
  1509. "ḉ": "c",
  1510. "è": "e",
  1511. "é": "e",
  1512. "ê": "e",
  1513. "ë": "e",
  1514. "ế": "e",
  1515. "ḗ": "e",
  1516. "ề": "e",
  1517. "ḕ": "e",
  1518. "ḝ": "e",
  1519. "ȇ": "e",
  1520. "ì": "i",
  1521. "í": "i",
  1522. "î": "i",
  1523. "ï": "i",
  1524. "ḯ": "i",
  1525. "ȋ": "i",
  1526. "ð": "d",
  1527. "ñ": "n",
  1528. "ò": "o",
  1529. "ó": "o",
  1530. "ô": "o",
  1531. "õ": "o",
  1532. "ö": "o",
  1533. "ø": "o",
  1534. "ố": "o",
  1535. "ṍ": "o",
  1536. "ṓ": "o",
  1537. "ȏ": "o",
  1538. "ù": "u",
  1539. "ú": "u",
  1540. "û": "u",
  1541. "ü": "u",
  1542. "ý": "y",
  1543. "ÿ": "y",
  1544. "Ā": "A",
  1545. "ā": "a",
  1546. "Ă": "A",
  1547. "ă": "a",
  1548. "Ą": "A",
  1549. "ą": "a",
  1550. "Ć": "C",
  1551. "ć": "c",
  1552. "Ĉ": "C",
  1553. "ĉ": "c",
  1554. "Ċ": "C",
  1555. "ċ": "c",
  1556. "Č": "C",
  1557. "č": "c",
  1558. "C̆": "C",
  1559. "c̆": "c",
  1560. "Ď": "D",
  1561. "ď": "d",
  1562. "Đ": "D",
  1563. "đ": "d",
  1564. "Ē": "E",
  1565. "ē": "e",
  1566. "Ĕ": "E",
  1567. "ĕ": "e",
  1568. "Ė": "E",
  1569. "ė": "e",
  1570. "Ę": "E",
  1571. "ę": "e",
  1572. "Ě": "E",
  1573. "ě": "e",
  1574. "Ĝ": "G",
  1575. "Ǵ": "G",
  1576. "ĝ": "g",
  1577. "ǵ": "g",
  1578. "Ğ": "G",
  1579. "ğ": "g",
  1580. "Ġ": "G",
  1581. "ġ": "g",
  1582. "Ģ": "G",
  1583. "ģ": "g",
  1584. "Ĥ": "H",
  1585. "ĥ": "h",
  1586. "Ħ": "H",
  1587. "ħ": "h",
  1588. "Ḫ": "H",
  1589. "ḫ": "h",
  1590. "Ĩ": "I",
  1591. "ĩ": "i",
  1592. "Ī": "I",
  1593. "ī": "i",
  1594. "Ĭ": "I",
  1595. "ĭ": "i",
  1596. "Į": "I",
  1597. "į": "i",
  1598. "İ": "I",
  1599. "ı": "i",
  1600. "IJ": "IJ",
  1601. "ij": "ij",
  1602. "Ĵ": "J",
  1603. "ĵ": "j",
  1604. "Ķ": "K",
  1605. "ķ": "k",
  1606. "Ḱ": "K",
  1607. "ḱ": "k",
  1608. "K̆": "K",
  1609. "k̆": "k",
  1610. "Ĺ": "L",
  1611. "ĺ": "l",
  1612. "Ļ": "L",
  1613. "ļ": "l",
  1614. "Ľ": "L",
  1615. "ľ": "l",
  1616. "Ŀ": "L",
  1617. "ŀ": "l",
  1618. "Ł": "l",
  1619. "ł": "l",
  1620. "Ḿ": "M",
  1621. "ḿ": "m",
  1622. "M̆": "M",
  1623. "m̆": "m",
  1624. "Ń": "N",
  1625. "ń": "n",
  1626. "Ņ": "N",
  1627. "ņ": "n",
  1628. "Ň": "N",
  1629. "ň": "n",
  1630. "ʼn": "n",
  1631. "N̆": "N",
  1632. "n̆": "n",
  1633. "Ō": "O",
  1634. "ō": "o",
  1635. "Ŏ": "O",
  1636. "ŏ": "o",
  1637. "Ő": "O",
  1638. "ő": "o",
  1639. "Œ": "OE",
  1640. "œ": "oe",
  1641. "P̆": "P",
  1642. "p̆": "p",
  1643. "Ŕ": "R",
  1644. "ŕ": "r",
  1645. "Ŗ": "R",
  1646. "ŗ": "r",
  1647. "Ř": "R",
  1648. "ř": "r",
  1649. "R̆": "R",
  1650. "r̆": "r",
  1651. "Ȓ": "R",
  1652. "ȓ": "r",
  1653. "Ś": "S",
  1654. "ś": "s",
  1655. "Ŝ": "S",
  1656. "ŝ": "s",
  1657. "Ş": "S",
  1658. "Ș": "S",
  1659. "ș": "s",
  1660. "ş": "s",
  1661. "Š": "S",
  1662. "š": "s",
  1663. "Ţ": "T",
  1664. "ţ": "t",
  1665. "ț": "t",
  1666. "Ț": "T",
  1667. "Ť": "T",
  1668. "ť": "t",
  1669. "Ŧ": "T",
  1670. "ŧ": "t",
  1671. "T̆": "T",
  1672. "t̆": "t",
  1673. "Ũ": "U",
  1674. "ũ": "u",
  1675. "Ū": "U",
  1676. "ū": "u",
  1677. "Ŭ": "U",
  1678. "ŭ": "u",
  1679. "Ů": "U",
  1680. "ů": "u",
  1681. "Ű": "U",
  1682. "ű": "u",
  1683. "Ų": "U",
  1684. "ų": "u",
  1685. "Ȗ": "U",
  1686. "ȗ": "u",
  1687. "V̆": "V",
  1688. "v̆": "v",
  1689. "Ŵ": "W",
  1690. "ŵ": "w",
  1691. "Ẃ": "W",
  1692. "ẃ": "w",
  1693. "X̆": "X",
  1694. "x̆": "x",
  1695. "Ŷ": "Y",
  1696. "ŷ": "y",
  1697. "Ÿ": "Y",
  1698. "Y̆": "Y",
  1699. "y̆": "y",
  1700. "Ź": "Z",
  1701. "ź": "z",
  1702. "Ż": "Z",
  1703. "ż": "z",
  1704. "Ž": "Z",
  1705. "ž": "z",
  1706. "ſ": "s",
  1707. "ƒ": "f",
  1708. "Ơ": "O",
  1709. "ơ": "o",
  1710. "Ư": "U",
  1711. "ư": "u",
  1712. "Ǎ": "A",
  1713. "ǎ": "a",
  1714. "Ǐ": "I",
  1715. "ǐ": "i",
  1716. "Ǒ": "O",
  1717. "ǒ": "o",
  1718. "Ǔ": "U",
  1719. "ǔ": "u",
  1720. "Ǖ": "U",
  1721. "ǖ": "u",
  1722. "Ǘ": "U",
  1723. "ǘ": "u",
  1724. "Ǚ": "U",
  1725. "ǚ": "u",
  1726. "Ǜ": "U",
  1727. "ǜ": "u",
  1728. "Ứ": "U",
  1729. "ứ": "u",
  1730. "Ṹ": "U",
  1731. "ṹ": "u",
  1732. "Ǻ": "A",
  1733. "ǻ": "a",
  1734. "Ǽ": "AE",
  1735. "ǽ": "ae",
  1736. "Ǿ": "O",
  1737. "ǿ": "o",
  1738. "Þ": "TH",
  1739. "þ": "th",
  1740. "Ṕ": "P",
  1741. "ṕ": "p",
  1742. "Ṥ": "S",
  1743. "ṥ": "s",
  1744. "X́": "X",
  1745. "x́": "x",
  1746. "Ѓ": "Г",
  1747. "ѓ": "г",
  1748. "Ќ": "К",
  1749. "ќ": "к",
  1750. "A̋": "A",
  1751. "a̋": "a",
  1752. "E̋": "E",
  1753. "e̋": "e",
  1754. "I̋": "I",
  1755. "i̋": "i",
  1756. "Ǹ": "N",
  1757. "ǹ": "n",
  1758. "Ồ": "O",
  1759. "ồ": "o",
  1760. "Ṑ": "O",
  1761. "ṑ": "o",
  1762. "Ừ": "U",
  1763. "ừ": "u",
  1764. "Ẁ": "W",
  1765. "ẁ": "w",
  1766. "Ỳ": "Y",
  1767. "ỳ": "y",
  1768. "Ȁ": "A",
  1769. "ȁ": "a",
  1770. "Ȅ": "E",
  1771. "ȅ": "e",
  1772. "Ȉ": "I",
  1773. "ȉ": "i",
  1774. "Ȍ": "O",
  1775. "ȍ": "o",
  1776. "Ȑ": "R",
  1777. "ȑ": "r",
  1778. "Ȕ": "U",
  1779. "ȕ": "u",
  1780. "B̌": "B",
  1781. "b̌": "b",
  1782. "Č̣": "C",
  1783. "č̣": "c",
  1784. "Ê̌": "E",
  1785. "ê̌": "e",
  1786. "F̌": "F",
  1787. "f̌": "f",
  1788. "Ǧ": "G",
  1789. "ǧ": "g",
  1790. "Ȟ": "H",
  1791. "ȟ": "h",
  1792. "J̌": "J",
  1793. "ǰ": "j",
  1794. "Ǩ": "K",
  1795. "ǩ": "k",
  1796. "M̌": "M",
  1797. "m̌": "m",
  1798. "P̌": "P",
  1799. "p̌": "p",
  1800. "Q̌": "Q",
  1801. "q̌": "q",
  1802. "Ř̩": "R",
  1803. "ř̩": "r",
  1804. "Ṧ": "S",
  1805. "ṧ": "s",
  1806. "V̌": "V",
  1807. "v̌": "v",
  1808. "W̌": "W",
  1809. "w̌": "w",
  1810. "X̌": "X",
  1811. "x̌": "x",
  1812. "Y̌": "Y",
  1813. "y̌": "y",
  1814. "A̧": "A",
  1815. "a̧": "a",
  1816. "B̧": "B",
  1817. "b̧": "b",
  1818. "Ḑ": "D",
  1819. "ḑ": "d",
  1820. "Ȩ": "E",
  1821. "ȩ": "e",
  1822. "Ɛ̧": "E",
  1823. "ɛ̧": "e",
  1824. "Ḩ": "H",
  1825. "ḩ": "h",
  1826. "I̧": "I",
  1827. "i̧": "i",
  1828. "Ɨ̧": "I",
  1829. "ɨ̧": "i",
  1830. "M̧": "M",
  1831. "m̧": "m",
  1832. "O̧": "O",
  1833. "o̧": "o",
  1834. "Q̧": "Q",
  1835. "q̧": "q",
  1836. "U̧": "U",
  1837. "u̧": "u",
  1838. "X̧": "X",
  1839. "x̧": "x",
  1840. "Z̧": "Z",
  1841. "z̧": "z",
  1842. };
  1843. var chars = Object.keys(characterMap).join('|');
  1844. var allAccents = new RegExp(chars, 'g');
  1845. var firstAccent = new RegExp(chars, '');
  1846. function matcher(match) {
  1847. return characterMap[match];
  1848. }
  1849. var removeAccents = function(string) {
  1850. return string.replace(allAccents, matcher);
  1851. };
  1852. var hasAccents = function(string) {
  1853. return !!string.match(firstAccent);
  1854. };
  1855. module.exports = removeAccents;
  1856. module.exports.has = hasAccents;
  1857. module.exports.remove = removeAccents;
  1858. /***/ })
  1859. /******/ });
  1860. /************************************************************************/
  1861. /******/ // The module cache
  1862. /******/ var __webpack_module_cache__ = {};
  1863. /******/
  1864. /******/ // The require function
  1865. /******/ function __webpack_require__(moduleId) {
  1866. /******/ // Check if module is in cache
  1867. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  1868. /******/ if (cachedModule !== undefined) {
  1869. /******/ return cachedModule.exports;
  1870. /******/ }
  1871. /******/ // Create a new module (and put it into the cache)
  1872. /******/ var module = __webpack_module_cache__[moduleId] = {
  1873. /******/ // no module.id needed
  1874. /******/ // no module.loaded needed
  1875. /******/ exports: {}
  1876. /******/ };
  1877. /******/
  1878. /******/ // Execute the module function
  1879. /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
  1880. /******/
  1881. /******/ // Return the exports of the module
  1882. /******/ return module.exports;
  1883. /******/ }
  1884. /******/
  1885. /************************************************************************/
  1886. /******/ /* webpack/runtime/compat get default export */
  1887. /******/ !function() {
  1888. /******/ // getDefaultExport function for compatibility with non-harmony modules
  1889. /******/ __webpack_require__.n = function(module) {
  1890. /******/ var getter = module && module.__esModule ?
  1891. /******/ function() { return module['default']; } :
  1892. /******/ function() { return module; };
  1893. /******/ __webpack_require__.d(getter, { a: getter });
  1894. /******/ return getter;
  1895. /******/ };
  1896. /******/ }();
  1897. /******/
  1898. /******/ /* webpack/runtime/define property getters */
  1899. /******/ !function() {
  1900. /******/ // define getter functions for harmony exports
  1901. /******/ __webpack_require__.d = function(exports, definition) {
  1902. /******/ for(var key in definition) {
  1903. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  1904. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  1905. /******/ }
  1906. /******/ }
  1907. /******/ };
  1908. /******/ }();
  1909. /******/
  1910. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  1911. /******/ !function() {
  1912. /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
  1913. /******/ }();
  1914. /******/
  1915. /******/ /* webpack/runtime/make namespace object */
  1916. /******/ !function() {
  1917. /******/ // define __esModule on exports
  1918. /******/ __webpack_require__.r = function(exports) {
  1919. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  1920. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  1921. /******/ }
  1922. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  1923. /******/ };
  1924. /******/ }();
  1925. /******/
  1926. /******/ /* webpack/runtime/nonce */
  1927. /******/ !function() {
  1928. /******/ __webpack_require__.nc = undefined;
  1929. /******/ }();
  1930. /******/
  1931. /************************************************************************/
  1932. var __webpack_exports__ = {};
  1933. // This entry need to be wrapped in an IIFE because it need to be in strict mode.
  1934. !function() {
  1935. "use strict";
  1936. // ESM COMPAT FLAG
  1937. __webpack_require__.r(__webpack_exports__);
  1938. // EXPORTS
  1939. __webpack_require__.d(__webpack_exports__, {
  1940. "AnglePickerControl": function() { return /* reexport */ AnglePickerControl; },
  1941. "Animate": function() { return /* reexport */ Animate; },
  1942. "Autocomplete": function() { return /* reexport */ Autocomplete; },
  1943. "BaseControl": function() { return /* reexport */ base_control; },
  1944. "BlockQuotation": function() { return /* reexport */ external_wp_primitives_namespaceObject.BlockQuotation; },
  1945. "Button": function() { return /* reexport */ build_module_button; },
  1946. "ButtonGroup": function() { return /* reexport */ button_group; },
  1947. "Card": function() { return /* reexport */ card_component; },
  1948. "CardBody": function() { return /* reexport */ card_body_component; },
  1949. "CardDivider": function() { return /* reexport */ card_divider_component; },
  1950. "CardFooter": function() { return /* reexport */ card_footer_component; },
  1951. "CardHeader": function() { return /* reexport */ card_header_component; },
  1952. "CardMedia": function() { return /* reexport */ card_media_component; },
  1953. "CheckboxControl": function() { return /* reexport */ checkbox_control; },
  1954. "Circle": function() { return /* reexport */ external_wp_primitives_namespaceObject.Circle; },
  1955. "ClipboardButton": function() { return /* reexport */ ClipboardButton; },
  1956. "ColorIndicator": function() { return /* reexport */ color_indicator; },
  1957. "ColorPalette": function() { return /* reexport */ color_palette; },
  1958. "ColorPicker": function() { return /* reexport */ LegacyAdapter; },
  1959. "ComboboxControl": function() { return /* reexport */ combobox_control; },
  1960. "CustomGradientPicker": function() { return /* reexport */ CustomGradientPicker; },
  1961. "CustomSelectControl": function() { return /* reexport */ CustomSelectControl; },
  1962. "Dashicon": function() { return /* reexport */ dashicon; },
  1963. "DatePicker": function() { return /* reexport */ date; },
  1964. "DateTimePicker": function() { return /* reexport */ build_module_date_time; },
  1965. "Disabled": function() { return /* reexport */ disabled; },
  1966. "Draggable": function() { return /* reexport */ Draggable; },
  1967. "DropZone": function() { return /* reexport */ drop_zone; },
  1968. "DropZoneProvider": function() { return /* reexport */ DropZoneProvider; },
  1969. "Dropdown": function() { return /* reexport */ Dropdown; },
  1970. "DropdownMenu": function() { return /* reexport */ dropdown_menu; },
  1971. "DuotonePicker": function() { return /* reexport */ duotone_picker; },
  1972. "DuotoneSwatch": function() { return /* reexport */ duotone_swatch; },
  1973. "ExternalLink": function() { return /* reexport */ external_link; },
  1974. "Fill": function() { return /* reexport */ slot_fill_Fill; },
  1975. "Flex": function() { return /* reexport */ flex_component; },
  1976. "FlexBlock": function() { return /* reexport */ flex_block_component; },
  1977. "FlexItem": function() { return /* reexport */ flex_item_component; },
  1978. "FocalPointPicker": function() { return /* reexport */ focal_point_picker; },
  1979. "FocusReturnProvider": function() { return /* reexport */ with_focus_return_Provider; },
  1980. "FocusableIframe": function() { return /* reexport */ FocusableIframe; },
  1981. "FontSizePicker": function() { return /* reexport */ font_size_picker; },
  1982. "FormFileUpload": function() { return /* reexport */ form_file_upload; },
  1983. "FormToggle": function() { return /* reexport */ form_toggle; },
  1984. "FormTokenField": function() { return /* reexport */ form_token_field; },
  1985. "G": function() { return /* reexport */ external_wp_primitives_namespaceObject.G; },
  1986. "GradientPicker": function() { return /* reexport */ GradientPicker; },
  1987. "Guide": function() { return /* reexport */ Guide; },
  1988. "GuidePage": function() { return /* reexport */ GuidePage; },
  1989. "HorizontalRule": function() { return /* reexport */ external_wp_primitives_namespaceObject.HorizontalRule; },
  1990. "Icon": function() { return /* reexport */ build_module_icon; },
  1991. "IconButton": function() { return /* reexport */ deprecated; },
  1992. "IsolatedEventContainer": function() { return /* reexport */ isolated_event_container; },
  1993. "KeyboardShortcuts": function() { return /* reexport */ keyboard_shortcuts; },
  1994. "MenuGroup": function() { return /* reexport */ menu_group; },
  1995. "MenuItem": function() { return /* reexport */ menu_item; },
  1996. "MenuItemsChoice": function() { return /* reexport */ MenuItemsChoice; },
  1997. "Modal": function() { return /* reexport */ modal; },
  1998. "NavigableMenu": function() { return /* reexport */ navigable_container_menu; },
  1999. "Notice": function() { return /* reexport */ build_module_notice; },
  2000. "NoticeList": function() { return /* reexport */ list; },
  2001. "Panel": function() { return /* reexport */ panel; },
  2002. "PanelBody": function() { return /* reexport */ body; },
  2003. "PanelHeader": function() { return /* reexport */ panel_header; },
  2004. "PanelRow": function() { return /* reexport */ row; },
  2005. "Path": function() { return /* reexport */ external_wp_primitives_namespaceObject.Path; },
  2006. "Placeholder": function() { return /* reexport */ placeholder; },
  2007. "Polygon": function() { return /* reexport */ external_wp_primitives_namespaceObject.Polygon; },
  2008. "Popover": function() { return /* reexport */ popover; },
  2009. "QueryControls": function() { return /* reexport */ QueryControls; },
  2010. "RadioControl": function() { return /* reexport */ radio_control; },
  2011. "RangeControl": function() { return /* reexport */ range_control; },
  2012. "Rect": function() { return /* reexport */ external_wp_primitives_namespaceObject.Rect; },
  2013. "ResizableBox": function() { return /* reexport */ resizable_box; },
  2014. "ResponsiveWrapper": function() { return /* reexport */ responsive_wrapper; },
  2015. "SVG": function() { return /* reexport */ external_wp_primitives_namespaceObject.SVG; },
  2016. "SandBox": function() { return /* reexport */ Sandbox; },
  2017. "ScrollLock": function() { return /* reexport */ scroll_lock; },
  2018. "SearchControl": function() { return /* reexport */ search_control; },
  2019. "SelectControl": function() { return /* reexport */ select_control; },
  2020. "Slot": function() { return /* reexport */ slot_fill_Slot; },
  2021. "SlotFillProvider": function() { return /* reexport */ Provider; },
  2022. "Snackbar": function() { return /* reexport */ snackbar; },
  2023. "SnackbarList": function() { return /* reexport */ snackbar_list; },
  2024. "Spinner": function() { return /* reexport */ spinner; },
  2025. "TabPanel": function() { return /* reexport */ tab_panel; },
  2026. "TabbableContainer": function() { return /* reexport */ tabbable; },
  2027. "TextControl": function() { return /* reexport */ text_control; },
  2028. "TextHighlight": function() { return /* reexport */ text_highlight; },
  2029. "TextareaControl": function() { return /* reexport */ textarea_control; },
  2030. "TimePicker": function() { return /* reexport */ time; },
  2031. "Tip": function() { return /* reexport */ build_module_tip; },
  2032. "ToggleControl": function() { return /* reexport */ toggle_control; },
  2033. "Toolbar": function() { return /* reexport */ toolbar; },
  2034. "ToolbarButton": function() { return /* reexport */ toolbar_button; },
  2035. "ToolbarDropdownMenu": function() { return /* reexport */ toolbar_dropdown_menu; },
  2036. "ToolbarGroup": function() { return /* reexport */ toolbar_group; },
  2037. "ToolbarItem": function() { return /* reexport */ toolbar_item; },
  2038. "Tooltip": function() { return /* reexport */ tooltip; },
  2039. "TreeSelect": function() { return /* reexport */ tree_select; },
  2040. "VisuallyHidden": function() { return /* reexport */ visually_hidden_component; },
  2041. "__experimentalAlignmentMatrixControl": function() { return /* reexport */ AlignmentMatrixControl; },
  2042. "__experimentalApplyValueToSides": function() { return /* reexport */ applyValueToSides; },
  2043. "__experimentalBorderBoxControl": function() { return /* reexport */ border_box_control_component; },
  2044. "__experimentalBorderControl": function() { return /* reexport */ border_control_component; },
  2045. "__experimentalBoxControl": function() { return /* reexport */ BoxControl; },
  2046. "__experimentalConfirmDialog": function() { return /* reexport */ confirm_dialog_component; },
  2047. "__experimentalDimensionControl": function() { return /* reexport */ dimension_control; },
  2048. "__experimentalDivider": function() { return /* reexport */ divider_component; },
  2049. "__experimentalDropdownContentWrapper": function() { return /* reexport */ dropdown_content_wrapper; },
  2050. "__experimentalElevation": function() { return /* reexport */ elevation_component; },
  2051. "__experimentalGrid": function() { return /* reexport */ grid_component; },
  2052. "__experimentalHStack": function() { return /* reexport */ h_stack_component; },
  2053. "__experimentalHasSplitBorders": function() { return /* reexport */ hasSplitBorders; },
  2054. "__experimentalHeading": function() { return /* reexport */ heading_component; },
  2055. "__experimentalInputControl": function() { return /* reexport */ input_control; },
  2056. "__experimentalInputControlPrefixWrapper": function() { return /* reexport */ input_prefix_wrapper; },
  2057. "__experimentalInputControlSuffixWrapper": function() { return /* reexport */ input_suffix_wrapper; },
  2058. "__experimentalIsDefinedBorder": function() { return /* reexport */ isDefinedBorder; },
  2059. "__experimentalIsEmptyBorder": function() { return /* reexport */ isEmptyBorder; },
  2060. "__experimentalItem": function() { return /* reexport */ item_component; },
  2061. "__experimentalItemGroup": function() { return /* reexport */ item_group_component; },
  2062. "__experimentalNavigation": function() { return /* reexport */ Navigation; },
  2063. "__experimentalNavigationBackButton": function() { return /* reexport */ back_button; },
  2064. "__experimentalNavigationGroup": function() { return /* reexport */ NavigationGroup; },
  2065. "__experimentalNavigationItem": function() { return /* reexport */ NavigationItem; },
  2066. "__experimentalNavigationMenu": function() { return /* reexport */ NavigationMenu; },
  2067. "__experimentalNavigatorBackButton": function() { return /* reexport */ navigator_back_button_component; },
  2068. "__experimentalNavigatorButton": function() { return /* reexport */ navigator_button_component; },
  2069. "__experimentalNavigatorProvider": function() { return /* reexport */ navigator_provider_component; },
  2070. "__experimentalNavigatorScreen": function() { return /* reexport */ navigator_screen_component; },
  2071. "__experimentalNumberControl": function() { return /* reexport */ number_control; },
  2072. "__experimentalPaletteEdit": function() { return /* reexport */ PaletteEdit; },
  2073. "__experimentalParseQuantityAndUnitFromRawValue": function() { return /* reexport */ parseQuantityAndUnitFromRawValue; },
  2074. "__experimentalRadio": function() { return /* reexport */ build_module_radio; },
  2075. "__experimentalRadioGroup": function() { return /* reexport */ radio_group; },
  2076. "__experimentalScrollable": function() { return /* reexport */ scrollable_component; },
  2077. "__experimentalSpacer": function() { return /* reexport */ spacer_component; },
  2078. "__experimentalStyleProvider": function() { return /* reexport */ style_provider; },
  2079. "__experimentalSurface": function() { return /* reexport */ surface_component; },
  2080. "__experimentalText": function() { return /* reexport */ text_component; },
  2081. "__experimentalToggleGroupControl": function() { return /* reexport */ toggle_group_control_component; },
  2082. "__experimentalToggleGroupControlOption": function() { return /* reexport */ toggle_group_control_option_component; },
  2083. "__experimentalToggleGroupControlOptionIcon": function() { return /* reexport */ toggle_group_control_option_icon_component; },
  2084. "__experimentalToolbarContext": function() { return /* reexport */ toolbar_context; },
  2085. "__experimentalToolsPanel": function() { return /* reexport */ tools_panel_component; },
  2086. "__experimentalToolsPanelContext": function() { return /* reexport */ ToolsPanelContext; },
  2087. "__experimentalToolsPanelItem": function() { return /* reexport */ tools_panel_item_component; },
  2088. "__experimentalTreeGrid": function() { return /* reexport */ tree_grid; },
  2089. "__experimentalTreeGridCell": function() { return /* reexport */ cell; },
  2090. "__experimentalTreeGridItem": function() { return /* reexport */ tree_grid_item; },
  2091. "__experimentalTreeGridRow": function() { return /* reexport */ tree_grid_row; },
  2092. "__experimentalTruncate": function() { return /* reexport */ truncate_component; },
  2093. "__experimentalUnitControl": function() { return /* reexport */ unit_control; },
  2094. "__experimentalUseCustomUnits": function() { return /* reexport */ useCustomUnits; },
  2095. "__experimentalUseNavigator": function() { return /* reexport */ use_navigator; },
  2096. "__experimentalUseSlot": function() { return /* reexport */ useSlot; },
  2097. "__experimentalVStack": function() { return /* reexport */ v_stack_component; },
  2098. "__experimentalView": function() { return /* reexport */ component; },
  2099. "__experimentalZStack": function() { return /* reexport */ z_stack_component; },
  2100. "__unstableComposite": function() { return /* reexport */ Composite; },
  2101. "__unstableCompositeGroup": function() { return /* reexport */ CompositeGroup; },
  2102. "__unstableCompositeItem": function() { return /* reexport */ CompositeItem; },
  2103. "__unstableDisclosureContent": function() { return /* reexport */ DisclosureContent; },
  2104. "__unstableGetAnimateClassName": function() { return /* reexport */ getAnimateClassName; },
  2105. "__unstableMotion": function() { return /* reexport */ motion; },
  2106. "__unstableUseAutocompleteProps": function() { return /* reexport */ useAutocompleteProps; },
  2107. "__unstableUseCompositeState": function() { return /* reexport */ useCompositeState; },
  2108. "__unstableUseNavigateRegions": function() { return /* reexport */ useNavigateRegions; },
  2109. "createSlotFill": function() { return /* reexport */ createSlotFill; },
  2110. "navigateRegions": function() { return /* reexport */ navigate_regions; },
  2111. "withConstrainedTabbing": function() { return /* reexport */ with_constrained_tabbing; },
  2112. "withFallbackStyles": function() { return /* reexport */ with_fallback_styles; },
  2113. "withFilters": function() { return /* reexport */ withFilters; },
  2114. "withFocusOutside": function() { return /* reexport */ with_focus_outside; },
  2115. "withFocusReturn": function() { return /* reexport */ with_focus_return; },
  2116. "withNotices": function() { return /* reexport */ with_notices; },
  2117. "withSpokenMessages": function() { return /* reexport */ with_spoken_messages; }
  2118. });
  2119. // NAMESPACE OBJECT: ./node_modules/@wordpress/components/build-module/text/styles.js
  2120. var text_styles_namespaceObject = {};
  2121. __webpack_require__.r(text_styles_namespaceObject);
  2122. __webpack_require__.d(text_styles_namespaceObject, {
  2123. "Text": function() { return Text; },
  2124. "block": function() { return styles_block; },
  2125. "destructive": function() { return destructive; },
  2126. "highlighterText": function() { return highlighterText; },
  2127. "muted": function() { return muted; },
  2128. "positive": function() { return positive; },
  2129. "upperCase": function() { return upperCase; }
  2130. });
  2131. // NAMESPACE OBJECT: ./node_modules/@wordpress/components/build-module/ui/tooltip/styles.js
  2132. var tooltip_styles_namespaceObject = {};
  2133. __webpack_require__.r(tooltip_styles_namespaceObject);
  2134. __webpack_require__.d(tooltip_styles_namespaceObject, {
  2135. "TooltipContent": function() { return TooltipContent; },
  2136. "TooltipPopoverView": function() { return TooltipPopoverView; },
  2137. "TooltipShortcut": function() { return TooltipShortcut; },
  2138. "noOutline": function() { return noOutline; }
  2139. });
  2140. // NAMESPACE OBJECT: ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control-option-base/styles.js
  2141. var toggle_group_control_option_base_styles_namespaceObject = {};
  2142. __webpack_require__.r(toggle_group_control_option_base_styles_namespaceObject);
  2143. __webpack_require__.d(toggle_group_control_option_base_styles_namespaceObject, {
  2144. "ButtonContentView": function() { return ButtonContentView; },
  2145. "LabelView": function() { return LabelView; },
  2146. "buttonActive": function() { return buttonActive; },
  2147. "buttonView": function() { return buttonView; },
  2148. "isIcon": function() { return styles_isIcon; },
  2149. "labelBlock": function() { return labelBlock; },
  2150. "separatorActive": function() { return separatorActive; }
  2151. });
  2152. ;// CONCATENATED MODULE: external ["wp","primitives"]
  2153. var external_wp_primitives_namespaceObject = window["wp"]["primitives"];
  2154. ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
  2155. function extends_extends() {
  2156. extends_extends = Object.assign ? Object.assign.bind() : function (target) {
  2157. for (var i = 1; i < arguments.length; i++) {
  2158. var source = arguments[i];
  2159. for (var key in source) {
  2160. if (Object.prototype.hasOwnProperty.call(source, key)) {
  2161. target[key] = source[key];
  2162. }
  2163. }
  2164. }
  2165. return target;
  2166. };
  2167. return extends_extends.apply(this, arguments);
  2168. }
  2169. ;// CONCATENATED MODULE: external ["wp","element"]
  2170. var external_wp_element_namespaceObject = window["wp"]["element"];
  2171. // EXTERNAL MODULE: ./node_modules/classnames/index.js
  2172. var classnames = __webpack_require__(4403);
  2173. var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
  2174. ;// CONCATENATED MODULE: external ["wp","i18n"]
  2175. var external_wp_i18n_namespaceObject = window["wp"]["i18n"];
  2176. ;// CONCATENATED MODULE: external ["wp","compose"]
  2177. var external_wp_compose_namespaceObject = window["wp"]["compose"];
  2178. ;// CONCATENATED MODULE: ./node_modules/reakit/es/_rollupPluginBabelHelpers-1f0bf8c2.js
  2179. function _defineProperty(obj, key, value) {
  2180. if (key in obj) {
  2181. Object.defineProperty(obj, key, {
  2182. value: value,
  2183. enumerable: true,
  2184. configurable: true,
  2185. writable: true
  2186. });
  2187. } else {
  2188. obj[key] = value;
  2189. }
  2190. return obj;
  2191. }
  2192. function ownKeys(object, enumerableOnly) {
  2193. var keys = Object.keys(object);
  2194. if (Object.getOwnPropertySymbols) {
  2195. var symbols = Object.getOwnPropertySymbols(object);
  2196. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2197. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2198. });
  2199. keys.push.apply(keys, symbols);
  2200. }
  2201. return keys;
  2202. }
  2203. function _objectSpread2(target) {
  2204. for (var i = 1; i < arguments.length; i++) {
  2205. var source = arguments[i] != null ? arguments[i] : {};
  2206. if (i % 2) {
  2207. ownKeys(Object(source), true).forEach(function (key) {
  2208. _defineProperty(target, key, source[key]);
  2209. });
  2210. } else if (Object.getOwnPropertyDescriptors) {
  2211. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2212. } else {
  2213. ownKeys(Object(source)).forEach(function (key) {
  2214. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2215. });
  2216. }
  2217. }
  2218. return target;
  2219. }
  2220. function _objectWithoutPropertiesLoose(source, excluded) {
  2221. if (source == null) return {};
  2222. var target = {};
  2223. var sourceKeys = Object.keys(source);
  2224. var key, i;
  2225. for (i = 0; i < sourceKeys.length; i++) {
  2226. key = sourceKeys[i];
  2227. if (excluded.indexOf(key) >= 0) continue;
  2228. target[key] = source[key];
  2229. }
  2230. return target;
  2231. }
  2232. function _unsupportedIterableToArray(o, minLen) {
  2233. if (!o) return;
  2234. if (typeof o === "string") return _arrayLikeToArray(o, minLen);
  2235. var n = Object.prototype.toString.call(o).slice(8, -1);
  2236. if (n === "Object" && o.constructor) n = o.constructor.name;
  2237. if (n === "Map" || n === "Set") return Array.from(o);
  2238. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
  2239. }
  2240. function _arrayLikeToArray(arr, len) {
  2241. if (len == null || len > arr.length) len = arr.length;
  2242. for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
  2243. return arr2;
  2244. }
  2245. function _createForOfIteratorHelperLoose(o, allowArrayLike) {
  2246. var it;
  2247. if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
  2248. if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
  2249. if (it) o = it;
  2250. var i = 0;
  2251. return function () {
  2252. if (i >= o.length) return {
  2253. done: true
  2254. };
  2255. return {
  2256. done: false,
  2257. value: o[i++]
  2258. };
  2259. };
  2260. }
  2261. throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  2262. }
  2263. it = o[Symbol.iterator]();
  2264. return it.next.bind(it);
  2265. }
  2266. ;// CONCATENATED MODULE: external "React"
  2267. var external_React_namespaceObject = window["React"];
  2268. var external_React_default = /*#__PURE__*/__webpack_require__.n(external_React_namespaceObject);
  2269. ;// CONCATENATED MODULE: ./node_modules/reakit-system/es/_rollupPluginBabelHelpers-0c84a174.js
  2270. function _rollupPluginBabelHelpers_0c84a174_defineProperty(obj, key, value) {
  2271. if (key in obj) {
  2272. Object.defineProperty(obj, key, {
  2273. value: value,
  2274. enumerable: true,
  2275. configurable: true,
  2276. writable: true
  2277. });
  2278. } else {
  2279. obj[key] = value;
  2280. }
  2281. return obj;
  2282. }
  2283. function _rollupPluginBabelHelpers_0c84a174_ownKeys(object, enumerableOnly) {
  2284. var keys = Object.keys(object);
  2285. if (Object.getOwnPropertySymbols) {
  2286. var symbols = Object.getOwnPropertySymbols(object);
  2287. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2288. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2289. });
  2290. keys.push.apply(keys, symbols);
  2291. }
  2292. return keys;
  2293. }
  2294. function _rollupPluginBabelHelpers_0c84a174_objectSpread2(target) {
  2295. for (var i = 1; i < arguments.length; i++) {
  2296. var source = arguments[i] != null ? arguments[i] : {};
  2297. if (i % 2) {
  2298. _rollupPluginBabelHelpers_0c84a174_ownKeys(Object(source), true).forEach(function (key) {
  2299. _rollupPluginBabelHelpers_0c84a174_defineProperty(target, key, source[key]);
  2300. });
  2301. } else if (Object.getOwnPropertyDescriptors) {
  2302. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2303. } else {
  2304. _rollupPluginBabelHelpers_0c84a174_ownKeys(Object(source)).forEach(function (key) {
  2305. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2306. });
  2307. }
  2308. }
  2309. return target;
  2310. }
  2311. function _rollupPluginBabelHelpers_0c84a174_objectWithoutPropertiesLoose(source, excluded) {
  2312. if (source == null) return {};
  2313. var target = {};
  2314. var sourceKeys = Object.keys(source);
  2315. var key, i;
  2316. for (i = 0; i < sourceKeys.length; i++) {
  2317. key = sourceKeys[i];
  2318. if (excluded.indexOf(key) >= 0) continue;
  2319. target[key] = source[key];
  2320. }
  2321. return target;
  2322. }
  2323. function _rollupPluginBabelHelpers_0c84a174_unsupportedIterableToArray(o, minLen) {
  2324. if (!o) return;
  2325. if (typeof o === "string") return _rollupPluginBabelHelpers_0c84a174_arrayLikeToArray(o, minLen);
  2326. var n = Object.prototype.toString.call(o).slice(8, -1);
  2327. if (n === "Object" && o.constructor) n = o.constructor.name;
  2328. if (n === "Map" || n === "Set") return Array.from(o);
  2329. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _rollupPluginBabelHelpers_0c84a174_arrayLikeToArray(o, minLen);
  2330. }
  2331. function _rollupPluginBabelHelpers_0c84a174_arrayLikeToArray(arr, len) {
  2332. if (len == null || len > arr.length) len = arr.length;
  2333. for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
  2334. return arr2;
  2335. }
  2336. function _rollupPluginBabelHelpers_0c84a174_createForOfIteratorHelperLoose(o, allowArrayLike) {
  2337. var it;
  2338. if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
  2339. if (Array.isArray(o) || (it = _rollupPluginBabelHelpers_0c84a174_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
  2340. if (it) o = it;
  2341. var i = 0;
  2342. return function () {
  2343. if (i >= o.length) return {
  2344. done: true
  2345. };
  2346. return {
  2347. done: false,
  2348. value: o[i++]
  2349. };
  2350. };
  2351. }
  2352. throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  2353. }
  2354. it = o[Symbol.iterator]();
  2355. return it.next.bind(it);
  2356. }
  2357. ;// CONCATENATED MODULE: ./node_modules/reakit-system/es/SystemContext.js
  2358. var SystemContext = /*#__PURE__*/(0,external_React_namespaceObject.createContext)({});
  2359. ;// CONCATENATED MODULE: ./node_modules/reakit-system/es/useCreateElement.js
  2360. function isRenderProp(children) {
  2361. return typeof children === "function";
  2362. }
  2363. /**
  2364. * Custom hook that will call `children` if it's a function. If
  2365. * `useCreateElement` has been passed to the context, it'll be used instead.
  2366. *
  2367. * @example
  2368. * import React from "react";
  2369. * import { SystemProvider, useCreateElement } from "reakit-system";
  2370. *
  2371. * const system = {
  2372. * useCreateElement(type, props, children = props.children) {
  2373. * // very similar to what `useCreateElement` does already
  2374. * if (typeof children === "function") {
  2375. * const { children: _, ...rest } = props;
  2376. * return children(rest);
  2377. * }
  2378. * return React.createElement(type, props, children);
  2379. * },
  2380. * };
  2381. *
  2382. * function Component(props) {
  2383. * return useCreateElement("div", props);
  2384. * }
  2385. *
  2386. * function App() {
  2387. * return (
  2388. * <SystemProvider unstable_system={system}>
  2389. * <Component url="url">{({ url }) => <a href={url}>link</a>}</Component>
  2390. * </SystemProvider>
  2391. * );
  2392. * }
  2393. */
  2394. var useCreateElement = function useCreateElement(type, props, children) {
  2395. if (children === void 0) {
  2396. children = props.children;
  2397. }
  2398. var context = (0,external_React_namespaceObject.useContext)(SystemContext);
  2399. if (context.useCreateElement) {
  2400. return context.useCreateElement(type, props, children);
  2401. }
  2402. if (typeof type === "string" && isRenderProp(children)) {
  2403. var _ = props.children,
  2404. rest = _rollupPluginBabelHelpers_0c84a174_objectWithoutPropertiesLoose(props, ["children"]);
  2405. return children(rest);
  2406. }
  2407. return /*#__PURE__*/(0,external_React_namespaceObject.createElement)(type, props, children);
  2408. };
  2409. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/_rollupPluginBabelHelpers-1f0bf8c2.js
  2410. function _rollupPluginBabelHelpers_1f0bf8c2_defineProperty(obj, key, value) {
  2411. if (key in obj) {
  2412. Object.defineProperty(obj, key, {
  2413. value: value,
  2414. enumerable: true,
  2415. configurable: true,
  2416. writable: true
  2417. });
  2418. } else {
  2419. obj[key] = value;
  2420. }
  2421. return obj;
  2422. }
  2423. function _rollupPluginBabelHelpers_1f0bf8c2_ownKeys(object, enumerableOnly) {
  2424. var keys = Object.keys(object);
  2425. if (Object.getOwnPropertySymbols) {
  2426. var symbols = Object.getOwnPropertySymbols(object);
  2427. if (enumerableOnly) symbols = symbols.filter(function (sym) {
  2428. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  2429. });
  2430. keys.push.apply(keys, symbols);
  2431. }
  2432. return keys;
  2433. }
  2434. function _rollupPluginBabelHelpers_1f0bf8c2_objectSpread2(target) {
  2435. for (var i = 1; i < arguments.length; i++) {
  2436. var source = arguments[i] != null ? arguments[i] : {};
  2437. if (i % 2) {
  2438. _rollupPluginBabelHelpers_1f0bf8c2_ownKeys(Object(source), true).forEach(function (key) {
  2439. _rollupPluginBabelHelpers_1f0bf8c2_defineProperty(target, key, source[key]);
  2440. });
  2441. } else if (Object.getOwnPropertyDescriptors) {
  2442. Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
  2443. } else {
  2444. _rollupPluginBabelHelpers_1f0bf8c2_ownKeys(Object(source)).forEach(function (key) {
  2445. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  2446. });
  2447. }
  2448. }
  2449. return target;
  2450. }
  2451. function _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(source, excluded) {
  2452. if (source == null) return {};
  2453. var target = {};
  2454. var sourceKeys = Object.keys(source);
  2455. var key, i;
  2456. for (i = 0; i < sourceKeys.length; i++) {
  2457. key = sourceKeys[i];
  2458. if (excluded.indexOf(key) >= 0) continue;
  2459. target[key] = source[key];
  2460. }
  2461. return target;
  2462. }
  2463. function _rollupPluginBabelHelpers_1f0bf8c2_unsupportedIterableToArray(o, minLen) {
  2464. if (!o) return;
  2465. if (typeof o === "string") return _rollupPluginBabelHelpers_1f0bf8c2_arrayLikeToArray(o, minLen);
  2466. var n = Object.prototype.toString.call(o).slice(8, -1);
  2467. if (n === "Object" && o.constructor) n = o.constructor.name;
  2468. if (n === "Map" || n === "Set") return Array.from(o);
  2469. if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _rollupPluginBabelHelpers_1f0bf8c2_arrayLikeToArray(o, minLen);
  2470. }
  2471. function _rollupPluginBabelHelpers_1f0bf8c2_arrayLikeToArray(arr, len) {
  2472. if (len == null || len > arr.length) len = arr.length;
  2473. for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
  2474. return arr2;
  2475. }
  2476. function _rollupPluginBabelHelpers_1f0bf8c2_createForOfIteratorHelperLoose(o, allowArrayLike) {
  2477. var it;
  2478. if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
  2479. if (Array.isArray(o) || (it = _rollupPluginBabelHelpers_1f0bf8c2_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
  2480. if (it) o = it;
  2481. var i = 0;
  2482. return function () {
  2483. if (i >= o.length) return {
  2484. done: true
  2485. };
  2486. return {
  2487. done: false,
  2488. value: o[i++]
  2489. };
  2490. };
  2491. }
  2492. throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  2493. }
  2494. it = o[Symbol.iterator]();
  2495. return it.next.bind(it);
  2496. }
  2497. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/isObject.js
  2498. /**
  2499. * Checks whether `arg` is an object or not.
  2500. *
  2501. * @returns {boolean}
  2502. */
  2503. function isObject_isObject(arg) {
  2504. return typeof arg === "object" && arg != null;
  2505. }
  2506. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/isPlainObject.js
  2507. /**
  2508. * Checks whether `arg` is a plain object or not.
  2509. *
  2510. * @returns {boolean}
  2511. */
  2512. function isPlainObject(arg) {
  2513. var _proto$constructor;
  2514. if (!isObject_isObject(arg)) return false;
  2515. var proto = Object.getPrototypeOf(arg);
  2516. if (proto == null) return true;
  2517. return ((_proto$constructor = proto.constructor) === null || _proto$constructor === void 0 ? void 0 : _proto$constructor.toString()) === Object.toString();
  2518. }
  2519. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/splitProps.js
  2520. /**
  2521. * Splits an object (`props`) into a tuple where the first item is an object
  2522. * with the passed `keys`, and the second item is an object with these keys
  2523. * omitted.
  2524. *
  2525. * @deprecated will be removed in version 2
  2526. *
  2527. * @example
  2528. * import { splitProps } from "reakit-utils";
  2529. *
  2530. * splitProps({ a: "a", b: "b" }, ["a"]); // [{ a: "a" }, { b: "b" }]
  2531. */
  2532. function __deprecatedSplitProps(props, keys) {
  2533. var propsKeys = Object.keys(props);
  2534. var picked = {};
  2535. var omitted = {};
  2536. for (var _i = 0, _propsKeys = propsKeys; _i < _propsKeys.length; _i++) {
  2537. var key = _propsKeys[_i];
  2538. if (keys.indexOf(key) >= 0) {
  2539. picked[key] = props[key];
  2540. } else {
  2541. omitted[key] = props[key];
  2542. }
  2543. }
  2544. return [picked, omitted];
  2545. }
  2546. /**
  2547. * Splits an object (`props`) into a tuple where the first item
  2548. * is the `state` property, and the second item is the rest of the properties.
  2549. *
  2550. * It is also backward compatible with version 1. If `keys` are passed then
  2551. * splits an object (`props`) into a tuple where the first item is an object
  2552. * with the passed `keys`, and the second item is an object with these keys
  2553. * omitted.
  2554. *
  2555. * @example
  2556. * import { splitProps } from "reakit-utils";
  2557. *
  2558. * splitProps({ a: "a", b: "b" }, ["a"]); // [{ a: "a" }, { b: "b" }]
  2559. *
  2560. * @example
  2561. * import { splitProps } from "reakit-utils";
  2562. *
  2563. * splitProps({ state: { a: "a" }, b: "b" }); // [{ a: "a" }, { b: "b" }]
  2564. */
  2565. function splitProps(props, keys) {
  2566. if (keys === void 0) {
  2567. keys = [];
  2568. }
  2569. if (!isPlainObject(props.state)) {
  2570. return __deprecatedSplitProps(props, keys);
  2571. }
  2572. var _deprecatedSplitProp = __deprecatedSplitProps(props, [].concat(keys, ["state"])),
  2573. picked = _deprecatedSplitProp[0],
  2574. omitted = _deprecatedSplitProp[1];
  2575. var state = picked.state,
  2576. restPicked = _rollupPluginBabelHelpers_1f0bf8c2_objectWithoutPropertiesLoose(picked, ["state"]);
  2577. return [_rollupPluginBabelHelpers_1f0bf8c2_objectSpread2(_rollupPluginBabelHelpers_1f0bf8c2_objectSpread2({}, state), restPicked), omitted];
  2578. }
  2579. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/shallowEqual.js
  2580. /**
  2581. * Compares two objects.
  2582. *
  2583. * @example
  2584. * import { shallowEqual } from "reakit-utils";
  2585. *
  2586. * shallowEqual({ a: "a" }, {}); // false
  2587. * shallowEqual({ a: "a" }, { b: "b" }); // false
  2588. * shallowEqual({ a: "a" }, { a: "a" }); // true
  2589. * shallowEqual({ a: "a" }, { a: "a", b: "b" }); // false
  2590. */
  2591. function shallowEqual(objA, objB) {
  2592. if (objA === objB) return true;
  2593. if (!objA) return false;
  2594. if (!objB) return false;
  2595. if (typeof objA !== "object") return false;
  2596. if (typeof objB !== "object") return false;
  2597. var aKeys = Object.keys(objA);
  2598. var bKeys = Object.keys(objB);
  2599. var length = aKeys.length;
  2600. if (bKeys.length !== length) return false;
  2601. for (var _i = 0, _aKeys = aKeys; _i < _aKeys.length; _i++) {
  2602. var key = _aKeys[_i];
  2603. if (objA[key] !== objB[key]) {
  2604. return false;
  2605. }
  2606. }
  2607. return true;
  2608. }
  2609. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/normalizePropsAreEqual.js
  2610. /**
  2611. * This higher order functions take `propsAreEqual` function and
  2612. * returns a new function which normalizes the props.
  2613. *
  2614. * Normalizing in our case is making sure the `propsAreEqual` works with
  2615. * both version 1 (object spreading) and version 2 (state object) state passing.
  2616. *
  2617. * To achieve this, the returned function in case of a state object
  2618. * will spread the state object in both `prev` and `next props.
  2619. *
  2620. * Other case it just returns the function as is which makes sure
  2621. * that we are still backward compatible
  2622. */
  2623. function normalizePropsAreEqual(propsAreEqual) {
  2624. if (propsAreEqual.name === "normalizePropsAreEqualInner") {
  2625. return propsAreEqual;
  2626. }
  2627. return function normalizePropsAreEqualInner(prev, next) {
  2628. if (!isPlainObject(prev.state) || !isPlainObject(next.state)) {
  2629. return propsAreEqual(prev, next);
  2630. }
  2631. return propsAreEqual(_rollupPluginBabelHelpers_1f0bf8c2_objectSpread2(_rollupPluginBabelHelpers_1f0bf8c2_objectSpread2({}, prev.state), prev), _rollupPluginBabelHelpers_1f0bf8c2_objectSpread2(_rollupPluginBabelHelpers_1f0bf8c2_objectSpread2({}, next.state), next));
  2632. };
  2633. }
  2634. ;// CONCATENATED MODULE: ./node_modules/reakit-system/es/createComponent.js
  2635. function createComponent_forwardRef(component) {
  2636. return /*#__PURE__*/(0,external_React_namespaceObject.forwardRef)(component);
  2637. }
  2638. function memo(component, propsAreEqual) {
  2639. return /*#__PURE__*/(0,external_React_namespaceObject.memo)(component, propsAreEqual);
  2640. }
  2641. /**
  2642. * Creates a React component.
  2643. *
  2644. * @example
  2645. * import { createComponent } from "reakit-system";
  2646. *
  2647. * const A = createComponent({ as: "a" });
  2648. *
  2649. * @param options
  2650. */
  2651. function createComponent(_ref) {
  2652. var type = _ref.as,
  2653. useHook = _ref.useHook,
  2654. shouldMemo = _ref.memo,
  2655. _ref$propsAreEqual = _ref.propsAreEqual,
  2656. propsAreEqual = _ref$propsAreEqual === void 0 ? useHook === null || useHook === void 0 ? void 0 : useHook.unstable_propsAreEqual : _ref$propsAreEqual,
  2657. _ref$keys = _ref.keys,
  2658. keys = _ref$keys === void 0 ? (useHook === null || useHook === void 0 ? void 0 : useHook.__keys) || [] : _ref$keys,
  2659. _ref$useCreateElement = _ref.useCreateElement,
  2660. useCreateElement$1 = _ref$useCreateElement === void 0 ? useCreateElement : _ref$useCreateElement;
  2661. var Comp = function Comp(_ref2, ref) {
  2662. var _ref2$as = _ref2.as,
  2663. as = _ref2$as === void 0 ? type : _ref2$as,
  2664. props = _rollupPluginBabelHelpers_0c84a174_objectWithoutPropertiesLoose(_ref2, ["as"]);
  2665. if (useHook) {
  2666. var _as$render;
  2667. var _splitProps = splitProps(props, keys),
  2668. _options = _splitProps[0],
  2669. htmlProps = _splitProps[1];
  2670. var _useHook = useHook(_options, _rollupPluginBabelHelpers_0c84a174_objectSpread2({
  2671. ref: ref
  2672. }, htmlProps)),
  2673. wrapElement = _useHook.wrapElement,
  2674. elementProps = _rollupPluginBabelHelpers_0c84a174_objectWithoutPropertiesLoose(_useHook, ["wrapElement"]); // @ts-ignore
  2675. var asKeys = ((_as$render = as.render) === null || _as$render === void 0 ? void 0 : _as$render.__keys) || as.__keys;
  2676. var asOptions = asKeys && splitProps(props, asKeys)[0];
  2677. var allProps = asOptions ? _rollupPluginBabelHelpers_0c84a174_objectSpread2(_rollupPluginBabelHelpers_0c84a174_objectSpread2({}, elementProps), asOptions) : elementProps;
  2678. var _element = useCreateElement$1(as, allProps);
  2679. if (wrapElement) {
  2680. return wrapElement(_element);
  2681. }
  2682. return _element;
  2683. }
  2684. return useCreateElement$1(as, _rollupPluginBabelHelpers_0c84a174_objectSpread2({
  2685. ref: ref
  2686. }, props));
  2687. };
  2688. if (false) {}
  2689. Comp = createComponent_forwardRef(Comp);
  2690. if (shouldMemo) {
  2691. Comp = memo(Comp, propsAreEqual && normalizePropsAreEqual(propsAreEqual));
  2692. }
  2693. Comp.__keys = keys;
  2694. Comp.unstable_propsAreEqual = normalizePropsAreEqual(propsAreEqual || shallowEqual);
  2695. return Comp;
  2696. }
  2697. ;// CONCATENATED MODULE: ./node_modules/reakit-system/es/useToken.js
  2698. /**
  2699. * React custom hook that returns the value of any token defined in the
  2700. * SystemContext. It's mainly used internally in [`useOptions`](#useoptions)
  2701. * and [`useProps`](#useprops).
  2702. *
  2703. * @example
  2704. * import { SystemProvider, useToken } from "reakit-system";
  2705. *
  2706. * const system = {
  2707. * token: "value",
  2708. * };
  2709. *
  2710. * function Component(props) {
  2711. * const token = useToken("token", "default value");
  2712. * return <div {...props}>{token}</div>;
  2713. * }
  2714. *
  2715. * function App() {
  2716. * return (
  2717. * <SystemProvider unstable_system={system}>
  2718. * <Component />
  2719. * </SystemProvider>
  2720. * );
  2721. * }
  2722. */
  2723. function useToken(token, defaultValue) {
  2724. (0,external_React_namespaceObject.useDebugValue)(token);
  2725. var context = (0,external_React_namespaceObject.useContext)(SystemContext);
  2726. return context[token] != null ? context[token] : defaultValue;
  2727. }
  2728. ;// CONCATENATED MODULE: ./node_modules/reakit-system/es/useProps.js
  2729. /**
  2730. * React custom hook that returns the props returned by a given
  2731. * `use${name}Props` in the SystemContext.
  2732. *
  2733. * @example
  2734. * import { SystemProvider, useProps } from "reakit-system";
  2735. *
  2736. * const system = {
  2737. * useAProps(options, htmlProps) {
  2738. * return {
  2739. * ...htmlProps,
  2740. * href: options.url,
  2741. * };
  2742. * },
  2743. * };
  2744. *
  2745. * function A({ url, ...htmlProps }) {
  2746. * const props = useProps("A", { url }, htmlProps);
  2747. * return <a {...props} />;
  2748. * }
  2749. *
  2750. * function App() {
  2751. * return (
  2752. * <SystemProvider unstable_system={system}>
  2753. * <A url="url">It will convert url into href in useAProps</A>
  2754. * </SystemProvider>
  2755. * );
  2756. * }
  2757. */
  2758. function useProps(name, options, htmlProps) {
  2759. if (options === void 0) {
  2760. options = {};
  2761. }
  2762. if (htmlProps === void 0) {
  2763. htmlProps = {};
  2764. }
  2765. var hookName = "use" + name + "Props";
  2766. (0,external_React_namespaceObject.useDebugValue)(hookName);
  2767. var useHook = useToken(hookName);
  2768. if (useHook) {
  2769. return useHook(options, htmlProps);
  2770. }
  2771. return htmlProps;
  2772. }
  2773. ;// CONCATENATED MODULE: ./node_modules/reakit-system/es/useOptions.js
  2774. /**
  2775. * React custom hook that returns the options returned by a given
  2776. * `use${name}Options` in the SystemContext.
  2777. *
  2778. * @example
  2779. * import React from "react";
  2780. * import { SystemProvider, useOptions } from "reakit-system";
  2781. *
  2782. * const system = {
  2783. * useAOptions(options, htmlProps) {
  2784. * return {
  2785. * ...options,
  2786. * url: htmlProps.href,
  2787. * };
  2788. * },
  2789. * };
  2790. *
  2791. * function A({ url, ...htmlProps }) {
  2792. * const options = useOptions("A", { url }, htmlProps);
  2793. * return <a href={options.url} {...htmlProps} />;
  2794. * }
  2795. *
  2796. * function App() {
  2797. * return (
  2798. * <SystemProvider unstable_system={system}>
  2799. * <A href="url">
  2800. * It will convert href into url in useAOptions and then url into href in A
  2801. * </A>
  2802. * </SystemProvider>
  2803. * );
  2804. * }
  2805. */
  2806. function useOptions(name, options, htmlProps) {
  2807. if (options === void 0) {
  2808. options = {};
  2809. }
  2810. if (htmlProps === void 0) {
  2811. htmlProps = {};
  2812. }
  2813. var hookName = "use" + name + "Options";
  2814. (0,external_React_namespaceObject.useDebugValue)(hookName);
  2815. var useHook = useToken(hookName);
  2816. if (useHook) {
  2817. return _rollupPluginBabelHelpers_0c84a174_objectSpread2(_rollupPluginBabelHelpers_0c84a174_objectSpread2({}, options), useHook(options, htmlProps));
  2818. }
  2819. return options;
  2820. }
  2821. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/toArray.js
  2822. /**
  2823. * Transforms `arg` into an array if it's not already.
  2824. *
  2825. * @example
  2826. * import { toArray } from "reakit-utils";
  2827. *
  2828. * toArray("a"); // ["a"]
  2829. * toArray(["a"]); // ["a"]
  2830. */
  2831. function toArray(arg) {
  2832. if (Array.isArray(arg)) {
  2833. return arg;
  2834. }
  2835. return typeof arg !== "undefined" ? [arg] : [];
  2836. }
  2837. ;// CONCATENATED MODULE: ./node_modules/reakit-system/es/createHook.js
  2838. /**
  2839. * Creates a React custom hook that will return component props.
  2840. *
  2841. * @example
  2842. * import { createHook } from "reakit-system";
  2843. *
  2844. * const useA = createHook({
  2845. * name: "A",
  2846. * keys: ["url"], // custom props/options keys
  2847. * useProps(options, htmlProps) {
  2848. * return {
  2849. * ...htmlProps,
  2850. * href: options.url,
  2851. * };
  2852. * },
  2853. * });
  2854. *
  2855. * function A({ url, ...htmlProps }) {
  2856. * const props = useA({ url }, htmlProps);
  2857. * return <a {...props} />;
  2858. * }
  2859. *
  2860. * @param options
  2861. */
  2862. function createHook(options) {
  2863. var _options$useState, _composedHooks$;
  2864. var composedHooks = toArray(options.compose);
  2865. var __useOptions = function __useOptions(hookOptions, htmlProps) {
  2866. // Call the current hook's useOptions first
  2867. if (options.useOptions) {
  2868. hookOptions = options.useOptions(hookOptions, htmlProps);
  2869. } // If there's name, call useOptions from the system context
  2870. if (options.name) {
  2871. hookOptions = useOptions(options.name, hookOptions, htmlProps);
  2872. } // Run composed hooks useOptions
  2873. if (options.compose) {
  2874. for (var _iterator = _rollupPluginBabelHelpers_0c84a174_createForOfIteratorHelperLoose(composedHooks), _step; !(_step = _iterator()).done;) {
  2875. var hook = _step.value;
  2876. hookOptions = hook.__useOptions(hookOptions, htmlProps);
  2877. }
  2878. }
  2879. return hookOptions;
  2880. };
  2881. var useHook = function useHook(hookOptions, htmlProps, unstable_ignoreUseOptions) {
  2882. if (hookOptions === void 0) {
  2883. hookOptions = {};
  2884. }
  2885. if (htmlProps === void 0) {
  2886. htmlProps = {};
  2887. }
  2888. if (unstable_ignoreUseOptions === void 0) {
  2889. unstable_ignoreUseOptions = false;
  2890. }
  2891. // This won't execute when useHook was called from within another useHook
  2892. if (!unstable_ignoreUseOptions) {
  2893. hookOptions = __useOptions(hookOptions, htmlProps);
  2894. } // Call the current hook's useProps
  2895. if (options.useProps) {
  2896. htmlProps = options.useProps(hookOptions, htmlProps);
  2897. } // If there's name, call useProps from the system context
  2898. if (options.name) {
  2899. htmlProps = useProps(options.name, hookOptions, htmlProps);
  2900. }
  2901. if (options.compose) {
  2902. if (options.useComposeOptions) {
  2903. hookOptions = options.useComposeOptions(hookOptions, htmlProps);
  2904. }
  2905. if (options.useComposeProps) {
  2906. htmlProps = options.useComposeProps(hookOptions, htmlProps);
  2907. } else {
  2908. for (var _iterator2 = _rollupPluginBabelHelpers_0c84a174_createForOfIteratorHelperLoose(composedHooks), _step2; !(_step2 = _iterator2()).done;) {
  2909. var hook = _step2.value;
  2910. htmlProps = hook(hookOptions, htmlProps, true);
  2911. }
  2912. }
  2913. } // Remove undefined values from htmlProps
  2914. var finalHTMLProps = {};
  2915. var definedHTMLProps = htmlProps || {};
  2916. for (var prop in definedHTMLProps) {
  2917. if (definedHTMLProps[prop] !== undefined) {
  2918. finalHTMLProps[prop] = definedHTMLProps[prop];
  2919. }
  2920. }
  2921. return finalHTMLProps;
  2922. };
  2923. useHook.__useOptions = __useOptions;
  2924. var composedKeys = composedHooks.reduce(function (keys, hook) {
  2925. keys.push.apply(keys, hook.__keys || []);
  2926. return keys;
  2927. }, []); // It's used by createComponent to split option props (keys) and html props
  2928. useHook.__keys = [].concat(composedKeys, ((_options$useState = options.useState) === null || _options$useState === void 0 ? void 0 : _options$useState.__keys) || [], options.keys || []);
  2929. useHook.unstable_propsAreEqual = options.propsAreEqual || ((_composedHooks$ = composedHooks[0]) === null || _composedHooks$ === void 0 ? void 0 : _composedHooks$.unstable_propsAreEqual) || shallowEqual;
  2930. if (false) {}
  2931. return useHook;
  2932. }
  2933. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/useForkRef.js
  2934. // https://github.com/mui-org/material-ui/blob/2bcc874cf07b81202968f769cb9c2398c7c11311/packages/material-ui/src/utils/useForkRef.js
  2935. function setRef(ref, value) {
  2936. if (value === void 0) {
  2937. value = null;
  2938. }
  2939. if (!ref) return;
  2940. if (typeof ref === "function") {
  2941. ref(value);
  2942. } else {
  2943. ref.current = value;
  2944. }
  2945. }
  2946. /**
  2947. * Merges up to two React Refs into a single memoized function React Ref so you
  2948. * can pass it to an element.
  2949. *
  2950. * @example
  2951. * import React from "react";
  2952. * import { useForkRef } from "reakit-utils";
  2953. *
  2954. * const Component = React.forwardRef((props, ref) => {
  2955. * const internalRef = React.useRef();
  2956. * return <div {...props} ref={useForkRef(internalRef, ref)} />;
  2957. * });
  2958. */
  2959. function useForkRef(refA, refB) {
  2960. return (0,external_React_namespaceObject.useMemo)(function () {
  2961. if (refA == null && refB == null) {
  2962. return null;
  2963. }
  2964. return function (value) {
  2965. setRef(refA, value);
  2966. setRef(refB, value);
  2967. };
  2968. }, [refA, refB]);
  2969. }
  2970. ;// CONCATENATED MODULE: ./node_modules/reakit-warning/es/useWarning.js
  2971. function isRefObject(ref) {
  2972. return isObject(ref) && "current" in ref;
  2973. }
  2974. /**
  2975. * Logs `messages` to the console using `console.warn` based on a `condition`.
  2976. * This should be used inside components.
  2977. */
  2978. function useWarning(condition) {
  2979. for (var _len = arguments.length, messages = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  2980. messages[_key - 1] = arguments[_key];
  2981. }
  2982. if (false) {}
  2983. }
  2984. ;// CONCATENATED MODULE: ./node_modules/reakit-warning/es/index.js
  2985. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/getDocument.js
  2986. /**
  2987. * Returns `element.ownerDocument || document`.
  2988. */
  2989. function getDocument(element) {
  2990. return element ? element.ownerDocument || element : document;
  2991. }
  2992. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/getWindow.js
  2993. // Thanks to Fluent UI for doing the [research on IE11 memory leak](https://github.com/microsoft/fluentui/pull/9010#issuecomment-490768427)
  2994. var _window; // Note: Accessing "window" in IE11 is somewhat expensive, and calling "typeof window"
  2995. // hits a memory leak, whereas aliasing it and calling "typeof _window" does not.
  2996. // Caching the window value at the file scope lets us minimize the impact.
  2997. try {
  2998. _window = window;
  2999. } catch (e) {
  3000. /* no-op */
  3001. }
  3002. /**
  3003. * Returns `element.ownerDocument.defaultView || window`.
  3004. */
  3005. function getWindow(element) {
  3006. if (!element) {
  3007. return _window;
  3008. }
  3009. return getDocument(element).defaultView || _window;
  3010. }
  3011. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/canUseDOM.js
  3012. function checkIsBrowser() {
  3013. var _window = getWindow();
  3014. return Boolean(typeof _window !== "undefined" && _window.document && _window.document.createElement);
  3015. }
  3016. /**
  3017. * It's `true` if it is running in a browser environment or `false` if it is not (SSR).
  3018. *
  3019. * @example
  3020. * import { canUseDOM } from "reakit-utils";
  3021. *
  3022. * const title = canUseDOM ? document.title : "";
  3023. */
  3024. var canUseDOM = checkIsBrowser();
  3025. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/useIsomorphicEffect.js
  3026. /**
  3027. * `React.useLayoutEffect` that fallbacks to `React.useEffect` on server side
  3028. * rendering.
  3029. */
  3030. var useIsomorphicEffect = !canUseDOM ? external_React_namespaceObject.useEffect : external_React_namespaceObject.useLayoutEffect;
  3031. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/useLiveRef.js
  3032. /**
  3033. * A `React.Ref` that keeps track of the passed `value`.
  3034. */
  3035. function useLiveRef(value) {
  3036. var ref = (0,external_React_namespaceObject.useRef)(value);
  3037. useIsomorphicEffect(function () {
  3038. ref.current = value;
  3039. });
  3040. return ref;
  3041. }
  3042. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/isSelfTarget.js
  3043. /**
  3044. * Returns `true` if `event.target` and `event.currentTarget` are the same.
  3045. */
  3046. function isSelfTarget(event) {
  3047. return event.target === event.currentTarget;
  3048. }
  3049. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/getActiveElement.js
  3050. /**
  3051. * Returns `element.ownerDocument.activeElement`.
  3052. */
  3053. function getActiveElement_getActiveElement(element) {
  3054. var _getDocument = getDocument(element),
  3055. activeElement = _getDocument.activeElement;
  3056. if (!(activeElement !== null && activeElement !== void 0 && activeElement.nodeName)) {
  3057. // In IE11, activeElement might be an empty object if we're interacting
  3058. // with elements inside of an iframe.
  3059. return null;
  3060. }
  3061. return activeElement;
  3062. }
  3063. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/contains.js
  3064. /**
  3065. * Similar to `Element.prototype.contains`, but a little bit faster when
  3066. * `element` is the same as `child`.
  3067. *
  3068. * @example
  3069. * import { contains } from "reakit-utils";
  3070. *
  3071. * contains(document.getElementById("parent"), document.getElementById("child"));
  3072. */
  3073. function contains(parent, child) {
  3074. return parent === child || parent.contains(child);
  3075. }
  3076. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/hasFocusWithin.js
  3077. /**
  3078. * Checks if `element` has focus within. Elements that are referenced by
  3079. * `aria-activedescendant` are also considered.
  3080. *
  3081. * @example
  3082. * import { hasFocusWithin } from "reakit-utils";
  3083. *
  3084. * hasFocusWithin(document.getElementById("id"));
  3085. */
  3086. function hasFocusWithin(element) {
  3087. var activeElement = getActiveElement_getActiveElement(element);
  3088. if (!activeElement) return false;
  3089. if (contains(element, activeElement)) return true;
  3090. var activeDescendant = activeElement.getAttribute("aria-activedescendant");
  3091. if (!activeDescendant) return false;
  3092. if (activeDescendant === element.id) return true;
  3093. return !!element.querySelector("#" + activeDescendant);
  3094. }
  3095. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/isPortalEvent.js
  3096. /**
  3097. * Returns `true` if `event` has been fired within a React Portal element.
  3098. */
  3099. function isPortalEvent(event) {
  3100. return !contains(event.currentTarget, event.target);
  3101. }
  3102. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/isButton.js
  3103. var buttonInputTypes = ["button", "color", "file", "image", "reset", "submit"];
  3104. /**
  3105. * Checks whether `element` is a native HTML button element.
  3106. *
  3107. * @example
  3108. * import { isButton } from "reakit-utils";
  3109. *
  3110. * isButton(document.querySelector("button")); // true
  3111. * isButton(document.querySelector("input[type='button']")); // true
  3112. * isButton(document.querySelector("div")); // false
  3113. * isButton(document.querySelector("input[type='text']")); // false
  3114. * isButton(document.querySelector("div[role='button']")); // false
  3115. *
  3116. * @returns {boolean}
  3117. */
  3118. function isButton(element) {
  3119. if (element.tagName === "BUTTON") return true;
  3120. if (element.tagName === "INPUT") {
  3121. var input = element;
  3122. return buttonInputTypes.indexOf(input.type) !== -1;
  3123. }
  3124. return false;
  3125. }
  3126. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/dom.js
  3127. /**
  3128. * Checks if a given string exists in the user agent string.
  3129. */
  3130. function isUA(string) {
  3131. if (!canUseDOM) return false;
  3132. return window.navigator.userAgent.indexOf(string) !== -1;
  3133. }
  3134. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/matches.js
  3135. /**
  3136. * Ponyfill for `Element.prototype.matches`
  3137. *
  3138. * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
  3139. */
  3140. function matches(element, selectors) {
  3141. if ("matches" in element) {
  3142. return element.matches(selectors);
  3143. }
  3144. if ("msMatchesSelector" in element) {
  3145. return element.msMatchesSelector(selectors);
  3146. }
  3147. return element.webkitMatchesSelector(selectors);
  3148. }
  3149. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/tabbable.js
  3150. /** @module tabbable */
  3151. 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'])";
  3152. function isVisible(element) {
  3153. var htmlElement = element;
  3154. return htmlElement.offsetWidth > 0 || htmlElement.offsetHeight > 0 || element.getClientRects().length > 0;
  3155. }
  3156. function hasNegativeTabIndex(element) {
  3157. var tabIndex = parseInt(element.getAttribute("tabindex") || "0", 10);
  3158. return tabIndex < 0;
  3159. }
  3160. /**
  3161. * Checks whether `element` is focusable or not.
  3162. *
  3163. * @memberof tabbable
  3164. *
  3165. * @example
  3166. * import { isFocusable } from "reakit-utils";
  3167. *
  3168. * isFocusable(document.querySelector("input")); // true
  3169. * isFocusable(document.querySelector("input[tabindex='-1']")); // true
  3170. * isFocusable(document.querySelector("input[hidden]")); // false
  3171. * isFocusable(document.querySelector("input:disabled")); // false
  3172. */
  3173. function isFocusable(element) {
  3174. return matches(element, selector) && isVisible(element);
  3175. }
  3176. /**
  3177. * Checks whether `element` is tabbable or not.
  3178. *
  3179. * @memberof tabbable
  3180. *
  3181. * @example
  3182. * import { isTabbable } from "reakit-utils";
  3183. *
  3184. * isTabbable(document.querySelector("input")); // true
  3185. * isTabbable(document.querySelector("input[tabindex='-1']")); // false
  3186. * isTabbable(document.querySelector("input[hidden]")); // false
  3187. * isTabbable(document.querySelector("input:disabled")); // false
  3188. */
  3189. function isTabbable(element) {
  3190. return isFocusable(element) && !hasNegativeTabIndex(element);
  3191. }
  3192. /**
  3193. * Returns all the focusable elements in `container`.
  3194. *
  3195. * @memberof tabbable
  3196. *
  3197. * @param {Element} container
  3198. *
  3199. * @returns {Element[]}
  3200. */
  3201. function getAllFocusableIn(container) {
  3202. var allFocusable = Array.from(container.querySelectorAll(selector));
  3203. allFocusable.unshift(container);
  3204. return allFocusable.filter(isFocusable);
  3205. }
  3206. /**
  3207. * Returns the first focusable element in `container`.
  3208. *
  3209. * @memberof tabbable
  3210. *
  3211. * @param {Element} container
  3212. *
  3213. * @returns {Element|null}
  3214. */
  3215. function getFirstFocusableIn(container) {
  3216. var _getAllFocusableIn = getAllFocusableIn(container),
  3217. first = _getAllFocusableIn[0];
  3218. return first || null;
  3219. }
  3220. /**
  3221. * Returns all the tabbable elements in `container`, including the container
  3222. * itself.
  3223. *
  3224. * @memberof tabbable
  3225. *
  3226. * @param {Element} container
  3227. * @param fallbackToFocusable If `true`, it'll return focusable elements if there are no tabbable ones.
  3228. *
  3229. * @returns {Element[]}
  3230. */
  3231. function getAllTabbableIn(container, fallbackToFocusable) {
  3232. var allFocusable = Array.from(container.querySelectorAll(selector));
  3233. var allTabbable = allFocusable.filter(isTabbable);
  3234. if (isTabbable(container)) {
  3235. allTabbable.unshift(container);
  3236. }
  3237. if (!allTabbable.length && fallbackToFocusable) {
  3238. return allFocusable;
  3239. }
  3240. return allTabbable;
  3241. }
  3242. /**
  3243. * Returns the first tabbable element in `container`, including the container
  3244. * itself if it's tabbable.
  3245. *
  3246. * @memberof tabbable
  3247. *
  3248. * @param {Element} container
  3249. * @param fallbackToFocusable If `true`, it'll return the first focusable element if there are no tabbable ones.
  3250. *
  3251. * @returns {Element|null}
  3252. */
  3253. function getFirstTabbableIn(container, fallbackToFocusable) {
  3254. var _getAllTabbableIn = getAllTabbableIn(container, fallbackToFocusable),
  3255. first = _getAllTabbableIn[0];
  3256. return first || null;
  3257. }
  3258. /**
  3259. * Returns the last tabbable element in `container`, including the container
  3260. * itself if it's tabbable.
  3261. *
  3262. * @memberof tabbable
  3263. *
  3264. * @param {Element} container
  3265. * @param fallbackToFocusable If `true`, it'll return the last focusable element if there are no tabbable ones.
  3266. *
  3267. * @returns {Element|null}
  3268. */
  3269. function getLastTabbableIn(container, fallbackToFocusable) {
  3270. var allTabbable = getAllTabbableIn(container, fallbackToFocusable);
  3271. return allTabbable[allTabbable.length - 1] || null;
  3272. }
  3273. /**
  3274. * Returns the next tabbable element in `container`.
  3275. *
  3276. * @memberof tabbable
  3277. *
  3278. * @param {Element} container
  3279. * @param fallbackToFocusable If `true`, it'll return the next focusable element if there are no tabbable ones.
  3280. *
  3281. * @returns {Element|null}
  3282. */
  3283. function getNextTabbableIn(container, fallbackToFocusable) {
  3284. var activeElement = getActiveElement(container);
  3285. var allFocusable = getAllFocusableIn(container);
  3286. var index = allFocusable.indexOf(activeElement);
  3287. var slice = allFocusable.slice(index + 1);
  3288. return slice.find(isTabbable) || allFocusable.find(isTabbable) || (fallbackToFocusable ? slice[0] : null);
  3289. }
  3290. /**
  3291. * Returns the previous tabbable element in `container`.
  3292. *
  3293. * @memberof tabbable
  3294. *
  3295. * @param {Element} container
  3296. * @param fallbackToFocusable If `true`, it'll return the previous focusable element if there are no tabbable ones.
  3297. *
  3298. * @returns {Element|null}
  3299. */
  3300. function getPreviousTabbableIn(container, fallbackToFocusable) {
  3301. var activeElement = getActiveElement(container);
  3302. var allFocusable = getAllFocusableIn(container).reverse();
  3303. var index = allFocusable.indexOf(activeElement);
  3304. var slice = allFocusable.slice(index + 1);
  3305. return slice.find(isTabbable) || allFocusable.find(isTabbable) || (fallbackToFocusable ? slice[0] : null);
  3306. }
  3307. /**
  3308. * Returns the closest focusable element.
  3309. *
  3310. * @memberof tabbable
  3311. *
  3312. * @param {Element} container
  3313. *
  3314. * @returns {Element|null}
  3315. */
  3316. function getClosestFocusable(element) {
  3317. while (element && !isFocusable(element)) {
  3318. element = closest(element, selector);
  3319. }
  3320. return element;
  3321. }
  3322. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Role/Role.js
  3323. // Automatically generated
  3324. var ROLE_KEYS = ["unstable_system"];
  3325. var useRole = createHook({
  3326. name: "Role",
  3327. keys: ROLE_KEYS,
  3328. propsAreEqual: function propsAreEqual(prev, next) {
  3329. var prevSystem = prev.unstable_system,
  3330. prevProps = _objectWithoutPropertiesLoose(prev, ["unstable_system"]);
  3331. var nextSystem = next.unstable_system,
  3332. nextProps = _objectWithoutPropertiesLoose(next, ["unstable_system"]);
  3333. if (prevSystem !== nextSystem && !shallowEqual(prevSystem, nextSystem)) {
  3334. return false;
  3335. }
  3336. return shallowEqual(prevProps, nextProps);
  3337. }
  3338. });
  3339. var Role = createComponent({
  3340. as: "div",
  3341. useHook: useRole
  3342. });
  3343. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Tabbable/Tabbable.js
  3344. // Automatically generated
  3345. var TABBABLE_KEYS = ["disabled", "focusable"];
  3346. var isSafariOrFirefoxOnMac = isUA("Mac") && !isUA("Chrome") && (isUA("Safari") || isUA("Firefox"));
  3347. function focusIfNeeded(element) {
  3348. if (!hasFocusWithin(element) && isFocusable(element)) {
  3349. element.focus();
  3350. }
  3351. }
  3352. function isNativeTabbable(element) {
  3353. return ["BUTTON", "INPUT", "SELECT", "TEXTAREA", "A"].includes(element.tagName);
  3354. }
  3355. function supportsDisabledAttribute(element) {
  3356. return ["BUTTON", "INPUT", "SELECT", "TEXTAREA"].includes(element.tagName);
  3357. }
  3358. function getTabIndex(trulyDisabled, nativeTabbable, supportsDisabled, htmlTabIndex) {
  3359. if (trulyDisabled) {
  3360. if (nativeTabbable && !supportsDisabled) {
  3361. // Anchor, audio and video tags don't support the `disabled` attribute.
  3362. // We must pass tabIndex={-1} so they don't receive focus on tab.
  3363. return -1;
  3364. } // Elements that support the `disabled` attribute don't need tabIndex.
  3365. return undefined;
  3366. }
  3367. if (nativeTabbable) {
  3368. // If the element is enabled and it's natively tabbable, we don't need to
  3369. // specify a tabIndex attribute unless it's explicitly set by the user.
  3370. return htmlTabIndex;
  3371. } // If the element is enabled and is not natively tabbable, we have to
  3372. // fallback tabIndex={0}.
  3373. return htmlTabIndex || 0;
  3374. }
  3375. function useDisableEvent(htmlEventRef, disabled) {
  3376. return (0,external_React_namespaceObject.useCallback)(function (event) {
  3377. var _htmlEventRef$current;
  3378. (_htmlEventRef$current = htmlEventRef.current) === null || _htmlEventRef$current === void 0 ? void 0 : _htmlEventRef$current.call(htmlEventRef, event);
  3379. if (event.defaultPrevented) return;
  3380. if (disabled) {
  3381. event.stopPropagation();
  3382. event.preventDefault();
  3383. }
  3384. }, [htmlEventRef, disabled]);
  3385. }
  3386. var useTabbable = createHook({
  3387. name: "Tabbable",
  3388. compose: useRole,
  3389. keys: TABBABLE_KEYS,
  3390. useOptions: function useOptions(options, _ref) {
  3391. var disabled = _ref.disabled;
  3392. return _objectSpread2({
  3393. disabled: disabled
  3394. }, options);
  3395. },
  3396. useProps: function useProps(options, _ref2) {
  3397. var htmlRef = _ref2.ref,
  3398. htmlTabIndex = _ref2.tabIndex,
  3399. htmlOnClickCapture = _ref2.onClickCapture,
  3400. htmlOnMouseDownCapture = _ref2.onMouseDownCapture,
  3401. htmlOnMouseDown = _ref2.onMouseDown,
  3402. htmlOnKeyPressCapture = _ref2.onKeyPressCapture,
  3403. htmlStyle = _ref2.style,
  3404. htmlProps = _objectWithoutPropertiesLoose(_ref2, ["ref", "tabIndex", "onClickCapture", "onMouseDownCapture", "onMouseDown", "onKeyPressCapture", "style"]);
  3405. var ref = (0,external_React_namespaceObject.useRef)(null);
  3406. var onClickCaptureRef = useLiveRef(htmlOnClickCapture);
  3407. var onMouseDownCaptureRef = useLiveRef(htmlOnMouseDownCapture);
  3408. var onMouseDownRef = useLiveRef(htmlOnMouseDown);
  3409. var onKeyPressCaptureRef = useLiveRef(htmlOnKeyPressCapture);
  3410. var trulyDisabled = !!options.disabled && !options.focusable;
  3411. var _React$useState = (0,external_React_namespaceObject.useState)(true),
  3412. nativeTabbable = _React$useState[0],
  3413. setNativeTabbable = _React$useState[1];
  3414. var _React$useState2 = (0,external_React_namespaceObject.useState)(true),
  3415. supportsDisabled = _React$useState2[0],
  3416. setSupportsDisabled = _React$useState2[1];
  3417. var style = options.disabled ? _objectSpread2({
  3418. pointerEvents: "none"
  3419. }, htmlStyle) : htmlStyle;
  3420. useIsomorphicEffect(function () {
  3421. var tabbable = ref.current;
  3422. if (!tabbable) {
  3423. false ? 0 : void 0;
  3424. return;
  3425. }
  3426. if (!isNativeTabbable(tabbable)) {
  3427. setNativeTabbable(false);
  3428. }
  3429. if (!supportsDisabledAttribute(tabbable)) {
  3430. setSupportsDisabled(false);
  3431. }
  3432. }, []);
  3433. var onClickCapture = useDisableEvent(onClickCaptureRef, options.disabled);
  3434. var onMouseDownCapture = useDisableEvent(onMouseDownCaptureRef, options.disabled);
  3435. var onKeyPressCapture = useDisableEvent(onKeyPressCaptureRef, options.disabled);
  3436. var onMouseDown = (0,external_React_namespaceObject.useCallback)(function (event) {
  3437. var _onMouseDownRef$curre;
  3438. (_onMouseDownRef$curre = onMouseDownRef.current) === null || _onMouseDownRef$curre === void 0 ? void 0 : _onMouseDownRef$curre.call(onMouseDownRef, event);
  3439. var element = event.currentTarget;
  3440. if (event.defaultPrevented) return; // Safari and Firefox on MacOS don't focus on buttons on mouse down
  3441. // like other browsers/platforms. Instead, they focus on the closest
  3442. // focusable ancestor element, which is ultimately the body element. So
  3443. // we make sure to give focus to the tabbable element on mouse down so
  3444. // it works consistently across browsers.
  3445. if (!isSafariOrFirefoxOnMac) return;
  3446. if (isPortalEvent(event)) return;
  3447. if (!isButton(element)) return; // We can't focus right away after on mouse down, otherwise it would
  3448. // prevent drag events from happening. So we schedule the focus to the
  3449. // next animation frame.
  3450. var raf = requestAnimationFrame(function () {
  3451. element.removeEventListener("mouseup", focusImmediately, true);
  3452. focusIfNeeded(element);
  3453. }); // If mouseUp happens before the next animation frame (which is common
  3454. // on touch screens or by just tapping the trackpad on MacBook's), we
  3455. // cancel the animation frame and immediately focus on the element.
  3456. var focusImmediately = function focusImmediately() {
  3457. cancelAnimationFrame(raf);
  3458. focusIfNeeded(element);
  3459. }; // By listening to the event in the capture phase, we make sure the
  3460. // focus event is fired before the onMouseUp and onMouseUpCapture React
  3461. // events, which is aligned with the default browser behavior.
  3462. element.addEventListener("mouseup", focusImmediately, {
  3463. once: true,
  3464. capture: true
  3465. });
  3466. }, []);
  3467. return _objectSpread2({
  3468. ref: useForkRef(ref, htmlRef),
  3469. style: style,
  3470. tabIndex: getTabIndex(trulyDisabled, nativeTabbable, supportsDisabled, htmlTabIndex),
  3471. disabled: trulyDisabled && supportsDisabled ? true : undefined,
  3472. "aria-disabled": options.disabled ? true : undefined,
  3473. onClickCapture: onClickCapture,
  3474. onMouseDownCapture: onMouseDownCapture,
  3475. onMouseDown: onMouseDown,
  3476. onKeyPressCapture: onKeyPressCapture
  3477. }, htmlProps);
  3478. }
  3479. });
  3480. var Tabbable = createComponent({
  3481. as: "div",
  3482. useHook: useTabbable
  3483. });
  3484. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Clickable/Clickable.js
  3485. // Automatically generated
  3486. var CLICKABLE_KEYS = ["unstable_clickOnEnter", "unstable_clickOnSpace"];
  3487. function isNativeClick(event) {
  3488. var element = event.currentTarget;
  3489. if (!event.isTrusted) return false; // istanbul ignore next: can't test trusted events yet
  3490. return isButton(element) || element.tagName === "INPUT" || element.tagName === "TEXTAREA" || element.tagName === "A" || element.tagName === "SELECT";
  3491. }
  3492. var useClickable = createHook({
  3493. name: "Clickable",
  3494. compose: useTabbable,
  3495. keys: CLICKABLE_KEYS,
  3496. useOptions: function useOptions(_ref) {
  3497. var _ref$unstable_clickOn = _ref.unstable_clickOnEnter,
  3498. unstable_clickOnEnter = _ref$unstable_clickOn === void 0 ? true : _ref$unstable_clickOn,
  3499. _ref$unstable_clickOn2 = _ref.unstable_clickOnSpace,
  3500. unstable_clickOnSpace = _ref$unstable_clickOn2 === void 0 ? true : _ref$unstable_clickOn2,
  3501. options = _objectWithoutPropertiesLoose(_ref, ["unstable_clickOnEnter", "unstable_clickOnSpace"]);
  3502. return _objectSpread2({
  3503. unstable_clickOnEnter: unstable_clickOnEnter,
  3504. unstable_clickOnSpace: unstable_clickOnSpace
  3505. }, options);
  3506. },
  3507. useProps: function useProps(options, _ref2) {
  3508. var htmlOnKeyDown = _ref2.onKeyDown,
  3509. htmlOnKeyUp = _ref2.onKeyUp,
  3510. htmlProps = _objectWithoutPropertiesLoose(_ref2, ["onKeyDown", "onKeyUp"]);
  3511. var _React$useState = (0,external_React_namespaceObject.useState)(false),
  3512. active = _React$useState[0],
  3513. setActive = _React$useState[1];
  3514. var onKeyDownRef = useLiveRef(htmlOnKeyDown);
  3515. var onKeyUpRef = useLiveRef(htmlOnKeyUp);
  3516. var onKeyDown = (0,external_React_namespaceObject.useCallback)(function (event) {
  3517. var _onKeyDownRef$current;
  3518. (_onKeyDownRef$current = onKeyDownRef.current) === null || _onKeyDownRef$current === void 0 ? void 0 : _onKeyDownRef$current.call(onKeyDownRef, event);
  3519. if (event.defaultPrevented) return;
  3520. if (options.disabled) return;
  3521. if (event.metaKey) return;
  3522. if (!isSelfTarget(event)) return;
  3523. var isEnter = options.unstable_clickOnEnter && event.key === "Enter";
  3524. var isSpace = options.unstable_clickOnSpace && event.key === " ";
  3525. if (isEnter || isSpace) {
  3526. if (isNativeClick(event)) return;
  3527. event.preventDefault();
  3528. if (isEnter) {
  3529. event.currentTarget.click();
  3530. } else if (isSpace) {
  3531. setActive(true);
  3532. }
  3533. }
  3534. }, [options.disabled, options.unstable_clickOnEnter, options.unstable_clickOnSpace]);
  3535. var onKeyUp = (0,external_React_namespaceObject.useCallback)(function (event) {
  3536. var _onKeyUpRef$current;
  3537. (_onKeyUpRef$current = onKeyUpRef.current) === null || _onKeyUpRef$current === void 0 ? void 0 : _onKeyUpRef$current.call(onKeyUpRef, event);
  3538. if (event.defaultPrevented) return;
  3539. if (options.disabled) return;
  3540. if (event.metaKey) return;
  3541. var isSpace = options.unstable_clickOnSpace && event.key === " ";
  3542. if (active && isSpace) {
  3543. setActive(false);
  3544. event.currentTarget.click();
  3545. }
  3546. }, [options.disabled, options.unstable_clickOnSpace, active]);
  3547. return _objectSpread2({
  3548. "data-active": active || undefined,
  3549. onKeyDown: onKeyDown,
  3550. onKeyUp: onKeyUp
  3551. }, htmlProps);
  3552. }
  3553. });
  3554. var Clickable = createComponent({
  3555. as: "button",
  3556. memo: true,
  3557. useHook: useClickable
  3558. });
  3559. ;// CONCATENATED MODULE: ./node_modules/reakit/es/getCurrentId-5aa9849e.js
  3560. function findFirstEnabledItem(items, excludeId) {
  3561. if (excludeId) {
  3562. return items.find(function (item) {
  3563. return !item.disabled && item.id !== excludeId;
  3564. });
  3565. }
  3566. return items.find(function (item) {
  3567. return !item.disabled;
  3568. });
  3569. }
  3570. function getCurrentId(options, passedId) {
  3571. var _findFirstEnabledItem;
  3572. if (passedId || passedId === null) {
  3573. return passedId;
  3574. }
  3575. if (options.currentId || options.currentId === null) {
  3576. return options.currentId;
  3577. }
  3578. return (_findFirstEnabledItem = findFirstEnabledItem(options.items || [])) === null || _findFirstEnabledItem === void 0 ? void 0 : _findFirstEnabledItem.id;
  3579. }
  3580. ;// CONCATENATED MODULE: ./node_modules/reakit/es/__keys-6742f591.js
  3581. // Automatically generated
  3582. 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"];
  3583. var COMPOSITE_KEYS = COMPOSITE_STATE_KEYS;
  3584. var COMPOSITE_GROUP_KEYS = COMPOSITE_KEYS;
  3585. var COMPOSITE_ITEM_KEYS = COMPOSITE_GROUP_KEYS;
  3586. var COMPOSITE_ITEM_WIDGET_KEYS = (/* unused pure expression or super */ null && (COMPOSITE_ITEM_KEYS));
  3587. ;// CONCATENATED MODULE: ./node_modules/reakit/es/userFocus-e16425e3.js
  3588. function userFocus(element) {
  3589. element.userFocus = true;
  3590. element.focus();
  3591. element.userFocus = false;
  3592. }
  3593. function hasUserFocus(element) {
  3594. return !!element.userFocus;
  3595. }
  3596. function setUserFocus(element, value) {
  3597. element.userFocus = value;
  3598. }
  3599. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/isTextField.js
  3600. /**
  3601. * Check whether the given element is a text field, where text field is defined
  3602. * by the ability to select within the input, or that it is contenteditable.
  3603. *
  3604. * @example
  3605. * import { isTextField } from "reakit-utils";
  3606. *
  3607. * isTextField(document.querySelector("div")); // false
  3608. * isTextField(document.querySelector("input")); // true
  3609. * isTextField(document.querySelector("input[type='button']")); // false
  3610. * isTextField(document.querySelector("textarea")); // true
  3611. * isTextField(document.querySelector("div[contenteditable='true']")); // true
  3612. */
  3613. function isTextField(element) {
  3614. try {
  3615. var isTextInput = element instanceof HTMLInputElement && element.selectionStart !== null;
  3616. var isTextArea = element.tagName === "TEXTAREA";
  3617. var isContentEditable = element.contentEditable === "true";
  3618. return isTextInput || isTextArea || isContentEditable || false;
  3619. } catch (error) {
  3620. // Safari throws an exception when trying to get `selectionStart`
  3621. // on non-text <input> elements (which, understandably, don't
  3622. // have the text selection API). We catch this via a try/catch
  3623. // block, as opposed to a more explicit check of the element's
  3624. // input types, because of Safari's non-standard behavior. This
  3625. // also means we don't have to worry about the list of input
  3626. // types that support `selectionStart` changing as the HTML spec
  3627. // evolves over time.
  3628. return false;
  3629. }
  3630. }
  3631. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/hasFocus.js
  3632. /**
  3633. * Checks if `element` has focus. Elements that are referenced by
  3634. * `aria-activedescendant` are also considered.
  3635. *
  3636. * @example
  3637. * import { hasFocus } from "reakit-utils";
  3638. *
  3639. * hasFocus(document.getElementById("id"));
  3640. */
  3641. function hasFocus(element) {
  3642. var activeElement = getActiveElement_getActiveElement(element);
  3643. if (!activeElement) return false;
  3644. if (activeElement === element) return true;
  3645. var activeDescendant = activeElement.getAttribute("aria-activedescendant");
  3646. if (!activeDescendant) return false;
  3647. return activeDescendant === element.id;
  3648. }
  3649. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/ensureFocus.js
  3650. /**
  3651. * Ensures `element` will receive focus if it's not already.
  3652. *
  3653. * @example
  3654. * import { ensureFocus } from "reakit-utils";
  3655. *
  3656. * ensureFocus(document.activeElement); // does nothing
  3657. *
  3658. * const element = document.querySelector("input");
  3659. *
  3660. * ensureFocus(element); // focuses element
  3661. * ensureFocus(element, { preventScroll: true }); // focuses element preventing scroll jump
  3662. *
  3663. * function isActive(el) {
  3664. * return el.dataset.active === "true";
  3665. * }
  3666. *
  3667. * ensureFocus(document.querySelector("[data-active='true']"), { isActive }); // does nothing
  3668. *
  3669. * @returns {number} `requestAnimationFrame` call ID so it can be passed to `cancelAnimationFrame` if needed.
  3670. */
  3671. function ensureFocus(element, _temp) {
  3672. var _ref = _temp === void 0 ? {} : _temp,
  3673. preventScroll = _ref.preventScroll,
  3674. _ref$isActive = _ref.isActive,
  3675. isActive = _ref$isActive === void 0 ? hasFocus : _ref$isActive;
  3676. if (isActive(element)) return -1;
  3677. element.focus({
  3678. preventScroll: preventScroll
  3679. });
  3680. if (isActive(element)) return -1;
  3681. return requestAnimationFrame(function () {
  3682. element.focus({
  3683. preventScroll: preventScroll
  3684. });
  3685. });
  3686. }
  3687. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Id/IdProvider.js
  3688. var defaultPrefix = "id";
  3689. function generateRandomString(prefix) {
  3690. if (prefix === void 0) {
  3691. prefix = defaultPrefix;
  3692. }
  3693. return "" + (prefix ? prefix + "-" : "") + Math.random().toString(32).substr(2, 6);
  3694. }
  3695. var unstable_IdContext = /*#__PURE__*/(0,external_React_namespaceObject.createContext)(generateRandomString);
  3696. function unstable_IdProvider(_ref) {
  3697. var children = _ref.children,
  3698. _ref$prefix = _ref.prefix,
  3699. prefix = _ref$prefix === void 0 ? defaultPrefix : _ref$prefix;
  3700. var count = useRef(0);
  3701. var generateId = useCallback(function (localPrefix) {
  3702. if (localPrefix === void 0) {
  3703. localPrefix = prefix;
  3704. }
  3705. return "" + (localPrefix ? localPrefix + "-" : "") + ++count.current;
  3706. }, [prefix]);
  3707. return /*#__PURE__*/createElement(unstable_IdContext.Provider, {
  3708. value: generateId
  3709. }, children);
  3710. }
  3711. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Id/Id.js
  3712. // Automatically generated
  3713. var ID_STATE_KEYS = ["baseId", "unstable_idCountRef", "setBaseId"];
  3714. var ID_KEYS = [].concat(ID_STATE_KEYS, ["id"]);
  3715. var unstable_useId = createHook({
  3716. keys: ID_KEYS,
  3717. useOptions: function useOptions(options, htmlProps) {
  3718. var generateId = (0,external_React_namespaceObject.useContext)(unstable_IdContext);
  3719. var _React$useState = (0,external_React_namespaceObject.useState)(function () {
  3720. // This comes from useIdState
  3721. if (options.unstable_idCountRef) {
  3722. options.unstable_idCountRef.current += 1;
  3723. return "-" + options.unstable_idCountRef.current;
  3724. } // If there's no useIdState, we check if `baseId` was passed (as a prop,
  3725. // not from useIdState).
  3726. if (options.baseId) {
  3727. return "-" + generateId("");
  3728. }
  3729. return "";
  3730. }),
  3731. suffix = _React$useState[0]; // `baseId` will be the prop passed directly as a prop or via useIdState.
  3732. // If there's neither, then it'll fallback to Context's generateId.
  3733. // This generateId can result in a sequential ID (if there's a Provider)
  3734. // or a random string (without Provider).
  3735. var baseId = (0,external_React_namespaceObject.useMemo)(function () {
  3736. return options.baseId || generateId();
  3737. }, [options.baseId, generateId]);
  3738. var id = htmlProps.id || options.id || "" + baseId + suffix;
  3739. return _objectSpread2(_objectSpread2({}, options), {}, {
  3740. id: id
  3741. });
  3742. },
  3743. useProps: function useProps(options, htmlProps) {
  3744. return _objectSpread2({
  3745. id: options.id
  3746. }, htmlProps);
  3747. }
  3748. });
  3749. var unstable_Id = createComponent({
  3750. as: "div",
  3751. useHook: unstable_useId
  3752. });
  3753. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/createEvent.js
  3754. /**
  3755. * Creates an `Event` in a way that also works on IE 11.
  3756. *
  3757. * @example
  3758. * import { createEvent } from "reakit-utils";
  3759. *
  3760. * const el = document.getElementById("id");
  3761. * el.dispatchEvent(createEvent(el, "blur", { bubbles: false }));
  3762. */
  3763. function createEvent(element, type, eventInit) {
  3764. if (typeof Event === "function") {
  3765. return new Event(type, eventInit);
  3766. } // IE 11 doesn't support Event constructors
  3767. var event = getDocument(element).createEvent("Event");
  3768. event.initEvent(type, eventInit === null || eventInit === void 0 ? void 0 : eventInit.bubbles, eventInit === null || eventInit === void 0 ? void 0 : eventInit.cancelable);
  3769. return event;
  3770. }
  3771. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/fireEvent.js
  3772. /**
  3773. * Creates and dispatches `Event` in a way that also works on IE 11.
  3774. *
  3775. * @example
  3776. * import { fireEvent } from "reakit-utils";
  3777. *
  3778. * fireEvent(document.getElementById("id"), "blur", {
  3779. * bubbles: true,
  3780. * cancelable: true,
  3781. * });
  3782. */
  3783. function fireEvent(element, type, eventInit) {
  3784. return element.dispatchEvent(createEvent(element, type, eventInit));
  3785. }
  3786. ;// CONCATENATED MODULE: ./node_modules/reakit/es/setTextFieldValue-0a221f4e.js
  3787. function setTextFieldValue(element, value) {
  3788. if (element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement) {
  3789. var _Object$getOwnPropert;
  3790. var proto = Object.getPrototypeOf(element);
  3791. var setValue = (_Object$getOwnPropert = Object.getOwnPropertyDescriptor(proto, "value")) === null || _Object$getOwnPropert === void 0 ? void 0 : _Object$getOwnPropert.set;
  3792. if (setValue) {
  3793. setValue.call(element, value);
  3794. fireEvent(element, "input", {
  3795. bubbles: true
  3796. });
  3797. }
  3798. }
  3799. }
  3800. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Composite/CompositeItem.js
  3801. function getWidget(itemElement) {
  3802. return itemElement.querySelector("[data-composite-item-widget]");
  3803. }
  3804. function useItem(options) {
  3805. return (0,external_React_namespaceObject.useMemo)(function () {
  3806. var _options$items;
  3807. return (_options$items = options.items) === null || _options$items === void 0 ? void 0 : _options$items.find(function (item) {
  3808. return options.id && item.id === options.id;
  3809. });
  3810. }, [options.items, options.id]);
  3811. }
  3812. function targetIsAnotherItem(event, items) {
  3813. if (isSelfTarget(event)) return false;
  3814. for (var _iterator = _createForOfIteratorHelperLoose(items), _step; !(_step = _iterator()).done;) {
  3815. var item = _step.value;
  3816. if (item.ref.current === event.target) {
  3817. return true;
  3818. }
  3819. }
  3820. return false;
  3821. }
  3822. var useCompositeItem = createHook({
  3823. name: "CompositeItem",
  3824. compose: [useClickable, unstable_useId],
  3825. keys: COMPOSITE_ITEM_KEYS,
  3826. propsAreEqual: function propsAreEqual(prev, next) {
  3827. if (!next.id || prev.id !== next.id) {
  3828. return useClickable.unstable_propsAreEqual(prev, next);
  3829. }
  3830. var prevCurrentId = prev.currentId,
  3831. prevMoves = prev.unstable_moves,
  3832. prevProps = _objectWithoutPropertiesLoose(prev, ["currentId", "unstable_moves"]);
  3833. var nextCurrentId = next.currentId,
  3834. nextMoves = next.unstable_moves,
  3835. nextProps = _objectWithoutPropertiesLoose(next, ["currentId", "unstable_moves"]);
  3836. if (nextCurrentId !== prevCurrentId) {
  3837. if (next.id === nextCurrentId || next.id === prevCurrentId) {
  3838. return false;
  3839. }
  3840. } else if (prevMoves !== nextMoves) {
  3841. return false;
  3842. }
  3843. return useClickable.unstable_propsAreEqual(prevProps, nextProps);
  3844. },
  3845. useOptions: function useOptions(options) {
  3846. return _objectSpread2(_objectSpread2({}, options), {}, {
  3847. id: options.id,
  3848. currentId: getCurrentId(options),
  3849. unstable_clickOnSpace: options.unstable_hasActiveWidget ? false : options.unstable_clickOnSpace
  3850. });
  3851. },
  3852. useProps: function useProps(options, _ref) {
  3853. var _options$items2;
  3854. var htmlRef = _ref.ref,
  3855. _ref$tabIndex = _ref.tabIndex,
  3856. htmlTabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex,
  3857. htmlOnMouseDown = _ref.onMouseDown,
  3858. htmlOnFocus = _ref.onFocus,
  3859. htmlOnBlurCapture = _ref.onBlurCapture,
  3860. htmlOnKeyDown = _ref.onKeyDown,
  3861. htmlOnClick = _ref.onClick,
  3862. htmlProps = _objectWithoutPropertiesLoose(_ref, ["ref", "tabIndex", "onMouseDown", "onFocus", "onBlurCapture", "onKeyDown", "onClick"]);
  3863. var ref = (0,external_React_namespaceObject.useRef)(null);
  3864. var id = options.id;
  3865. var trulyDisabled = options.disabled && !options.focusable;
  3866. var isCurrentItem = options.currentId === id;
  3867. var isCurrentItemRef = useLiveRef(isCurrentItem);
  3868. var hasFocusedComposite = (0,external_React_namespaceObject.useRef)(false);
  3869. var item = useItem(options);
  3870. var onMouseDownRef = useLiveRef(htmlOnMouseDown);
  3871. var onFocusRef = useLiveRef(htmlOnFocus);
  3872. var onBlurCaptureRef = useLiveRef(htmlOnBlurCapture);
  3873. var onKeyDownRef = useLiveRef(htmlOnKeyDown);
  3874. var onClickRef = useLiveRef(htmlOnClick);
  3875. var shouldTabIndex = !options.unstable_virtual && !options.unstable_hasActiveWidget && isCurrentItem || // We don't want to set tabIndex="-1" when using CompositeItem as a
  3876. // standalone component, without state props.
  3877. !((_options$items2 = options.items) !== null && _options$items2 !== void 0 && _options$items2.length);
  3878. (0,external_React_namespaceObject.useEffect)(function () {
  3879. var _options$registerItem;
  3880. if (!id) return undefined;
  3881. (_options$registerItem = options.registerItem) === null || _options$registerItem === void 0 ? void 0 : _options$registerItem.call(options, {
  3882. id: id,
  3883. ref: ref,
  3884. disabled: !!trulyDisabled
  3885. });
  3886. return function () {
  3887. var _options$unregisterIt;
  3888. (_options$unregisterIt = options.unregisterItem) === null || _options$unregisterIt === void 0 ? void 0 : _options$unregisterIt.call(options, id);
  3889. };
  3890. }, [id, trulyDisabled, options.registerItem, options.unregisterItem]);
  3891. (0,external_React_namespaceObject.useEffect)(function () {
  3892. var element = ref.current;
  3893. if (!element) {
  3894. false ? 0 : void 0;
  3895. return;
  3896. } // `moves` will be incremented whenever next, previous, up, down, first,
  3897. // last or move have been called. This means that the composite item will
  3898. // be focused whenever some of these functions are called. We're using
  3899. // isCurrentItemRef instead of isCurrentItem because we don't want to
  3900. // focus the item if isCurrentItem changes (and options.moves doesn't).
  3901. if (options.unstable_moves && isCurrentItemRef.current) {
  3902. userFocus(element);
  3903. }
  3904. }, [options.unstable_moves]);
  3905. var onMouseDown = (0,external_React_namespaceObject.useCallback)(function (event) {
  3906. var _onMouseDownRef$curre;
  3907. (_onMouseDownRef$curre = onMouseDownRef.current) === null || _onMouseDownRef$curre === void 0 ? void 0 : _onMouseDownRef$curre.call(onMouseDownRef, event);
  3908. setUserFocus(event.currentTarget, true);
  3909. }, []);
  3910. var onFocus = (0,external_React_namespaceObject.useCallback)(function (event) {
  3911. var _onFocusRef$current, _options$setCurrentId;
  3912. var shouldFocusComposite = hasUserFocus(event.currentTarget);
  3913. setUserFocus(event.currentTarget, false);
  3914. (_onFocusRef$current = onFocusRef.current) === null || _onFocusRef$current === void 0 ? void 0 : _onFocusRef$current.call(onFocusRef, event);
  3915. if (event.defaultPrevented) return;
  3916. if (isPortalEvent(event)) return;
  3917. if (!id) return;
  3918. if (targetIsAnotherItem(event, options.items)) return;
  3919. (_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
  3920. // composite container receives focus, not the composite item.
  3921. // But we don't want to do this if the target is another focusable
  3922. // element inside the composite item, such as CompositeItemWidget.
  3923. if (shouldFocusComposite && options.unstable_virtual && options.baseId && isSelfTarget(event)) {
  3924. var target = event.target;
  3925. var composite = getDocument(target).getElementById(options.baseId);
  3926. if (composite) {
  3927. hasFocusedComposite.current = true;
  3928. ensureFocus(composite);
  3929. }
  3930. }
  3931. }, [id, options.items, options.setCurrentId, options.unstable_virtual, options.baseId]);
  3932. var onBlurCapture = (0,external_React_namespaceObject.useCallback)(function (event) {
  3933. var _onBlurCaptureRef$cur;
  3934. (_onBlurCaptureRef$cur = onBlurCaptureRef.current) === null || _onBlurCaptureRef$cur === void 0 ? void 0 : _onBlurCaptureRef$cur.call(onBlurCaptureRef, event);
  3935. if (event.defaultPrevented) return;
  3936. if (options.unstable_virtual && hasFocusedComposite.current) {
  3937. // When hasFocusedComposite is true, composite has been focused right
  3938. // after focusing this item. This is an intermediate blur event, so
  3939. // we ignore it.
  3940. hasFocusedComposite.current = false;
  3941. event.preventDefault();
  3942. event.stopPropagation();
  3943. }
  3944. }, [options.unstable_virtual]);
  3945. var onKeyDown = (0,external_React_namespaceObject.useCallback)(function (event) {
  3946. var _onKeyDownRef$current;
  3947. if (!isSelfTarget(event)) return;
  3948. var isVertical = options.orientation !== "horizontal";
  3949. var isHorizontal = options.orientation !== "vertical";
  3950. var isGrid = !!(item !== null && item !== void 0 && item.groupId);
  3951. var keyMap = {
  3952. ArrowUp: (isGrid || isVertical) && options.up,
  3953. ArrowRight: (isGrid || isHorizontal) && options.next,
  3954. ArrowDown: (isGrid || isVertical) && options.down,
  3955. ArrowLeft: (isGrid || isHorizontal) && options.previous,
  3956. Home: function Home() {
  3957. if (!isGrid || event.ctrlKey) {
  3958. var _options$first;
  3959. (_options$first = options.first) === null || _options$first === void 0 ? void 0 : _options$first.call(options);
  3960. } else {
  3961. var _options$previous;
  3962. (_options$previous = options.previous) === null || _options$previous === void 0 ? void 0 : _options$previous.call(options, true);
  3963. }
  3964. },
  3965. End: function End() {
  3966. if (!isGrid || event.ctrlKey) {
  3967. var _options$last;
  3968. (_options$last = options.last) === null || _options$last === void 0 ? void 0 : _options$last.call(options);
  3969. } else {
  3970. var _options$next;
  3971. (_options$next = options.next) === null || _options$next === void 0 ? void 0 : _options$next.call(options, true);
  3972. }
  3973. },
  3974. PageUp: function PageUp() {
  3975. if (isGrid) {
  3976. var _options$up;
  3977. (_options$up = options.up) === null || _options$up === void 0 ? void 0 : _options$up.call(options, true);
  3978. } else {
  3979. var _options$first2;
  3980. (_options$first2 = options.first) === null || _options$first2 === void 0 ? void 0 : _options$first2.call(options);
  3981. }
  3982. },
  3983. PageDown: function PageDown() {
  3984. if (isGrid) {
  3985. var _options$down;
  3986. (_options$down = options.down) === null || _options$down === void 0 ? void 0 : _options$down.call(options, true);
  3987. } else {
  3988. var _options$last2;
  3989. (_options$last2 = options.last) === null || _options$last2 === void 0 ? void 0 : _options$last2.call(options);
  3990. }
  3991. }
  3992. };
  3993. var action = keyMap[event.key];
  3994. if (action) {
  3995. event.preventDefault();
  3996. action();
  3997. return;
  3998. }
  3999. (_onKeyDownRef$current = onKeyDownRef.current) === null || _onKeyDownRef$current === void 0 ? void 0 : _onKeyDownRef$current.call(onKeyDownRef, event);
  4000. if (event.defaultPrevented) return;
  4001. if (event.key.length === 1 && event.key !== " ") {
  4002. var widget = getWidget(event.currentTarget);
  4003. if (widget && isTextField(widget)) {
  4004. widget.focus();
  4005. setTextFieldValue(widget, "");
  4006. }
  4007. } else if (event.key === "Delete" || event.key === "Backspace") {
  4008. var _widget = getWidget(event.currentTarget);
  4009. if (_widget && isTextField(_widget)) {
  4010. event.preventDefault();
  4011. setTextFieldValue(_widget, "");
  4012. }
  4013. }
  4014. }, [options.orientation, item, options.up, options.next, options.down, options.previous, options.first, options.last]);
  4015. var onClick = (0,external_React_namespaceObject.useCallback)(function (event) {
  4016. var _onClickRef$current;
  4017. (_onClickRef$current = onClickRef.current) === null || _onClickRef$current === void 0 ? void 0 : _onClickRef$current.call(onClickRef, event);
  4018. if (event.defaultPrevented) return;
  4019. var element = event.currentTarget;
  4020. var widget = getWidget(element);
  4021. if (widget && !hasFocusWithin(widget)) {
  4022. // If there's a widget inside the composite item, we make sure it's
  4023. // focused when pressing enter, space or clicking on the composite item.
  4024. widget.focus();
  4025. }
  4026. }, []);
  4027. return _objectSpread2({
  4028. ref: useForkRef(ref, htmlRef),
  4029. id: id,
  4030. tabIndex: shouldTabIndex ? htmlTabIndex : -1,
  4031. "aria-selected": options.unstable_virtual && isCurrentItem ? true : undefined,
  4032. onMouseDown: onMouseDown,
  4033. onFocus: onFocus,
  4034. onBlurCapture: onBlurCapture,
  4035. onKeyDown: onKeyDown,
  4036. onClick: onClick
  4037. }, htmlProps);
  4038. }
  4039. });
  4040. var CompositeItem = createComponent({
  4041. as: "button",
  4042. memo: true,
  4043. useHook: useCompositeItem
  4044. });
  4045. ;// CONCATENATED MODULE: ./node_modules/@floating-ui/core/dist/floating-ui.core.browser.min.mjs
  4046. function t(t){return t.split("-")[0]}function floating_ui_core_browser_min_e(t){return t.split("-")[1]}function floating_ui_core_browser_min_n(e){return["top","bottom"].includes(t(e))?"x":"y"}function r(t){return"y"===t?"height":"width"}function i(i,o,a){let{reference:l,floating:s}=i;const c=l.x+l.width/2-s.width/2,f=l.y+l.height/2-s.height/2,u=floating_ui_core_browser_min_n(o),m=r(u),g=l[m]/2-s[m]/2,d="x"===u;let p;switch(t(o)){case"top":p={x:c,y:l.y-s.height};break;case"bottom":p={x:c,y:l.y+l.height};break;case"right":p={x:l.x+l.width,y:f};break;case"left":p={x:l.x-s.width,y:f};break;default:p={x:l.x,y:l.y}}switch(floating_ui_core_browser_min_e(o)){case"start":p[u]-=g*(a&&d?-1:1);break;case"end":p[u]+=g*(a&&d?-1:1)}return p}const floating_ui_core_browser_min_o=async(t,e,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:a=[],platform:l}=n,s=await(null==l.isRTL?void 0:l.isRTL(e));let c=await l.getElementRects({reference:t,floating:e,strategy:o}),{x:f,y:u}=i(c,r,s),m=r,g={},d=0;for(let n=0;n<a.length;n++){const{name:p,fn:h}=a[n],{x:y,y:x,data:w,reset:v}=await h({x:f,y:u,initialPlacement:r,placement:m,strategy:o,middlewareData:g,rects:c,platform:l,elements:{reference:t,floating:e}});f=null!=y?y:f,u=null!=x?x:u,g={...g,[p]:{...g[p],...w}},v&&d<=50&&(d++,"object"==typeof v&&(v.placement&&(m=v.placement),v.rects&&(c=!0===v.rects?await l.getElementRects({reference:t,floating:e,strategy:o}):v.rects),({x:f,y:u}=i(c,m,s))),n=-1)}return{x:f,y:u,placement:m,strategy:o,middlewareData:g}};function floating_ui_core_browser_min_a(t){return"number"!=typeof t?function(t){return{top:0,right:0,bottom:0,left:0,...t}}(t):{top:t,right:t,bottom:t,left:t}}function l(t){return{...t,top:t.y,left:t.x,right:t.x+t.width,bottom:t.y+t.height}}async function s(t,e){var n;void 0===e&&(e={});const{x:r,y:i,platform:o,rects:s,elements:c,strategy:f}=t,{boundary:u="clippingAncestors",rootBoundary:m="viewport",elementContext:g="floating",altBoundary:d=!1,padding:p=0}=e,h=floating_ui_core_browser_min_a(p),y=c[d?"floating"===g?"reference":"floating":g],x=l(await o.getClippingRect({element:null==(n=await(null==o.isElement?void 0:o.isElement(y)))||n?y:y.contextElement||await(null==o.getDocumentElement?void 0:o.getDocumentElement(c.floating)),boundary:u,rootBoundary:m,strategy:f})),w=l(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({rect:"floating"===g?{...s.floating,x:r,y:i}:s.reference,offsetParent:await(null==o.getOffsetParent?void 0:o.getOffsetParent(c.floating)),strategy:f}):s[g]);return{top:x.top-w.top+h.top,bottom:w.bottom-x.bottom+h.bottom,left:x.left-w.left+h.left,right:w.right-x.right+h.right}}const c=Math.min,f=Math.max;function u(t,e,n){return f(t,c(e,n))}const m=t=>({name:"arrow",options:t,async fn(i){const{element:o,padding:l=0}=null!=t?t:{},{x:s,y:c,placement:f,rects:m,platform:g}=i;if(null==o)return{};const d=floating_ui_core_browser_min_a(l),p={x:s,y:c},h=floating_ui_core_browser_min_n(f),y=floating_ui_core_browser_min_e(f),x=r(h),w=await g.getDimensions(o),v="y"===h?"top":"left",b="y"===h?"bottom":"right",R=m.reference[x]+m.reference[h]-p[h]-m.floating[x],A=p[h]-m.reference[h],P=await(null==g.getOffsetParent?void 0:g.getOffsetParent(o));let T=P?"y"===h?P.clientHeight||0:P.clientWidth||0:0;0===T&&(T=m.floating[x]);const O=R/2-A/2,L=d[v],D=T-w[x]-d[b],k=T/2-w[x]/2+O,E=u(L,k,D),C=("start"===y?d[v]:d[b])>0&&k!==E&&m.reference[x]<=m.floating[x];return{[h]:p[h]-(C?k<L?L-k:D-k:0),data:{[h]:E,centerOffset:k-E}}}}),g={left:"right",right:"left",bottom:"top",top:"bottom"};function d(t){return t.replace(/left|right|bottom|top/g,(t=>g[t]))}function p(t,i,o){void 0===o&&(o=!1);const a=floating_ui_core_browser_min_e(t),l=floating_ui_core_browser_min_n(t),s=r(l);let c="x"===l?a===(o?"end":"start")?"right":"left":"start"===a?"bottom":"top";return i.reference[s]>i.floating[s]&&(c=d(c)),{main:c,cross:d(c)}}const h={start:"end",end:"start"};function y(t){return t.replace(/start|end/g,(t=>h[t]))}const x=["top","right","bottom","left"],w=x.reduce(((t,e)=>t.concat(e,e+"-start",e+"-end")),[]);const v=function(n){return void 0===n&&(n={}),{name:"autoPlacement",options:n,async fn(r){var i,o,a,l,c;const{x:f,y:u,rects:m,middlewareData:g,placement:d,platform:h,elements:x}=r,{alignment:v=null,allowedPlacements:b=w,autoAlignment:R=!0,...A}=n,P=function(n,r,i){return(n?[...i.filter((t=>floating_ui_core_browser_min_e(t)===n)),...i.filter((t=>floating_ui_core_browser_min_e(t)!==n))]:i.filter((e=>t(e)===e))).filter((t=>!n||floating_ui_core_browser_min_e(t)===n||!!r&&y(t)!==t))}(v,R,b),T=await s(r,A),O=null!=(i=null==(o=g.autoPlacement)?void 0:o.index)?i:0,L=P[O];if(null==L)return{};const{main:D,cross:k}=p(L,m,await(null==h.isRTL?void 0:h.isRTL(x.floating)));if(d!==L)return{x:f,y:u,reset:{placement:P[0]}};const E=[T[t(L)],T[D],T[k]],C=[...null!=(a=null==(l=g.autoPlacement)?void 0:l.overflows)?a:[],{placement:L,overflows:E}],H=P[O+1];if(H)return{data:{index:O+1,overflows:C},reset:{placement:H}};const B=C.slice().sort(((t,e)=>t.overflows[0]-e.overflows[0])),V=null==(c=B.find((t=>{let{overflows:e}=t;return e.every((t=>t<=0))})))?void 0:c.placement,F=null!=V?V:B[0].placement;return F!==d?{data:{index:O+1,overflows:C},reset:{placement:F}}:{}}}};const b=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(n){var r;const{placement:i,middlewareData:o,rects:a,initialPlacement:l,platform:c,elements:f}=n,{mainAxis:u=!0,crossAxis:m=!0,fallbackPlacements:g,fallbackStrategy:h="bestFit",flipAlignment:x=!0,...w}=e,v=t(i),b=g||(v===l||!x?[d(l)]:function(t){const e=d(t);return[y(t),e,y(e)]}(l)),R=[l,...b],A=await s(n,w),P=[];let T=(null==(r=o.flip)?void 0:r.overflows)||[];if(u&&P.push(A[v]),m){const{main:t,cross:e}=p(i,a,await(null==c.isRTL?void 0:c.isRTL(f.floating)));P.push(A[t],A[e])}if(T=[...T,{placement:i,overflows:P}],!P.every((t=>t<=0))){var O,L;const t=(null!=(O=null==(L=o.flip)?void 0:L.index)?O:0)+1,e=R[t];if(e)return{data:{index:t,overflows:T},reset:{placement:e}};let n="bottom";switch(h){case"bestFit":{var D;const t=null==(D=T.map((t=>[t,t.overflows.filter((t=>t>0)).reduce(((t,e)=>t+e),0)])).sort(((t,e)=>t[1]-e[1]))[0])?void 0:D[0].placement;t&&(n=t);break}case"initialPlacement":n=l}if(i!==n)return{reset:{placement:n}}}return{}}}};function R(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function A(t){return x.some((e=>t[e]>=0))}const P=function(t){let{strategy:e="referenceHidden",...n}=void 0===t?{}:t;return{name:"hide",async fn(t){const{rects:r}=t;switch(e){case"referenceHidden":{const e=R(await s(t,{...n,elementContext:"reference"}),r.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:A(e)}}}case"escaped":{const e=R(await s(t,{...n,altBoundary:!0}),r.floating);return{data:{escapedOffsets:e,escaped:A(e)}}}default:return{}}}}};const T=function(r){return void 0===r&&(r=0),{name:"offset",options:r,async fn(i){const{x:o,y:a}=i,l=await async function(r,i){const{placement:o,platform:a,elements:l}=r,s=await(null==a.isRTL?void 0:a.isRTL(l.floating)),c=t(o),f=floating_ui_core_browser_min_e(o),u="x"===floating_ui_core_browser_min_n(o),m=["left","top"].includes(c)?-1:1,g=s&&u?-1:1,d="function"==typeof i?i(r):i;let{mainAxis:p,crossAxis:h,alignmentAxis:y}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return f&&"number"==typeof y&&(h="end"===f?-1*y:y),u?{x:h*g,y:p*m}:{x:p*m,y:h*g}}(i,r);return{x:o+l.x,y:a+l.y,data:l}}}};function O(t){return"x"===t?"y":"x"}const L=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(r){const{x:i,y:o,placement:a}=r,{mainAxis:l=!0,crossAxis:c=!1,limiter:f={fn:t=>{let{x:e,y:n}=t;return{x:e,y:n}}},...m}=e,g={x:i,y:o},d=await s(r,m),p=floating_ui_core_browser_min_n(t(a)),h=O(p);let y=g[p],x=g[h];if(l){const t="y"===p?"bottom":"right";y=u(y+d["y"===p?"top":"left"],y,y-d[t])}if(c){const t="y"===h?"bottom":"right";x=u(x+d["y"===h?"top":"left"],x,x-d[t])}const w=f.fn({...r,[p]:y,[h]:x});return{...w,data:{x:w.x-i,y:w.y-o}}}}},D=function(e){return void 0===e&&(e={}),{options:e,fn(r){const{x:i,y:o,placement:a,rects:l,middlewareData:s}=r,{offset:c=0,mainAxis:f=!0,crossAxis:u=!0}=e,m={x:i,y:o},g=floating_ui_core_browser_min_n(a),d=O(g);let p=m[g],h=m[d];const y="function"==typeof c?c(r):c,x="number"==typeof y?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(f){const t="y"===g?"height":"width",e=l.reference[g]-l.floating[t]+x.mainAxis,n=l.reference[g]+l.reference[t]-x.mainAxis;p<e?p=e:p>n&&(p=n)}if(u){var w,v,b,R;const e="y"===g?"width":"height",n=["top","left"].includes(t(a)),r=l.reference[d]-l.floating[e]+(n&&null!=(w=null==(v=s.offset)?void 0:v[d])?w:0)+(n?0:x.crossAxis),i=l.reference[d]+l.reference[e]+(n?0:null!=(b=null==(R=s.offset)?void 0:R[d])?b:0)-(n?x.crossAxis:0);h<r?h=r:h>i&&(h=i)}return{[g]:p,[d]:h}}}},k=function(n){return void 0===n&&(n={}),{name:"size",options:n,async fn(r){const{placement:i,rects:o,platform:a,elements:l}=r,{apply:c=(()=>{}),...u}=n,m=await s(r,u),g=t(i),d=floating_ui_core_browser_min_e(i);let p,h;"top"===g||"bottom"===g?(p=g,h=d===(await(null==a.isRTL?void 0:a.isRTL(l.floating))?"start":"end")?"left":"right"):(h=g,p="end"===d?"top":"bottom");const y=f(m.left,0),x=f(m.right,0),w=f(m.top,0),v=f(m.bottom,0),b={availableHeight:o.floating.height-(["left","right"].includes(i)?2*(0!==w||0!==v?w+v:f(m.top,m.bottom)):m[p]),availableWidth:o.floating.width-(["top","bottom"].includes(i)?2*(0!==y||0!==x?y+x:f(m.left,m.right)):m[h])};await c({...r,...b});const R=await a.getDimensions(l.floating);return o.floating.width!==R.width||o.floating.height!==R.height?{reset:{rects:!0}}:{}}}},E=function(e){return void 0===e&&(e={}),{name:"inline",options:e,async fn(r){var i;const{placement:o,elements:s,rects:u,platform:m,strategy:g}=r,{padding:d=2,x:p,y:h}=e,y=l(m.convertOffsetParentRelativeRectToViewportRelativeRect?await m.convertOffsetParentRelativeRectToViewportRelativeRect({rect:u.reference,offsetParent:await(null==m.getOffsetParent?void 0:m.getOffsetParent(s.floating)),strategy:g}):u.reference),x=null!=(i=await(null==m.getClientRects?void 0:m.getClientRects(s.reference)))?i:[],w=floating_ui_core_browser_min_a(d);const v=await m.getElementRects({reference:{getBoundingClientRect:function(){var e;if(2===x.length&&x[0].left>x[1].right&&null!=p&&null!=h)return null!=(e=x.find((t=>p>t.left-w.left&&p<t.right+w.right&&h>t.top-w.top&&h<t.bottom+w.bottom)))?e:y;if(x.length>=2){if("x"===floating_ui_core_browser_min_n(o)){const e=x[0],n=x[x.length-1],r="top"===t(o),i=e.top,a=n.bottom,l=r?e.left:n.left,s=r?e.right:n.right;return{top:i,bottom:a,left:l,right:s,width:s-l,height:a-i,x:l,y:i}}const e="left"===t(o),r=f(...x.map((t=>t.right))),i=c(...x.map((t=>t.left))),a=x.filter((t=>e?t.left===i:t.right===r)),l=a[0].top,s=a[a.length-1].bottom;return{top:l,bottom:s,left:i,right:r,width:r-i,height:s-l,x:i,y:l}}return y}},floating:s.floating,strategy:g});return u.reference.x!==v.reference.x||u.reference.y!==v.reference.y||u.reference.width!==v.reference.width||u.reference.height!==v.reference.height?{reset:{rects:v}}:{}}}};
  4047. ;// CONCATENATED MODULE: ./node_modules/@floating-ui/dom/dist/floating-ui.dom.browser.min.mjs
  4048. function floating_ui_dom_browser_min_n(t){return t&&t.document&&t.location&&t.alert&&t.setInterval}function floating_ui_dom_browser_min_o(t){if(null==t)return window;if(!floating_ui_dom_browser_min_n(t)){const e=t.ownerDocument;return e&&e.defaultView||window}return t}function floating_ui_dom_browser_min_i(t){return floating_ui_dom_browser_min_o(t).getComputedStyle(t)}function floating_ui_dom_browser_min_r(t){return floating_ui_dom_browser_min_n(t)?"":t?(t.nodeName||"").toLowerCase():""}function floating_ui_dom_browser_min_l(){const t=navigator.userAgentData;return null!=t&&t.brands?t.brands.map((t=>t.brand+"/"+t.version)).join(" "):navigator.userAgent}function floating_ui_dom_browser_min_c(t){return t instanceof floating_ui_dom_browser_min_o(t).HTMLElement}function floating_ui_dom_browser_min_s(t){return t instanceof floating_ui_dom_browser_min_o(t).Element}function floating_ui_dom_browser_min_f(t){if("undefined"==typeof ShadowRoot)return!1;return t instanceof floating_ui_dom_browser_min_o(t).ShadowRoot||t instanceof ShadowRoot}function floating_ui_dom_browser_min_u(t){const{overflow:e,overflowX:n,overflowY:o,display:r}=floating_ui_dom_browser_min_i(t);return/auto|scroll|overlay|hidden/.test(e+o+n)&&!["inline","contents"].includes(r)}function floating_ui_dom_browser_min_d(t){return["table","td","th"].includes(floating_ui_dom_browser_min_r(t))}function floating_ui_dom_browser_min_h(t){const e=/firefox/i.test(floating_ui_dom_browser_min_l()),n=floating_ui_dom_browser_min_i(t);return"none"!==n.transform||"none"!==n.perspective||e&&"filter"===n.willChange||e&&!!n.filter&&"none"!==n.filter||["transform","perspective"].some((t=>n.willChange.includes(t)))||["paint","layout","strict","content"].some((t=>{const e=n.contain;return null!=e&&e.includes(t)}))}function floating_ui_dom_browser_min_a(){return!/^((?!chrome|android).)*safari/i.test(floating_ui_dom_browser_min_l())}function floating_ui_dom_browser_min_g(t){return["html","body","#document"].includes(floating_ui_dom_browser_min_r(t))}const floating_ui_dom_browser_min_m=Math.min,floating_ui_dom_browser_min_p=Math.max,floating_ui_dom_browser_min_w=Math.round;function floating_ui_dom_browser_min_v(t,e,n){var i,r,l,f;void 0===e&&(e=!1),void 0===n&&(n=!1);const u=t.getBoundingClientRect();let d=1,h=1;e&&floating_ui_dom_browser_min_c(t)&&(d=t.offsetWidth>0&&floating_ui_dom_browser_min_w(u.width)/t.offsetWidth||1,h=t.offsetHeight>0&&floating_ui_dom_browser_min_w(u.height)/t.offsetHeight||1);const g=floating_ui_dom_browser_min_s(t)?floating_ui_dom_browser_min_o(t):window,m=!floating_ui_dom_browser_min_a()&&n,p=(u.left+(m&&null!=(i=null==(r=g.visualViewport)?void 0:r.offsetLeft)?i:0))/d,v=(u.top+(m&&null!=(l=null==(f=g.visualViewport)?void 0:f.offsetTop)?l:0))/h,y=u.width/d,x=u.height/h;return{width:y,height:x,top:v,right:p+y,bottom:v+x,left:p,x:p,y:v}}function floating_ui_dom_browser_min_y(t){return(e=t,(e instanceof floating_ui_dom_browser_min_o(e).Node?t.ownerDocument:t.document)||window.document).documentElement;var e}function floating_ui_dom_browser_min_x(t){return floating_ui_dom_browser_min_s(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function floating_ui_dom_browser_min_b(t){return floating_ui_dom_browser_min_v(floating_ui_dom_browser_min_y(t)).left+floating_ui_dom_browser_min_x(t).scrollLeft}function floating_ui_dom_browser_min_L(t,e,n){const o=floating_ui_dom_browser_min_c(e),i=floating_ui_dom_browser_min_y(e),l=floating_ui_dom_browser_min_v(t,o&&function(t){const e=floating_ui_dom_browser_min_v(t);return floating_ui_dom_browser_min_w(e.width)!==t.offsetWidth||floating_ui_dom_browser_min_w(e.height)!==t.offsetHeight}(e),"fixed"===n);let s={scrollLeft:0,scrollTop:0};const f={x:0,y:0};if(o||!o&&"fixed"!==n)if(("body"!==floating_ui_dom_browser_min_r(e)||floating_ui_dom_browser_min_u(i))&&(s=floating_ui_dom_browser_min_x(e)),floating_ui_dom_browser_min_c(e)){const t=floating_ui_dom_browser_min_v(e,!0);f.x=t.x+e.clientLeft,f.y=t.y+e.clientTop}else i&&(f.x=floating_ui_dom_browser_min_b(i));return{x:l.left+s.scrollLeft-f.x,y:l.top+s.scrollTop-f.y,width:l.width,height:l.height}}function floating_ui_dom_browser_min_R(t){return"html"===floating_ui_dom_browser_min_r(t)?t:t.assignedSlot||t.parentNode||(floating_ui_dom_browser_min_f(t)?t.host:null)||floating_ui_dom_browser_min_y(t)}function floating_ui_dom_browser_min_E(t){return floating_ui_dom_browser_min_c(t)&&"fixed"!==floating_ui_dom_browser_min_i(t).position?t.offsetParent:null}function floating_ui_dom_browser_min_T(t){const e=floating_ui_dom_browser_min_o(t);let n=floating_ui_dom_browser_min_E(t);for(;n&&floating_ui_dom_browser_min_d(n)&&"static"===floating_ui_dom_browser_min_i(n).position;)n=floating_ui_dom_browser_min_E(n);return n&&("html"===floating_ui_dom_browser_min_r(n)||"body"===floating_ui_dom_browser_min_r(n)&&"static"===floating_ui_dom_browser_min_i(n).position&&!floating_ui_dom_browser_min_h(n))?e:n||function(t){let e=floating_ui_dom_browser_min_R(t);for(floating_ui_dom_browser_min_f(e)&&(e=e.host);floating_ui_dom_browser_min_c(e)&&!floating_ui_dom_browser_min_g(e);){if(floating_ui_dom_browser_min_h(e))return e;{const t=e.parentNode;e=floating_ui_dom_browser_min_f(t)?t.host:t}}return null}(t)||e}function W(t){if(floating_ui_dom_browser_min_c(t))return{width:t.offsetWidth,height:t.offsetHeight};const e=floating_ui_dom_browser_min_v(t);return{width:e.width,height:e.height}}function H(t){const e=floating_ui_dom_browser_min_R(t);return floating_ui_dom_browser_min_g(e)?t.ownerDocument.body:floating_ui_dom_browser_min_c(e)&&floating_ui_dom_browser_min_u(e)?e:H(e)}function C(t,e){var n;void 0===e&&(e=[]);const i=H(t),r=i===(null==(n=t.ownerDocument)?void 0:n.body),l=floating_ui_dom_browser_min_o(i),c=r?[l].concat(l.visualViewport||[],floating_ui_dom_browser_min_u(i)?i:[]):i,s=e.concat(c);return r?s:s.concat(C(c))}function floating_ui_dom_browser_min_D(e,n,r){return"viewport"===n?l(function(t,e){const n=floating_ui_dom_browser_min_o(t),i=floating_ui_dom_browser_min_y(t),r=n.visualViewport;let l=i.clientWidth,c=i.clientHeight,s=0,f=0;if(r){l=r.width,c=r.height;const t=floating_ui_dom_browser_min_a();(t||!t&&"fixed"===e)&&(s=r.offsetLeft,f=r.offsetTop)}return{width:l,height:c,x:s,y:f}}(e,r)):floating_ui_dom_browser_min_s(n)?function(t,e){const n=floating_ui_dom_browser_min_v(t,!1,"fixed"===e),o=n.top+t.clientTop,i=n.left+t.clientLeft;return{top:o,left:i,x:i,y:o,right:i+t.clientWidth,bottom:o+t.clientHeight,width:t.clientWidth,height:t.clientHeight}}(n,r):l(function(t){var e;const n=floating_ui_dom_browser_min_y(t),o=floating_ui_dom_browser_min_x(t),r=null==(e=t.ownerDocument)?void 0:e.body,l=floating_ui_dom_browser_min_p(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),c=floating_ui_dom_browser_min_p(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0);let s=-o.scrollLeft+floating_ui_dom_browser_min_b(t);const f=-o.scrollTop;return"rtl"===floating_ui_dom_browser_min_i(r||n).direction&&(s+=floating_ui_dom_browser_min_p(n.clientWidth,r?r.clientWidth:0)-l),{width:l,height:c,x:s,y:f}}(floating_ui_dom_browser_min_y(e)))}function N(t){const e=C(t),n=function(t,e){let n=t;for(;n&&!floating_ui_dom_browser_min_g(n)&&!e.includes(n)&&(!floating_ui_dom_browser_min_s(n)||!["absolute","fixed"].includes(floating_ui_dom_browser_min_i(n).position));){const t=floating_ui_dom_browser_min_R(n);n=floating_ui_dom_browser_min_f(t)?t.host:t}return n}(t,e);let o=null;if(n&&floating_ui_dom_browser_min_c(n)){const t=floating_ui_dom_browser_min_T(n);floating_ui_dom_browser_min_u(n)?o=n:floating_ui_dom_browser_min_c(t)&&(o=t)}return floating_ui_dom_browser_min_s(o)?e.filter((t=>o&&floating_ui_dom_browser_min_s(t)&&function(t,e){const n=null==e.getRootNode?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&floating_ui_dom_browser_min_f(n)){let n=e;do{if(n&&t===n)return!0;n=n.parentNode||n.host}while(n)}return!1}(t,o)&&"body"!==floating_ui_dom_browser_min_r(t))):[]}const S={getClippingRect:function(t){let{element:e,boundary:n,rootBoundary:o,strategy:i}=t;const r=[..."clippingAncestors"===n?N(e):[].concat(n),o],l=r[0],c=r.reduce(((t,n)=>{const o=floating_ui_dom_browser_min_D(e,n,i);return t.top=floating_ui_dom_browser_min_p(o.top,t.top),t.right=floating_ui_dom_browser_min_m(o.right,t.right),t.bottom=floating_ui_dom_browser_min_m(o.bottom,t.bottom),t.left=floating_ui_dom_browser_min_p(o.left,t.left),t}),floating_ui_dom_browser_min_D(e,l,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{rect:e,offsetParent:n,strategy:o}=t;const i=floating_ui_dom_browser_min_c(n),l=floating_ui_dom_browser_min_y(n);if(n===l)return e;let s={scrollLeft:0,scrollTop:0};const f={x:0,y:0};if((i||!i&&"fixed"!==o)&&(("body"!==floating_ui_dom_browser_min_r(n)||floating_ui_dom_browser_min_u(l))&&(s=floating_ui_dom_browser_min_x(n)),floating_ui_dom_browser_min_c(n))){const t=floating_ui_dom_browser_min_v(n,!0);f.x=t.x+n.clientLeft,f.y=t.y+n.clientTop}return{...e,x:e.x-s.scrollLeft+f.x,y:e.y-s.scrollTop+f.y}},isElement:floating_ui_dom_browser_min_s,getDimensions:W,getOffsetParent:floating_ui_dom_browser_min_T,getDocumentElement:floating_ui_dom_browser_min_y,getElementRects:t=>{let{reference:e,floating:n,strategy:o}=t;return{reference:floating_ui_dom_browser_min_L(e,floating_ui_dom_browser_min_T(n),o),floating:{...W(n),x:0,y:0}}},getClientRects:t=>Array.from(t.getClientRects()),isRTL:t=>"rtl"===floating_ui_dom_browser_min_i(t).direction};function z(t,e,n,o){void 0===o&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:l=!0,animationFrame:c=!1}=o,f=i&&!c,u=f||r?[...floating_ui_dom_browser_min_s(t)?C(t):t.contextElement?C(t.contextElement):[],...C(e)]:[];u.forEach((t=>{f&&t.addEventListener("scroll",n,{passive:!0}),r&&t.addEventListener("resize",n)}));let d,h=null;if(l){let o=!0;h=new ResizeObserver((()=>{o||n(),o=!1})),floating_ui_dom_browser_min_s(t)&&!c&&h.observe(t),floating_ui_dom_browser_min_s(t)||!t.contextElement||c||h.observe(t.contextElement),h.observe(e)}let a=c?floating_ui_dom_browser_min_v(t):null;return c&&function e(){const o=floating_ui_dom_browser_min_v(t);!a||o.x===a.x&&o.y===a.y&&o.width===a.width&&o.height===a.height||n();a=o,d=requestAnimationFrame(e)}(),n(),()=>{var t;u.forEach((t=>{f&&t.removeEventListener("scroll",n),r&&t.removeEventListener("resize",n)})),null==(t=h)||t.disconnect(),h=null,c&&cancelAnimationFrame(d)}}const floating_ui_dom_browser_min_A=(t,n,o)=>floating_ui_core_browser_min_o(t,n,{platform:S,...o});
  4049. ;// CONCATENATED MODULE: external "ReactDOM"
  4050. var external_ReactDOM_namespaceObject = window["ReactDOM"];
  4051. ;// CONCATENATED MODULE: ./node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.esm.js
  4052. var index = typeof document !== 'undefined' ? external_React_namespaceObject.useLayoutEffect : external_React_namespaceObject.useEffect;
  4053. // Fork of `fast-deep-equal` that only does the comparisons we need and compares
  4054. // functions
  4055. function deepEqual(a, b) {
  4056. if (a === b) {
  4057. return true;
  4058. }
  4059. if (typeof a !== typeof b) {
  4060. return false;
  4061. }
  4062. if (typeof a === 'function' && a.toString() === b.toString()) {
  4063. return true;
  4064. }
  4065. let length, i, keys;
  4066. if (a && b && typeof a == 'object') {
  4067. if (Array.isArray(a)) {
  4068. length = a.length;
  4069. if (length != b.length) return false;
  4070. for (i = length; i-- !== 0;) {
  4071. if (!deepEqual(a[i], b[i])) {
  4072. return false;
  4073. }
  4074. }
  4075. return true;
  4076. }
  4077. keys = Object.keys(a);
  4078. length = keys.length;
  4079. if (length !== Object.keys(b).length) {
  4080. return false;
  4081. }
  4082. for (i = length; i-- !== 0;) {
  4083. if (!Object.prototype.hasOwnProperty.call(b, keys[i])) {
  4084. return false;
  4085. }
  4086. }
  4087. for (i = length; i-- !== 0;) {
  4088. const key = keys[i];
  4089. if (key === '_owner' && a.$$typeof) {
  4090. continue;
  4091. }
  4092. if (!deepEqual(a[key], b[key])) {
  4093. return false;
  4094. }
  4095. }
  4096. return true;
  4097. }
  4098. return a !== a && b !== b;
  4099. }
  4100. function useLatestRef(value) {
  4101. const ref = external_React_namespaceObject.useRef(value);
  4102. index(() => {
  4103. ref.current = value;
  4104. });
  4105. return ref;
  4106. }
  4107. function useFloating(_temp) {
  4108. let {
  4109. middleware,
  4110. placement = 'bottom',
  4111. strategy = 'absolute',
  4112. whileElementsMounted
  4113. } = _temp === void 0 ? {} : _temp;
  4114. const [data, setData] = external_React_namespaceObject.useState({
  4115. // Setting these to `null` will allow the consumer to determine if
  4116. // `computePosition()` has run yet
  4117. x: null,
  4118. y: null,
  4119. strategy,
  4120. placement,
  4121. middlewareData: {}
  4122. });
  4123. const [latestMiddleware, setLatestMiddleware] = external_React_namespaceObject.useState(middleware);
  4124. if (!deepEqual(latestMiddleware == null ? void 0 : latestMiddleware.map(_ref => {
  4125. let {
  4126. name,
  4127. options
  4128. } = _ref;
  4129. return {
  4130. name,
  4131. options
  4132. };
  4133. }), middleware == null ? void 0 : middleware.map(_ref2 => {
  4134. let {
  4135. name,
  4136. options
  4137. } = _ref2;
  4138. return {
  4139. name,
  4140. options
  4141. };
  4142. }))) {
  4143. setLatestMiddleware(middleware);
  4144. }
  4145. const reference = external_React_namespaceObject.useRef(null);
  4146. const floating = external_React_namespaceObject.useRef(null);
  4147. const cleanupRef = external_React_namespaceObject.useRef(null);
  4148. const dataRef = external_React_namespaceObject.useRef(data);
  4149. const whileElementsMountedRef = useLatestRef(whileElementsMounted);
  4150. const update = external_React_namespaceObject.useCallback(() => {
  4151. if (!reference.current || !floating.current) {
  4152. return;
  4153. }
  4154. floating_ui_dom_browser_min_A(reference.current, floating.current, {
  4155. middleware: latestMiddleware,
  4156. placement,
  4157. strategy
  4158. }).then(data => {
  4159. if (isMountedRef.current && !deepEqual(dataRef.current, data)) {
  4160. dataRef.current = data;
  4161. external_ReactDOM_namespaceObject.flushSync(() => {
  4162. setData(data);
  4163. });
  4164. }
  4165. });
  4166. }, [latestMiddleware, placement, strategy]);
  4167. index(() => {
  4168. // Skip first update
  4169. if (isMountedRef.current) {
  4170. update();
  4171. }
  4172. }, [update]);
  4173. const isMountedRef = external_React_namespaceObject.useRef(false);
  4174. index(() => {
  4175. isMountedRef.current = true;
  4176. return () => {
  4177. isMountedRef.current = false;
  4178. };
  4179. }, []);
  4180. const runElementMountCallback = external_React_namespaceObject.useCallback(() => {
  4181. if (typeof cleanupRef.current === 'function') {
  4182. cleanupRef.current();
  4183. cleanupRef.current = null;
  4184. }
  4185. if (reference.current && floating.current) {
  4186. if (whileElementsMountedRef.current) {
  4187. const cleanupFn = whileElementsMountedRef.current(reference.current, floating.current, update);
  4188. cleanupRef.current = cleanupFn;
  4189. } else {
  4190. update();
  4191. }
  4192. }
  4193. }, [update, whileElementsMountedRef]);
  4194. const setReference = external_React_namespaceObject.useCallback(node => {
  4195. reference.current = node;
  4196. runElementMountCallback();
  4197. }, [runElementMountCallback]);
  4198. const setFloating = external_React_namespaceObject.useCallback(node => {
  4199. floating.current = node;
  4200. runElementMountCallback();
  4201. }, [runElementMountCallback]);
  4202. const refs = external_React_namespaceObject.useMemo(() => ({
  4203. reference,
  4204. floating
  4205. }), []);
  4206. return external_React_namespaceObject.useMemo(() => ({ ...data,
  4207. update,
  4208. refs,
  4209. reference: setReference,
  4210. floating: setFloating
  4211. }), [data, update, refs, setReference, setFloating]);
  4212. }
  4213. /**
  4214. * Positions an inner element of the floating element such that it is centered
  4215. * to the reference element.
  4216. * This wraps the core `arrow` middleware to allow React refs as the element.
  4217. * @see https://floating-ui.com/docs/arrow
  4218. */
  4219. const arrow = options => {
  4220. const {
  4221. element,
  4222. padding
  4223. } = options;
  4224. function isRef(value) {
  4225. return Object.prototype.hasOwnProperty.call(value, 'current');
  4226. }
  4227. return {
  4228. name: 'arrow',
  4229. options,
  4230. fn(args) {
  4231. if (isRef(element)) {
  4232. if (element.current != null) {
  4233. return m({
  4234. element: element.current,
  4235. padding
  4236. }).fn(args);
  4237. }
  4238. return {};
  4239. } else if (element) {
  4240. return m({
  4241. element,
  4242. padding
  4243. }).fn(args);
  4244. }
  4245. return {};
  4246. }
  4247. };
  4248. };
  4249. ;// CONCATENATED MODULE: ./node_modules/tslib/tslib.es6.js
  4250. /*! *****************************************************************************
  4251. Copyright (c) Microsoft Corporation.
  4252. Permission to use, copy, modify, and/or distribute this software for any
  4253. purpose with or without fee is hereby granted.
  4254. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  4255. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  4256. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  4257. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  4258. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  4259. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  4260. PERFORMANCE OF THIS SOFTWARE.
  4261. ***************************************************************************** */
  4262. /* global Reflect, Promise */
  4263. var extendStatics = function(d, b) {
  4264. extendStatics = Object.setPrototypeOf ||
  4265. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  4266. function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  4267. return extendStatics(d, b);
  4268. };
  4269. function __extends(d, b) {
  4270. if (typeof b !== "function" && b !== null)
  4271. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  4272. extendStatics(d, b);
  4273. function __() { this.constructor = d; }
  4274. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  4275. }
  4276. var __assign = function() {
  4277. __assign = Object.assign || function __assign(t) {
  4278. for (var s, i = 1, n = arguments.length; i < n; i++) {
  4279. s = arguments[i];
  4280. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  4281. }
  4282. return t;
  4283. }
  4284. return __assign.apply(this, arguments);
  4285. }
  4286. function __rest(s, e) {
  4287. var t = {};
  4288. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
  4289. t[p] = s[p];
  4290. if (s != null && typeof Object.getOwnPropertySymbols === "function")
  4291. for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
  4292. if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
  4293. t[p[i]] = s[p[i]];
  4294. }
  4295. return t;
  4296. }
  4297. function __decorate(decorators, target, key, desc) {
  4298. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  4299. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  4300. 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;
  4301. return c > 3 && r && Object.defineProperty(target, key, r), r;
  4302. }
  4303. function __param(paramIndex, decorator) {
  4304. return function (target, key) { decorator(target, key, paramIndex); }
  4305. }
  4306. function __metadata(metadataKey, metadataValue) {
  4307. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
  4308. }
  4309. function __awaiter(thisArg, _arguments, P, generator) {
  4310. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  4311. return new (P || (P = Promise))(function (resolve, reject) {
  4312. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  4313. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  4314. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  4315. step((generator = generator.apply(thisArg, _arguments || [])).next());
  4316. });
  4317. }
  4318. function __generator(thisArg, body) {
  4319. var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
  4320. return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
  4321. function verb(n) { return function (v) { return step([n, v]); }; }
  4322. function step(op) {
  4323. if (f) throw new TypeError("Generator is already executing.");
  4324. while (_) try {
  4325. 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;
  4326. if (y = 0, t) op = [op[0] & 2, t.value];
  4327. switch (op[0]) {
  4328. case 0: case 1: t = op; break;
  4329. case 4: _.label++; return { value: op[1], done: false };
  4330. case 5: _.label++; y = op[1]; op = [0]; continue;
  4331. case 7: op = _.ops.pop(); _.trys.pop(); continue;
  4332. default:
  4333. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
  4334. if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
  4335. if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
  4336. if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
  4337. if (t[2]) _.ops.pop();
  4338. _.trys.pop(); continue;
  4339. }
  4340. op = body.call(thisArg, _);
  4341. } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
  4342. if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
  4343. }
  4344. }
  4345. var __createBinding = Object.create ? (function(o, m, k, k2) {
  4346. if (k2 === undefined) k2 = k;
  4347. Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
  4348. }) : (function(o, m, k, k2) {
  4349. if (k2 === undefined) k2 = k;
  4350. o[k2] = m[k];
  4351. });
  4352. function __exportStar(m, o) {
  4353. for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
  4354. }
  4355. function __values(o) {
  4356. var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  4357. if (m) return m.call(o);
  4358. if (o && typeof o.length === "number") return {
  4359. next: function () {
  4360. if (o && i >= o.length) o = void 0;
  4361. return { value: o && o[i++], done: !o };
  4362. }
  4363. };
  4364. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  4365. }
  4366. function tslib_es6_read(o, n) {
  4367. var m = typeof Symbol === "function" && o[Symbol.iterator];
  4368. if (!m) return o;
  4369. var i = m.call(o), r, ar = [], e;
  4370. try {
  4371. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  4372. }
  4373. catch (error) { e = { error: error }; }
  4374. finally {
  4375. try {
  4376. if (r && !r.done && (m = i["return"])) m.call(i);
  4377. }
  4378. finally { if (e) throw e.error; }
  4379. }
  4380. return ar;
  4381. }
  4382. /** @deprecated */
  4383. function __spread() {
  4384. for (var ar = [], i = 0; i < arguments.length; i++)
  4385. ar = ar.concat(tslib_es6_read(arguments[i]));
  4386. return ar;
  4387. }
  4388. /** @deprecated */
  4389. function __spreadArrays() {
  4390. for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
  4391. for (var r = Array(s), k = 0, i = 0; i < il; i++)
  4392. for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
  4393. r[k] = a[j];
  4394. return r;
  4395. }
  4396. function tslib_es6_spreadArray(to, from, pack) {
  4397. if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
  4398. if (ar || !(i in from)) {
  4399. if (!ar) ar = Array.prototype.slice.call(from, 0, i);
  4400. ar[i] = from[i];
  4401. }
  4402. }
  4403. return to.concat(ar || Array.prototype.slice.call(from));
  4404. }
  4405. function __await(v) {
  4406. return this instanceof __await ? (this.v = v, this) : new __await(v);
  4407. }
  4408. function __asyncGenerator(thisArg, _arguments, generator) {
  4409. if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  4410. var g = generator.apply(thisArg, _arguments || []), i, q = [];
  4411. return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
  4412. 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); }); }; }
  4413. function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
  4414. function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
  4415. function fulfill(value) { resume("next", value); }
  4416. function reject(value) { resume("throw", value); }
  4417. function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
  4418. }
  4419. function __asyncDelegator(o) {
  4420. var i, p;
  4421. return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
  4422. 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; }
  4423. }
  4424. function __asyncValues(o) {
  4425. if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  4426. var m = o[Symbol.asyncIterator], i;
  4427. 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);
  4428. 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); }); }; }
  4429. function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
  4430. }
  4431. function __makeTemplateObject(cooked, raw) {
  4432. if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
  4433. return cooked;
  4434. };
  4435. var __setModuleDefault = Object.create ? (function(o, v) {
  4436. Object.defineProperty(o, "default", { enumerable: true, value: v });
  4437. }) : function(o, v) {
  4438. o["default"] = v;
  4439. };
  4440. function __importStar(mod) {
  4441. if (mod && mod.__esModule) return mod;
  4442. var result = {};
  4443. if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  4444. __setModuleDefault(result, mod);
  4445. return result;
  4446. }
  4447. function __importDefault(mod) {
  4448. return (mod && mod.__esModule) ? mod : { default: mod };
  4449. }
  4450. function __classPrivateFieldGet(receiver, state, kind, f) {
  4451. if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
  4452. 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");
  4453. return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
  4454. }
  4455. function __classPrivateFieldSet(receiver, state, value, kind, f) {
  4456. if (kind === "m") throw new TypeError("Private method is not writable");
  4457. if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
  4458. 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");
  4459. return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
  4460. }
  4461. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/context/MotionConfigContext.mjs
  4462. /**
  4463. * @public
  4464. */
  4465. var MotionConfigContext = (0,external_React_namespaceObject.createContext)({
  4466. transformPagePoint: function (p) { return p; },
  4467. isStatic: false,
  4468. reducedMotion: "never",
  4469. });
  4470. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/is-browser.mjs
  4471. var isBrowser = typeof document !== "undefined";
  4472. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/use-reduced-motion.mjs
  4473. // Does this device prefer reduced motion? Returns `null` server-side.
  4474. var prefersReducedMotion = { current: null };
  4475. var hasDetected = false;
  4476. function initPrefersReducedMotion() {
  4477. hasDetected = true;
  4478. if (!isBrowser)
  4479. return;
  4480. if (window.matchMedia) {
  4481. var motionMediaQuery_1 = window.matchMedia("(prefers-reduced-motion)");
  4482. var setReducedMotionPreferences = function () {
  4483. return (prefersReducedMotion.current = motionMediaQuery_1.matches);
  4484. };
  4485. motionMediaQuery_1.addListener(setReducedMotionPreferences);
  4486. setReducedMotionPreferences();
  4487. }
  4488. else {
  4489. prefersReducedMotion.current = false;
  4490. }
  4491. }
  4492. /**
  4493. * A hook that returns `true` if we should be using reduced motion based on the current device's Reduced Motion setting.
  4494. *
  4495. * This can be used to implement changes to your UI based on Reduced Motion. For instance, replacing motion-sickness inducing
  4496. * `x`/`y` animations with `opacity`, disabling the autoplay of background videos, or turning off parallax motion.
  4497. *
  4498. * It will actively respond to changes and re-render your components with the latest setting.
  4499. *
  4500. * ```jsx
  4501. * export function Sidebar({ isOpen }) {
  4502. * const shouldReduceMotion = useReducedMotion()
  4503. * const closedX = shouldReduceMotion ? 0 : "-100%"
  4504. *
  4505. * return (
  4506. * <motion.div animate={{
  4507. * opacity: isOpen ? 1 : 0,
  4508. * x: isOpen ? 0 : closedX
  4509. * }} />
  4510. * )
  4511. * }
  4512. * ```
  4513. *
  4514. * @return boolean
  4515. *
  4516. * @public
  4517. */
  4518. function useReducedMotion() {
  4519. /**
  4520. * Lazy initialisation of prefersReducedMotion
  4521. */
  4522. !hasDetected && initPrefersReducedMotion();
  4523. var _a = tslib_es6_read((0,external_React_namespaceObject.useState)(prefersReducedMotion.current), 1), shouldReduceMotion = _a[0];
  4524. /**
  4525. * TODO See if people miss automatically updating shouldReduceMotion setting
  4526. */
  4527. return shouldReduceMotion;
  4528. }
  4529. function useReducedMotionConfig() {
  4530. var reducedMotionPreference = useReducedMotion();
  4531. var reducedMotion = (0,external_React_namespaceObject.useContext)(MotionConfigContext).reducedMotion;
  4532. if (reducedMotion === "never") {
  4533. return false;
  4534. }
  4535. else if (reducedMotion === "always") {
  4536. return true;
  4537. }
  4538. else {
  4539. return reducedMotionPreference;
  4540. }
  4541. }
  4542. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/process.mjs
  4543. /**
  4544. * Browser-safe usage of process
  4545. */
  4546. var defaultEnvironment = "production";
  4547. var env = typeof process === "undefined" || process.env === undefined
  4548. ? defaultEnvironment
  4549. : "production" || 0;
  4550. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/definitions.mjs
  4551. var createDefinition = function (propNames) { return ({
  4552. isEnabled: function (props) { return propNames.some(function (name) { return !!props[name]; }); },
  4553. }); };
  4554. var featureDefinitions = {
  4555. measureLayout: createDefinition(["layout", "layoutId", "drag"]),
  4556. animation: createDefinition([
  4557. "animate",
  4558. "exit",
  4559. "variants",
  4560. "whileHover",
  4561. "whileTap",
  4562. "whileFocus",
  4563. "whileDrag",
  4564. "whileInView",
  4565. ]),
  4566. exit: createDefinition(["exit"]),
  4567. drag: createDefinition(["drag", "dragControls"]),
  4568. focus: createDefinition(["whileFocus"]),
  4569. hover: createDefinition(["whileHover", "onHoverStart", "onHoverEnd"]),
  4570. tap: createDefinition(["whileTap", "onTap", "onTapStart", "onTapCancel"]),
  4571. pan: createDefinition([
  4572. "onPan",
  4573. "onPanStart",
  4574. "onPanSessionStart",
  4575. "onPanEnd",
  4576. ]),
  4577. inView: createDefinition([
  4578. "whileInView",
  4579. "onViewportEnter",
  4580. "onViewportLeave",
  4581. ]),
  4582. };
  4583. function loadFeatures(features) {
  4584. for (var key in features) {
  4585. if (features[key] === null)
  4586. continue;
  4587. if (key === "projectionNodeConstructor") {
  4588. featureDefinitions.projectionNodeConstructor = features[key];
  4589. }
  4590. else {
  4591. featureDefinitions[key].Component = features[key];
  4592. }
  4593. }
  4594. }
  4595. ;// CONCATENATED MODULE: ./node_modules/hey-listen/dist/hey-listen.es.js
  4596. var warning = function () { };
  4597. var invariant = function () { };
  4598. if (false) {}
  4599. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/context/LazyContext.mjs
  4600. var LazyContext = (0,external_React_namespaceObject.createContext)({ strict: false });
  4601. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/use-features.mjs
  4602. var featureNames = Object.keys(featureDefinitions);
  4603. var numFeatures = featureNames.length;
  4604. /**
  4605. * Load features via renderless components based on the provided MotionProps.
  4606. */
  4607. function useFeatures(props, visualElement, preloadedFeatures) {
  4608. var features = [];
  4609. var lazyContext = (0,external_React_namespaceObject.useContext)(LazyContext);
  4610. if (!visualElement)
  4611. return null;
  4612. /**
  4613. * If we're in development mode, check to make sure we're not rendering a motion component
  4614. * as a child of LazyMotion, as this will break the file-size benefits of using it.
  4615. */
  4616. if (env !== "production" && preloadedFeatures && lazyContext.strict) {
  4617. invariant(false, "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.");
  4618. }
  4619. for (var i = 0; i < numFeatures; i++) {
  4620. var name_1 = featureNames[i];
  4621. var _a = featureDefinitions[name_1], isEnabled = _a.isEnabled, Component = _a.Component;
  4622. /**
  4623. * It might be possible in the future to use this moment to
  4624. * dynamically request functionality. In initial tests this
  4625. * was producing a lot of duplication amongst bundles.
  4626. */
  4627. if (isEnabled(props) && Component) {
  4628. features.push(external_React_namespaceObject.createElement(Component, __assign({ key: name_1 }, props, { visualElement: visualElement })));
  4629. }
  4630. }
  4631. return features;
  4632. }
  4633. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/context/MotionContext/index.mjs
  4634. var MotionContext = (0,external_React_namespaceObject.createContext)({});
  4635. function useVisualElementContext() {
  4636. return (0,external_React_namespaceObject.useContext)(MotionContext).visualElement;
  4637. }
  4638. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/context/PresenceContext.mjs
  4639. /**
  4640. * @public
  4641. */
  4642. var PresenceContext_PresenceContext = (0,external_React_namespaceObject.createContext)(null);
  4643. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/use-isomorphic-effect.mjs
  4644. var useIsomorphicLayoutEffect = isBrowser ? external_React_namespaceObject.useLayoutEffect : external_React_namespaceObject.useEffect;
  4645. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/utils/use-visual-element.mjs
  4646. function useVisualElement(Component, visualState, props, createVisualElement) {
  4647. var lazyContext = (0,external_React_namespaceObject.useContext)(LazyContext);
  4648. var parent = useVisualElementContext();
  4649. var presenceContext = (0,external_React_namespaceObject.useContext)(PresenceContext_PresenceContext);
  4650. var shouldReduceMotion = useReducedMotionConfig();
  4651. var visualElementRef = (0,external_React_namespaceObject.useRef)(undefined);
  4652. /**
  4653. * If we haven't preloaded a renderer, check to see if we have one lazy-loaded
  4654. */
  4655. if (!createVisualElement)
  4656. createVisualElement = lazyContext.renderer;
  4657. if (!visualElementRef.current && createVisualElement) {
  4658. visualElementRef.current = createVisualElement(Component, {
  4659. visualState: visualState,
  4660. parent: parent,
  4661. props: props,
  4662. presenceId: presenceContext === null || presenceContext === void 0 ? void 0 : presenceContext.id,
  4663. blockInitialAnimation: (presenceContext === null || presenceContext === void 0 ? void 0 : presenceContext.initial) === false,
  4664. shouldReduceMotion: shouldReduceMotion,
  4665. });
  4666. }
  4667. var visualElement = visualElementRef.current;
  4668. useIsomorphicLayoutEffect(function () {
  4669. visualElement === null || visualElement === void 0 ? void 0 : visualElement.syncRender();
  4670. });
  4671. (0,external_React_namespaceObject.useEffect)(function () {
  4672. var _a;
  4673. (_a = visualElement === null || visualElement === void 0 ? void 0 : visualElement.animationState) === null || _a === void 0 ? void 0 : _a.animateChanges();
  4674. });
  4675. useIsomorphicLayoutEffect(function () { return function () { return visualElement === null || visualElement === void 0 ? void 0 : visualElement.notifyUnmount(); }; }, []);
  4676. return visualElement;
  4677. }
  4678. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/is-ref-object.mjs
  4679. function is_ref_object_isRefObject(ref) {
  4680. return (typeof ref === "object" &&
  4681. Object.prototype.hasOwnProperty.call(ref, "current"));
  4682. }
  4683. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/utils/use-motion-ref.mjs
  4684. /**
  4685. * Creates a ref function that, when called, hydrates the provided
  4686. * external ref and VisualElement.
  4687. */
  4688. function useMotionRef(visualState, visualElement, externalRef) {
  4689. return (0,external_React_namespaceObject.useCallback)(function (instance) {
  4690. var _a;
  4691. instance && ((_a = visualState.mount) === null || _a === void 0 ? void 0 : _a.call(visualState, instance));
  4692. if (visualElement) {
  4693. instance
  4694. ? visualElement.mount(instance)
  4695. : visualElement.unmount();
  4696. }
  4697. if (externalRef) {
  4698. if (typeof externalRef === "function") {
  4699. externalRef(instance);
  4700. }
  4701. else if (is_ref_object_isRefObject(externalRef)) {
  4702. externalRef.current = instance;
  4703. }
  4704. }
  4705. },
  4706. /**
  4707. * Only pass a new ref callback to React if we've received a visual element
  4708. * factory. Otherwise we'll be mounting/remounting every time externalRef
  4709. * or other dependencies change.
  4710. */
  4711. [visualElement]);
  4712. }
  4713. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/variants.mjs
  4714. /**
  4715. * Decides if the supplied variable is an array of variant labels
  4716. */
  4717. function isVariantLabels(v) {
  4718. return Array.isArray(v);
  4719. }
  4720. /**
  4721. * Decides if the supplied variable is variant label
  4722. */
  4723. function isVariantLabel(v) {
  4724. return typeof v === "string" || isVariantLabels(v);
  4725. }
  4726. /**
  4727. * Creates an object containing the latest state of every MotionValue on a VisualElement
  4728. */
  4729. function getCurrent(visualElement) {
  4730. var current = {};
  4731. visualElement.forEachValue(function (value, key) { return (current[key] = value.get()); });
  4732. return current;
  4733. }
  4734. /**
  4735. * Creates an object containing the latest velocity of every MotionValue on a VisualElement
  4736. */
  4737. function getVelocity(visualElement) {
  4738. var velocity = {};
  4739. visualElement.forEachValue(function (value, key) { return (velocity[key] = value.getVelocity()); });
  4740. return velocity;
  4741. }
  4742. function resolveVariantFromProps(props, definition, custom, currentValues, currentVelocity) {
  4743. var _a;
  4744. if (currentValues === void 0) { currentValues = {}; }
  4745. if (currentVelocity === void 0) { currentVelocity = {}; }
  4746. /**
  4747. * If the variant definition is a function, resolve.
  4748. */
  4749. if (typeof definition === "function") {
  4750. definition = definition(custom !== null && custom !== void 0 ? custom : props.custom, currentValues, currentVelocity);
  4751. }
  4752. /**
  4753. * If the variant definition is a variant label, or
  4754. * the function returned a variant label, resolve.
  4755. */
  4756. if (typeof definition === "string") {
  4757. definition = (_a = props.variants) === null || _a === void 0 ? void 0 : _a[definition];
  4758. }
  4759. /**
  4760. * At this point we've resolved both functions and variant labels,
  4761. * but the resolved variant label might itself have been a function.
  4762. * If so, resolve. This can only have returned a valid target object.
  4763. */
  4764. if (typeof definition === "function") {
  4765. definition = definition(custom !== null && custom !== void 0 ? custom : props.custom, currentValues, currentVelocity);
  4766. }
  4767. return definition;
  4768. }
  4769. function resolveVariant(visualElement, definition, custom) {
  4770. var props = visualElement.getProps();
  4771. return resolveVariantFromProps(props, definition, custom !== null && custom !== void 0 ? custom : props.custom, getCurrent(visualElement), getVelocity(visualElement));
  4772. }
  4773. function checkIfControllingVariants(props) {
  4774. var _a;
  4775. return (typeof ((_a = props.animate) === null || _a === void 0 ? void 0 : _a.start) === "function" ||
  4776. isVariantLabel(props.initial) ||
  4777. isVariantLabel(props.animate) ||
  4778. isVariantLabel(props.whileHover) ||
  4779. isVariantLabel(props.whileDrag) ||
  4780. isVariantLabel(props.whileTap) ||
  4781. isVariantLabel(props.whileFocus) ||
  4782. isVariantLabel(props.exit));
  4783. }
  4784. function checkIfVariantNode(props) {
  4785. return Boolean(checkIfControllingVariants(props) || props.variants);
  4786. }
  4787. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/context/MotionContext/utils.mjs
  4788. function getCurrentTreeVariants(props, context) {
  4789. if (checkIfControllingVariants(props)) {
  4790. var initial = props.initial, animate = props.animate;
  4791. return {
  4792. initial: initial === false || isVariantLabel(initial)
  4793. ? initial
  4794. : undefined,
  4795. animate: isVariantLabel(animate) ? animate : undefined,
  4796. };
  4797. }
  4798. return props.inherit !== false ? context : {};
  4799. }
  4800. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/context/MotionContext/create.mjs
  4801. function useCreateMotionContext(props) {
  4802. var _a = getCurrentTreeVariants(props, (0,external_React_namespaceObject.useContext)(MotionContext)), initial = _a.initial, animate = _a.animate;
  4803. return (0,external_React_namespaceObject.useMemo)(function () { return ({ initial: initial, animate: animate }); }, [variantLabelsAsDependency(initial), variantLabelsAsDependency(animate)]);
  4804. }
  4805. function variantLabelsAsDependency(prop) {
  4806. return Array.isArray(prop) ? prop.join(" ") : prop;
  4807. }
  4808. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/use-constant.mjs
  4809. /**
  4810. * Creates a constant value over the lifecycle of a component.
  4811. *
  4812. * Even if `useMemo` is provided an empty array as its final argument, it doesn't offer
  4813. * a guarantee that it won't re-run for performance reasons later on. By using `useConstant`
  4814. * you can ensure that initialisers don't execute twice or more.
  4815. */
  4816. function useConstant(init) {
  4817. var ref = (0,external_React_namespaceObject.useRef)(null);
  4818. if (ref.current === null) {
  4819. ref.current = init();
  4820. }
  4821. return ref.current;
  4822. }
  4823. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/node/state.mjs
  4824. /**
  4825. * This should only ever be modified on the client otherwise it'll
  4826. * persist through server requests. If we need instanced states we
  4827. * could lazy-init via root.
  4828. */
  4829. var globalProjectionState = {
  4830. /**
  4831. * Global flag as to whether the tree has animated since the last time
  4832. * we resized the window
  4833. */
  4834. hasAnimatedSinceResize: true,
  4835. /**
  4836. * We set this to true once, on the first update. Any nodes added to the tree beyond that
  4837. * update will be given a `data-projection-id` attribute.
  4838. */
  4839. hasEverUpdated: false,
  4840. };
  4841. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/node/id.mjs
  4842. var id = 1;
  4843. function useProjectionId() {
  4844. return useConstant(function () {
  4845. if (globalProjectionState.hasEverUpdated) {
  4846. return id++;
  4847. }
  4848. });
  4849. }
  4850. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/context/LayoutGroupContext.mjs
  4851. var LayoutGroupContext = (0,external_React_namespaceObject.createContext)({});
  4852. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/context/SwitchLayoutGroupContext.mjs
  4853. /**
  4854. * Internal, exported only for usage in Framer
  4855. */
  4856. var SwitchLayoutGroupContext = (0,external_React_namespaceObject.createContext)({});
  4857. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/use-projection.mjs
  4858. function useProjection(projectionId, _a, visualElement, ProjectionNodeConstructor) {
  4859. var _b;
  4860. var layoutId = _a.layoutId, layout = _a.layout, drag = _a.drag, dragConstraints = _a.dragConstraints, layoutScroll = _a.layoutScroll;
  4861. var initialPromotionConfig = (0,external_React_namespaceObject.useContext)(SwitchLayoutGroupContext);
  4862. if (!ProjectionNodeConstructor ||
  4863. !visualElement ||
  4864. (visualElement === null || visualElement === void 0 ? void 0 : visualElement.projection)) {
  4865. return;
  4866. }
  4867. visualElement.projection = new ProjectionNodeConstructor(projectionId, visualElement.getLatestValues(), (_b = visualElement.parent) === null || _b === void 0 ? void 0 : _b.projection);
  4868. visualElement.projection.setOptions({
  4869. layoutId: layoutId,
  4870. layout: layout,
  4871. alwaysMeasureLayout: Boolean(drag) || (dragConstraints && is_ref_object_isRefObject(dragConstraints)),
  4872. visualElement: visualElement,
  4873. scheduleRender: function () { return visualElement.scheduleRender(); },
  4874. /**
  4875. * TODO: Update options in an effect. This could be tricky as it'll be too late
  4876. * to update by the time layout animations run.
  4877. * We also need to fix this safeToRemove by linking it up to the one returned by usePresence,
  4878. * ensuring it gets called if there's no potential layout animations.
  4879. *
  4880. */
  4881. animationType: typeof layout === "string" ? layout : "both",
  4882. initialPromotionConfig: initialPromotionConfig,
  4883. layoutScroll: layoutScroll,
  4884. });
  4885. }
  4886. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/utils/VisualElementHandler.mjs
  4887. var VisualElementHandler = /** @class */ (function (_super) {
  4888. __extends(VisualElementHandler, _super);
  4889. function VisualElementHandler() {
  4890. return _super !== null && _super.apply(this, arguments) || this;
  4891. }
  4892. /**
  4893. * Update visual element props as soon as we know this update is going to be commited.
  4894. */
  4895. VisualElementHandler.prototype.getSnapshotBeforeUpdate = function () {
  4896. this.updateProps();
  4897. return null;
  4898. };
  4899. VisualElementHandler.prototype.componentDidUpdate = function () { };
  4900. VisualElementHandler.prototype.updateProps = function () {
  4901. var _a = this.props, visualElement = _a.visualElement, props = _a.props;
  4902. if (visualElement)
  4903. visualElement.setProps(props);
  4904. };
  4905. VisualElementHandler.prototype.render = function () {
  4906. return this.props.children;
  4907. };
  4908. return VisualElementHandler;
  4909. }(external_React_namespaceObject.Component));
  4910. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/index.mjs
  4911. /**
  4912. * Create a `motion` component.
  4913. *
  4914. * This function accepts a Component argument, which can be either a string (ie "div"
  4915. * for `motion.div`), or an actual React component.
  4916. *
  4917. * Alongside this is a config option which provides a way of rendering the provided
  4918. * component "offline", or outside the React render cycle.
  4919. */
  4920. function motion_createMotionComponent(_a) {
  4921. var preloadedFeatures = _a.preloadedFeatures, createVisualElement = _a.createVisualElement, projectionNodeConstructor = _a.projectionNodeConstructor, useRender = _a.useRender, useVisualState = _a.useVisualState, Component = _a.Component;
  4922. preloadedFeatures && loadFeatures(preloadedFeatures);
  4923. function MotionComponent(props, externalRef) {
  4924. var layoutId = useLayoutId(props);
  4925. props = __assign(__assign({}, props), { layoutId: layoutId });
  4926. /**
  4927. * If we're rendering in a static environment, we only visually update the component
  4928. * as a result of a React-rerender rather than interactions or animations. This
  4929. * means we don't need to load additional memory structures like VisualElement,
  4930. * or any gesture/animation features.
  4931. */
  4932. var config = (0,external_React_namespaceObject.useContext)(MotionConfigContext);
  4933. var features = null;
  4934. var context = useCreateMotionContext(props);
  4935. /**
  4936. * Create a unique projection ID for this component. If a new component is added
  4937. * during a layout animation we'll use this to query the DOM and hydrate its ref early, allowing
  4938. * us to measure it as soon as any layout effect flushes pending layout animations.
  4939. *
  4940. * Performance note: It'd be better not to have to search the DOM for these elements.
  4941. * For newly-entering components it could be enough to only correct treeScale, in which
  4942. * case we could mount in a scale-correction mode. This wouldn't be enough for
  4943. * shared element transitions however. Perhaps for those we could revert to a root node
  4944. * that gets forceRendered and layout animations are triggered on its layout effect.
  4945. */
  4946. var projectionId = config.isStatic ? undefined : useProjectionId();
  4947. /**
  4948. *
  4949. */
  4950. var visualState = useVisualState(props, config.isStatic);
  4951. if (!config.isStatic && isBrowser) {
  4952. /**
  4953. * Create a VisualElement for this component. A VisualElement provides a common
  4954. * interface to renderer-specific APIs (ie DOM/Three.js etc) as well as
  4955. * providing a way of rendering to these APIs outside of the React render loop
  4956. * for more performant animations and interactions
  4957. */
  4958. context.visualElement = useVisualElement(Component, visualState, __assign(__assign({}, config), props), createVisualElement);
  4959. useProjection(projectionId, props, context.visualElement, projectionNodeConstructor ||
  4960. featureDefinitions.projectionNodeConstructor);
  4961. /**
  4962. * Load Motion gesture and animation features. These are rendered as renderless
  4963. * components so each feature can optionally make use of React lifecycle methods.
  4964. */
  4965. features = useFeatures(props, context.visualElement, preloadedFeatures);
  4966. }
  4967. /**
  4968. * The mount order and hierarchy is specific to ensure our element ref
  4969. * is hydrated by the time features fire their effects.
  4970. */
  4971. return (external_React_namespaceObject.createElement(VisualElementHandler, { visualElement: context.visualElement, props: __assign(__assign({}, config), props) },
  4972. features,
  4973. external_React_namespaceObject.createElement(MotionContext.Provider, { value: context }, useRender(Component, props, projectionId, useMotionRef(visualState, context.visualElement, externalRef), visualState, config.isStatic, context.visualElement))));
  4974. }
  4975. return (0,external_React_namespaceObject.forwardRef)(MotionComponent);
  4976. }
  4977. function useLayoutId(_a) {
  4978. var _b;
  4979. var layoutId = _a.layoutId;
  4980. var layoutGroupId = (_b = (0,external_React_namespaceObject.useContext)(LayoutGroupContext)) === null || _b === void 0 ? void 0 : _b.id;
  4981. return layoutGroupId && layoutId !== undefined
  4982. ? layoutGroupId + "-" + layoutId
  4983. : layoutId;
  4984. }
  4985. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/motion-proxy.mjs
  4986. /**
  4987. * Convert any React component into a `motion` component. The provided component
  4988. * **must** use `React.forwardRef` to the underlying DOM component you want to animate.
  4989. *
  4990. * ```jsx
  4991. * const Component = React.forwardRef((props, ref) => {
  4992. * return <div ref={ref} />
  4993. * })
  4994. *
  4995. * const MotionComponent = motion(Component)
  4996. * ```
  4997. *
  4998. * @public
  4999. */
  5000. function createMotionProxy(createConfig) {
  5001. function custom(Component, customMotionComponentConfig) {
  5002. if (customMotionComponentConfig === void 0) { customMotionComponentConfig = {}; }
  5003. return motion_createMotionComponent(createConfig(Component, customMotionComponentConfig));
  5004. }
  5005. if (typeof Proxy === "undefined") {
  5006. return custom;
  5007. }
  5008. /**
  5009. * A cache of generated `motion` components, e.g `motion.div`, `motion.input` etc.
  5010. * Rather than generating them anew every render.
  5011. */
  5012. var componentCache = new Map();
  5013. return new Proxy(custom, {
  5014. /**
  5015. * Called when `motion` is referenced with a prop: `motion.div`, `motion.input` etc.
  5016. * The prop name is passed through as `key` and we can use that to generate a `motion`
  5017. * DOM component with that name.
  5018. */
  5019. get: function (_target, key) {
  5020. /**
  5021. * If this element doesn't exist in the component cache, create it and cache.
  5022. */
  5023. if (!componentCache.has(key)) {
  5024. componentCache.set(key, custom(key));
  5025. }
  5026. return componentCache.get(key);
  5027. },
  5028. });
  5029. }
  5030. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/lowercase-elements.mjs
  5031. /**
  5032. * We keep these listed seperately as we use the lowercase tag names as part
  5033. * of the runtime bundle to detect SVG components
  5034. */
  5035. var lowercaseSVGElements = [
  5036. "animate",
  5037. "circle",
  5038. "defs",
  5039. "desc",
  5040. "ellipse",
  5041. "g",
  5042. "image",
  5043. "line",
  5044. "filter",
  5045. "marker",
  5046. "mask",
  5047. "metadata",
  5048. "path",
  5049. "pattern",
  5050. "polygon",
  5051. "polyline",
  5052. "rect",
  5053. "stop",
  5054. "svg",
  5055. "switch",
  5056. "symbol",
  5057. "text",
  5058. "tspan",
  5059. "use",
  5060. "view",
  5061. ];
  5062. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/is-svg-component.mjs
  5063. function isSVGComponent(Component) {
  5064. if (
  5065. /**
  5066. * If it's not a string, it's a custom React component. Currently we only support
  5067. * HTML custom React components.
  5068. */
  5069. typeof Component !== "string" ||
  5070. /**
  5071. * If it contains a dash, the element is a custom HTML webcomponent.
  5072. */
  5073. Component.includes("-")) {
  5074. return false;
  5075. }
  5076. else if (
  5077. /**
  5078. * If it's in our list of lowercase SVG tags, it's an SVG component
  5079. */
  5080. lowercaseSVGElements.indexOf(Component) > -1 ||
  5081. /**
  5082. * If it contains a capital letter, it's an SVG component
  5083. */
  5084. /[A-Z]/.test(Component)) {
  5085. return true;
  5086. }
  5087. return false;
  5088. }
  5089. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/styles/scale-correction.mjs
  5090. var scaleCorrectors = {};
  5091. function addScaleCorrector(correctors) {
  5092. Object.assign(scaleCorrectors, correctors);
  5093. }
  5094. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/utils/transform.mjs
  5095. /**
  5096. * A list of all transformable axes. We'll use this list to generated a version
  5097. * of each axes for each transform.
  5098. */
  5099. var transformAxes = ["", "X", "Y", "Z"];
  5100. /**
  5101. * An ordered array of each transformable value. By default, transform values
  5102. * will be sorted to this order.
  5103. */
  5104. var order = ["translate", "scale", "rotate", "skew"];
  5105. /**
  5106. * Generate a list of every possible transform key.
  5107. */
  5108. var transformProps = ["transformPerspective", "x", "y", "z"];
  5109. order.forEach(function (operationKey) {
  5110. return transformAxes.forEach(function (axesKey) {
  5111. return transformProps.push(operationKey + axesKey);
  5112. });
  5113. });
  5114. /**
  5115. * A function to use with Array.sort to sort transform keys by their default order.
  5116. */
  5117. function sortTransformProps(a, b) {
  5118. return transformProps.indexOf(a) - transformProps.indexOf(b);
  5119. }
  5120. /**
  5121. * A quick lookup for transform props.
  5122. */
  5123. var transformPropSet = new Set(transformProps);
  5124. function isTransformProp(key) {
  5125. return transformPropSet.has(key);
  5126. }
  5127. /**
  5128. * A quick lookup for transform origin props
  5129. */
  5130. var transformOriginProps = new Set(["originX", "originY", "originZ"]);
  5131. function isTransformOriginProp(key) {
  5132. return transformOriginProps.has(key);
  5133. }
  5134. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/utils/is-forced-motion-value.mjs
  5135. function isForcedMotionValue(key, _a) {
  5136. var layout = _a.layout, layoutId = _a.layoutId;
  5137. return (isTransformProp(key) ||
  5138. isTransformOriginProp(key) ||
  5139. ((layout || layoutId !== undefined) &&
  5140. (!!scaleCorrectors[key] || key === "opacity")));
  5141. }
  5142. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/value/utils/is-motion-value.mjs
  5143. var isMotionValue = function (value) {
  5144. return Boolean(value !== null && typeof value === "object" && value.getVelocity);
  5145. };
  5146. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/utils/build-transform.mjs
  5147. var translateAlias = {
  5148. x: "translateX",
  5149. y: "translateY",
  5150. z: "translateZ",
  5151. transformPerspective: "perspective",
  5152. };
  5153. /**
  5154. * Build a CSS transform style from individual x/y/scale etc properties.
  5155. *
  5156. * This outputs with a default order of transforms/scales/rotations, this can be customised by
  5157. * providing a transformTemplate function.
  5158. */
  5159. function buildTransform(_a, _b, transformIsDefault, transformTemplate) {
  5160. var transform = _a.transform, transformKeys = _a.transformKeys;
  5161. var _c = _b.enableHardwareAcceleration, enableHardwareAcceleration = _c === void 0 ? true : _c, _d = _b.allowTransformNone, allowTransformNone = _d === void 0 ? true : _d;
  5162. // The transform string we're going to build into.
  5163. var transformString = "";
  5164. // Transform keys into their default order - this will determine the output order.
  5165. transformKeys.sort(sortTransformProps);
  5166. // Track whether the defined transform has a defined z so we don't add a
  5167. // second to enable hardware acceleration
  5168. var transformHasZ = false;
  5169. // Loop over each transform and build them into transformString
  5170. var numTransformKeys = transformKeys.length;
  5171. for (var i = 0; i < numTransformKeys; i++) {
  5172. var key = transformKeys[i];
  5173. transformString += "".concat(translateAlias[key] || key, "(").concat(transform[key], ") ");
  5174. if (key === "z")
  5175. transformHasZ = true;
  5176. }
  5177. if (!transformHasZ && enableHardwareAcceleration) {
  5178. transformString += "translateZ(0)";
  5179. }
  5180. else {
  5181. transformString = transformString.trim();
  5182. }
  5183. // If we have a custom `transform` template, pass our transform values and
  5184. // generated transformString to that before returning
  5185. if (transformTemplate) {
  5186. transformString = transformTemplate(transform, transformIsDefault ? "" : transformString);
  5187. }
  5188. else if (allowTransformNone && transformIsDefault) {
  5189. transformString = "none";
  5190. }
  5191. return transformString;
  5192. }
  5193. /**
  5194. * Build a transformOrigin style. Uses the same defaults as the browser for
  5195. * undefined origins.
  5196. */
  5197. function buildTransformOrigin(_a) {
  5198. 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;
  5199. return "".concat(originX, " ").concat(originY, " ").concat(originZ);
  5200. }
  5201. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/is-css-variable.mjs
  5202. /**
  5203. * Returns true if the provided key is a CSS variable
  5204. */
  5205. function isCSSVariable(key) {
  5206. return key.startsWith("--");
  5207. }
  5208. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/get-as-type.mjs
  5209. /**
  5210. * Provided a value and a ValueType, returns the value as that value type.
  5211. */
  5212. var getValueAsType = function (value, type) {
  5213. return type && typeof value === "number"
  5214. ? type.transform(value)
  5215. : value;
  5216. };
  5217. ;// CONCATENATED MODULE: ./node_modules/style-value-types/dist/es/utils.mjs
  5218. const clamp = (min, max) => (v) => Math.max(Math.min(v, max), min);
  5219. const sanitize = (v) => (v % 1 ? Number(v.toFixed(5)) : v);
  5220. const floatRegex = /(-)?([\d]*\.?[\d])+/g;
  5221. 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;
  5222. const singleColorRegex = /^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i;
  5223. function isString(v) {
  5224. return typeof v === 'string';
  5225. }
  5226. ;// CONCATENATED MODULE: ./node_modules/style-value-types/dist/es/numbers/units.mjs
  5227. const createUnitType = (unit) => ({
  5228. test: (v) => isString(v) && v.endsWith(unit) && v.split(' ').length === 1,
  5229. parse: parseFloat,
  5230. transform: (v) => `${v}${unit}`,
  5231. });
  5232. const degrees = createUnitType('deg');
  5233. const percent = createUnitType('%');
  5234. const px = createUnitType('px');
  5235. const vh = createUnitType('vh');
  5236. const vw = createUnitType('vw');
  5237. const progressPercentage = Object.assign(Object.assign({}, percent), { parse: (v) => percent.parse(v) / 100, transform: (v) => percent.transform(v * 100) });
  5238. ;// CONCATENATED MODULE: ./node_modules/style-value-types/dist/es/numbers/index.mjs
  5239. const number = {
  5240. test: (v) => typeof v === 'number',
  5241. parse: parseFloat,
  5242. transform: (v) => v,
  5243. };
  5244. const alpha = Object.assign(Object.assign({}, number), { transform: clamp(0, 1) });
  5245. const scale = Object.assign(Object.assign({}, number), { default: 1 });
  5246. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/type-int.mjs
  5247. var type_int_int = __assign(__assign({}, number), { transform: Math.round });
  5248. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/number.mjs
  5249. var numberValueTypes = {
  5250. // Border props
  5251. borderWidth: px,
  5252. borderTopWidth: px,
  5253. borderRightWidth: px,
  5254. borderBottomWidth: px,
  5255. borderLeftWidth: px,
  5256. borderRadius: px,
  5257. radius: px,
  5258. borderTopLeftRadius: px,
  5259. borderTopRightRadius: px,
  5260. borderBottomRightRadius: px,
  5261. borderBottomLeftRadius: px,
  5262. // Positioning props
  5263. width: px,
  5264. maxWidth: px,
  5265. height: px,
  5266. maxHeight: px,
  5267. size: px,
  5268. top: px,
  5269. right: px,
  5270. bottom: px,
  5271. left: px,
  5272. // Spacing props
  5273. padding: px,
  5274. paddingTop: px,
  5275. paddingRight: px,
  5276. paddingBottom: px,
  5277. paddingLeft: px,
  5278. margin: px,
  5279. marginTop: px,
  5280. marginRight: px,
  5281. marginBottom: px,
  5282. marginLeft: px,
  5283. // Transform props
  5284. rotate: degrees,
  5285. rotateX: degrees,
  5286. rotateY: degrees,
  5287. rotateZ: degrees,
  5288. scale: scale,
  5289. scaleX: scale,
  5290. scaleY: scale,
  5291. scaleZ: scale,
  5292. skew: degrees,
  5293. skewX: degrees,
  5294. skewY: degrees,
  5295. distance: px,
  5296. translateX: px,
  5297. translateY: px,
  5298. translateZ: px,
  5299. x: px,
  5300. y: px,
  5301. z: px,
  5302. perspective: px,
  5303. transformPerspective: px,
  5304. opacity: alpha,
  5305. originX: progressPercentage,
  5306. originY: progressPercentage,
  5307. originZ: px,
  5308. // Misc
  5309. zIndex: type_int_int,
  5310. // SVG
  5311. fillOpacity: alpha,
  5312. strokeOpacity: alpha,
  5313. numOctaves: type_int_int,
  5314. };
  5315. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/utils/build-styles.mjs
  5316. function buildHTMLStyles(state, latestValues, options, transformTemplate) {
  5317. var _a;
  5318. var style = state.style, vars = state.vars, transform = state.transform, transformKeys = state.transformKeys, transformOrigin = state.transformOrigin;
  5319. // Empty the transformKeys array. As we're throwing out refs to its items
  5320. // this might not be as cheap as suspected. Maybe using the array as a buffer
  5321. // with a manual incrementation would be better.
  5322. transformKeys.length = 0;
  5323. // Track whether we encounter any transform or transformOrigin values.
  5324. var hasTransform = false;
  5325. var hasTransformOrigin = false;
  5326. // Does the calculated transform essentially equal "none"?
  5327. var transformIsNone = true;
  5328. /**
  5329. * Loop over all our latest animated values and decide whether to handle them
  5330. * as a style or CSS variable.
  5331. *
  5332. * Transforms and transform origins are kept seperately for further processing.
  5333. */
  5334. for (var key in latestValues) {
  5335. var value = latestValues[key];
  5336. /**
  5337. * If this is a CSS variable we don't do any further processing.
  5338. */
  5339. if (isCSSVariable(key)) {
  5340. vars[key] = value;
  5341. continue;
  5342. }
  5343. // Convert the value to its default value type, ie 0 -> "0px"
  5344. var valueType = numberValueTypes[key];
  5345. var valueAsType = getValueAsType(value, valueType);
  5346. if (isTransformProp(key)) {
  5347. // If this is a transform, flag to enable further transform processing
  5348. hasTransform = true;
  5349. transform[key] = valueAsType;
  5350. transformKeys.push(key);
  5351. // If we already know we have a non-default transform, early return
  5352. if (!transformIsNone)
  5353. continue;
  5354. // Otherwise check to see if this is a default transform
  5355. if (value !== ((_a = valueType.default) !== null && _a !== void 0 ? _a : 0))
  5356. transformIsNone = false;
  5357. }
  5358. else if (isTransformOriginProp(key)) {
  5359. transformOrigin[key] = valueAsType;
  5360. // If this is a transform origin, flag and enable further transform-origin processing
  5361. hasTransformOrigin = true;
  5362. }
  5363. else {
  5364. style[key] = valueAsType;
  5365. }
  5366. }
  5367. if (hasTransform) {
  5368. style.transform = buildTransform(state, options, transformIsNone, transformTemplate);
  5369. }
  5370. else if (transformTemplate) {
  5371. style.transform = transformTemplate({}, "");
  5372. }
  5373. else if (!latestValues.transform && style.transform) {
  5374. style.transform = "none";
  5375. }
  5376. if (hasTransformOrigin) {
  5377. style.transformOrigin = buildTransformOrigin(transformOrigin);
  5378. }
  5379. }
  5380. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/utils/create-render-state.mjs
  5381. var createHtmlRenderState = function () { return ({
  5382. style: {},
  5383. transform: {},
  5384. transformKeys: [],
  5385. transformOrigin: {},
  5386. vars: {},
  5387. }); };
  5388. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/use-props.mjs
  5389. function copyRawValuesOnly(target, source, props) {
  5390. for (var key in source) {
  5391. if (!isMotionValue(source[key]) && !isForcedMotionValue(key, props)) {
  5392. target[key] = source[key];
  5393. }
  5394. }
  5395. }
  5396. function useInitialMotionValues(_a, visualState, isStatic) {
  5397. var transformTemplate = _a.transformTemplate;
  5398. return (0,external_React_namespaceObject.useMemo)(function () {
  5399. var state = createHtmlRenderState();
  5400. buildHTMLStyles(state, visualState, { enableHardwareAcceleration: !isStatic }, transformTemplate);
  5401. var vars = state.vars, style = state.style;
  5402. return __assign(__assign({}, vars), style);
  5403. }, [visualState]);
  5404. }
  5405. function useStyle(props, visualState, isStatic) {
  5406. var styleProp = props.style || {};
  5407. var style = {};
  5408. /**
  5409. * Copy non-Motion Values straight into style
  5410. */
  5411. copyRawValuesOnly(style, styleProp, props);
  5412. Object.assign(style, useInitialMotionValues(props, visualState, isStatic));
  5413. if (props.transformValues) {
  5414. style = props.transformValues(style);
  5415. }
  5416. return style;
  5417. }
  5418. function useHTMLProps(props, visualState, isStatic) {
  5419. // The `any` isn't ideal but it is the type of createElement props argument
  5420. var htmlProps = {};
  5421. var style = useStyle(props, visualState, isStatic);
  5422. if (Boolean(props.drag) && props.dragListener !== false) {
  5423. // Disable the ghost element when a user drags
  5424. htmlProps.draggable = false;
  5425. // Disable text selection
  5426. style.userSelect =
  5427. style.WebkitUserSelect =
  5428. style.WebkitTouchCallout =
  5429. "none";
  5430. // Disable scrolling on the draggable direction
  5431. style.touchAction =
  5432. props.drag === true
  5433. ? "none"
  5434. : "pan-".concat(props.drag === "x" ? "y" : "x");
  5435. }
  5436. htmlProps.style = style;
  5437. return htmlProps;
  5438. }
  5439. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/utils/valid-prop.mjs
  5440. /**
  5441. * A list of all valid MotionProps.
  5442. *
  5443. * @privateRemarks
  5444. * This doesn't throw if a `MotionProp` name is missing - it should.
  5445. */
  5446. var validMotionProps = new Set([
  5447. "initial",
  5448. "animate",
  5449. "exit",
  5450. "style",
  5451. "variants",
  5452. "transition",
  5453. "transformTemplate",
  5454. "transformValues",
  5455. "custom",
  5456. "inherit",
  5457. "layout",
  5458. "layoutId",
  5459. "layoutDependency",
  5460. "onLayoutAnimationStart",
  5461. "onLayoutAnimationComplete",
  5462. "onLayoutMeasure",
  5463. "onBeforeLayoutMeasure",
  5464. "onAnimationStart",
  5465. "onAnimationComplete",
  5466. "onUpdate",
  5467. "onDragStart",
  5468. "onDrag",
  5469. "onDragEnd",
  5470. "onMeasureDragConstraints",
  5471. "onDirectionLock",
  5472. "onDragTransitionEnd",
  5473. "drag",
  5474. "dragControls",
  5475. "dragListener",
  5476. "dragConstraints",
  5477. "dragDirectionLock",
  5478. "dragSnapToOrigin",
  5479. "_dragX",
  5480. "_dragY",
  5481. "dragElastic",
  5482. "dragMomentum",
  5483. "dragPropagation",
  5484. "dragTransition",
  5485. "whileDrag",
  5486. "onPan",
  5487. "onPanStart",
  5488. "onPanEnd",
  5489. "onPanSessionStart",
  5490. "onTap",
  5491. "onTapStart",
  5492. "onTapCancel",
  5493. "onHoverStart",
  5494. "onHoverEnd",
  5495. "whileFocus",
  5496. "whileTap",
  5497. "whileHover",
  5498. "whileInView",
  5499. "onViewportEnter",
  5500. "onViewportLeave",
  5501. "viewport",
  5502. "layoutScroll",
  5503. ]);
  5504. /**
  5505. * Check whether a prop name is a valid `MotionProp` key.
  5506. *
  5507. * @param key - Name of the property to check
  5508. * @returns `true` is key is a valid `MotionProp`.
  5509. *
  5510. * @public
  5511. */
  5512. function isValidMotionProp(key) {
  5513. return validMotionProps.has(key);
  5514. }
  5515. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/filter-props.mjs
  5516. var shouldForward = function (key) { return !isValidMotionProp(key); };
  5517. function loadExternalIsValidProp(isValidProp) {
  5518. if (!isValidProp)
  5519. return;
  5520. // Explicitly filter our events
  5521. shouldForward = function (key) {
  5522. return key.startsWith("on") ? !isValidMotionProp(key) : isValidProp(key);
  5523. };
  5524. }
  5525. /**
  5526. * Emotion and Styled Components both allow users to pass through arbitrary props to their components
  5527. * to dynamically generate CSS. They both use the `@emotion/is-prop-valid` package to determine which
  5528. * of these should be passed to the underlying DOM node.
  5529. *
  5530. * However, when styling a Motion component `styled(motion.div)`, both packages pass through *all* props
  5531. * as it's seen as an arbitrary component rather than a DOM node. Motion only allows arbitrary props
  5532. * passed through the `custom` prop so it doesn't *need* the payload or computational overhead of
  5533. * `@emotion/is-prop-valid`, however to fix this problem we need to use it.
  5534. *
  5535. * By making it an optionalDependency we can offer this functionality only in the situations where it's
  5536. * actually required.
  5537. */
  5538. try {
  5539. /**
  5540. * We attempt to import this package but require won't be defined in esm environments, in that case
  5541. * isPropValid will have to be provided via `MotionContext`. In a 6.0.0 this should probably be removed
  5542. * in favour of explicit injection.
  5543. */
  5544. loadExternalIsValidProp(require("@emotion/is-prop-valid").default);
  5545. }
  5546. catch (_a) {
  5547. // We don't need to actually do anything here - the fallback is the existing `isPropValid`.
  5548. }
  5549. function filterProps(props, isDom, forwardMotionProps) {
  5550. var filteredProps = {};
  5551. for (var key in props) {
  5552. if (shouldForward(key) ||
  5553. (forwardMotionProps === true && isValidMotionProp(key)) ||
  5554. (!isDom && !isValidMotionProp(key)) ||
  5555. // If trying to use native HTML drag events, forward drag listeners
  5556. (props["draggable"] && key.startsWith("onDrag"))) {
  5557. filteredProps[key] = props[key];
  5558. }
  5559. }
  5560. return filteredProps;
  5561. }
  5562. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/utils/transform-origin.mjs
  5563. function calcOrigin(origin, offset, size) {
  5564. return typeof origin === "string"
  5565. ? origin
  5566. : px.transform(offset + size * origin);
  5567. }
  5568. /**
  5569. * The SVG transform origin defaults are different to CSS and is less intuitive,
  5570. * so we use the measured dimensions of the SVG to reconcile these.
  5571. */
  5572. function calcSVGTransformOrigin(dimensions, originX, originY) {
  5573. var pxOriginX = calcOrigin(originX, dimensions.x, dimensions.width);
  5574. var pxOriginY = calcOrigin(originY, dimensions.y, dimensions.height);
  5575. return "".concat(pxOriginX, " ").concat(pxOriginY);
  5576. }
  5577. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/utils/path.mjs
  5578. var dashKeys = {
  5579. offset: "stroke-dashoffset",
  5580. array: "stroke-dasharray",
  5581. };
  5582. var camelKeys = {
  5583. offset: "strokeDashoffset",
  5584. array: "strokeDasharray",
  5585. };
  5586. /**
  5587. * Build SVG path properties. Uses the path's measured length to convert
  5588. * our custom pathLength, pathSpacing and pathOffset into stroke-dashoffset
  5589. * and stroke-dasharray attributes.
  5590. *
  5591. * This function is mutative to reduce per-frame GC.
  5592. */
  5593. function buildSVGPath(attrs, length, spacing, offset, useDashCase) {
  5594. if (spacing === void 0) { spacing = 1; }
  5595. if (offset === void 0) { offset = 0; }
  5596. if (useDashCase === void 0) { useDashCase = true; }
  5597. // Normalise path length by setting SVG attribute pathLength to 1
  5598. attrs.pathLength = 1;
  5599. // We use dash case when setting attributes directly to the DOM node and camel case
  5600. // when defining props on a React component.
  5601. var keys = useDashCase ? dashKeys : camelKeys;
  5602. // Build the dash offset
  5603. attrs[keys.offset] = px.transform(-offset);
  5604. // Build the dash array
  5605. var pathLength = px.transform(length);
  5606. var pathSpacing = px.transform(spacing);
  5607. attrs[keys.array] = "".concat(pathLength, " ").concat(pathSpacing);
  5608. }
  5609. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/utils/build-attrs.mjs
  5610. /**
  5611. * Build SVG visual attrbutes, like cx and style.transform
  5612. */
  5613. function buildSVGAttrs(state, _a, options, transformTemplate) {
  5614. 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,
  5615. // This is object creation, which we try to avoid per-frame.
  5616. latest = __rest(_a, ["attrX", "attrY", "originX", "originY", "pathLength", "pathSpacing", "pathOffset"]);
  5617. buildHTMLStyles(state, latest, options, transformTemplate);
  5618. state.attrs = state.style;
  5619. state.style = {};
  5620. var attrs = state.attrs, style = state.style, dimensions = state.dimensions;
  5621. /**
  5622. * However, we apply transforms as CSS transforms. So if we detect a transform we take it from attrs
  5623. * and copy it into style.
  5624. */
  5625. if (attrs.transform) {
  5626. if (dimensions)
  5627. style.transform = attrs.transform;
  5628. delete attrs.transform;
  5629. }
  5630. // Parse transformOrigin
  5631. if (dimensions &&
  5632. (originX !== undefined || originY !== undefined || style.transform)) {
  5633. style.transformOrigin = calcSVGTransformOrigin(dimensions, originX !== undefined ? originX : 0.5, originY !== undefined ? originY : 0.5);
  5634. }
  5635. // Treat x/y not as shortcuts but as actual attributes
  5636. if (attrX !== undefined)
  5637. attrs.x = attrX;
  5638. if (attrY !== undefined)
  5639. attrs.y = attrY;
  5640. // Build SVG path if one has been defined
  5641. if (pathLength !== undefined) {
  5642. buildSVGPath(attrs, pathLength, pathSpacing, pathOffset, false);
  5643. }
  5644. }
  5645. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/utils/create-render-state.mjs
  5646. var createSvgRenderState = function () { return (__assign(__assign({}, createHtmlRenderState()), { attrs: {} })); };
  5647. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/use-props.mjs
  5648. function useSVGProps(props, visualState) {
  5649. var visualProps = (0,external_React_namespaceObject.useMemo)(function () {
  5650. var state = createSvgRenderState();
  5651. buildSVGAttrs(state, visualState, { enableHardwareAcceleration: false }, props.transformTemplate);
  5652. return __assign(__assign({}, state.attrs), { style: __assign({}, state.style) });
  5653. }, [visualState]);
  5654. if (props.style) {
  5655. var rawStyles = {};
  5656. copyRawValuesOnly(rawStyles, props.style, props);
  5657. visualProps.style = __assign(__assign({}, rawStyles), visualProps.style);
  5658. }
  5659. return visualProps;
  5660. }
  5661. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/use-render.mjs
  5662. function createUseRender(forwardMotionProps) {
  5663. if (forwardMotionProps === void 0) { forwardMotionProps = false; }
  5664. var useRender = function (Component, props, projectionId, ref, _a, isStatic) {
  5665. var latestValues = _a.latestValues;
  5666. var useVisualProps = isSVGComponent(Component)
  5667. ? useSVGProps
  5668. : useHTMLProps;
  5669. var visualProps = useVisualProps(props, latestValues, isStatic);
  5670. var filteredProps = filterProps(props, typeof Component === "string", forwardMotionProps);
  5671. var elementProps = __assign(__assign(__assign({}, filteredProps), visualProps), { ref: ref });
  5672. if (projectionId) {
  5673. elementProps["data-projection-id"] = projectionId;
  5674. }
  5675. return (0,external_React_namespaceObject.createElement)(Component, elementProps);
  5676. };
  5677. return useRender;
  5678. }
  5679. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/camel-to-dash.mjs
  5680. var CAMEL_CASE_PATTERN = /([a-z])([A-Z])/g;
  5681. var REPLACE_TEMPLATE = "$1-$2";
  5682. /**
  5683. * Convert camelCase to dash-case properties.
  5684. */
  5685. var camelToDash = function (str) {
  5686. return str.replace(CAMEL_CASE_PATTERN, REPLACE_TEMPLATE).toLowerCase();
  5687. };
  5688. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/utils/render.mjs
  5689. function renderHTML(element, _a, styleProp, projection) {
  5690. var style = _a.style, vars = _a.vars;
  5691. Object.assign(element.style, style, projection && projection.getProjectionStyles(styleProp));
  5692. // Loop over any CSS variables and assign those.
  5693. for (var key in vars) {
  5694. element.style.setProperty(key, vars[key]);
  5695. }
  5696. }
  5697. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/utils/camel-case-attrs.mjs
  5698. /**
  5699. * A set of attribute names that are always read/written as camel case.
  5700. */
  5701. var camelCaseAttributes = new Set([
  5702. "baseFrequency",
  5703. "diffuseConstant",
  5704. "kernelMatrix",
  5705. "kernelUnitLength",
  5706. "keySplines",
  5707. "keyTimes",
  5708. "limitingConeAngle",
  5709. "markerHeight",
  5710. "markerWidth",
  5711. "numOctaves",
  5712. "targetX",
  5713. "targetY",
  5714. "surfaceScale",
  5715. "specularConstant",
  5716. "specularExponent",
  5717. "stdDeviation",
  5718. "tableValues",
  5719. "viewBox",
  5720. "gradientTransform",
  5721. "pathLength",
  5722. ]);
  5723. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/utils/render.mjs
  5724. function renderSVG(element, renderState, _styleProp, projection) {
  5725. renderHTML(element, renderState, undefined, projection);
  5726. for (var key in renderState.attrs) {
  5727. element.setAttribute(!camelCaseAttributes.has(key) ? camelToDash(key) : key, renderState.attrs[key]);
  5728. }
  5729. }
  5730. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/utils/scrape-motion-values.mjs
  5731. function scrapeMotionValuesFromProps(props) {
  5732. var style = props.style;
  5733. var newValues = {};
  5734. for (var key in style) {
  5735. if (isMotionValue(style[key]) || isForcedMotionValue(key, props)) {
  5736. newValues[key] = style[key];
  5737. }
  5738. }
  5739. return newValues;
  5740. }
  5741. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/utils/scrape-motion-values.mjs
  5742. function scrape_motion_values_scrapeMotionValuesFromProps(props) {
  5743. var newValues = scrapeMotionValuesFromProps(props);
  5744. for (var key in props) {
  5745. if (isMotionValue(props[key])) {
  5746. var targetKey = key === "x" || key === "y" ? "attr" + key.toUpperCase() : key;
  5747. newValues[targetKey] = props[key];
  5748. }
  5749. }
  5750. return newValues;
  5751. }
  5752. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/utils/is-animation-controls.mjs
  5753. function isAnimationControls(v) {
  5754. return typeof v === "object" && typeof v.start === "function";
  5755. }
  5756. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/utils/is-keyframes-target.mjs
  5757. var isKeyframesTarget = function (v) {
  5758. return Array.isArray(v);
  5759. };
  5760. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/resolve-value.mjs
  5761. var isCustomValue = function (v) {
  5762. return Boolean(v && typeof v === "object" && v.mix && v.toValue);
  5763. };
  5764. var resolveFinalValueInKeyframes = function (v) {
  5765. // TODO maybe throw if v.length - 1 is placeholder token?
  5766. return isKeyframesTarget(v) ? v[v.length - 1] || 0 : v;
  5767. };
  5768. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/value/utils/resolve-motion-value.mjs
  5769. /**
  5770. * If the provided value is a MotionValue, this returns the actual value, otherwise just the value itself
  5771. *
  5772. * TODO: Remove and move to library
  5773. */
  5774. function resolveMotionValue(value) {
  5775. var unwrappedValue = isMotionValue(value) ? value.get() : value;
  5776. return isCustomValue(unwrappedValue)
  5777. ? unwrappedValue.toValue()
  5778. : unwrappedValue;
  5779. }
  5780. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/utils/use-visual-state.mjs
  5781. function makeState(_a, props, context, presenceContext) {
  5782. var scrapeMotionValuesFromProps = _a.scrapeMotionValuesFromProps, createRenderState = _a.createRenderState, onMount = _a.onMount;
  5783. var state = {
  5784. latestValues: makeLatestValues(props, context, presenceContext, scrapeMotionValuesFromProps),
  5785. renderState: createRenderState(),
  5786. };
  5787. if (onMount) {
  5788. state.mount = function (instance) { return onMount(props, instance, state); };
  5789. }
  5790. return state;
  5791. }
  5792. var makeUseVisualState = function (config) {
  5793. return function (props, isStatic) {
  5794. var context = (0,external_React_namespaceObject.useContext)(MotionContext);
  5795. var presenceContext = (0,external_React_namespaceObject.useContext)(PresenceContext_PresenceContext);
  5796. return isStatic
  5797. ? makeState(config, props, context, presenceContext)
  5798. : useConstant(function () {
  5799. return makeState(config, props, context, presenceContext);
  5800. });
  5801. };
  5802. };
  5803. function makeLatestValues(props, context, presenceContext, scrapeMotionValues) {
  5804. var values = {};
  5805. var blockInitialAnimation = (presenceContext === null || presenceContext === void 0 ? void 0 : presenceContext.initial) === false;
  5806. var motionValues = scrapeMotionValues(props);
  5807. for (var key in motionValues) {
  5808. values[key] = resolveMotionValue(motionValues[key]);
  5809. }
  5810. var initial = props.initial, animate = props.animate;
  5811. var isControllingVariants = checkIfControllingVariants(props);
  5812. var isVariantNode = checkIfVariantNode(props);
  5813. if (context &&
  5814. isVariantNode &&
  5815. !isControllingVariants &&
  5816. props.inherit !== false) {
  5817. initial !== null && initial !== void 0 ? initial : (initial = context.initial);
  5818. animate !== null && animate !== void 0 ? animate : (animate = context.animate);
  5819. }
  5820. var initialAnimationIsBlocked = blockInitialAnimation || initial === false;
  5821. var variantToSet = initialAnimationIsBlocked ? animate : initial;
  5822. if (variantToSet &&
  5823. typeof variantToSet !== "boolean" &&
  5824. !isAnimationControls(variantToSet)) {
  5825. var list = Array.isArray(variantToSet) ? variantToSet : [variantToSet];
  5826. list.forEach(function (definition) {
  5827. var resolved = resolveVariantFromProps(props, definition);
  5828. if (!resolved)
  5829. return;
  5830. var transitionEnd = resolved.transitionEnd; resolved.transition; var target = __rest(resolved, ["transitionEnd", "transition"]);
  5831. for (var key in target) {
  5832. var valueTarget = target[key];
  5833. if (Array.isArray(valueTarget)) {
  5834. /**
  5835. * Take final keyframe if the initial animation is blocked because
  5836. * we want to initialise at the end of that blocked animation.
  5837. */
  5838. var index = initialAnimationIsBlocked
  5839. ? valueTarget.length - 1
  5840. : 0;
  5841. valueTarget = valueTarget[index];
  5842. }
  5843. if (valueTarget !== null) {
  5844. values[key] = valueTarget;
  5845. }
  5846. }
  5847. for (var key in transitionEnd)
  5848. values[key] = transitionEnd[key];
  5849. });
  5850. }
  5851. return values;
  5852. }
  5853. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/config-motion.mjs
  5854. var svgMotionConfig = {
  5855. useVisualState: makeUseVisualState({
  5856. scrapeMotionValuesFromProps: scrape_motion_values_scrapeMotionValuesFromProps,
  5857. createRenderState: createSvgRenderState,
  5858. onMount: function (props, instance, _a) {
  5859. var renderState = _a.renderState, latestValues = _a.latestValues;
  5860. try {
  5861. renderState.dimensions =
  5862. typeof instance.getBBox ===
  5863. "function"
  5864. ? instance.getBBox()
  5865. : instance.getBoundingClientRect();
  5866. }
  5867. catch (e) {
  5868. // Most likely trying to measure an unrendered element under Firefox
  5869. renderState.dimensions = {
  5870. x: 0,
  5871. y: 0,
  5872. width: 0,
  5873. height: 0,
  5874. };
  5875. }
  5876. buildSVGAttrs(renderState, latestValues, { enableHardwareAcceleration: false }, props.transformTemplate);
  5877. renderSVG(instance, renderState);
  5878. },
  5879. }),
  5880. };
  5881. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/config-motion.mjs
  5882. var htmlMotionConfig = {
  5883. useVisualState: makeUseVisualState({
  5884. scrapeMotionValuesFromProps: scrapeMotionValuesFromProps,
  5885. createRenderState: createHtmlRenderState,
  5886. }),
  5887. };
  5888. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/create-config.mjs
  5889. function create_config_createDomMotionConfig(Component, _a, preloadedFeatures, createVisualElement, projectionNodeConstructor) {
  5890. var _b = _a.forwardMotionProps, forwardMotionProps = _b === void 0 ? false : _b;
  5891. var baseConfig = isSVGComponent(Component)
  5892. ? svgMotionConfig
  5893. : htmlMotionConfig;
  5894. return __assign(__assign({}, baseConfig), { preloadedFeatures: preloadedFeatures, useRender: createUseRender(forwardMotionProps), createVisualElement: createVisualElement, projectionNodeConstructor: projectionNodeConstructor, Component: Component });
  5895. }
  5896. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/types.mjs
  5897. var AnimationType;
  5898. (function (AnimationType) {
  5899. AnimationType["Animate"] = "animate";
  5900. AnimationType["Hover"] = "whileHover";
  5901. AnimationType["Tap"] = "whileTap";
  5902. AnimationType["Drag"] = "whileDrag";
  5903. AnimationType["Focus"] = "whileFocus";
  5904. AnimationType["InView"] = "whileInView";
  5905. AnimationType["Exit"] = "exit";
  5906. })(AnimationType || (AnimationType = {}));
  5907. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/events/use-dom-event.mjs
  5908. function addDomEvent(target, eventName, handler, options) {
  5909. if (options === void 0) { options = { passive: true }; }
  5910. target.addEventListener(eventName, handler, options);
  5911. return function () { return target.removeEventListener(eventName, handler); };
  5912. }
  5913. /**
  5914. * Attaches an event listener directly to the provided DOM element.
  5915. *
  5916. * Bypassing React's event system can be desirable, for instance when attaching non-passive
  5917. * event handlers.
  5918. *
  5919. * ```jsx
  5920. * const ref = useRef(null)
  5921. *
  5922. * useDomEvent(ref, 'wheel', onWheel, { passive: false })
  5923. *
  5924. * return <div ref={ref} />
  5925. * ```
  5926. *
  5927. * @param ref - React.RefObject that's been provided to the element you want to bind the listener to.
  5928. * @param eventName - Name of the event you want listen for.
  5929. * @param handler - Function to fire when receiving the event.
  5930. * @param options - Options to pass to `Event.addEventListener`.
  5931. *
  5932. * @public
  5933. */
  5934. function useDomEvent(ref, eventName, handler, options) {
  5935. (0,external_React_namespaceObject.useEffect)(function () {
  5936. var element = ref.current;
  5937. if (handler && element) {
  5938. return addDomEvent(element, eventName, handler, options);
  5939. }
  5940. }, [ref, eventName, handler, options]);
  5941. }
  5942. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/use-focus-gesture.mjs
  5943. /**
  5944. *
  5945. * @param props
  5946. * @param ref
  5947. * @internal
  5948. */
  5949. function useFocusGesture(_a) {
  5950. var whileFocus = _a.whileFocus, visualElement = _a.visualElement;
  5951. var onFocus = function () {
  5952. var _a;
  5953. (_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.Focus, true);
  5954. };
  5955. var onBlur = function () {
  5956. var _a;
  5957. (_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.Focus, false);
  5958. };
  5959. useDomEvent(visualElement, "focus", whileFocus ? onFocus : undefined);
  5960. useDomEvent(visualElement, "blur", whileFocus ? onBlur : undefined);
  5961. }
  5962. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/utils/event-type.mjs
  5963. function isMouseEvent(event) {
  5964. // PointerEvent inherits from MouseEvent so we can't use a straight instanceof check.
  5965. if (typeof PointerEvent !== "undefined" && event instanceof PointerEvent) {
  5966. return !!(event.pointerType === "mouse");
  5967. }
  5968. return event instanceof MouseEvent;
  5969. }
  5970. function isTouchEvent(event) {
  5971. var hasTouches = !!event.touches;
  5972. return hasTouches;
  5973. }
  5974. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/events/event-info.mjs
  5975. /**
  5976. * Filters out events not attached to the primary pointer (currently left mouse button)
  5977. * @param eventHandler
  5978. */
  5979. function filterPrimaryPointer(eventHandler) {
  5980. return function (event) {
  5981. var isMouseEvent = event instanceof MouseEvent;
  5982. var isPrimaryPointer = !isMouseEvent ||
  5983. (isMouseEvent && event.button === 0);
  5984. if (isPrimaryPointer) {
  5985. eventHandler(event);
  5986. }
  5987. };
  5988. }
  5989. var defaultPagePoint = { pageX: 0, pageY: 0 };
  5990. function pointFromTouch(e, pointType) {
  5991. if (pointType === void 0) { pointType = "page"; }
  5992. var primaryTouch = e.touches[0] || e.changedTouches[0];
  5993. var point = primaryTouch || defaultPagePoint;
  5994. return {
  5995. x: point[pointType + "X"],
  5996. y: point[pointType + "Y"],
  5997. };
  5998. }
  5999. function pointFromMouse(point, pointType) {
  6000. if (pointType === void 0) { pointType = "page"; }
  6001. return {
  6002. x: point[pointType + "X"],
  6003. y: point[pointType + "Y"],
  6004. };
  6005. }
  6006. function extractEventInfo(event, pointType) {
  6007. if (pointType === void 0) { pointType = "page"; }
  6008. return {
  6009. point: isTouchEvent(event)
  6010. ? pointFromTouch(event, pointType)
  6011. : pointFromMouse(event, pointType),
  6012. };
  6013. }
  6014. var wrapHandler = function (handler, shouldFilterPrimaryPointer) {
  6015. if (shouldFilterPrimaryPointer === void 0) { shouldFilterPrimaryPointer = false; }
  6016. var listener = function (event) {
  6017. return handler(event, extractEventInfo(event));
  6018. };
  6019. return shouldFilterPrimaryPointer
  6020. ? filterPrimaryPointer(listener)
  6021. : listener;
  6022. };
  6023. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/events/utils.mjs
  6024. // We check for event support via functions in case they've been mocked by a testing suite.
  6025. var supportsPointerEvents = function () {
  6026. return isBrowser && window.onpointerdown === null;
  6027. };
  6028. var supportsTouchEvents = function () {
  6029. return isBrowser && window.ontouchstart === null;
  6030. };
  6031. var supportsMouseEvents = function () {
  6032. return isBrowser && window.onmousedown === null;
  6033. };
  6034. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/events/use-pointer-event.mjs
  6035. var mouseEventNames = {
  6036. pointerdown: "mousedown",
  6037. pointermove: "mousemove",
  6038. pointerup: "mouseup",
  6039. pointercancel: "mousecancel",
  6040. pointerover: "mouseover",
  6041. pointerout: "mouseout",
  6042. pointerenter: "mouseenter",
  6043. pointerleave: "mouseleave",
  6044. };
  6045. var touchEventNames = {
  6046. pointerdown: "touchstart",
  6047. pointermove: "touchmove",
  6048. pointerup: "touchend",
  6049. pointercancel: "touchcancel",
  6050. };
  6051. function getPointerEventName(name) {
  6052. if (supportsPointerEvents()) {
  6053. return name;
  6054. }
  6055. else if (supportsTouchEvents()) {
  6056. return touchEventNames[name];
  6057. }
  6058. else if (supportsMouseEvents()) {
  6059. return mouseEventNames[name];
  6060. }
  6061. return name;
  6062. }
  6063. function addPointerEvent(target, eventName, handler, options) {
  6064. return addDomEvent(target, getPointerEventName(eventName), wrapHandler(handler, eventName === "pointerdown"), options);
  6065. }
  6066. function usePointerEvent(ref, eventName, handler, options) {
  6067. return useDomEvent(ref, getPointerEventName(eventName), handler && wrapHandler(handler, eventName === "pointerdown"), options);
  6068. }
  6069. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/drag/utils/lock.mjs
  6070. function createLock(name) {
  6071. var lock = null;
  6072. return function () {
  6073. var openLock = function () {
  6074. lock = null;
  6075. };
  6076. if (lock === null) {
  6077. lock = name;
  6078. return openLock;
  6079. }
  6080. return false;
  6081. };
  6082. }
  6083. var globalHorizontalLock = createLock("dragHorizontal");
  6084. var globalVerticalLock = createLock("dragVertical");
  6085. function getGlobalLock(drag) {
  6086. var lock = false;
  6087. if (drag === "y") {
  6088. lock = globalVerticalLock();
  6089. }
  6090. else if (drag === "x") {
  6091. lock = globalHorizontalLock();
  6092. }
  6093. else {
  6094. var openHorizontal_1 = globalHorizontalLock();
  6095. var openVertical_1 = globalVerticalLock();
  6096. if (openHorizontal_1 && openVertical_1) {
  6097. lock = function () {
  6098. openHorizontal_1();
  6099. openVertical_1();
  6100. };
  6101. }
  6102. else {
  6103. // Release the locks because we don't use them
  6104. if (openHorizontal_1)
  6105. openHorizontal_1();
  6106. if (openVertical_1)
  6107. openVertical_1();
  6108. }
  6109. }
  6110. return lock;
  6111. }
  6112. function isDragActive() {
  6113. // Check the gesture lock - if we get it, it means no drag gesture is active
  6114. // and we can safely fire the tap gesture.
  6115. var openGestureLock = getGlobalLock(true);
  6116. if (!openGestureLock)
  6117. return true;
  6118. openGestureLock();
  6119. return false;
  6120. }
  6121. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/use-hover-gesture.mjs
  6122. function createHoverEvent(visualElement, isActive, callback) {
  6123. return function (event, info) {
  6124. var _a;
  6125. if (!isMouseEvent(event) || isDragActive())
  6126. return;
  6127. /**
  6128. * Ensure we trigger animations before firing event callback
  6129. */
  6130. (_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.Hover, isActive);
  6131. callback === null || callback === void 0 ? void 0 : callback(event, info);
  6132. };
  6133. }
  6134. function useHoverGesture(_a) {
  6135. var onHoverStart = _a.onHoverStart, onHoverEnd = _a.onHoverEnd, whileHover = _a.whileHover, visualElement = _a.visualElement;
  6136. usePointerEvent(visualElement, "pointerenter", onHoverStart || whileHover
  6137. ? createHoverEvent(visualElement, true, onHoverStart)
  6138. : undefined, { passive: !onHoverStart });
  6139. usePointerEvent(visualElement, "pointerleave", onHoverEnd || whileHover
  6140. ? createHoverEvent(visualElement, false, onHoverEnd)
  6141. : undefined, { passive: !onHoverEnd });
  6142. }
  6143. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/utils/is-node-or-child.mjs
  6144. /**
  6145. * Recursively traverse up the tree to check whether the provided child node
  6146. * is the parent or a descendant of it.
  6147. *
  6148. * @param parent - Element to find
  6149. * @param child - Element to test against parent
  6150. */
  6151. var isNodeOrChild = function (parent, child) {
  6152. if (!child) {
  6153. return false;
  6154. }
  6155. else if (parent === child) {
  6156. return true;
  6157. }
  6158. else {
  6159. return isNodeOrChild(parent, child.parentElement);
  6160. }
  6161. };
  6162. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/use-unmount-effect.mjs
  6163. function useUnmountEffect(callback) {
  6164. return (0,external_React_namespaceObject.useEffect)(function () { return function () { return callback(); }; }, []);
  6165. }
  6166. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/pipe.mjs
  6167. const combineFunctions = (a, b) => (v) => b(a(v));
  6168. const pipe = (...transformers) => transformers.reduce(combineFunctions);
  6169. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/use-tap-gesture.mjs
  6170. /**
  6171. * @param handlers -
  6172. * @internal
  6173. */
  6174. function useTapGesture(_a) {
  6175. var onTap = _a.onTap, onTapStart = _a.onTapStart, onTapCancel = _a.onTapCancel, whileTap = _a.whileTap, visualElement = _a.visualElement;
  6176. var hasPressListeners = onTap || onTapStart || onTapCancel || whileTap;
  6177. var isPressing = (0,external_React_namespaceObject.useRef)(false);
  6178. var cancelPointerEndListeners = (0,external_React_namespaceObject.useRef)(null);
  6179. /**
  6180. * Only set listener to passive if there are no external listeners.
  6181. */
  6182. var eventOptions = {
  6183. passive: !(onTapStart || onTap || onTapCancel || onPointerDown),
  6184. };
  6185. function removePointerEndListener() {
  6186. var _a;
  6187. (_a = cancelPointerEndListeners.current) === null || _a === void 0 ? void 0 : _a.call(cancelPointerEndListeners);
  6188. cancelPointerEndListeners.current = null;
  6189. }
  6190. function checkPointerEnd() {
  6191. var _a;
  6192. removePointerEndListener();
  6193. isPressing.current = false;
  6194. (_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.Tap, false);
  6195. return !isDragActive();
  6196. }
  6197. function onPointerUp(event, info) {
  6198. if (!checkPointerEnd())
  6199. return;
  6200. /**
  6201. * We only count this as a tap gesture if the event.target is the same
  6202. * as, or a child of, this component's element
  6203. */
  6204. !isNodeOrChild(visualElement.getInstance(), event.target)
  6205. ? onTapCancel === null || onTapCancel === void 0 ? void 0 : onTapCancel(event, info)
  6206. : onTap === null || onTap === void 0 ? void 0 : onTap(event, info);
  6207. }
  6208. function onPointerCancel(event, info) {
  6209. if (!checkPointerEnd())
  6210. return;
  6211. onTapCancel === null || onTapCancel === void 0 ? void 0 : onTapCancel(event, info);
  6212. }
  6213. function onPointerDown(event, info) {
  6214. var _a;
  6215. removePointerEndListener();
  6216. if (isPressing.current)
  6217. return;
  6218. isPressing.current = true;
  6219. cancelPointerEndListeners.current = pipe(addPointerEvent(window, "pointerup", onPointerUp, eventOptions), addPointerEvent(window, "pointercancel", onPointerCancel, eventOptions));
  6220. /**
  6221. * Ensure we trigger animations before firing event callback
  6222. */
  6223. (_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.Tap, true);
  6224. onTapStart === null || onTapStart === void 0 ? void 0 : onTapStart(event, info);
  6225. }
  6226. usePointerEvent(visualElement, "pointerdown", hasPressListeners ? onPointerDown : undefined, eventOptions);
  6227. useUnmountEffect(removePointerEndListener);
  6228. }
  6229. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/warn-once.mjs
  6230. var warned = new Set();
  6231. function warnOnce(condition, message, element) {
  6232. if (condition || warned.has(message))
  6233. return;
  6234. console.warn(message);
  6235. if (element)
  6236. console.warn(element);
  6237. warned.add(message);
  6238. }
  6239. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/viewport/observers.mjs
  6240. /**
  6241. * Map an IntersectionHandler callback to an element. We only ever make one handler for one
  6242. * element, so even though these handlers might all be triggered by different
  6243. * observers, we can keep them in the same map.
  6244. */
  6245. var observerCallbacks = new WeakMap();
  6246. /**
  6247. * Multiple observers can be created for multiple element/document roots. Each with
  6248. * different settings. So here we store dictionaries of observers to each root,
  6249. * using serialised settings (threshold/margin) as lookup keys.
  6250. */
  6251. var observers = new WeakMap();
  6252. var fireObserverCallback = function (entry) {
  6253. var _a;
  6254. (_a = observerCallbacks.get(entry.target)) === null || _a === void 0 ? void 0 : _a(entry);
  6255. };
  6256. var fireAllObserverCallbacks = function (entries) {
  6257. entries.forEach(fireObserverCallback);
  6258. };
  6259. function initIntersectionObserver(_a) {
  6260. var root = _a.root, options = __rest(_a, ["root"]);
  6261. var lookupRoot = root || document;
  6262. /**
  6263. * If we don't have an observer lookup map for this root, create one.
  6264. */
  6265. if (!observers.has(lookupRoot)) {
  6266. observers.set(lookupRoot, {});
  6267. }
  6268. var rootObservers = observers.get(lookupRoot);
  6269. var key = JSON.stringify(options);
  6270. /**
  6271. * If we don't have an observer for this combination of root and settings,
  6272. * create one.
  6273. */
  6274. if (!rootObservers[key]) {
  6275. rootObservers[key] = new IntersectionObserver(fireAllObserverCallbacks, __assign({ root: root }, options));
  6276. }
  6277. return rootObservers[key];
  6278. }
  6279. function observeIntersection(element, options, callback) {
  6280. var rootInteresectionObserver = initIntersectionObserver(options);
  6281. observerCallbacks.set(element, callback);
  6282. rootInteresectionObserver.observe(element);
  6283. return function () {
  6284. observerCallbacks.delete(element);
  6285. rootInteresectionObserver.unobserve(element);
  6286. };
  6287. }
  6288. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/viewport/use-viewport.mjs
  6289. function useViewport(_a) {
  6290. var visualElement = _a.visualElement, whileInView = _a.whileInView, onViewportEnter = _a.onViewportEnter, onViewportLeave = _a.onViewportLeave, _b = _a.viewport, viewport = _b === void 0 ? {} : _b;
  6291. var state = (0,external_React_namespaceObject.useRef)({
  6292. hasEnteredView: false,
  6293. isInView: false,
  6294. });
  6295. var shouldObserve = Boolean(whileInView || onViewportEnter || onViewportLeave);
  6296. if (viewport.once && state.current.hasEnteredView)
  6297. shouldObserve = false;
  6298. var useObserver = typeof IntersectionObserver === "undefined"
  6299. ? useMissingIntersectionObserver
  6300. : useIntersectionObserver;
  6301. useObserver(shouldObserve, state.current, visualElement, viewport);
  6302. }
  6303. var thresholdNames = {
  6304. some: 0,
  6305. all: 1,
  6306. };
  6307. function useIntersectionObserver(shouldObserve, state, visualElement, _a) {
  6308. var root = _a.root, rootMargin = _a.margin, _b = _a.amount, amount = _b === void 0 ? "some" : _b, once = _a.once;
  6309. (0,external_React_namespaceObject.useEffect)(function () {
  6310. if (!shouldObserve)
  6311. return;
  6312. var options = {
  6313. root: root === null || root === void 0 ? void 0 : root.current,
  6314. rootMargin: rootMargin,
  6315. threshold: typeof amount === "number" ? amount : thresholdNames[amount],
  6316. };
  6317. var intersectionCallback = function (entry) {
  6318. var _a;
  6319. var isIntersecting = entry.isIntersecting;
  6320. /**
  6321. * If there's been no change in the viewport state, early return.
  6322. */
  6323. if (state.isInView === isIntersecting)
  6324. return;
  6325. state.isInView = isIntersecting;
  6326. /**
  6327. * Handle hasEnteredView. If this is only meant to run once, and
  6328. * element isn't visible, early return. Otherwise set hasEnteredView to true.
  6329. */
  6330. if (once && !isIntersecting && state.hasEnteredView) {
  6331. return;
  6332. }
  6333. else if (isIntersecting) {
  6334. state.hasEnteredView = true;
  6335. }
  6336. (_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.InView, isIntersecting);
  6337. /**
  6338. * Use the latest committed props rather than the ones in scope
  6339. * when this observer is created
  6340. */
  6341. var props = visualElement.getProps();
  6342. var callback = isIntersecting
  6343. ? props.onViewportEnter
  6344. : props.onViewportLeave;
  6345. callback === null || callback === void 0 ? void 0 : callback(entry);
  6346. };
  6347. return observeIntersection(visualElement.getInstance(), options, intersectionCallback);
  6348. }, [shouldObserve, root, rootMargin, amount]);
  6349. }
  6350. /**
  6351. * If IntersectionObserver is missing, we activate inView and fire onViewportEnter
  6352. * on mount. This way, the page will be in the state the author expects users
  6353. * to see it in for everyone.
  6354. */
  6355. function useMissingIntersectionObserver(shouldObserve, state, visualElement, _a) {
  6356. var _b = _a.fallback, fallback = _b === void 0 ? true : _b;
  6357. (0,external_React_namespaceObject.useEffect)(function () {
  6358. if (!shouldObserve || !fallback)
  6359. return;
  6360. if (env !== "production") {
  6361. warnOnce(false, "IntersectionObserver not available on this device. whileInView animations will trigger on mount.");
  6362. }
  6363. /**
  6364. * Fire this in an rAF because, at this point, the animation state
  6365. * won't have flushed for the first time and there's certain logic in
  6366. * there that behaves differently on the initial animation.
  6367. *
  6368. * This hook should be quite rarely called so setting this in an rAF
  6369. * is preferred to changing the behaviour of the animation state.
  6370. */
  6371. requestAnimationFrame(function () {
  6372. var _a;
  6373. state.hasEnteredView = true;
  6374. var onViewportEnter = visualElement.getProps().onViewportEnter;
  6375. onViewportEnter === null || onViewportEnter === void 0 ? void 0 : onViewportEnter(null);
  6376. (_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.InView, true);
  6377. });
  6378. }, [shouldObserve]);
  6379. }
  6380. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/utils/make-renderless-component.mjs
  6381. var makeRenderlessComponent = function (hook) { return function (props) {
  6382. hook(props);
  6383. return null;
  6384. }; };
  6385. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/gestures.mjs
  6386. var gestureAnimations = {
  6387. inView: makeRenderlessComponent(useViewport),
  6388. tap: makeRenderlessComponent(useTapGesture),
  6389. focus: makeRenderlessComponent(useFocusGesture),
  6390. hover: makeRenderlessComponent(useHoverGesture),
  6391. };
  6392. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/use-id.mjs
  6393. var counter = 0;
  6394. var incrementId = function () { return counter++; };
  6395. var useId = function () { return useConstant(incrementId); };
  6396. /**
  6397. * Ideally we'd use the following code to support React 18 optionally.
  6398. * But this fairly fails in Webpack (otherwise treeshaking wouldn't work at all).
  6399. * Need to come up with a different way of figuring this out.
  6400. */
  6401. // export const useId = (React as any).useId
  6402. // ? (React as any).useId
  6403. // : () => useConstant(incrementId)
  6404. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/components/AnimatePresence/use-presence.mjs
  6405. /**
  6406. * When a component is the child of `AnimatePresence`, it can use `usePresence`
  6407. * to access information about whether it's still present in the React tree.
  6408. *
  6409. * ```jsx
  6410. * import { usePresence } from "framer-motion"
  6411. *
  6412. * export const Component = () => {
  6413. * const [isPresent, safeToRemove] = usePresence()
  6414. *
  6415. * useEffect(() => {
  6416. * !isPresent && setTimeout(safeToRemove, 1000)
  6417. * }, [isPresent])
  6418. *
  6419. * return <div />
  6420. * }
  6421. * ```
  6422. *
  6423. * If `isPresent` is `false`, it means that a component has been removed the tree, but
  6424. * `AnimatePresence` won't really remove it until `safeToRemove` has been called.
  6425. *
  6426. * @public
  6427. */
  6428. function usePresence() {
  6429. var context = (0,external_React_namespaceObject.useContext)(PresenceContext_PresenceContext);
  6430. if (context === null)
  6431. return [true, null];
  6432. var isPresent = context.isPresent, onExitComplete = context.onExitComplete, register = context.register;
  6433. // It's safe to call the following hooks conditionally (after an early return) because the context will always
  6434. // either be null or non-null for the lifespan of the component.
  6435. // Replace with useId when released in React
  6436. var id = useId();
  6437. (0,external_React_namespaceObject.useEffect)(function () { return register(id); }, []);
  6438. var safeToRemove = function () { return onExitComplete === null || onExitComplete === void 0 ? void 0 : onExitComplete(id); };
  6439. return !isPresent && onExitComplete ? [false, safeToRemove] : [true];
  6440. }
  6441. /**
  6442. * Similar to `usePresence`, except `useIsPresent` simply returns whether or not the component is present.
  6443. * There is no `safeToRemove` function.
  6444. *
  6445. * ```jsx
  6446. * import { useIsPresent } from "framer-motion"
  6447. *
  6448. * export const Component = () => {
  6449. * const isPresent = useIsPresent()
  6450. *
  6451. * useEffect(() => {
  6452. * !isPresent && console.log("I've been removed!")
  6453. * }, [isPresent])
  6454. *
  6455. * return <div />
  6456. * }
  6457. * ```
  6458. *
  6459. * @public
  6460. */
  6461. function useIsPresent() {
  6462. return isPresent(useContext(PresenceContext));
  6463. }
  6464. function isPresent(context) {
  6465. return context === null ? true : context.isPresent;
  6466. }
  6467. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/shallow-compare.mjs
  6468. function shallowCompare(next, prev) {
  6469. if (!Array.isArray(prev))
  6470. return false;
  6471. var prevLength = prev.length;
  6472. if (prevLength !== next.length)
  6473. return false;
  6474. for (var i = 0; i < prevLength; i++) {
  6475. if (prev[i] !== next[i])
  6476. return false;
  6477. }
  6478. return true;
  6479. }
  6480. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/clamp.mjs
  6481. const clamp_clamp = (min, max, v) => Math.min(Math.max(v, min), max);
  6482. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/animations/utils/find-spring.mjs
  6483. const safeMin = 0.001;
  6484. const minDuration = 0.01;
  6485. const maxDuration = 10.0;
  6486. const minDamping = 0.05;
  6487. const maxDamping = 1;
  6488. function findSpring({ duration = 800, bounce = 0.25, velocity = 0, mass = 1, }) {
  6489. let envelope;
  6490. let derivative;
  6491. warning(duration <= maxDuration * 1000, "Spring duration must be 10 seconds or less");
  6492. let dampingRatio = 1 - bounce;
  6493. dampingRatio = clamp_clamp(minDamping, maxDamping, dampingRatio);
  6494. duration = clamp_clamp(minDuration, maxDuration, duration / 1000);
  6495. if (dampingRatio < 1) {
  6496. envelope = (undampedFreq) => {
  6497. const exponentialDecay = undampedFreq * dampingRatio;
  6498. const delta = exponentialDecay * duration;
  6499. const a = exponentialDecay - velocity;
  6500. const b = calcAngularFreq(undampedFreq, dampingRatio);
  6501. const c = Math.exp(-delta);
  6502. return safeMin - (a / b) * c;
  6503. };
  6504. derivative = (undampedFreq) => {
  6505. const exponentialDecay = undampedFreq * dampingRatio;
  6506. const delta = exponentialDecay * duration;
  6507. const d = delta * velocity + velocity;
  6508. const e = Math.pow(dampingRatio, 2) * Math.pow(undampedFreq, 2) * duration;
  6509. const f = Math.exp(-delta);
  6510. const g = calcAngularFreq(Math.pow(undampedFreq, 2), dampingRatio);
  6511. const factor = -envelope(undampedFreq) + safeMin > 0 ? -1 : 1;
  6512. return (factor * ((d - e) * f)) / g;
  6513. };
  6514. }
  6515. else {
  6516. envelope = (undampedFreq) => {
  6517. const a = Math.exp(-undampedFreq * duration);
  6518. const b = (undampedFreq - velocity) * duration + 1;
  6519. return -safeMin + a * b;
  6520. };
  6521. derivative = (undampedFreq) => {
  6522. const a = Math.exp(-undampedFreq * duration);
  6523. const b = (velocity - undampedFreq) * (duration * duration);
  6524. return a * b;
  6525. };
  6526. }
  6527. const initialGuess = 5 / duration;
  6528. const undampedFreq = approximateRoot(envelope, derivative, initialGuess);
  6529. duration = duration * 1000;
  6530. if (isNaN(undampedFreq)) {
  6531. return {
  6532. stiffness: 100,
  6533. damping: 10,
  6534. duration,
  6535. };
  6536. }
  6537. else {
  6538. const stiffness = Math.pow(undampedFreq, 2) * mass;
  6539. return {
  6540. stiffness,
  6541. damping: dampingRatio * 2 * Math.sqrt(mass * stiffness),
  6542. duration,
  6543. };
  6544. }
  6545. }
  6546. const rootIterations = 12;
  6547. function approximateRoot(envelope, derivative, initialGuess) {
  6548. let result = initialGuess;
  6549. for (let i = 1; i < rootIterations; i++) {
  6550. result = result - envelope(result) / derivative(result);
  6551. }
  6552. return result;
  6553. }
  6554. function calcAngularFreq(undampedFreq, dampingRatio) {
  6555. return undampedFreq * Math.sqrt(1 - dampingRatio * dampingRatio);
  6556. }
  6557. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/animations/generators/spring.mjs
  6558. const durationKeys = ["duration", "bounce"];
  6559. const physicsKeys = ["stiffness", "damping", "mass"];
  6560. function isSpringType(options, keys) {
  6561. return keys.some((key) => options[key] !== undefined);
  6562. }
  6563. function getSpringOptions(options) {
  6564. let springOptions = Object.assign({ velocity: 0.0, stiffness: 100, damping: 10, mass: 1.0, isResolvedFromDuration: false }, options);
  6565. if (!isSpringType(options, physicsKeys) &&
  6566. isSpringType(options, durationKeys)) {
  6567. const derived = findSpring(options);
  6568. springOptions = Object.assign(Object.assign(Object.assign({}, springOptions), derived), { velocity: 0.0, mass: 1.0 });
  6569. springOptions.isResolvedFromDuration = true;
  6570. }
  6571. return springOptions;
  6572. }
  6573. function spring(_a) {
  6574. var { from = 0.0, to = 1.0, restSpeed = 2, restDelta } = _a, options = __rest(_a, ["from", "to", "restSpeed", "restDelta"]);
  6575. const state = { done: false, value: from };
  6576. let { stiffness, damping, mass, velocity, duration, isResolvedFromDuration, } = getSpringOptions(options);
  6577. let resolveSpring = zero;
  6578. let resolveVelocity = zero;
  6579. function createSpring() {
  6580. const initialVelocity = velocity ? -(velocity / 1000) : 0.0;
  6581. const initialDelta = to - from;
  6582. const dampingRatio = damping / (2 * Math.sqrt(stiffness * mass));
  6583. const undampedAngularFreq = Math.sqrt(stiffness / mass) / 1000;
  6584. if (restDelta === undefined) {
  6585. restDelta = Math.min(Math.abs(to - from) / 100, 0.4);
  6586. }
  6587. if (dampingRatio < 1) {
  6588. const angularFreq = calcAngularFreq(undampedAngularFreq, dampingRatio);
  6589. resolveSpring = (t) => {
  6590. const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
  6591. return (to -
  6592. envelope *
  6593. (((initialVelocity +
  6594. dampingRatio * undampedAngularFreq * initialDelta) /
  6595. angularFreq) *
  6596. Math.sin(angularFreq * t) +
  6597. initialDelta * Math.cos(angularFreq * t)));
  6598. };
  6599. resolveVelocity = (t) => {
  6600. const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
  6601. return (dampingRatio *
  6602. undampedAngularFreq *
  6603. envelope *
  6604. ((Math.sin(angularFreq * t) *
  6605. (initialVelocity +
  6606. dampingRatio *
  6607. undampedAngularFreq *
  6608. initialDelta)) /
  6609. angularFreq +
  6610. initialDelta * Math.cos(angularFreq * t)) -
  6611. envelope *
  6612. (Math.cos(angularFreq * t) *
  6613. (initialVelocity +
  6614. dampingRatio *
  6615. undampedAngularFreq *
  6616. initialDelta) -
  6617. angularFreq *
  6618. initialDelta *
  6619. Math.sin(angularFreq * t)));
  6620. };
  6621. }
  6622. else if (dampingRatio === 1) {
  6623. resolveSpring = (t) => to -
  6624. Math.exp(-undampedAngularFreq * t) *
  6625. (initialDelta +
  6626. (initialVelocity + undampedAngularFreq * initialDelta) *
  6627. t);
  6628. }
  6629. else {
  6630. const dampedAngularFreq = undampedAngularFreq * Math.sqrt(dampingRatio * dampingRatio - 1);
  6631. resolveSpring = (t) => {
  6632. const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
  6633. const freqForT = Math.min(dampedAngularFreq * t, 300);
  6634. return (to -
  6635. (envelope *
  6636. ((initialVelocity +
  6637. dampingRatio * undampedAngularFreq * initialDelta) *
  6638. Math.sinh(freqForT) +
  6639. dampedAngularFreq *
  6640. initialDelta *
  6641. Math.cosh(freqForT))) /
  6642. dampedAngularFreq);
  6643. };
  6644. }
  6645. }
  6646. createSpring();
  6647. return {
  6648. next: (t) => {
  6649. const current = resolveSpring(t);
  6650. if (!isResolvedFromDuration) {
  6651. const currentVelocity = resolveVelocity(t) * 1000;
  6652. const isBelowVelocityThreshold = Math.abs(currentVelocity) <= restSpeed;
  6653. const isBelowDisplacementThreshold = Math.abs(to - current) <= restDelta;
  6654. state.done =
  6655. isBelowVelocityThreshold && isBelowDisplacementThreshold;
  6656. }
  6657. else {
  6658. state.done = t >= duration;
  6659. }
  6660. state.value = state.done ? to : current;
  6661. return state;
  6662. },
  6663. flipTarget: () => {
  6664. velocity = -velocity;
  6665. [from, to] = [to, from];
  6666. createSpring();
  6667. },
  6668. };
  6669. }
  6670. spring.needsInterpolation = (a, b) => typeof a === "string" || typeof b === "string";
  6671. const zero = (_t) => 0;
  6672. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/progress.mjs
  6673. const progress = (from, to, value) => {
  6674. const toFromDifference = to - from;
  6675. return toFromDifference === 0 ? 1 : (value - from) / toFromDifference;
  6676. };
  6677. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/mix.mjs
  6678. const mix = (from, to, progress) => -progress * from + progress * to + from;
  6679. ;// CONCATENATED MODULE: ./node_modules/style-value-types/dist/es/color/utils.mjs
  6680. const isColorString = (type, testProp) => (v) => {
  6681. return Boolean((isString(v) && singleColorRegex.test(v) && v.startsWith(type)) ||
  6682. (testProp && Object.prototype.hasOwnProperty.call(v, testProp)));
  6683. };
  6684. const splitColor = (aName, bName, cName) => (v) => {
  6685. if (!isString(v))
  6686. return v;
  6687. const [a, b, c, alpha] = v.match(floatRegex);
  6688. return {
  6689. [aName]: parseFloat(a),
  6690. [bName]: parseFloat(b),
  6691. [cName]: parseFloat(c),
  6692. alpha: alpha !== undefined ? parseFloat(alpha) : 1,
  6693. };
  6694. };
  6695. ;// CONCATENATED MODULE: ./node_modules/style-value-types/dist/es/color/rgba.mjs
  6696. const clampRgbUnit = clamp(0, 255);
  6697. const rgbUnit = Object.assign(Object.assign({}, number), { transform: (v) => Math.round(clampRgbUnit(v)) });
  6698. const rgba = {
  6699. test: isColorString('rgb', 'red'),
  6700. parse: splitColor('red', 'green', 'blue'),
  6701. transform: ({ red, green, blue, alpha: alpha$1 = 1 }) => 'rgba(' +
  6702. rgbUnit.transform(red) +
  6703. ', ' +
  6704. rgbUnit.transform(green) +
  6705. ', ' +
  6706. rgbUnit.transform(blue) +
  6707. ', ' +
  6708. sanitize(alpha.transform(alpha$1)) +
  6709. ')',
  6710. };
  6711. ;// CONCATENATED MODULE: ./node_modules/style-value-types/dist/es/color/hex.mjs
  6712. function parseHex(v) {
  6713. let r = '';
  6714. let g = '';
  6715. let b = '';
  6716. let a = '';
  6717. if (v.length > 5) {
  6718. r = v.substr(1, 2);
  6719. g = v.substr(3, 2);
  6720. b = v.substr(5, 2);
  6721. a = v.substr(7, 2);
  6722. }
  6723. else {
  6724. r = v.substr(1, 1);
  6725. g = v.substr(2, 1);
  6726. b = v.substr(3, 1);
  6727. a = v.substr(4, 1);
  6728. r += r;
  6729. g += g;
  6730. b += b;
  6731. a += a;
  6732. }
  6733. return {
  6734. red: parseInt(r, 16),
  6735. green: parseInt(g, 16),
  6736. blue: parseInt(b, 16),
  6737. alpha: a ? parseInt(a, 16) / 255 : 1,
  6738. };
  6739. }
  6740. const hex = {
  6741. test: isColorString('#'),
  6742. parse: parseHex,
  6743. transform: rgba.transform,
  6744. };
  6745. ;// CONCATENATED MODULE: ./node_modules/style-value-types/dist/es/color/hsla.mjs
  6746. const hsla = {
  6747. test: isColorString('hsl', 'hue'),
  6748. parse: splitColor('hue', 'saturation', 'lightness'),
  6749. transform: ({ hue, saturation, lightness, alpha: alpha$1 = 1 }) => {
  6750. return ('hsla(' +
  6751. Math.round(hue) +
  6752. ', ' +
  6753. percent.transform(sanitize(saturation)) +
  6754. ', ' +
  6755. percent.transform(sanitize(lightness)) +
  6756. ', ' +
  6757. sanitize(alpha.transform(alpha$1)) +
  6758. ')');
  6759. },
  6760. };
  6761. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/hsla-to-rgba.mjs
  6762. function hueToRgb(p, q, t) {
  6763. if (t < 0)
  6764. t += 1;
  6765. if (t > 1)
  6766. t -= 1;
  6767. if (t < 1 / 6)
  6768. return p + (q - p) * 6 * t;
  6769. if (t < 1 / 2)
  6770. return q;
  6771. if (t < 2 / 3)
  6772. return p + (q - p) * (2 / 3 - t) * 6;
  6773. return p;
  6774. }
  6775. function hslaToRgba({ hue, saturation, lightness, alpha }) {
  6776. hue /= 360;
  6777. saturation /= 100;
  6778. lightness /= 100;
  6779. let red = 0;
  6780. let green = 0;
  6781. let blue = 0;
  6782. if (!saturation) {
  6783. red = green = blue = lightness;
  6784. }
  6785. else {
  6786. const q = lightness < 0.5
  6787. ? lightness * (1 + saturation)
  6788. : lightness + saturation - lightness * saturation;
  6789. const p = 2 * lightness - q;
  6790. red = hueToRgb(p, q, hue + 1 / 3);
  6791. green = hueToRgb(p, q, hue);
  6792. blue = hueToRgb(p, q, hue - 1 / 3);
  6793. }
  6794. return {
  6795. red: Math.round(red * 255),
  6796. green: Math.round(green * 255),
  6797. blue: Math.round(blue * 255),
  6798. alpha,
  6799. };
  6800. }
  6801. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/mix-color.mjs
  6802. const mixLinearColor = (from, to, v) => {
  6803. const fromExpo = from * from;
  6804. const toExpo = to * to;
  6805. return Math.sqrt(Math.max(0, v * (toExpo - fromExpo) + fromExpo));
  6806. };
  6807. const colorTypes = [hex, rgba, hsla];
  6808. const getColorType = (v) => colorTypes.find((type) => type.test(v));
  6809. const notAnimatable = (color) => `'${color}' is not an animatable color. Use the equivalent color code instead.`;
  6810. const mixColor = (from, to) => {
  6811. let fromColorType = getColorType(from);
  6812. let toColorType = getColorType(to);
  6813. invariant(!!fromColorType, notAnimatable(from));
  6814. invariant(!!toColorType, notAnimatable(to));
  6815. let fromColor = fromColorType.parse(from);
  6816. let toColor = toColorType.parse(to);
  6817. if (fromColorType === hsla) {
  6818. fromColor = hslaToRgba(fromColor);
  6819. fromColorType = rgba;
  6820. }
  6821. if (toColorType === hsla) {
  6822. toColor = hslaToRgba(toColor);
  6823. toColorType = rgba;
  6824. }
  6825. const blended = Object.assign({}, fromColor);
  6826. return (v) => {
  6827. for (const key in blended) {
  6828. if (key !== "alpha") {
  6829. blended[key] = mixLinearColor(fromColor[key], toColor[key], v);
  6830. }
  6831. }
  6832. blended.alpha = mix(fromColor.alpha, toColor.alpha, v);
  6833. return fromColorType.transform(blended);
  6834. };
  6835. };
  6836. ;// CONCATENATED MODULE: ./node_modules/style-value-types/dist/es/color/index.mjs
  6837. const color = {
  6838. test: (v) => rgba.test(v) || hex.test(v) || hsla.test(v),
  6839. parse: (v) => {
  6840. if (rgba.test(v)) {
  6841. return rgba.parse(v);
  6842. }
  6843. else if (hsla.test(v)) {
  6844. return hsla.parse(v);
  6845. }
  6846. else {
  6847. return hex.parse(v);
  6848. }
  6849. },
  6850. transform: (v) => {
  6851. return isString(v)
  6852. ? v
  6853. : v.hasOwnProperty('red')
  6854. ? rgba.transform(v)
  6855. : hsla.transform(v);
  6856. },
  6857. };
  6858. ;// CONCATENATED MODULE: ./node_modules/style-value-types/dist/es/complex/index.mjs
  6859. const colorToken = '${c}';
  6860. const numberToken = '${n}';
  6861. function test(v) {
  6862. var _a, _b, _c, _d;
  6863. return (isNaN(v) &&
  6864. isString(v) &&
  6865. ((_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);
  6866. }
  6867. function analyse(v) {
  6868. if (typeof v === 'number')
  6869. v = `${v}`;
  6870. const values = [];
  6871. let numColors = 0;
  6872. const colors = v.match(colorRegex);
  6873. if (colors) {
  6874. numColors = colors.length;
  6875. v = v.replace(colorRegex, colorToken);
  6876. values.push(...colors.map(color.parse));
  6877. }
  6878. const numbers = v.match(floatRegex);
  6879. if (numbers) {
  6880. v = v.replace(floatRegex, numberToken);
  6881. values.push(...numbers.map(number.parse));
  6882. }
  6883. return { values, numColors, tokenised: v };
  6884. }
  6885. function parse(v) {
  6886. return analyse(v).values;
  6887. }
  6888. function createTransformer(v) {
  6889. const { values, numColors, tokenised } = analyse(v);
  6890. const numValues = values.length;
  6891. return (v) => {
  6892. let output = tokenised;
  6893. for (let i = 0; i < numValues; i++) {
  6894. output = output.replace(i < numColors ? colorToken : numberToken, i < numColors ? color.transform(v[i]) : sanitize(v[i]));
  6895. }
  6896. return output;
  6897. };
  6898. }
  6899. const convertNumbersToZero = (v) => typeof v === 'number' ? 0 : v;
  6900. function getAnimatableNone(v) {
  6901. const parsed = parse(v);
  6902. const transformer = createTransformer(v);
  6903. return transformer(parsed.map(convertNumbersToZero));
  6904. }
  6905. const complex = { test, parse, createTransformer, getAnimatableNone };
  6906. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/inc.mjs
  6907. const zeroPoint = {
  6908. x: 0,
  6909. y: 0,
  6910. z: 0
  6911. };
  6912. const isNum = (v) => typeof v === 'number';
  6913. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/mix-complex.mjs
  6914. function getMixer(origin, target) {
  6915. if (isNum(origin)) {
  6916. return (v) => mix(origin, target, v);
  6917. }
  6918. else if (color.test(origin)) {
  6919. return mixColor(origin, target);
  6920. }
  6921. else {
  6922. return mixComplex(origin, target);
  6923. }
  6924. }
  6925. const mixArray = (from, to) => {
  6926. const output = [...from];
  6927. const numValues = output.length;
  6928. const blendValue = from.map((fromThis, i) => getMixer(fromThis, to[i]));
  6929. return (v) => {
  6930. for (let i = 0; i < numValues; i++) {
  6931. output[i] = blendValue[i](v);
  6932. }
  6933. return output;
  6934. };
  6935. };
  6936. const mixObject = (origin, target) => {
  6937. const output = Object.assign(Object.assign({}, origin), target);
  6938. const blendValue = {};
  6939. for (const key in output) {
  6940. if (origin[key] !== undefined && target[key] !== undefined) {
  6941. blendValue[key] = getMixer(origin[key], target[key]);
  6942. }
  6943. }
  6944. return (v) => {
  6945. for (const key in blendValue) {
  6946. output[key] = blendValue[key](v);
  6947. }
  6948. return output;
  6949. };
  6950. };
  6951. function mix_complex_analyse(value) {
  6952. const parsed = complex.parse(value);
  6953. const numValues = parsed.length;
  6954. let numNumbers = 0;
  6955. let numRGB = 0;
  6956. let numHSL = 0;
  6957. for (let i = 0; i < numValues; i++) {
  6958. if (numNumbers || typeof parsed[i] === "number") {
  6959. numNumbers++;
  6960. }
  6961. else {
  6962. if (parsed[i].hue !== undefined) {
  6963. numHSL++;
  6964. }
  6965. else {
  6966. numRGB++;
  6967. }
  6968. }
  6969. }
  6970. return { parsed, numNumbers, numRGB, numHSL };
  6971. }
  6972. const mixComplex = (origin, target) => {
  6973. const template = complex.createTransformer(target);
  6974. const originStats = mix_complex_analyse(origin);
  6975. const targetStats = mix_complex_analyse(target);
  6976. const canInterpolate = originStats.numHSL === targetStats.numHSL &&
  6977. originStats.numRGB === targetStats.numRGB &&
  6978. originStats.numNumbers >= targetStats.numNumbers;
  6979. if (canInterpolate) {
  6980. return pipe(mixArray(originStats.parsed, targetStats.parsed), template);
  6981. }
  6982. else {
  6983. 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.`);
  6984. return (p) => `${p > 0 ? target : origin}`;
  6985. }
  6986. };
  6987. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/interpolate.mjs
  6988. const mixNumber = (from, to) => (p) => mix(from, to, p);
  6989. function detectMixerFactory(v) {
  6990. if (typeof v === 'number') {
  6991. return mixNumber;
  6992. }
  6993. else if (typeof v === 'string') {
  6994. if (color.test(v)) {
  6995. return mixColor;
  6996. }
  6997. else {
  6998. return mixComplex;
  6999. }
  7000. }
  7001. else if (Array.isArray(v)) {
  7002. return mixArray;
  7003. }
  7004. else if (typeof v === 'object') {
  7005. return mixObject;
  7006. }
  7007. }
  7008. function createMixers(output, ease, customMixer) {
  7009. const mixers = [];
  7010. const mixerFactory = customMixer || detectMixerFactory(output[0]);
  7011. const numMixers = output.length - 1;
  7012. for (let i = 0; i < numMixers; i++) {
  7013. let mixer = mixerFactory(output[i], output[i + 1]);
  7014. if (ease) {
  7015. const easingFunction = Array.isArray(ease) ? ease[i] : ease;
  7016. mixer = pipe(easingFunction, mixer);
  7017. }
  7018. mixers.push(mixer);
  7019. }
  7020. return mixers;
  7021. }
  7022. function fastInterpolate([from, to], [mixer]) {
  7023. return (v) => mixer(progress(from, to, v));
  7024. }
  7025. function slowInterpolate(input, mixers) {
  7026. const inputLength = input.length;
  7027. const lastInputIndex = inputLength - 1;
  7028. return (v) => {
  7029. let mixerIndex = 0;
  7030. let foundMixerIndex = false;
  7031. if (v <= input[0]) {
  7032. foundMixerIndex = true;
  7033. }
  7034. else if (v >= input[lastInputIndex]) {
  7035. mixerIndex = lastInputIndex - 1;
  7036. foundMixerIndex = true;
  7037. }
  7038. if (!foundMixerIndex) {
  7039. let i = 1;
  7040. for (; i < inputLength; i++) {
  7041. if (input[i] > v || i === lastInputIndex) {
  7042. break;
  7043. }
  7044. }
  7045. mixerIndex = i - 1;
  7046. }
  7047. const progressInRange = progress(input[mixerIndex], input[mixerIndex + 1], v);
  7048. return mixers[mixerIndex](progressInRange);
  7049. };
  7050. }
  7051. function interpolate(input, output, { clamp: isClamp = true, ease, mixer } = {}) {
  7052. const inputLength = input.length;
  7053. invariant(inputLength === output.length, 'Both input and output ranges must be the same length');
  7054. 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.');
  7055. if (input[0] > input[inputLength - 1]) {
  7056. input = [].concat(input);
  7057. output = [].concat(output);
  7058. input.reverse();
  7059. output.reverse();
  7060. }
  7061. const mixers = createMixers(output, ease, mixer);
  7062. const interpolator = inputLength === 2
  7063. ? fastInterpolate(input, mixers)
  7064. : slowInterpolate(input, mixers);
  7065. return isClamp
  7066. ? (v) => interpolator(clamp_clamp(input[0], input[inputLength - 1], v))
  7067. : interpolator;
  7068. }
  7069. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/easing/utils.mjs
  7070. const reverseEasing = easing => p => 1 - easing(1 - p);
  7071. const mirrorEasing = easing => p => p <= 0.5 ? easing(2 * p) / 2 : (2 - easing(2 * (1 - p))) / 2;
  7072. const createExpoIn = (power) => p => Math.pow(p, power);
  7073. const createBackIn = (power) => p => p * p * ((power + 1) * p - power);
  7074. const createAnticipate = (power) => {
  7075. const backEasing = createBackIn(power);
  7076. return p => (p *= 2) < 1
  7077. ? 0.5 * backEasing(p)
  7078. : 0.5 * (2 - Math.pow(2, -10 * (p - 1)));
  7079. };
  7080. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/easing/index.mjs
  7081. const DEFAULT_OVERSHOOT_STRENGTH = 1.525;
  7082. const BOUNCE_FIRST_THRESHOLD = 4.0 / 11.0;
  7083. const BOUNCE_SECOND_THRESHOLD = 8.0 / 11.0;
  7084. const BOUNCE_THIRD_THRESHOLD = 9.0 / 10.0;
  7085. const linear = p => p;
  7086. const easeIn = createExpoIn(2);
  7087. const easeOut = reverseEasing(easeIn);
  7088. const easeInOut = mirrorEasing(easeIn);
  7089. const circIn = p => 1 - Math.sin(Math.acos(p));
  7090. const circOut = reverseEasing(circIn);
  7091. const circInOut = mirrorEasing(circOut);
  7092. const backIn = createBackIn(DEFAULT_OVERSHOOT_STRENGTH);
  7093. const backOut = reverseEasing(backIn);
  7094. const backInOut = mirrorEasing(backIn);
  7095. const anticipate = createAnticipate(DEFAULT_OVERSHOOT_STRENGTH);
  7096. const ca = 4356.0 / 361.0;
  7097. const cb = 35442.0 / 1805.0;
  7098. const cc = 16061.0 / 1805.0;
  7099. const bounceOut = (p) => {
  7100. if (p === 1 || p === 0)
  7101. return p;
  7102. const p2 = p * p;
  7103. return p < BOUNCE_FIRST_THRESHOLD
  7104. ? 7.5625 * p2
  7105. : p < BOUNCE_SECOND_THRESHOLD
  7106. ? 9.075 * p2 - 9.9 * p + 3.4
  7107. : p < BOUNCE_THIRD_THRESHOLD
  7108. ? ca * p2 - cb * p + cc
  7109. : 10.8 * p * p - 20.52 * p + 10.72;
  7110. };
  7111. const bounceIn = reverseEasing(bounceOut);
  7112. const bounceInOut = (p) => p < 0.5
  7113. ? 0.5 * (1.0 - bounceOut(1.0 - p * 2.0))
  7114. : 0.5 * bounceOut(p * 2.0 - 1.0) + 0.5;
  7115. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/animations/generators/keyframes.mjs
  7116. function defaultEasing(values, easing) {
  7117. return values.map(() => easing || easeInOut).splice(0, values.length - 1);
  7118. }
  7119. function defaultOffset(values) {
  7120. const numValues = values.length;
  7121. return values.map((_value, i) => i !== 0 ? i / (numValues - 1) : 0);
  7122. }
  7123. function convertOffsetToTimes(offset, duration) {
  7124. return offset.map((o) => o * duration);
  7125. }
  7126. function keyframes({ from = 0, to = 1, ease, offset, duration = 300, }) {
  7127. const state = { done: false, value: from };
  7128. const values = Array.isArray(to) ? to : [from, to];
  7129. const times = convertOffsetToTimes(offset && offset.length === values.length
  7130. ? offset
  7131. : defaultOffset(values), duration);
  7132. function createInterpolator() {
  7133. return interpolate(times, values, {
  7134. ease: Array.isArray(ease) ? ease : defaultEasing(values, ease),
  7135. });
  7136. }
  7137. let interpolator = createInterpolator();
  7138. return {
  7139. next: (t) => {
  7140. state.value = interpolator(t);
  7141. state.done = t >= duration;
  7142. return state;
  7143. },
  7144. flipTarget: () => {
  7145. values.reverse();
  7146. interpolator = createInterpolator();
  7147. },
  7148. };
  7149. }
  7150. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/animations/generators/decay.mjs
  7151. function decay({ velocity = 0, from = 0, power = 0.8, timeConstant = 350, restDelta = 0.5, modifyTarget, }) {
  7152. const state = { done: false, value: from };
  7153. let amplitude = power * velocity;
  7154. const ideal = from + amplitude;
  7155. const target = modifyTarget === undefined ? ideal : modifyTarget(ideal);
  7156. if (target !== ideal)
  7157. amplitude = target - from;
  7158. return {
  7159. next: (t) => {
  7160. const delta = -amplitude * Math.exp(-t / timeConstant);
  7161. state.done = !(delta > restDelta || delta < -restDelta);
  7162. state.value = state.done ? target : target + delta;
  7163. return state;
  7164. },
  7165. flipTarget: () => { },
  7166. };
  7167. }
  7168. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/animations/utils/detect-animation-from-options.mjs
  7169. const types = { keyframes: keyframes, spring: spring, decay: decay };
  7170. function detectAnimationFromOptions(config) {
  7171. if (Array.isArray(config.to)) {
  7172. return keyframes;
  7173. }
  7174. else if (types[config.type]) {
  7175. return types[config.type];
  7176. }
  7177. const keys = new Set(Object.keys(config));
  7178. if (keys.has("ease") ||
  7179. (keys.has("duration") && !keys.has("dampingRatio"))) {
  7180. return keyframes;
  7181. }
  7182. else if (keys.has("dampingRatio") ||
  7183. keys.has("stiffness") ||
  7184. keys.has("mass") ||
  7185. keys.has("damping") ||
  7186. keys.has("restSpeed") ||
  7187. keys.has("restDelta")) {
  7188. return spring;
  7189. }
  7190. return keyframes;
  7191. }
  7192. ;// CONCATENATED MODULE: ./node_modules/framesync/dist/es/on-next-frame.mjs
  7193. const defaultTimestep = (1 / 60) * 1000;
  7194. const getCurrentTime = typeof performance !== "undefined"
  7195. ? () => performance.now()
  7196. : () => Date.now();
  7197. const onNextFrame = typeof window !== "undefined"
  7198. ? (callback) => window.requestAnimationFrame(callback)
  7199. : (callback) => setTimeout(() => callback(getCurrentTime()), defaultTimestep);
  7200. ;// CONCATENATED MODULE: ./node_modules/framesync/dist/es/create-render-step.mjs
  7201. function createRenderStep(runNextFrame) {
  7202. let toRun = [];
  7203. let toRunNextFrame = [];
  7204. let numToRun = 0;
  7205. let isProcessing = false;
  7206. let flushNextFrame = false;
  7207. const toKeepAlive = new WeakSet();
  7208. const step = {
  7209. schedule: (callback, keepAlive = false, immediate = false) => {
  7210. const addToCurrentFrame = immediate && isProcessing;
  7211. const buffer = addToCurrentFrame ? toRun : toRunNextFrame;
  7212. if (keepAlive)
  7213. toKeepAlive.add(callback);
  7214. if (buffer.indexOf(callback) === -1) {
  7215. buffer.push(callback);
  7216. if (addToCurrentFrame && isProcessing)
  7217. numToRun = toRun.length;
  7218. }
  7219. return callback;
  7220. },
  7221. cancel: (callback) => {
  7222. const index = toRunNextFrame.indexOf(callback);
  7223. if (index !== -1)
  7224. toRunNextFrame.splice(index, 1);
  7225. toKeepAlive.delete(callback);
  7226. },
  7227. process: (frameData) => {
  7228. if (isProcessing) {
  7229. flushNextFrame = true;
  7230. return;
  7231. }
  7232. isProcessing = true;
  7233. [toRun, toRunNextFrame] = [toRunNextFrame, toRun];
  7234. toRunNextFrame.length = 0;
  7235. numToRun = toRun.length;
  7236. if (numToRun) {
  7237. for (let i = 0; i < numToRun; i++) {
  7238. const callback = toRun[i];
  7239. callback(frameData);
  7240. if (toKeepAlive.has(callback)) {
  7241. step.schedule(callback);
  7242. runNextFrame();
  7243. }
  7244. }
  7245. }
  7246. isProcessing = false;
  7247. if (flushNextFrame) {
  7248. flushNextFrame = false;
  7249. step.process(frameData);
  7250. }
  7251. },
  7252. };
  7253. return step;
  7254. }
  7255. ;// CONCATENATED MODULE: ./node_modules/framesync/dist/es/index.mjs
  7256. const maxElapsed = 40;
  7257. let useDefaultElapsed = true;
  7258. let runNextFrame = false;
  7259. let isProcessing = false;
  7260. const es_frame = {
  7261. delta: 0,
  7262. timestamp: 0,
  7263. };
  7264. const stepsOrder = [
  7265. "read",
  7266. "update",
  7267. "preRender",
  7268. "render",
  7269. "postRender",
  7270. ];
  7271. const steps = stepsOrder.reduce((acc, key) => {
  7272. acc[key] = createRenderStep(() => (runNextFrame = true));
  7273. return acc;
  7274. }, {});
  7275. const sync = stepsOrder.reduce((acc, key) => {
  7276. const step = steps[key];
  7277. acc[key] = (process, keepAlive = false, immediate = false) => {
  7278. if (!runNextFrame)
  7279. startLoop();
  7280. return step.schedule(process, keepAlive, immediate);
  7281. };
  7282. return acc;
  7283. }, {});
  7284. const cancelSync = stepsOrder.reduce((acc, key) => {
  7285. acc[key] = steps[key].cancel;
  7286. return acc;
  7287. }, {});
  7288. const flushSync = stepsOrder.reduce((acc, key) => {
  7289. acc[key] = () => steps[key].process(es_frame);
  7290. return acc;
  7291. }, {});
  7292. const processStep = (stepId) => steps[stepId].process(es_frame);
  7293. const processFrame = (timestamp) => {
  7294. runNextFrame = false;
  7295. es_frame.delta = useDefaultElapsed
  7296. ? defaultTimestep
  7297. : Math.max(Math.min(timestamp - es_frame.timestamp, maxElapsed), 1);
  7298. es_frame.timestamp = timestamp;
  7299. isProcessing = true;
  7300. stepsOrder.forEach(processStep);
  7301. isProcessing = false;
  7302. if (runNextFrame) {
  7303. useDefaultElapsed = false;
  7304. onNextFrame(processFrame);
  7305. }
  7306. };
  7307. const startLoop = () => {
  7308. runNextFrame = true;
  7309. useDefaultElapsed = true;
  7310. if (!isProcessing)
  7311. onNextFrame(processFrame);
  7312. };
  7313. const getFrameData = () => es_frame;
  7314. /* harmony default export */ var es = (sync);
  7315. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/animations/utils/elapsed.mjs
  7316. function loopElapsed(elapsed, duration, delay = 0) {
  7317. return elapsed - duration - delay;
  7318. }
  7319. function reverseElapsed(elapsed, duration, delay = 0, isForwardPlayback = true) {
  7320. return isForwardPlayback
  7321. ? loopElapsed(duration + -elapsed, duration, delay)
  7322. : duration - (elapsed - duration) + delay;
  7323. }
  7324. function hasRepeatDelayElapsed(elapsed, duration, delay, isForwardPlayback) {
  7325. return isForwardPlayback ? elapsed >= duration + delay : elapsed <= -delay;
  7326. }
  7327. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/animations/index.mjs
  7328. const framesync = (update) => {
  7329. const passTimestamp = ({ delta }) => update(delta);
  7330. return {
  7331. start: () => es.update(passTimestamp, true),
  7332. stop: () => cancelSync.update(passTimestamp),
  7333. };
  7334. };
  7335. function animate(_a) {
  7336. var _b, _c;
  7337. 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"]);
  7338. let { to } = options;
  7339. let driverControls;
  7340. let repeatCount = 0;
  7341. let computedDuration = options.duration;
  7342. let latest;
  7343. let isComplete = false;
  7344. let isForwardPlayback = true;
  7345. let interpolateFromNumber;
  7346. const animator = detectAnimationFromOptions(options);
  7347. if ((_c = (_b = animator).needsInterpolation) === null || _c === void 0 ? void 0 : _c.call(_b, from, to)) {
  7348. interpolateFromNumber = interpolate([0, 100], [from, to], {
  7349. clamp: false,
  7350. });
  7351. from = 0;
  7352. to = 100;
  7353. }
  7354. const animation = animator(Object.assign(Object.assign({}, options), { from, to }));
  7355. function repeat() {
  7356. repeatCount++;
  7357. if (repeatType === "reverse") {
  7358. isForwardPlayback = repeatCount % 2 === 0;
  7359. elapsed = reverseElapsed(elapsed, computedDuration, repeatDelay, isForwardPlayback);
  7360. }
  7361. else {
  7362. elapsed = loopElapsed(elapsed, computedDuration, repeatDelay);
  7363. if (repeatType === "mirror")
  7364. animation.flipTarget();
  7365. }
  7366. isComplete = false;
  7367. onRepeat && onRepeat();
  7368. }
  7369. function complete() {
  7370. driverControls.stop();
  7371. onComplete && onComplete();
  7372. }
  7373. function update(delta) {
  7374. if (!isForwardPlayback)
  7375. delta = -delta;
  7376. elapsed += delta;
  7377. if (!isComplete) {
  7378. const state = animation.next(Math.max(0, elapsed));
  7379. latest = state.value;
  7380. if (interpolateFromNumber)
  7381. latest = interpolateFromNumber(latest);
  7382. isComplete = isForwardPlayback ? state.done : elapsed <= 0;
  7383. }
  7384. onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(latest);
  7385. if (isComplete) {
  7386. if (repeatCount === 0)
  7387. computedDuration !== null && computedDuration !== void 0 ? computedDuration : (computedDuration = elapsed);
  7388. if (repeatCount < repeatMax) {
  7389. hasRepeatDelayElapsed(elapsed, computedDuration, repeatDelay, isForwardPlayback) && repeat();
  7390. }
  7391. else {
  7392. complete();
  7393. }
  7394. }
  7395. }
  7396. function play() {
  7397. onPlay === null || onPlay === void 0 ? void 0 : onPlay();
  7398. driverControls = driver(update);
  7399. driverControls.start();
  7400. }
  7401. autoplay && play();
  7402. return {
  7403. stop: () => {
  7404. onStop === null || onStop === void 0 ? void 0 : onStop();
  7405. driverControls.stop();
  7406. },
  7407. };
  7408. }
  7409. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/velocity-per-second.mjs
  7410. function velocityPerSecond(velocity, frameDuration) {
  7411. return frameDuration ? velocity * (1000 / frameDuration) : 0;
  7412. }
  7413. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/animations/inertia.mjs
  7414. function inertia({ from = 0, velocity = 0, min, max, power = 0.8, timeConstant = 750, bounceStiffness = 500, bounceDamping = 10, restDelta = 1, modifyTarget, driver, onUpdate, onComplete, onStop, }) {
  7415. let currentAnimation;
  7416. function isOutOfBounds(v) {
  7417. return (min !== undefined && v < min) || (max !== undefined && v > max);
  7418. }
  7419. function boundaryNearest(v) {
  7420. if (min === undefined)
  7421. return max;
  7422. if (max === undefined)
  7423. return min;
  7424. return Math.abs(min - v) < Math.abs(max - v) ? min : max;
  7425. }
  7426. function startAnimation(options) {
  7427. currentAnimation === null || currentAnimation === void 0 ? void 0 : currentAnimation.stop();
  7428. currentAnimation = animate(Object.assign(Object.assign({}, options), { driver, onUpdate: (v) => {
  7429. var _a;
  7430. onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(v);
  7431. (_a = options.onUpdate) === null || _a === void 0 ? void 0 : _a.call(options, v);
  7432. }, onComplete,
  7433. onStop }));
  7434. }
  7435. function startSpring(options) {
  7436. startAnimation(Object.assign({ type: "spring", stiffness: bounceStiffness, damping: bounceDamping, restDelta }, options));
  7437. }
  7438. if (isOutOfBounds(from)) {
  7439. startSpring({ from, velocity, to: boundaryNearest(from) });
  7440. }
  7441. else {
  7442. let target = power * velocity + from;
  7443. if (typeof modifyTarget !== "undefined")
  7444. target = modifyTarget(target);
  7445. const boundary = boundaryNearest(target);
  7446. const heading = boundary === min ? -1 : 1;
  7447. let prev;
  7448. let current;
  7449. const checkBoundary = (v) => {
  7450. prev = current;
  7451. current = v;
  7452. velocity = velocityPerSecond(v - prev, getFrameData().delta);
  7453. if ((heading === 1 && v > boundary) ||
  7454. (heading === -1 && v < boundary)) {
  7455. startSpring({ from: v, to: boundary, velocity });
  7456. }
  7457. };
  7458. startAnimation({
  7459. type: "decay",
  7460. from,
  7461. velocity,
  7462. timeConstant,
  7463. power,
  7464. restDelta,
  7465. modifyTarget,
  7466. onUpdate: isOutOfBounds(target) ? checkBoundary : undefined,
  7467. });
  7468. }
  7469. return {
  7470. stop: () => currentAnimation === null || currentAnimation === void 0 ? void 0 : currentAnimation.stop(),
  7471. };
  7472. }
  7473. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/time-conversion.mjs
  7474. /**
  7475. * Converts seconds to milliseconds
  7476. *
  7477. * @param seconds - Time in seconds.
  7478. * @return milliseconds - Converted time in milliseconds.
  7479. */
  7480. var secondsToMilliseconds = function (seconds) { return seconds * 1000; };
  7481. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/easing/cubic-bezier.mjs
  7482. const cubic_bezier_a = (a1, a2) => 1.0 - 3.0 * a2 + 3.0 * a1;
  7483. const cubic_bezier_b = (a1, a2) => 3.0 * a2 - 6.0 * a1;
  7484. const cubic_bezier_c = (a1) => 3.0 * a1;
  7485. const calcBezier = (t, a1, a2) => ((cubic_bezier_a(a1, a2) * t + cubic_bezier_b(a1, a2)) * t + cubic_bezier_c(a1)) * t;
  7486. 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);
  7487. const subdivisionPrecision = 0.0000001;
  7488. const subdivisionMaxIterations = 10;
  7489. function binarySubdivide(aX, aA, aB, mX1, mX2) {
  7490. let currentX;
  7491. let currentT;
  7492. let i = 0;
  7493. do {
  7494. currentT = aA + (aB - aA) / 2.0;
  7495. currentX = calcBezier(currentT, mX1, mX2) - aX;
  7496. if (currentX > 0.0) {
  7497. aB = currentT;
  7498. }
  7499. else {
  7500. aA = currentT;
  7501. }
  7502. } while (Math.abs(currentX) > subdivisionPrecision &&
  7503. ++i < subdivisionMaxIterations);
  7504. return currentT;
  7505. }
  7506. const newtonIterations = 8;
  7507. const newtonMinSlope = 0.001;
  7508. function newtonRaphsonIterate(aX, aGuessT, mX1, mX2) {
  7509. for (let i = 0; i < newtonIterations; ++i) {
  7510. const currentSlope = getSlope(aGuessT, mX1, mX2);
  7511. if (currentSlope === 0.0) {
  7512. return aGuessT;
  7513. }
  7514. const currentX = calcBezier(aGuessT, mX1, mX2) - aX;
  7515. aGuessT -= currentX / currentSlope;
  7516. }
  7517. return aGuessT;
  7518. }
  7519. const kSplineTableSize = 11;
  7520. const kSampleStepSize = 1.0 / (kSplineTableSize - 1.0);
  7521. function cubicBezier(mX1, mY1, mX2, mY2) {
  7522. if (mX1 === mY1 && mX2 === mY2)
  7523. return linear;
  7524. const sampleValues = new Float32Array(kSplineTableSize);
  7525. for (let i = 0; i < kSplineTableSize; ++i) {
  7526. sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2);
  7527. }
  7528. function getTForX(aX) {
  7529. let intervalStart = 0.0;
  7530. let currentSample = 1;
  7531. const lastSample = kSplineTableSize - 1;
  7532. for (; currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) {
  7533. intervalStart += kSampleStepSize;
  7534. }
  7535. --currentSample;
  7536. const dist = (aX - sampleValues[currentSample]) /
  7537. (sampleValues[currentSample + 1] - sampleValues[currentSample]);
  7538. const guessForT = intervalStart + dist * kSampleStepSize;
  7539. const initialSlope = getSlope(guessForT, mX1, mX2);
  7540. if (initialSlope >= newtonMinSlope) {
  7541. return newtonRaphsonIterate(aX, guessForT, mX1, mX2);
  7542. }
  7543. else if (initialSlope === 0.0) {
  7544. return guessForT;
  7545. }
  7546. else {
  7547. return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2);
  7548. }
  7549. }
  7550. return (t) => t === 0 || t === 1 ? t : calcBezier(getTForX(t), mY1, mY2);
  7551. }
  7552. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/utils/easing.mjs
  7553. var easingLookup = {
  7554. linear: linear,
  7555. easeIn: easeIn,
  7556. easeInOut: easeInOut,
  7557. easeOut: easeOut,
  7558. circIn: circIn,
  7559. circInOut: circInOut,
  7560. circOut: circOut,
  7561. backIn: backIn,
  7562. backInOut: backInOut,
  7563. backOut: backOut,
  7564. anticipate: anticipate,
  7565. bounceIn: bounceIn,
  7566. bounceInOut: bounceInOut,
  7567. bounceOut: bounceOut,
  7568. };
  7569. var easingDefinitionToFunction = function (definition) {
  7570. if (Array.isArray(definition)) {
  7571. // If cubic bezier definition, create bezier curve
  7572. invariant(definition.length === 4, "Cubic bezier arrays must contain four numerical values.");
  7573. var _a = tslib_es6_read(definition, 4), x1 = _a[0], y1 = _a[1], x2 = _a[2], y2 = _a[3];
  7574. return cubicBezier(x1, y1, x2, y2);
  7575. }
  7576. else if (typeof definition === "string") {
  7577. // Else lookup from table
  7578. invariant(easingLookup[definition] !== undefined, "Invalid easing type '".concat(definition, "'"));
  7579. return easingLookup[definition];
  7580. }
  7581. return definition;
  7582. };
  7583. var isEasingArray = function (ease) {
  7584. return Array.isArray(ease) && typeof ease[0] !== "number";
  7585. };
  7586. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/utils/is-animatable.mjs
  7587. /**
  7588. * Check if a value is animatable. Examples:
  7589. *
  7590. * ✅: 100, "100px", "#fff"
  7591. * ❌: "block", "url(2.jpg)"
  7592. * @param value
  7593. *
  7594. * @internal
  7595. */
  7596. var isAnimatable = function (key, value) {
  7597. // If the list of keys tat might be non-animatable grows, replace with Set
  7598. if (key === "zIndex")
  7599. return false;
  7600. // If it's a number or a keyframes array, we can animate it. We might at some point
  7601. // need to do a deep isAnimatable check of keyframes, or let Popmotion handle this,
  7602. // but for now lets leave it like this for performance reasons
  7603. if (typeof value === "number" || Array.isArray(value))
  7604. return true;
  7605. if (typeof value === "string" && // It's animatable if we have a string
  7606. complex.test(value) && // And it contains numbers and/or colors
  7607. !value.startsWith("url(") // Unless it starts with "url("
  7608. ) {
  7609. return true;
  7610. }
  7611. return false;
  7612. };
  7613. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/utils/default-transitions.mjs
  7614. var underDampedSpring = function () { return ({
  7615. type: "spring",
  7616. stiffness: 500,
  7617. damping: 25,
  7618. restSpeed: 10,
  7619. }); };
  7620. var criticallyDampedSpring = function (to) { return ({
  7621. type: "spring",
  7622. stiffness: 550,
  7623. damping: to === 0 ? 2 * Math.sqrt(550) : 30,
  7624. restSpeed: 10,
  7625. }); };
  7626. var linearTween = function () { return ({
  7627. type: "keyframes",
  7628. ease: "linear",
  7629. duration: 0.3,
  7630. }); };
  7631. var default_transitions_keyframes = function (values) { return ({
  7632. type: "keyframes",
  7633. duration: 0.8,
  7634. values: values,
  7635. }); };
  7636. var defaultTransitions = {
  7637. x: underDampedSpring,
  7638. y: underDampedSpring,
  7639. z: underDampedSpring,
  7640. rotate: underDampedSpring,
  7641. rotateX: underDampedSpring,
  7642. rotateY: underDampedSpring,
  7643. rotateZ: underDampedSpring,
  7644. scaleX: criticallyDampedSpring,
  7645. scaleY: criticallyDampedSpring,
  7646. scale: criticallyDampedSpring,
  7647. opacity: linearTween,
  7648. backgroundColor: linearTween,
  7649. color: linearTween,
  7650. default: criticallyDampedSpring,
  7651. };
  7652. var getDefaultTransition = function (valueKey, to) {
  7653. var transitionFactory;
  7654. if (isKeyframesTarget(to)) {
  7655. transitionFactory = default_transitions_keyframes;
  7656. }
  7657. else {
  7658. transitionFactory =
  7659. defaultTransitions[valueKey] || defaultTransitions.default;
  7660. }
  7661. return __assign({ to: to }, transitionFactory(to));
  7662. };
  7663. ;// CONCATENATED MODULE: ./node_modules/style-value-types/dist/es/complex/filter.mjs
  7664. const maxDefaults = new Set(['brightness', 'contrast', 'saturate', 'opacity']);
  7665. function applyDefaultFilter(v) {
  7666. let [name, value] = v.slice(0, -1).split('(');
  7667. if (name === 'drop-shadow')
  7668. return v;
  7669. const [number] = value.match(floatRegex) || [];
  7670. if (!number)
  7671. return v;
  7672. const unit = value.replace(number, '');
  7673. let defaultValue = maxDefaults.has(name) ? 1 : 0;
  7674. if (number !== value)
  7675. defaultValue *= 100;
  7676. return name + '(' + defaultValue + unit + ')';
  7677. }
  7678. const functionRegex = /([a-z-]*)\(.*?\)/g;
  7679. const filter = Object.assign(Object.assign({}, complex), { getAnimatableNone: (v) => {
  7680. const functions = v.match(functionRegex);
  7681. return functions ? functions.map(applyDefaultFilter).join(' ') : v;
  7682. } });
  7683. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/defaults.mjs
  7684. /**
  7685. * A map of default value types for common values
  7686. */
  7687. var defaultValueTypes = __assign(__assign({}, numberValueTypes), {
  7688. // Color props
  7689. color: color, backgroundColor: color, outlineColor: color, fill: color, stroke: color,
  7690. // Border props
  7691. borderColor: color, borderTopColor: color, borderRightColor: color, borderBottomColor: color, borderLeftColor: color, filter: filter, WebkitFilter: filter });
  7692. /**
  7693. * Gets the default ValueType for the provided value key
  7694. */
  7695. var getDefaultValueType = function (key) { return defaultValueTypes[key]; };
  7696. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/animatable-none.mjs
  7697. function animatable_none_getAnimatableNone(key, value) {
  7698. var _a;
  7699. var defaultValueType = getDefaultValueType(key);
  7700. if (defaultValueType !== filter)
  7701. defaultValueType = complex;
  7702. // If value is not recognised as animatable, ie "none", create an animatable version origin based on the target
  7703. return (_a = defaultValueType.getAnimatableNone) === null || _a === void 0 ? void 0 : _a.call(defaultValueType, value);
  7704. }
  7705. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/use-instant-transition-state.mjs
  7706. var instantAnimationState = {
  7707. current: false,
  7708. };
  7709. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/utils/transitions.mjs
  7710. /**
  7711. * Decide whether a transition is defined on a given Transition.
  7712. * This filters out orchestration options and returns true
  7713. * if any options are left.
  7714. */
  7715. function isTransitionDefined(_a) {
  7716. _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"]);
  7717. return !!Object.keys(transition).length;
  7718. }
  7719. var legacyRepeatWarning = false;
  7720. /**
  7721. * Convert Framer Motion's Transition type into Popmotion-compatible options.
  7722. */
  7723. function convertTransitionToAnimationOptions(_a) {
  7724. var ease = _a.ease, times = _a.times, yoyo = _a.yoyo, flip = _a.flip, loop = _a.loop, transition = __rest(_a, ["ease", "times", "yoyo", "flip", "loop"]);
  7725. var options = __assign({}, transition);
  7726. if (times)
  7727. options["offset"] = times;
  7728. /**
  7729. * Convert any existing durations from seconds to milliseconds
  7730. */
  7731. if (transition.duration)
  7732. options["duration"] = secondsToMilliseconds(transition.duration);
  7733. if (transition.repeatDelay)
  7734. options.repeatDelay = secondsToMilliseconds(transition.repeatDelay);
  7735. /**
  7736. * Map easing names to Popmotion's easing functions
  7737. */
  7738. if (ease) {
  7739. options["ease"] = isEasingArray(ease)
  7740. ? ease.map(easingDefinitionToFunction)
  7741. : easingDefinitionToFunction(ease);
  7742. }
  7743. /**
  7744. * Support legacy transition API
  7745. */
  7746. if (transition.type === "tween")
  7747. options.type = "keyframes";
  7748. /**
  7749. * TODO: These options are officially removed from the API.
  7750. */
  7751. if (yoyo || loop || flip) {
  7752. warning(!legacyRepeatWarning, "yoyo, loop and flip have been removed from the API. Replace with repeat and repeatType options.");
  7753. legacyRepeatWarning = true;
  7754. if (yoyo) {
  7755. options.repeatType = "reverse";
  7756. }
  7757. else if (loop) {
  7758. options.repeatType = "loop";
  7759. }
  7760. else if (flip) {
  7761. options.repeatType = "mirror";
  7762. }
  7763. options.repeat = loop || yoyo || flip || transition.repeat;
  7764. }
  7765. /**
  7766. * TODO: Popmotion 9 has the ability to automatically detect whether to use
  7767. * a keyframes or spring animation, but does so by detecting velocity and other spring options.
  7768. * It'd be good to introduce a similar thing here.
  7769. */
  7770. if (transition.type !== "spring")
  7771. options.type = "keyframes";
  7772. return options;
  7773. }
  7774. /**
  7775. * Get the delay for a value by checking Transition with decreasing specificity.
  7776. */
  7777. function getDelayFromTransition(transition, key) {
  7778. var _a, _b;
  7779. var valueTransition = getValueTransition(transition, key) || {};
  7780. return (_b = (_a = valueTransition.delay) !== null && _a !== void 0 ? _a : transition.delay) !== null && _b !== void 0 ? _b : 0;
  7781. }
  7782. function hydrateKeyframes(options) {
  7783. if (Array.isArray(options.to) && options.to[0] === null) {
  7784. options.to = tslib_es6_spreadArray([], tslib_es6_read(options.to), false);
  7785. options.to[0] = options.from;
  7786. }
  7787. return options;
  7788. }
  7789. function getPopmotionAnimationOptions(transition, options, key) {
  7790. var _a;
  7791. if (Array.isArray(options.to)) {
  7792. (_a = transition.duration) !== null && _a !== void 0 ? _a : (transition.duration = 0.8);
  7793. }
  7794. hydrateKeyframes(options);
  7795. /**
  7796. * Get a default transition if none is determined to be defined.
  7797. */
  7798. if (!isTransitionDefined(transition)) {
  7799. transition = __assign(__assign({}, transition), getDefaultTransition(key, options.to));
  7800. }
  7801. return __assign(__assign({}, options), convertTransitionToAnimationOptions(transition));
  7802. }
  7803. /**
  7804. *
  7805. */
  7806. function getAnimation(key, value, target, transition, onComplete) {
  7807. var _a;
  7808. var valueTransition = getValueTransition(transition, key);
  7809. var origin = (_a = valueTransition.from) !== null && _a !== void 0 ? _a : value.get();
  7810. var isTargetAnimatable = isAnimatable(key, target);
  7811. if (origin === "none" && isTargetAnimatable && typeof target === "string") {
  7812. /**
  7813. * If we're trying to animate from "none", try and get an animatable version
  7814. * of the target. This could be improved to work both ways.
  7815. */
  7816. origin = animatable_none_getAnimatableNone(key, target);
  7817. }
  7818. else if (isZero(origin) && typeof target === "string") {
  7819. origin = getZeroUnit(target);
  7820. }
  7821. else if (!Array.isArray(target) &&
  7822. isZero(target) &&
  7823. typeof origin === "string") {
  7824. target = getZeroUnit(origin);
  7825. }
  7826. var isOriginAnimatable = isAnimatable(key, origin);
  7827. 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."));
  7828. function start() {
  7829. var options = {
  7830. from: origin,
  7831. to: target,
  7832. velocity: value.getVelocity(),
  7833. onComplete: onComplete,
  7834. onUpdate: function (v) { return value.set(v); },
  7835. };
  7836. return valueTransition.type === "inertia" ||
  7837. valueTransition.type === "decay"
  7838. ? inertia(__assign(__assign({}, options), valueTransition))
  7839. : animate(__assign(__assign({}, getPopmotionAnimationOptions(valueTransition, options, key)), { onUpdate: function (v) {
  7840. var _a;
  7841. options.onUpdate(v);
  7842. (_a = valueTransition.onUpdate) === null || _a === void 0 ? void 0 : _a.call(valueTransition, v);
  7843. }, onComplete: function () {
  7844. var _a;
  7845. options.onComplete();
  7846. (_a = valueTransition.onComplete) === null || _a === void 0 ? void 0 : _a.call(valueTransition);
  7847. } }));
  7848. }
  7849. function set() {
  7850. var _a, _b;
  7851. var finalTarget = resolveFinalValueInKeyframes(target);
  7852. value.set(finalTarget);
  7853. onComplete();
  7854. (_a = valueTransition === null || valueTransition === void 0 ? void 0 : valueTransition.onUpdate) === null || _a === void 0 ? void 0 : _a.call(valueTransition, finalTarget);
  7855. (_b = valueTransition === null || valueTransition === void 0 ? void 0 : valueTransition.onComplete) === null || _b === void 0 ? void 0 : _b.call(valueTransition);
  7856. return { stop: function () { } };
  7857. }
  7858. return !isOriginAnimatable ||
  7859. !isTargetAnimatable ||
  7860. valueTransition.type === false
  7861. ? set
  7862. : start;
  7863. }
  7864. function isZero(value) {
  7865. return (value === 0 ||
  7866. (typeof value === "string" &&
  7867. parseFloat(value) === 0 &&
  7868. value.indexOf(" ") === -1));
  7869. }
  7870. function getZeroUnit(potentialUnitType) {
  7871. return typeof potentialUnitType === "number"
  7872. ? 0
  7873. : animatable_none_getAnimatableNone("", potentialUnitType);
  7874. }
  7875. function getValueTransition(transition, key) {
  7876. return transition[key] || transition["default"] || transition;
  7877. }
  7878. /**
  7879. * Start animation on a MotionValue. This function is an interface between
  7880. * Framer Motion and Popmotion
  7881. */
  7882. function startAnimation(key, value, target, transition) {
  7883. if (transition === void 0) { transition = {}; }
  7884. if (instantAnimationState.current) {
  7885. transition = { type: false };
  7886. }
  7887. return value.start(function (onComplete) {
  7888. var delayTimer;
  7889. var controls;
  7890. var animation = getAnimation(key, value, target, transition, onComplete);
  7891. var delay = getDelayFromTransition(transition, key);
  7892. var start = function () { return (controls = animation()); };
  7893. if (delay) {
  7894. delayTimer = window.setTimeout(start, secondsToMilliseconds(delay));
  7895. }
  7896. else {
  7897. start();
  7898. }
  7899. return function () {
  7900. clearTimeout(delayTimer);
  7901. controls === null || controls === void 0 ? void 0 : controls.stop();
  7902. };
  7903. });
  7904. }
  7905. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/is-numerical-string.mjs
  7906. /**
  7907. * Check if value is a numerical string, ie a string that is purely a number eg "100" or "-100.1"
  7908. */
  7909. var isNumericalString = function (v) { return /^\-?\d*\.?\d+$/.test(v); };
  7910. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/is-zero-value-string.mjs
  7911. /**
  7912. * Check if the value is a zero value string like "0px" or "0%"
  7913. */
  7914. var isZeroValueString = function (v) { return /^0[^.\s]+$/.test(v); };
  7915. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/array.mjs
  7916. function addUniqueItem(arr, item) {
  7917. arr.indexOf(item) === -1 && arr.push(item);
  7918. }
  7919. function removeItem(arr, item) {
  7920. var index = arr.indexOf(item);
  7921. index > -1 && arr.splice(index, 1);
  7922. }
  7923. // Adapted from array-move
  7924. function moveItem(_a, fromIndex, toIndex) {
  7925. var _b = __read(_a), arr = _b.slice(0);
  7926. var startIndex = fromIndex < 0 ? arr.length + fromIndex : fromIndex;
  7927. if (startIndex >= 0 && startIndex < arr.length) {
  7928. var endIndex = toIndex < 0 ? arr.length + toIndex : toIndex;
  7929. var _c = __read(arr.splice(fromIndex, 1), 1), item = _c[0];
  7930. arr.splice(endIndex, 0, item);
  7931. }
  7932. return arr;
  7933. }
  7934. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/subscription-manager.mjs
  7935. var SubscriptionManager = /** @class */ (function () {
  7936. function SubscriptionManager() {
  7937. this.subscriptions = [];
  7938. }
  7939. SubscriptionManager.prototype.add = function (handler) {
  7940. var _this = this;
  7941. addUniqueItem(this.subscriptions, handler);
  7942. return function () { return removeItem(_this.subscriptions, handler); };
  7943. };
  7944. SubscriptionManager.prototype.notify = function (a, b, c) {
  7945. var numSubscriptions = this.subscriptions.length;
  7946. if (!numSubscriptions)
  7947. return;
  7948. if (numSubscriptions === 1) {
  7949. /**
  7950. * If there's only a single handler we can just call it without invoking a loop.
  7951. */
  7952. this.subscriptions[0](a, b, c);
  7953. }
  7954. else {
  7955. for (var i = 0; i < numSubscriptions; i++) {
  7956. /**
  7957. * Check whether the handler exists before firing as it's possible
  7958. * the subscriptions were modified during this loop running.
  7959. */
  7960. var handler = this.subscriptions[i];
  7961. handler && handler(a, b, c);
  7962. }
  7963. }
  7964. };
  7965. SubscriptionManager.prototype.getSize = function () {
  7966. return this.subscriptions.length;
  7967. };
  7968. SubscriptionManager.prototype.clear = function () {
  7969. this.subscriptions.length = 0;
  7970. };
  7971. return SubscriptionManager;
  7972. }());
  7973. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/value/index.mjs
  7974. var isFloat = function (value) {
  7975. return !isNaN(parseFloat(value));
  7976. };
  7977. /**
  7978. * `MotionValue` is used to track the state and velocity of motion values.
  7979. *
  7980. * @public
  7981. */
  7982. var MotionValue = /** @class */ (function () {
  7983. /**
  7984. * @param init - The initiating value
  7985. * @param config - Optional configuration options
  7986. *
  7987. * - `transformer`: A function to transform incoming values with.
  7988. *
  7989. * @internal
  7990. */
  7991. function MotionValue(init) {
  7992. var _this = this;
  7993. /**
  7994. * This will be replaced by the build step with the latest version number.
  7995. * When MotionValues are provided to motion components, warn if versions are mixed.
  7996. */
  7997. this.version = "6.5.1";
  7998. /**
  7999. * Duration, in milliseconds, since last updating frame.
  8000. *
  8001. * @internal
  8002. */
  8003. this.timeDelta = 0;
  8004. /**
  8005. * Timestamp of the last time this `MotionValue` was updated.
  8006. *
  8007. * @internal
  8008. */
  8009. this.lastUpdated = 0;
  8010. /**
  8011. * Functions to notify when the `MotionValue` updates.
  8012. *
  8013. * @internal
  8014. */
  8015. this.updateSubscribers = new SubscriptionManager();
  8016. /**
  8017. * Functions to notify when the velocity updates.
  8018. *
  8019. * @internal
  8020. */
  8021. this.velocityUpdateSubscribers = new SubscriptionManager();
  8022. /**
  8023. * Functions to notify when the `MotionValue` updates and `render` is set to `true`.
  8024. *
  8025. * @internal
  8026. */
  8027. this.renderSubscribers = new SubscriptionManager();
  8028. /**
  8029. * Tracks whether this value can output a velocity. Currently this is only true
  8030. * if the value is numerical, but we might be able to widen the scope here and support
  8031. * other value types.
  8032. *
  8033. * @internal
  8034. */
  8035. this.canTrackVelocity = false;
  8036. this.updateAndNotify = function (v, render) {
  8037. if (render === void 0) { render = true; }
  8038. _this.prev = _this.current;
  8039. _this.current = v;
  8040. // Update timestamp
  8041. var _a = getFrameData(), delta = _a.delta, timestamp = _a.timestamp;
  8042. if (_this.lastUpdated !== timestamp) {
  8043. _this.timeDelta = delta;
  8044. _this.lastUpdated = timestamp;
  8045. es.postRender(_this.scheduleVelocityCheck);
  8046. }
  8047. // Update update subscribers
  8048. if (_this.prev !== _this.current) {
  8049. _this.updateSubscribers.notify(_this.current);
  8050. }
  8051. // Update velocity subscribers
  8052. if (_this.velocityUpdateSubscribers.getSize()) {
  8053. _this.velocityUpdateSubscribers.notify(_this.getVelocity());
  8054. }
  8055. // Update render subscribers
  8056. if (render) {
  8057. _this.renderSubscribers.notify(_this.current);
  8058. }
  8059. };
  8060. /**
  8061. * Schedule a velocity check for the next frame.
  8062. *
  8063. * This is an instanced and bound function to prevent generating a new
  8064. * function once per frame.
  8065. *
  8066. * @internal
  8067. */
  8068. this.scheduleVelocityCheck = function () { return es.postRender(_this.velocityCheck); };
  8069. /**
  8070. * Updates `prev` with `current` if the value hasn't been updated this frame.
  8071. * This ensures velocity calculations return `0`.
  8072. *
  8073. * This is an instanced and bound function to prevent generating a new
  8074. * function once per frame.
  8075. *
  8076. * @internal
  8077. */
  8078. this.velocityCheck = function (_a) {
  8079. var timestamp = _a.timestamp;
  8080. if (timestamp !== _this.lastUpdated) {
  8081. _this.prev = _this.current;
  8082. _this.velocityUpdateSubscribers.notify(_this.getVelocity());
  8083. }
  8084. };
  8085. this.hasAnimated = false;
  8086. this.prev = this.current = init;
  8087. this.canTrackVelocity = isFloat(this.current);
  8088. }
  8089. /**
  8090. * Adds a function that will be notified when the `MotionValue` is updated.
  8091. *
  8092. * It returns a function that, when called, will cancel the subscription.
  8093. *
  8094. * When calling `onChange` inside a React component, it should be wrapped with the
  8095. * `useEffect` hook. As it returns an unsubscribe function, this should be returned
  8096. * from the `useEffect` function to ensure you don't add duplicate subscribers..
  8097. *
  8098. * ```jsx
  8099. * export const MyComponent = () => {
  8100. * const x = useMotionValue(0)
  8101. * const y = useMotionValue(0)
  8102. * const opacity = useMotionValue(1)
  8103. *
  8104. * useEffect(() => {
  8105. * function updateOpacity() {
  8106. * const maxXY = Math.max(x.get(), y.get())
  8107. * const newOpacity = transform(maxXY, [0, 100], [1, 0])
  8108. * opacity.set(newOpacity)
  8109. * }
  8110. *
  8111. * const unsubscribeX = x.onChange(updateOpacity)
  8112. * const unsubscribeY = y.onChange(updateOpacity)
  8113. *
  8114. * return () => {
  8115. * unsubscribeX()
  8116. * unsubscribeY()
  8117. * }
  8118. * }, [])
  8119. *
  8120. * return <motion.div style={{ x }} />
  8121. * }
  8122. * ```
  8123. *
  8124. * @privateRemarks
  8125. *
  8126. * We could look into a `useOnChange` hook if the above lifecycle management proves confusing.
  8127. *
  8128. * ```jsx
  8129. * useOnChange(x, () => {})
  8130. * ```
  8131. *
  8132. * @param subscriber - A function that receives the latest value.
  8133. * @returns A function that, when called, will cancel this subscription.
  8134. *
  8135. * @public
  8136. */
  8137. MotionValue.prototype.onChange = function (subscription) {
  8138. return this.updateSubscribers.add(subscription);
  8139. };
  8140. MotionValue.prototype.clearListeners = function () {
  8141. this.updateSubscribers.clear();
  8142. };
  8143. /**
  8144. * Adds a function that will be notified when the `MotionValue` requests a render.
  8145. *
  8146. * @param subscriber - A function that's provided the latest value.
  8147. * @returns A function that, when called, will cancel this subscription.
  8148. *
  8149. * @internal
  8150. */
  8151. MotionValue.prototype.onRenderRequest = function (subscription) {
  8152. // Render immediately
  8153. subscription(this.get());
  8154. return this.renderSubscribers.add(subscription);
  8155. };
  8156. /**
  8157. * Attaches a passive effect to the `MotionValue`.
  8158. *
  8159. * @internal
  8160. */
  8161. MotionValue.prototype.attach = function (passiveEffect) {
  8162. this.passiveEffect = passiveEffect;
  8163. };
  8164. /**
  8165. * Sets the state of the `MotionValue`.
  8166. *
  8167. * @remarks
  8168. *
  8169. * ```jsx
  8170. * const x = useMotionValue(0)
  8171. * x.set(10)
  8172. * ```
  8173. *
  8174. * @param latest - Latest value to set.
  8175. * @param render - Whether to notify render subscribers. Defaults to `true`
  8176. *
  8177. * @public
  8178. */
  8179. MotionValue.prototype.set = function (v, render) {
  8180. if (render === void 0) { render = true; }
  8181. if (!render || !this.passiveEffect) {
  8182. this.updateAndNotify(v, render);
  8183. }
  8184. else {
  8185. this.passiveEffect(v, this.updateAndNotify);
  8186. }
  8187. };
  8188. /**
  8189. * Returns the latest state of `MotionValue`
  8190. *
  8191. * @returns - The latest state of `MotionValue`
  8192. *
  8193. * @public
  8194. */
  8195. MotionValue.prototype.get = function () {
  8196. return this.current;
  8197. };
  8198. /**
  8199. * @public
  8200. */
  8201. MotionValue.prototype.getPrevious = function () {
  8202. return this.prev;
  8203. };
  8204. /**
  8205. * Returns the latest velocity of `MotionValue`
  8206. *
  8207. * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
  8208. *
  8209. * @public
  8210. */
  8211. MotionValue.prototype.getVelocity = function () {
  8212. // This could be isFloat(this.prev) && isFloat(this.current), but that would be wasteful
  8213. return this.canTrackVelocity
  8214. ? // These casts could be avoided if parseFloat would be typed better
  8215. velocityPerSecond(parseFloat(this.current) -
  8216. parseFloat(this.prev), this.timeDelta)
  8217. : 0;
  8218. };
  8219. /**
  8220. * Registers a new animation to control this `MotionValue`. Only one
  8221. * animation can drive a `MotionValue` at one time.
  8222. *
  8223. * ```jsx
  8224. * value.start()
  8225. * ```
  8226. *
  8227. * @param animation - A function that starts the provided animation
  8228. *
  8229. * @internal
  8230. */
  8231. MotionValue.prototype.start = function (animation) {
  8232. var _this = this;
  8233. this.stop();
  8234. return new Promise(function (resolve) {
  8235. _this.hasAnimated = true;
  8236. _this.stopAnimation = animation(resolve);
  8237. }).then(function () { return _this.clearAnimation(); });
  8238. };
  8239. /**
  8240. * Stop the currently active animation.
  8241. *
  8242. * @public
  8243. */
  8244. MotionValue.prototype.stop = function () {
  8245. if (this.stopAnimation)
  8246. this.stopAnimation();
  8247. this.clearAnimation();
  8248. };
  8249. /**
  8250. * Returns `true` if this value is currently animating.
  8251. *
  8252. * @public
  8253. */
  8254. MotionValue.prototype.isAnimating = function () {
  8255. return !!this.stopAnimation;
  8256. };
  8257. MotionValue.prototype.clearAnimation = function () {
  8258. this.stopAnimation = null;
  8259. };
  8260. /**
  8261. * Destroy and clean up subscribers to this `MotionValue`.
  8262. *
  8263. * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
  8264. * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
  8265. * created a `MotionValue` via the `motionValue` function.
  8266. *
  8267. * @public
  8268. */
  8269. MotionValue.prototype.destroy = function () {
  8270. this.updateSubscribers.clear();
  8271. this.renderSubscribers.clear();
  8272. this.stop();
  8273. };
  8274. return MotionValue;
  8275. }());
  8276. function motionValue(init) {
  8277. return new MotionValue(init);
  8278. }
  8279. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/test.mjs
  8280. /**
  8281. * Tests a provided value against a ValueType
  8282. */
  8283. var testValueType = function (v) { return function (type) { return type.test(v); }; };
  8284. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/type-auto.mjs
  8285. /**
  8286. * ValueType for "auto"
  8287. */
  8288. var auto = {
  8289. test: function (v) { return v === "auto"; },
  8290. parse: function (v) { return v; },
  8291. };
  8292. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/dimensions.mjs
  8293. /**
  8294. * A list of value types commonly used for dimensions
  8295. */
  8296. var dimensionValueTypes = [number, px, percent, degrees, vw, vh, auto];
  8297. /**
  8298. * Tests a dimensional value against the list of dimension ValueTypes
  8299. */
  8300. var findDimensionValueType = function (v) {
  8301. return dimensionValueTypes.find(testValueType(v));
  8302. };
  8303. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/value-types/find.mjs
  8304. /**
  8305. * A list of all ValueTypes
  8306. */
  8307. var valueTypes = tslib_es6_spreadArray(tslib_es6_spreadArray([], tslib_es6_read(dimensionValueTypes), false), [color, complex], false);
  8308. /**
  8309. * Tests a value against the list of ValueTypes
  8310. */
  8311. var findValueType = function (v) { return valueTypes.find(testValueType(v)); };
  8312. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/setters.mjs
  8313. /**
  8314. * Set VisualElement's MotionValue, creating a new MotionValue for it if
  8315. * it doesn't exist.
  8316. */
  8317. function setMotionValue(visualElement, key, value) {
  8318. if (visualElement.hasValue(key)) {
  8319. visualElement.getValue(key).set(value);
  8320. }
  8321. else {
  8322. visualElement.addValue(key, motionValue(value));
  8323. }
  8324. }
  8325. function setTarget(visualElement, definition) {
  8326. var resolved = resolveVariant(visualElement, definition);
  8327. var _a = resolved ? visualElement.makeTargetAnimatable(resolved, false) : {}, _b = _a.transitionEnd, transitionEnd = _b === void 0 ? {} : _b; _a.transition; var target = __rest(_a, ["transitionEnd", "transition"]);
  8328. target = __assign(__assign({}, target), transitionEnd);
  8329. for (var key in target) {
  8330. var value = resolveFinalValueInKeyframes(target[key]);
  8331. setMotionValue(visualElement, key, value);
  8332. }
  8333. }
  8334. function setVariants(visualElement, variantLabels) {
  8335. var reversedLabels = __spreadArray([], __read(variantLabels), false).reverse();
  8336. reversedLabels.forEach(function (key) {
  8337. var _a;
  8338. var variant = visualElement.getVariant(key);
  8339. variant && setTarget(visualElement, variant);
  8340. (_a = visualElement.variantChildren) === null || _a === void 0 ? void 0 : _a.forEach(function (child) {
  8341. setVariants(child, variantLabels);
  8342. });
  8343. });
  8344. }
  8345. function setValues(visualElement, definition) {
  8346. if (Array.isArray(definition)) {
  8347. return setVariants(visualElement, definition);
  8348. }
  8349. else if (typeof definition === "string") {
  8350. return setVariants(visualElement, [definition]);
  8351. }
  8352. else {
  8353. setTarget(visualElement, definition);
  8354. }
  8355. }
  8356. function checkTargetForNewValues(visualElement, target, origin) {
  8357. var _a, _b, _c;
  8358. var _d;
  8359. var newValueKeys = Object.keys(target).filter(function (key) { return !visualElement.hasValue(key); });
  8360. var numNewValues = newValueKeys.length;
  8361. if (!numNewValues)
  8362. return;
  8363. for (var i = 0; i < numNewValues; i++) {
  8364. var key = newValueKeys[i];
  8365. var targetValue = target[key];
  8366. var value = null;
  8367. /**
  8368. * If the target is a series of keyframes, we can use the first value
  8369. * in the array. If this first value is null, we'll still need to read from the DOM.
  8370. */
  8371. if (Array.isArray(targetValue)) {
  8372. value = targetValue[0];
  8373. }
  8374. /**
  8375. * If the target isn't keyframes, or the first keyframe was null, we need to
  8376. * first check if an origin value was explicitly defined in the transition as "from",
  8377. * if not read the value from the DOM. As an absolute fallback, take the defined target value.
  8378. */
  8379. if (value === null) {
  8380. value = (_b = (_a = origin[key]) !== null && _a !== void 0 ? _a : visualElement.readValue(key)) !== null && _b !== void 0 ? _b : target[key];
  8381. }
  8382. /**
  8383. * If value is still undefined or null, ignore it. Preferably this would throw,
  8384. * but this was causing issues in Framer.
  8385. */
  8386. if (value === undefined || value === null)
  8387. continue;
  8388. if (typeof value === "string" &&
  8389. (isNumericalString(value) || isZeroValueString(value))) {
  8390. // If this is a number read as a string, ie "0" or "200", convert it to a number
  8391. value = parseFloat(value);
  8392. }
  8393. else if (!findValueType(value) && complex.test(targetValue)) {
  8394. value = animatable_none_getAnimatableNone(key, targetValue);
  8395. }
  8396. visualElement.addValue(key, motionValue(value));
  8397. (_c = (_d = origin)[key]) !== null && _c !== void 0 ? _c : (_d[key] = value);
  8398. visualElement.setBaseTarget(key, value);
  8399. }
  8400. }
  8401. function getOriginFromTransition(key, transition) {
  8402. if (!transition)
  8403. return;
  8404. var valueTransition = transition[key] || transition["default"] || transition;
  8405. return valueTransition.from;
  8406. }
  8407. function getOrigin(target, transition, visualElement) {
  8408. var _a, _b;
  8409. var origin = {};
  8410. for (var key in target) {
  8411. origin[key] =
  8412. (_a = getOriginFromTransition(key, transition)) !== null && _a !== void 0 ? _a : (_b = visualElement.getValue(key)) === null || _b === void 0 ? void 0 : _b.get();
  8413. }
  8414. return origin;
  8415. }
  8416. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/animation.mjs
  8417. function animateVisualElement(visualElement, definition, options) {
  8418. if (options === void 0) { options = {}; }
  8419. visualElement.notifyAnimationStart(definition);
  8420. var animation;
  8421. if (Array.isArray(definition)) {
  8422. var animations = definition.map(function (variant) {
  8423. return animateVariant(visualElement, variant, options);
  8424. });
  8425. animation = Promise.all(animations);
  8426. }
  8427. else if (typeof definition === "string") {
  8428. animation = animateVariant(visualElement, definition, options);
  8429. }
  8430. else {
  8431. var resolvedDefinition = typeof definition === "function"
  8432. ? resolveVariant(visualElement, definition, options.custom)
  8433. : definition;
  8434. animation = animateTarget(visualElement, resolvedDefinition, options);
  8435. }
  8436. return animation.then(function () {
  8437. return visualElement.notifyAnimationComplete(definition);
  8438. });
  8439. }
  8440. function animateVariant(visualElement, variant, options) {
  8441. var _a;
  8442. if (options === void 0) { options = {}; }
  8443. var resolved = resolveVariant(visualElement, variant, options.custom);
  8444. var _b = (resolved || {}).transition, transition = _b === void 0 ? visualElement.getDefaultTransition() || {} : _b;
  8445. if (options.transitionOverride) {
  8446. transition = options.transitionOverride;
  8447. }
  8448. /**
  8449. * If we have a variant, create a callback that runs it as an animation.
  8450. * Otherwise, we resolve a Promise immediately for a composable no-op.
  8451. */
  8452. var getAnimation = resolved
  8453. ? function () { return animateTarget(visualElement, resolved, options); }
  8454. : function () { return Promise.resolve(); };
  8455. /**
  8456. * If we have children, create a callback that runs all their animations.
  8457. * Otherwise, we resolve a Promise immediately for a composable no-op.
  8458. */
  8459. var getChildAnimations = ((_a = visualElement.variantChildren) === null || _a === void 0 ? void 0 : _a.size)
  8460. ? function (forwardDelay) {
  8461. if (forwardDelay === void 0) { forwardDelay = 0; }
  8462. var _a = transition.delayChildren, delayChildren = _a === void 0 ? 0 : _a, staggerChildren = transition.staggerChildren, staggerDirection = transition.staggerDirection;
  8463. return animateChildren(visualElement, variant, delayChildren + forwardDelay, staggerChildren, staggerDirection, options);
  8464. }
  8465. : function () { return Promise.resolve(); };
  8466. /**
  8467. * If the transition explicitly defines a "when" option, we need to resolve either
  8468. * this animation or all children animations before playing the other.
  8469. */
  8470. var when = transition.when;
  8471. if (when) {
  8472. var _c = tslib_es6_read(when === "beforeChildren"
  8473. ? [getAnimation, getChildAnimations]
  8474. : [getChildAnimations, getAnimation], 2), first = _c[0], last = _c[1];
  8475. return first().then(last);
  8476. }
  8477. else {
  8478. return Promise.all([getAnimation(), getChildAnimations(options.delay)]);
  8479. }
  8480. }
  8481. /**
  8482. * @internal
  8483. */
  8484. function animateTarget(visualElement, definition, _a) {
  8485. var _b;
  8486. var _c = _a === void 0 ? {} : _a, _d = _c.delay, delay = _d === void 0 ? 0 : _d, transitionOverride = _c.transitionOverride, type = _c.type;
  8487. var _e = visualElement.makeTargetAnimatable(definition), _f = _e.transition, transition = _f === void 0 ? visualElement.getDefaultTransition() : _f, transitionEnd = _e.transitionEnd, target = __rest(_e, ["transition", "transitionEnd"]);
  8488. if (transitionOverride)
  8489. transition = transitionOverride;
  8490. var animations = [];
  8491. var animationTypeState = type && ((_b = visualElement.animationState) === null || _b === void 0 ? void 0 : _b.getState()[type]);
  8492. for (var key in target) {
  8493. var value = visualElement.getValue(key);
  8494. var valueTarget = target[key];
  8495. if (!value ||
  8496. valueTarget === undefined ||
  8497. (animationTypeState &&
  8498. shouldBlockAnimation(animationTypeState, key))) {
  8499. continue;
  8500. }
  8501. var valueTransition = __assign({ delay: delay }, transition);
  8502. /**
  8503. * Make animation instant if this is a transform prop and we should reduce motion.
  8504. */
  8505. if (visualElement.shouldReduceMotion && isTransformProp(key)) {
  8506. valueTransition = __assign(__assign({}, valueTransition), { type: false, delay: 0 });
  8507. }
  8508. var animation = startAnimation(key, value, valueTarget, valueTransition);
  8509. animations.push(animation);
  8510. }
  8511. return Promise.all(animations).then(function () {
  8512. transitionEnd && setTarget(visualElement, transitionEnd);
  8513. });
  8514. }
  8515. function animateChildren(visualElement, variant, delayChildren, staggerChildren, staggerDirection, options) {
  8516. if (delayChildren === void 0) { delayChildren = 0; }
  8517. if (staggerChildren === void 0) { staggerChildren = 0; }
  8518. if (staggerDirection === void 0) { staggerDirection = 1; }
  8519. var animations = [];
  8520. var maxStaggerDuration = (visualElement.variantChildren.size - 1) * staggerChildren;
  8521. var generateStaggerDuration = staggerDirection === 1
  8522. ? function (i) {
  8523. if (i === void 0) { i = 0; }
  8524. return i * staggerChildren;
  8525. }
  8526. : function (i) {
  8527. if (i === void 0) { i = 0; }
  8528. return maxStaggerDuration - i * staggerChildren;
  8529. };
  8530. Array.from(visualElement.variantChildren)
  8531. .sort(sortByTreeOrder)
  8532. .forEach(function (child, i) {
  8533. animations.push(animateVariant(child, variant, __assign(__assign({}, options), { delay: delayChildren + generateStaggerDuration(i) })).then(function () { return child.notifyAnimationComplete(variant); }));
  8534. });
  8535. return Promise.all(animations);
  8536. }
  8537. function stopAnimation(visualElement) {
  8538. visualElement.forEachValue(function (value) { return value.stop(); });
  8539. }
  8540. function sortByTreeOrder(a, b) {
  8541. return a.sortNodePosition(b);
  8542. }
  8543. /**
  8544. * Decide whether we should block this animation. Previously, we achieved this
  8545. * just by checking whether the key was listed in protectedKeys, but this
  8546. * posed problems if an animation was triggered by afterChildren and protectedKeys
  8547. * had been set to true in the meantime.
  8548. */
  8549. function shouldBlockAnimation(_a, key) {
  8550. var protectedKeys = _a.protectedKeys, needsAnimating = _a.needsAnimating;
  8551. var shouldBlock = protectedKeys.hasOwnProperty(key) && needsAnimating[key] !== true;
  8552. needsAnimating[key] = false;
  8553. return shouldBlock;
  8554. }
  8555. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/animation-state.mjs
  8556. var variantPriorityOrder = [
  8557. AnimationType.Animate,
  8558. AnimationType.InView,
  8559. AnimationType.Focus,
  8560. AnimationType.Hover,
  8561. AnimationType.Tap,
  8562. AnimationType.Drag,
  8563. AnimationType.Exit,
  8564. ];
  8565. var reversePriorityOrder = tslib_es6_spreadArray([], tslib_es6_read(variantPriorityOrder), false).reverse();
  8566. var numAnimationTypes = variantPriorityOrder.length;
  8567. function animateList(visualElement) {
  8568. return function (animations) {
  8569. return Promise.all(animations.map(function (_a) {
  8570. var animation = _a.animation, options = _a.options;
  8571. return animateVisualElement(visualElement, animation, options);
  8572. }));
  8573. };
  8574. }
  8575. function createAnimationState(visualElement) {
  8576. var animate = animateList(visualElement);
  8577. var state = createState();
  8578. var allAnimatedKeys = {};
  8579. var isInitialRender = true;
  8580. /**
  8581. * This function will be used to reduce the animation definitions for
  8582. * each active animation type into an object of resolved values for it.
  8583. */
  8584. var buildResolvedTypeValues = function (acc, definition) {
  8585. var resolved = resolveVariant(visualElement, definition);
  8586. if (resolved) {
  8587. resolved.transition; var transitionEnd = resolved.transitionEnd, target = __rest(resolved, ["transition", "transitionEnd"]);
  8588. acc = __assign(__assign(__assign({}, acc), target), transitionEnd);
  8589. }
  8590. return acc;
  8591. };
  8592. function isAnimated(key) {
  8593. return allAnimatedKeys[key] !== undefined;
  8594. }
  8595. /**
  8596. * This just allows us to inject mocked animation functions
  8597. * @internal
  8598. */
  8599. function setAnimateFunction(makeAnimator) {
  8600. animate = makeAnimator(visualElement);
  8601. }
  8602. /**
  8603. * When we receive new props, we need to:
  8604. * 1. Create a list of protected keys for each type. This is a directory of
  8605. * value keys that are currently being "handled" by types of a higher priority
  8606. * so that whenever an animation is played of a given type, these values are
  8607. * protected from being animated.
  8608. * 2. Determine if an animation type needs animating.
  8609. * 3. Determine if any values have been removed from a type and figure out
  8610. * what to animate those to.
  8611. */
  8612. function animateChanges(options, changedActiveType) {
  8613. var _a;
  8614. var props = visualElement.getProps();
  8615. var context = visualElement.getVariantContext(true) || {};
  8616. /**
  8617. * A list of animations that we'll build into as we iterate through the animation
  8618. * types. This will get executed at the end of the function.
  8619. */
  8620. var animations = [];
  8621. /**
  8622. * Keep track of which values have been removed. Then, as we hit lower priority
  8623. * animation types, we can check if they contain removed values and animate to that.
  8624. */
  8625. var removedKeys = new Set();
  8626. /**
  8627. * A dictionary of all encountered keys. This is an object to let us build into and
  8628. * copy it without iteration. Each time we hit an animation type we set its protected
  8629. * keys - the keys its not allowed to animate - to the latest version of this object.
  8630. */
  8631. var encounteredKeys = {};
  8632. /**
  8633. * If a variant has been removed at a given index, and this component is controlling
  8634. * variant animations, we want to ensure lower-priority variants are forced to animate.
  8635. */
  8636. var removedVariantIndex = Infinity;
  8637. var _loop_1 = function (i) {
  8638. var type = reversePriorityOrder[i];
  8639. var typeState = state[type];
  8640. var prop = (_a = props[type]) !== null && _a !== void 0 ? _a : context[type];
  8641. var propIsVariant = isVariantLabel(prop);
  8642. /**
  8643. * If this type has *just* changed isActive status, set activeDelta
  8644. * to that status. Otherwise set to null.
  8645. */
  8646. var activeDelta = type === changedActiveType ? typeState.isActive : null;
  8647. if (activeDelta === false)
  8648. removedVariantIndex = i;
  8649. /**
  8650. * If this prop is an inherited variant, rather than been set directly on the
  8651. * component itself, we want to make sure we allow the parent to trigger animations.
  8652. *
  8653. * TODO: Can probably change this to a !isControllingVariants check
  8654. */
  8655. var isInherited = prop === context[type] && prop !== props[type] && propIsVariant;
  8656. /**
  8657. *
  8658. */
  8659. if (isInherited &&
  8660. isInitialRender &&
  8661. visualElement.manuallyAnimateOnMount) {
  8662. isInherited = false;
  8663. }
  8664. /**
  8665. * Set all encountered keys so far as the protected keys for this type. This will
  8666. * be any key that has been animated or otherwise handled by active, higher-priortiy types.
  8667. */
  8668. typeState.protectedKeys = __assign({}, encounteredKeys);
  8669. // Check if we can skip analysing this prop early
  8670. if (
  8671. // If it isn't active and hasn't *just* been set as inactive
  8672. (!typeState.isActive && activeDelta === null) ||
  8673. // If we didn't and don't have any defined prop for this animation type
  8674. (!prop && !typeState.prevProp) ||
  8675. // Or if the prop doesn't define an animation
  8676. isAnimationControls(prop) ||
  8677. typeof prop === "boolean") {
  8678. return "continue";
  8679. }
  8680. /**
  8681. * As we go look through the values defined on this type, if we detect
  8682. * a changed value or a value that was removed in a higher priority, we set
  8683. * this to true and add this prop to the animation list.
  8684. */
  8685. var variantDidChange = checkVariantsDidChange(typeState.prevProp, prop);
  8686. var shouldAnimateType = variantDidChange ||
  8687. // If we're making this variant active, we want to always make it active
  8688. (type === changedActiveType &&
  8689. typeState.isActive &&
  8690. !isInherited &&
  8691. propIsVariant) ||
  8692. // If we removed a higher-priority variant (i is in reverse order)
  8693. (i > removedVariantIndex && propIsVariant);
  8694. /**
  8695. * As animations can be set as variant lists, variants or target objects, we
  8696. * coerce everything to an array if it isn't one already
  8697. */
  8698. var definitionList = Array.isArray(prop) ? prop : [prop];
  8699. /**
  8700. * Build an object of all the resolved values. We'll use this in the subsequent
  8701. * animateChanges calls to determine whether a value has changed.
  8702. */
  8703. var resolvedValues = definitionList.reduce(buildResolvedTypeValues, {});
  8704. if (activeDelta === false)
  8705. resolvedValues = {};
  8706. /**
  8707. * Now we need to loop through all the keys in the prev prop and this prop,
  8708. * and decide:
  8709. * 1. If the value has changed, and needs animating
  8710. * 2. If it has been removed, and needs adding to the removedKeys set
  8711. * 3. If it has been removed in a higher priority type and needs animating
  8712. * 4. If it hasn't been removed in a higher priority but hasn't changed, and
  8713. * needs adding to the type's protectedKeys list.
  8714. */
  8715. var _b = typeState.prevResolvedValues, prevResolvedValues = _b === void 0 ? {} : _b;
  8716. var allKeys = __assign(__assign({}, prevResolvedValues), resolvedValues);
  8717. var markToAnimate = function (key) {
  8718. shouldAnimateType = true;
  8719. removedKeys.delete(key);
  8720. typeState.needsAnimating[key] = true;
  8721. };
  8722. for (var key in allKeys) {
  8723. var next = resolvedValues[key];
  8724. var prev = prevResolvedValues[key];
  8725. // If we've already handled this we can just skip ahead
  8726. if (encounteredKeys.hasOwnProperty(key))
  8727. continue;
  8728. /**
  8729. * If the value has changed, we probably want to animate it.
  8730. */
  8731. if (next !== prev) {
  8732. /**
  8733. * If both values are keyframes, we need to shallow compare them to
  8734. * detect whether any value has changed. If it has, we animate it.
  8735. */
  8736. if (isKeyframesTarget(next) && isKeyframesTarget(prev)) {
  8737. if (!shallowCompare(next, prev) || variantDidChange) {
  8738. markToAnimate(key);
  8739. }
  8740. else {
  8741. /**
  8742. * If it hasn't changed, we want to ensure it doesn't animate by
  8743. * adding it to the list of protected keys.
  8744. */
  8745. typeState.protectedKeys[key] = true;
  8746. }
  8747. }
  8748. else if (next !== undefined) {
  8749. // If next is defined and doesn't equal prev, it needs animating
  8750. markToAnimate(key);
  8751. }
  8752. else {
  8753. // If it's undefined, it's been removed.
  8754. removedKeys.add(key);
  8755. }
  8756. }
  8757. else if (next !== undefined && removedKeys.has(key)) {
  8758. /**
  8759. * If next hasn't changed and it isn't undefined, we want to check if it's
  8760. * been removed by a higher priority
  8761. */
  8762. markToAnimate(key);
  8763. }
  8764. else {
  8765. /**
  8766. * If it hasn't changed, we add it to the list of protected values
  8767. * to ensure it doesn't get animated.
  8768. */
  8769. typeState.protectedKeys[key] = true;
  8770. }
  8771. }
  8772. /**
  8773. * Update the typeState so next time animateChanges is called we can compare the
  8774. * latest prop and resolvedValues to these.
  8775. */
  8776. typeState.prevProp = prop;
  8777. typeState.prevResolvedValues = resolvedValues;
  8778. /**
  8779. *
  8780. */
  8781. if (typeState.isActive) {
  8782. encounteredKeys = __assign(__assign({}, encounteredKeys), resolvedValues);
  8783. }
  8784. if (isInitialRender && visualElement.blockInitialAnimation) {
  8785. shouldAnimateType = false;
  8786. }
  8787. /**
  8788. * If this is an inherited prop we want to hard-block animations
  8789. * TODO: Test as this should probably still handle animations triggered
  8790. * by removed values?
  8791. */
  8792. if (shouldAnimateType && !isInherited) {
  8793. animations.push.apply(animations, tslib_es6_spreadArray([], tslib_es6_read(definitionList.map(function (animation) { return ({
  8794. animation: animation,
  8795. options: __assign({ type: type }, options),
  8796. }); })), false));
  8797. }
  8798. };
  8799. /**
  8800. * Iterate through all animation types in reverse priority order. For each, we want to
  8801. * detect which values it's handling and whether or not they've changed (and therefore
  8802. * need to be animated). If any values have been removed, we want to detect those in
  8803. * lower priority props and flag for animation.
  8804. */
  8805. for (var i = 0; i < numAnimationTypes; i++) {
  8806. _loop_1(i);
  8807. }
  8808. allAnimatedKeys = __assign({}, encounteredKeys);
  8809. /**
  8810. * If there are some removed value that haven't been dealt with,
  8811. * we need to create a new animation that falls back either to the value
  8812. * defined in the style prop, or the last read value.
  8813. */
  8814. if (removedKeys.size) {
  8815. var fallbackAnimation_1 = {};
  8816. removedKeys.forEach(function (key) {
  8817. var fallbackTarget = visualElement.getBaseTarget(key);
  8818. if (fallbackTarget !== undefined) {
  8819. fallbackAnimation_1[key] = fallbackTarget;
  8820. }
  8821. });
  8822. animations.push({ animation: fallbackAnimation_1 });
  8823. }
  8824. var shouldAnimate = Boolean(animations.length);
  8825. if (isInitialRender &&
  8826. props.initial === false &&
  8827. !visualElement.manuallyAnimateOnMount) {
  8828. shouldAnimate = false;
  8829. }
  8830. isInitialRender = false;
  8831. return shouldAnimate ? animate(animations) : Promise.resolve();
  8832. }
  8833. /**
  8834. * Change whether a certain animation type is active.
  8835. */
  8836. function setActive(type, isActive, options) {
  8837. var _a;
  8838. // If the active state hasn't changed, we can safely do nothing here
  8839. if (state[type].isActive === isActive)
  8840. return Promise.resolve();
  8841. // Propagate active change to children
  8842. (_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); });
  8843. state[type].isActive = isActive;
  8844. var animations = animateChanges(options, type);
  8845. for (var key in state) {
  8846. state[key].protectedKeys = {};
  8847. }
  8848. return animations;
  8849. }
  8850. return {
  8851. isAnimated: isAnimated,
  8852. animateChanges: animateChanges,
  8853. setActive: setActive,
  8854. setAnimateFunction: setAnimateFunction,
  8855. getState: function () { return state; },
  8856. };
  8857. }
  8858. function checkVariantsDidChange(prev, next) {
  8859. if (typeof next === "string") {
  8860. return next !== prev;
  8861. }
  8862. else if (isVariantLabels(next)) {
  8863. return !shallowCompare(next, prev);
  8864. }
  8865. return false;
  8866. }
  8867. function createTypeState(isActive) {
  8868. if (isActive === void 0) { isActive = false; }
  8869. return {
  8870. isActive: isActive,
  8871. protectedKeys: {},
  8872. needsAnimating: {},
  8873. prevResolvedValues: {},
  8874. };
  8875. }
  8876. function createState() {
  8877. var _a;
  8878. return _a = {},
  8879. _a[AnimationType.Animate] = createTypeState(true),
  8880. _a[AnimationType.InView] = createTypeState(),
  8881. _a[AnimationType.Hover] = createTypeState(),
  8882. _a[AnimationType.Tap] = createTypeState(),
  8883. _a[AnimationType.Drag] = createTypeState(),
  8884. _a[AnimationType.Focus] = createTypeState(),
  8885. _a[AnimationType.Exit] = createTypeState(),
  8886. _a;
  8887. }
  8888. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/animations.mjs
  8889. var animations = {
  8890. animation: makeRenderlessComponent(function (_a) {
  8891. var visualElement = _a.visualElement, animate = _a.animate;
  8892. /**
  8893. * We dynamically generate the AnimationState manager as it contains a reference
  8894. * to the underlying animation library. We only want to load that if we load this,
  8895. * so people can optionally code split it out using the `m` component.
  8896. */
  8897. visualElement.animationState || (visualElement.animationState = createAnimationState(visualElement));
  8898. /**
  8899. * Subscribe any provided AnimationControls to the component's VisualElement
  8900. */
  8901. if (isAnimationControls(animate)) {
  8902. (0,external_React_namespaceObject.useEffect)(function () { return animate.subscribe(visualElement); }, [animate]);
  8903. }
  8904. }),
  8905. exit: makeRenderlessComponent(function (props) {
  8906. var custom = props.custom, visualElement = props.visualElement;
  8907. var _a = tslib_es6_read(usePresence(), 2), isPresent = _a[0], safeToRemove = _a[1];
  8908. var presenceContext = (0,external_React_namespaceObject.useContext)(PresenceContext_PresenceContext);
  8909. (0,external_React_namespaceObject.useEffect)(function () {
  8910. var _a, _b;
  8911. visualElement.isPresent = isPresent;
  8912. 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 });
  8913. !isPresent && (animation === null || animation === void 0 ? void 0 : animation.then(safeToRemove));
  8914. }, [isPresent]);
  8915. }),
  8916. };
  8917. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/is-point.mjs
  8918. const isPoint = (point) => point.hasOwnProperty('x') && point.hasOwnProperty('y');
  8919. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/is-point-3d.mjs
  8920. const isPoint3D = (point) => isPoint(point) && point.hasOwnProperty('z');
  8921. ;// CONCATENATED MODULE: ./node_modules/popmotion/dist/es/utils/distance.mjs
  8922. const distance1D = (a, b) => Math.abs(a - b);
  8923. function distance(a, b) {
  8924. if (isNum(a) && isNum(b)) {
  8925. return distance1D(a, b);
  8926. }
  8927. else if (isPoint(a) && isPoint(b)) {
  8928. const xDelta = distance1D(a.x, b.x);
  8929. const yDelta = distance1D(a.y, b.y);
  8930. const zDelta = isPoint3D(a) && isPoint3D(b) ? distance1D(a.z, b.z) : 0;
  8931. return Math.sqrt(Math.pow(xDelta, 2) + Math.pow(yDelta, 2) + Math.pow(zDelta, 2));
  8932. }
  8933. }
  8934. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/PanSession.mjs
  8935. /**
  8936. * @internal
  8937. */
  8938. var PanSession = /** @class */ (function () {
  8939. function PanSession(event, handlers, _a) {
  8940. var _this = this;
  8941. var _b = _a === void 0 ? {} : _a, transformPagePoint = _b.transformPagePoint;
  8942. /**
  8943. * @internal
  8944. */
  8945. this.startEvent = null;
  8946. /**
  8947. * @internal
  8948. */
  8949. this.lastMoveEvent = null;
  8950. /**
  8951. * @internal
  8952. */
  8953. this.lastMoveEventInfo = null;
  8954. /**
  8955. * @internal
  8956. */
  8957. this.handlers = {};
  8958. this.updatePoint = function () {
  8959. if (!(_this.lastMoveEvent && _this.lastMoveEventInfo))
  8960. return;
  8961. var info = getPanInfo(_this.lastMoveEventInfo, _this.history);
  8962. var isPanStarted = _this.startEvent !== null;
  8963. // Only start panning if the offset is larger than 3 pixels. If we make it
  8964. // any larger than this we'll want to reset the pointer history
  8965. // on the first update to avoid visual snapping to the cursoe.
  8966. var isDistancePastThreshold = distance(info.offset, { x: 0, y: 0 }) >= 3;
  8967. if (!isPanStarted && !isDistancePastThreshold)
  8968. return;
  8969. var point = info.point;
  8970. var timestamp = getFrameData().timestamp;
  8971. _this.history.push(__assign(__assign({}, point), { timestamp: timestamp }));
  8972. var _a = _this.handlers, onStart = _a.onStart, onMove = _a.onMove;
  8973. if (!isPanStarted) {
  8974. onStart && onStart(_this.lastMoveEvent, info);
  8975. _this.startEvent = _this.lastMoveEvent;
  8976. }
  8977. onMove && onMove(_this.lastMoveEvent, info);
  8978. };
  8979. this.handlePointerMove = function (event, info) {
  8980. _this.lastMoveEvent = event;
  8981. _this.lastMoveEventInfo = transformPoint(info, _this.transformPagePoint);
  8982. // Because Safari doesn't trigger mouseup events when it's above a `<select>`
  8983. if (isMouseEvent(event) && event.buttons === 0) {
  8984. _this.handlePointerUp(event, info);
  8985. return;
  8986. }
  8987. // Throttle mouse move event to once per frame
  8988. es.update(_this.updatePoint, true);
  8989. };
  8990. this.handlePointerUp = function (event, info) {
  8991. _this.end();
  8992. var _a = _this.handlers, onEnd = _a.onEnd, onSessionEnd = _a.onSessionEnd;
  8993. var panInfo = getPanInfo(transformPoint(info, _this.transformPagePoint), _this.history);
  8994. if (_this.startEvent && onEnd) {
  8995. onEnd(event, panInfo);
  8996. }
  8997. onSessionEnd && onSessionEnd(event, panInfo);
  8998. };
  8999. // If we have more than one touch, don't start detecting this gesture
  9000. if (isTouchEvent(event) && event.touches.length > 1)
  9001. return;
  9002. this.handlers = handlers;
  9003. this.transformPagePoint = transformPagePoint;
  9004. var info = extractEventInfo(event);
  9005. var initialInfo = transformPoint(info, this.transformPagePoint);
  9006. var point = initialInfo.point;
  9007. var timestamp = getFrameData().timestamp;
  9008. this.history = [__assign(__assign({}, point), { timestamp: timestamp })];
  9009. var onSessionStart = handlers.onSessionStart;
  9010. onSessionStart &&
  9011. onSessionStart(event, getPanInfo(initialInfo, this.history));
  9012. this.removeListeners = pipe(addPointerEvent(window, "pointermove", this.handlePointerMove), addPointerEvent(window, "pointerup", this.handlePointerUp), addPointerEvent(window, "pointercancel", this.handlePointerUp));
  9013. }
  9014. PanSession.prototype.updateHandlers = function (handlers) {
  9015. this.handlers = handlers;
  9016. };
  9017. PanSession.prototype.end = function () {
  9018. this.removeListeners && this.removeListeners();
  9019. cancelSync.update(this.updatePoint);
  9020. };
  9021. return PanSession;
  9022. }());
  9023. function transformPoint(info, transformPagePoint) {
  9024. return transformPagePoint ? { point: transformPagePoint(info.point) } : info;
  9025. }
  9026. function subtractPoint(a, b) {
  9027. return { x: a.x - b.x, y: a.y - b.y };
  9028. }
  9029. function getPanInfo(_a, history) {
  9030. var point = _a.point;
  9031. return {
  9032. point: point,
  9033. delta: subtractPoint(point, lastDevicePoint(history)),
  9034. offset: subtractPoint(point, startDevicePoint(history)),
  9035. velocity: PanSession_getVelocity(history, 0.1),
  9036. };
  9037. }
  9038. function startDevicePoint(history) {
  9039. return history[0];
  9040. }
  9041. function lastDevicePoint(history) {
  9042. return history[history.length - 1];
  9043. }
  9044. function PanSession_getVelocity(history, timeDelta) {
  9045. if (history.length < 2) {
  9046. return { x: 0, y: 0 };
  9047. }
  9048. var i = history.length - 1;
  9049. var timestampedPoint = null;
  9050. var lastPoint = lastDevicePoint(history);
  9051. while (i >= 0) {
  9052. timestampedPoint = history[i];
  9053. if (lastPoint.timestamp - timestampedPoint.timestamp >
  9054. secondsToMilliseconds(timeDelta)) {
  9055. break;
  9056. }
  9057. i--;
  9058. }
  9059. if (!timestampedPoint) {
  9060. return { x: 0, y: 0 };
  9061. }
  9062. var time = (lastPoint.timestamp - timestampedPoint.timestamp) / 1000;
  9063. if (time === 0) {
  9064. return { x: 0, y: 0 };
  9065. }
  9066. var currentVelocity = {
  9067. x: (lastPoint.x - timestampedPoint.x) / time,
  9068. y: (lastPoint.y - timestampedPoint.y) / time,
  9069. };
  9070. if (currentVelocity.x === Infinity) {
  9071. currentVelocity.x = 0;
  9072. }
  9073. if (currentVelocity.y === Infinity) {
  9074. currentVelocity.y = 0;
  9075. }
  9076. return currentVelocity;
  9077. }
  9078. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/geometry/delta-calc.mjs
  9079. function calcLength(axis) {
  9080. return axis.max - axis.min;
  9081. }
  9082. function isNear(value, target, maxDistance) {
  9083. if (target === void 0) { target = 0; }
  9084. if (maxDistance === void 0) { maxDistance = 0.01; }
  9085. return distance(value, target) < maxDistance;
  9086. }
  9087. function calcAxisDelta(delta, source, target, origin) {
  9088. if (origin === void 0) { origin = 0.5; }
  9089. delta.origin = origin;
  9090. delta.originPoint = mix(source.min, source.max, delta.origin);
  9091. delta.scale = calcLength(target) / calcLength(source);
  9092. if (isNear(delta.scale, 1, 0.0001) || isNaN(delta.scale))
  9093. delta.scale = 1;
  9094. delta.translate =
  9095. mix(target.min, target.max, delta.origin) - delta.originPoint;
  9096. if (isNear(delta.translate) || isNaN(delta.translate))
  9097. delta.translate = 0;
  9098. }
  9099. function calcBoxDelta(delta, source, target, origin) {
  9100. calcAxisDelta(delta.x, source.x, target.x, origin === null || origin === void 0 ? void 0 : origin.originX);
  9101. calcAxisDelta(delta.y, source.y, target.y, origin === null || origin === void 0 ? void 0 : origin.originY);
  9102. }
  9103. function calcRelativeAxis(target, relative, parent) {
  9104. target.min = parent.min + relative.min;
  9105. target.max = target.min + calcLength(relative);
  9106. }
  9107. function calcRelativeBox(target, relative, parent) {
  9108. calcRelativeAxis(target.x, relative.x, parent.x);
  9109. calcRelativeAxis(target.y, relative.y, parent.y);
  9110. }
  9111. function calcRelativeAxisPosition(target, layout, parent) {
  9112. target.min = layout.min - parent.min;
  9113. target.max = target.min + calcLength(layout);
  9114. }
  9115. function calcRelativePosition(target, layout, parent) {
  9116. calcRelativeAxisPosition(target.x, layout.x, parent.x);
  9117. calcRelativeAxisPosition(target.y, layout.y, parent.y);
  9118. }
  9119. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/drag/utils/constraints.mjs
  9120. /**
  9121. * Apply constraints to a point. These constraints are both physical along an
  9122. * axis, and an elastic factor that determines how much to constrain the point
  9123. * by if it does lie outside the defined parameters.
  9124. */
  9125. function applyConstraints(point, _a, elastic) {
  9126. var min = _a.min, max = _a.max;
  9127. if (min !== undefined && point < min) {
  9128. // If we have a min point defined, and this is outside of that, constrain
  9129. point = elastic ? mix(min, point, elastic.min) : Math.max(point, min);
  9130. }
  9131. else if (max !== undefined && point > max) {
  9132. // If we have a max point defined, and this is outside of that, constrain
  9133. point = elastic ? mix(max, point, elastic.max) : Math.min(point, max);
  9134. }
  9135. return point;
  9136. }
  9137. /**
  9138. * Calculate constraints in terms of the viewport when defined relatively to the
  9139. * measured axis. This is measured from the nearest edge, so a max constraint of 200
  9140. * on an axis with a max value of 300 would return a constraint of 500 - axis length
  9141. */
  9142. function calcRelativeAxisConstraints(axis, min, max) {
  9143. return {
  9144. min: min !== undefined ? axis.min + min : undefined,
  9145. max: max !== undefined
  9146. ? axis.max + max - (axis.max - axis.min)
  9147. : undefined,
  9148. };
  9149. }
  9150. /**
  9151. * Calculate constraints in terms of the viewport when
  9152. * defined relatively to the measured bounding box.
  9153. */
  9154. function calcRelativeConstraints(layoutBox, _a) {
  9155. var top = _a.top, left = _a.left, bottom = _a.bottom, right = _a.right;
  9156. return {
  9157. x: calcRelativeAxisConstraints(layoutBox.x, left, right),
  9158. y: calcRelativeAxisConstraints(layoutBox.y, top, bottom),
  9159. };
  9160. }
  9161. /**
  9162. * Calculate viewport constraints when defined as another viewport-relative axis
  9163. */
  9164. function calcViewportAxisConstraints(layoutAxis, constraintsAxis) {
  9165. var _a;
  9166. var min = constraintsAxis.min - layoutAxis.min;
  9167. var max = constraintsAxis.max - layoutAxis.max;
  9168. // If the constraints axis is actually smaller than the layout axis then we can
  9169. // flip the constraints
  9170. if (constraintsAxis.max - constraintsAxis.min <
  9171. layoutAxis.max - layoutAxis.min) {
  9172. _a = tslib_es6_read([max, min], 2), min = _a[0], max = _a[1];
  9173. }
  9174. return { min: min, max: max };
  9175. }
  9176. /**
  9177. * Calculate viewport constraints when defined as another viewport-relative box
  9178. */
  9179. function calcViewportConstraints(layoutBox, constraintsBox) {
  9180. return {
  9181. x: calcViewportAxisConstraints(layoutBox.x, constraintsBox.x),
  9182. y: calcViewportAxisConstraints(layoutBox.y, constraintsBox.y),
  9183. };
  9184. }
  9185. /**
  9186. * Calculate a transform origin relative to the source axis, between 0-1, that results
  9187. * in an asthetically pleasing scale/transform needed to project from source to target.
  9188. */
  9189. function constraints_calcOrigin(source, target) {
  9190. var origin = 0.5;
  9191. var sourceLength = calcLength(source);
  9192. var targetLength = calcLength(target);
  9193. if (targetLength > sourceLength) {
  9194. origin = progress(target.min, target.max - sourceLength, source.min);
  9195. }
  9196. else if (sourceLength > targetLength) {
  9197. origin = progress(source.min, source.max - targetLength, target.min);
  9198. }
  9199. return clamp_clamp(0, 1, origin);
  9200. }
  9201. /**
  9202. * Rebase the calculated viewport constraints relative to the layout.min point.
  9203. */
  9204. function rebaseAxisConstraints(layout, constraints) {
  9205. var relativeConstraints = {};
  9206. if (constraints.min !== undefined) {
  9207. relativeConstraints.min = constraints.min - layout.min;
  9208. }
  9209. if (constraints.max !== undefined) {
  9210. relativeConstraints.max = constraints.max - layout.min;
  9211. }
  9212. return relativeConstraints;
  9213. }
  9214. var defaultElastic = 0.35;
  9215. /**
  9216. * Accepts a dragElastic prop and returns resolved elastic values for each axis.
  9217. */
  9218. function resolveDragElastic(dragElastic) {
  9219. if (dragElastic === void 0) { dragElastic = defaultElastic; }
  9220. if (dragElastic === false) {
  9221. dragElastic = 0;
  9222. }
  9223. else if (dragElastic === true) {
  9224. dragElastic = defaultElastic;
  9225. }
  9226. return {
  9227. x: resolveAxisElastic(dragElastic, "left", "right"),
  9228. y: resolveAxisElastic(dragElastic, "top", "bottom"),
  9229. };
  9230. }
  9231. function resolveAxisElastic(dragElastic, minLabel, maxLabel) {
  9232. return {
  9233. min: resolvePointElastic(dragElastic, minLabel),
  9234. max: resolvePointElastic(dragElastic, maxLabel),
  9235. };
  9236. }
  9237. function resolvePointElastic(dragElastic, label) {
  9238. var _a;
  9239. return typeof dragElastic === "number"
  9240. ? dragElastic
  9241. : (_a = dragElastic[label]) !== null && _a !== void 0 ? _a : 0;
  9242. }
  9243. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/geometry/models.mjs
  9244. var createAxisDelta = function () { return ({
  9245. translate: 0,
  9246. scale: 1,
  9247. origin: 0,
  9248. originPoint: 0,
  9249. }); };
  9250. var createDelta = function () { return ({
  9251. x: createAxisDelta(),
  9252. y: createAxisDelta(),
  9253. }); };
  9254. var createAxis = function () { return ({ min: 0, max: 0 }); };
  9255. var createBox = function () { return ({
  9256. x: createAxis(),
  9257. y: createAxis(),
  9258. }); };
  9259. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/utils/each-axis.mjs
  9260. function eachAxis(callback) {
  9261. return [callback("x"), callback("y")];
  9262. }
  9263. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/geometry/conversion.mjs
  9264. /**
  9265. * Bounding boxes tend to be defined as top, left, right, bottom. For various operations
  9266. * it's easier to consider each axis individually. This function returns a bounding box
  9267. * as a map of single-axis min/max values.
  9268. */
  9269. function convertBoundingBoxToBox(_a) {
  9270. var top = _a.top, left = _a.left, right = _a.right, bottom = _a.bottom;
  9271. return {
  9272. x: { min: left, max: right },
  9273. y: { min: top, max: bottom },
  9274. };
  9275. }
  9276. function convertBoxToBoundingBox(_a) {
  9277. var x = _a.x, y = _a.y;
  9278. return { top: y.min, right: x.max, bottom: y.max, left: x.min };
  9279. }
  9280. /**
  9281. * Applies a TransformPoint function to a bounding box. TransformPoint is usually a function
  9282. * provided by Framer to allow measured points to be corrected for device scaling. This is used
  9283. * when measuring DOM elements and DOM event points.
  9284. */
  9285. function transformBoxPoints(point, transformPoint) {
  9286. if (!transformPoint)
  9287. return point;
  9288. var topLeft = transformPoint({ x: point.left, y: point.top });
  9289. var bottomRight = transformPoint({ x: point.right, y: point.bottom });
  9290. return {
  9291. top: topLeft.y,
  9292. left: topLeft.x,
  9293. bottom: bottomRight.y,
  9294. right: bottomRight.x,
  9295. };
  9296. }
  9297. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/utils/has-transform.mjs
  9298. function isIdentityScale(scale) {
  9299. return scale === undefined || scale === 1;
  9300. }
  9301. function hasScale(_a) {
  9302. var scale = _a.scale, scaleX = _a.scaleX, scaleY = _a.scaleY;
  9303. return (!isIdentityScale(scale) ||
  9304. !isIdentityScale(scaleX) ||
  9305. !isIdentityScale(scaleY));
  9306. }
  9307. function hasTransform(values) {
  9308. return (hasScale(values) ||
  9309. hasTranslate(values.x) ||
  9310. hasTranslate(values.y) ||
  9311. values.z ||
  9312. values.rotate ||
  9313. values.rotateX ||
  9314. values.rotateY);
  9315. }
  9316. function hasTranslate(value) {
  9317. return value && value !== "0%";
  9318. }
  9319. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/geometry/delta-apply.mjs
  9320. /**
  9321. * Scales a point based on a factor and an originPoint
  9322. */
  9323. function scalePoint(point, scale, originPoint) {
  9324. var distanceFromOrigin = point - originPoint;
  9325. var scaled = scale * distanceFromOrigin;
  9326. return originPoint + scaled;
  9327. }
  9328. /**
  9329. * Applies a translate/scale delta to a point
  9330. */
  9331. function applyPointDelta(point, translate, scale, originPoint, boxScale) {
  9332. if (boxScale !== undefined) {
  9333. point = scalePoint(point, boxScale, originPoint);
  9334. }
  9335. return scalePoint(point, scale, originPoint) + translate;
  9336. }
  9337. /**
  9338. * Applies a translate/scale delta to an axis
  9339. */
  9340. function applyAxisDelta(axis, translate, scale, originPoint, boxScale) {
  9341. if (translate === void 0) { translate = 0; }
  9342. if (scale === void 0) { scale = 1; }
  9343. axis.min = applyPointDelta(axis.min, translate, scale, originPoint, boxScale);
  9344. axis.max = applyPointDelta(axis.max, translate, scale, originPoint, boxScale);
  9345. }
  9346. /**
  9347. * Applies a translate/scale delta to a box
  9348. */
  9349. function applyBoxDelta(box, _a) {
  9350. var x = _a.x, y = _a.y;
  9351. applyAxisDelta(box.x, x.translate, x.scale, x.originPoint);
  9352. applyAxisDelta(box.y, y.translate, y.scale, y.originPoint);
  9353. }
  9354. /**
  9355. * Apply a tree of deltas to a box. We do this to calculate the effect of all the transforms
  9356. * in a tree upon our box before then calculating how to project it into our desired viewport-relative box
  9357. *
  9358. * This is the final nested loop within updateLayoutDelta for future refactoring
  9359. */
  9360. function applyTreeDeltas(box, treeScale, treePath, isSharedTransition) {
  9361. var _a, _b;
  9362. if (isSharedTransition === void 0) { isSharedTransition = false; }
  9363. var treeLength = treePath.length;
  9364. if (!treeLength)
  9365. return;
  9366. // Reset the treeScale
  9367. treeScale.x = treeScale.y = 1;
  9368. var node;
  9369. var delta;
  9370. for (var i = 0; i < treeLength; i++) {
  9371. node = treePath[i];
  9372. delta = node.projectionDelta;
  9373. if (((_b = (_a = node.instance) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.display) === "contents")
  9374. continue;
  9375. if (isSharedTransition &&
  9376. node.options.layoutScroll &&
  9377. node.scroll &&
  9378. node !== node.root) {
  9379. transformBox(box, { x: -node.scroll.x, y: -node.scroll.y });
  9380. }
  9381. if (delta) {
  9382. // Incoporate each ancestor's scale into a culmulative treeScale for this component
  9383. treeScale.x *= delta.x.scale;
  9384. treeScale.y *= delta.y.scale;
  9385. // Apply each ancestor's calculated delta into this component's recorded layout box
  9386. applyBoxDelta(box, delta);
  9387. }
  9388. if (isSharedTransition && hasTransform(node.latestValues)) {
  9389. transformBox(box, node.latestValues);
  9390. }
  9391. }
  9392. }
  9393. function translateAxis(axis, distance) {
  9394. axis.min = axis.min + distance;
  9395. axis.max = axis.max + distance;
  9396. }
  9397. /**
  9398. * Apply a transform to an axis from the latest resolved motion values.
  9399. * This function basically acts as a bridge between a flat motion value map
  9400. * and applyAxisDelta
  9401. */
  9402. function transformAxis(axis, transforms, _a) {
  9403. var _b = tslib_es6_read(_a, 3), key = _b[0], scaleKey = _b[1], originKey = _b[2];
  9404. var axisOrigin = transforms[originKey] !== undefined ? transforms[originKey] : 0.5;
  9405. var originPoint = mix(axis.min, axis.max, axisOrigin);
  9406. // Apply the axis delta to the final axis
  9407. applyAxisDelta(axis, transforms[key], transforms[scaleKey], originPoint, transforms.scale);
  9408. }
  9409. /**
  9410. * The names of the motion values we want to apply as translation, scale and origin.
  9411. */
  9412. var xKeys = ["x", "scaleX", "originX"];
  9413. var yKeys = ["y", "scaleY", "originY"];
  9414. /**
  9415. * Apply a transform to a box from the latest resolved motion values.
  9416. */
  9417. function transformBox(box, transform) {
  9418. transformAxis(box.x, transform, xKeys);
  9419. transformAxis(box.y, transform, yKeys);
  9420. }
  9421. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/utils/measure.mjs
  9422. function measureViewportBox(instance, transformPoint) {
  9423. return convertBoundingBoxToBox(transformBoxPoints(instance.getBoundingClientRect(), transformPoint));
  9424. }
  9425. function measurePageBox(element, rootProjectionNode, transformPagePoint) {
  9426. var viewportBox = measureViewportBox(element, transformPagePoint);
  9427. var scroll = rootProjectionNode.scroll;
  9428. if (scroll) {
  9429. translateAxis(viewportBox.x, scroll.x);
  9430. translateAxis(viewportBox.y, scroll.y);
  9431. }
  9432. return viewportBox;
  9433. }
  9434. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/drag/VisualElementDragControls.mjs
  9435. var elementDragControls = new WeakMap();
  9436. /**
  9437. *
  9438. */
  9439. // let latestPointerEvent: AnyPointerEvent
  9440. var VisualElementDragControls = /** @class */ (function () {
  9441. function VisualElementDragControls(visualElement) {
  9442. // This is a reference to the global drag gesture lock, ensuring only one component
  9443. // can "capture" the drag of one or both axes.
  9444. // TODO: Look into moving this into pansession?
  9445. this.openGlobalLock = null;
  9446. this.isDragging = false;
  9447. this.currentDirection = null;
  9448. this.originPoint = { x: 0, y: 0 };
  9449. /**
  9450. * The permitted boundaries of travel, in pixels.
  9451. */
  9452. this.constraints = false;
  9453. this.hasMutatedConstraints = false;
  9454. /**
  9455. * The per-axis resolved elastic values.
  9456. */
  9457. this.elastic = createBox();
  9458. this.visualElement = visualElement;
  9459. }
  9460. VisualElementDragControls.prototype.start = function (originEvent, _a) {
  9461. var _this = this;
  9462. var _b = _a === void 0 ? {} : _a, _c = _b.snapToCursor, snapToCursor = _c === void 0 ? false : _c;
  9463. /**
  9464. * Don't start dragging if this component is exiting
  9465. */
  9466. if (this.visualElement.isPresent === false)
  9467. return;
  9468. var onSessionStart = function (event) {
  9469. // Stop any animations on both axis values immediately. This allows the user to throw and catch
  9470. // the component.
  9471. _this.stopAnimation();
  9472. if (snapToCursor) {
  9473. _this.snapToCursor(extractEventInfo(event, "page").point);
  9474. }
  9475. };
  9476. var onStart = function (event, info) {
  9477. var _a;
  9478. // Attempt to grab the global drag gesture lock - maybe make this part of PanSession
  9479. var _b = _this.getProps(), drag = _b.drag, dragPropagation = _b.dragPropagation, onDragStart = _b.onDragStart;
  9480. if (drag && !dragPropagation) {
  9481. if (_this.openGlobalLock)
  9482. _this.openGlobalLock();
  9483. _this.openGlobalLock = getGlobalLock(drag);
  9484. // If we don 't have the lock, don't start dragging
  9485. if (!_this.openGlobalLock)
  9486. return;
  9487. }
  9488. _this.isDragging = true;
  9489. _this.currentDirection = null;
  9490. _this.resolveConstraints();
  9491. if (_this.visualElement.projection) {
  9492. _this.visualElement.projection.isAnimationBlocked = true;
  9493. _this.visualElement.projection.target = undefined;
  9494. }
  9495. /**
  9496. * Record gesture origin
  9497. */
  9498. eachAxis(function (axis) {
  9499. var _a, _b;
  9500. var current = _this.getAxisMotionValue(axis).get() || 0;
  9501. /**
  9502. * If the MotionValue is a percentage value convert to px
  9503. */
  9504. if (percent.test(current)) {
  9505. var measuredAxis = (_b = (_a = _this.visualElement.projection) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.actual[axis];
  9506. if (measuredAxis) {
  9507. var length_1 = calcLength(measuredAxis);
  9508. current = length_1 * (parseFloat(current) / 100);
  9509. }
  9510. }
  9511. _this.originPoint[axis] = current;
  9512. });
  9513. // Fire onDragStart event
  9514. onDragStart === null || onDragStart === void 0 ? void 0 : onDragStart(event, info);
  9515. (_a = _this.visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(AnimationType.Drag, true);
  9516. };
  9517. var onMove = function (event, info) {
  9518. // latestPointerEvent = event
  9519. var _a = _this.getProps(), dragPropagation = _a.dragPropagation, dragDirectionLock = _a.dragDirectionLock, onDirectionLock = _a.onDirectionLock, onDrag = _a.onDrag;
  9520. // If we didn't successfully receive the gesture lock, early return.
  9521. if (!dragPropagation && !_this.openGlobalLock)
  9522. return;
  9523. var offset = info.offset;
  9524. // Attempt to detect drag direction if directionLock is true
  9525. if (dragDirectionLock && _this.currentDirection === null) {
  9526. _this.currentDirection = getCurrentDirection(offset);
  9527. // If we've successfully set a direction, notify listener
  9528. if (_this.currentDirection !== null) {
  9529. onDirectionLock === null || onDirectionLock === void 0 ? void 0 : onDirectionLock(_this.currentDirection);
  9530. }
  9531. return;
  9532. }
  9533. // Update each point with the latest position
  9534. _this.updateAxis("x", info.point, offset);
  9535. _this.updateAxis("y", info.point, offset);
  9536. /**
  9537. * Ideally we would leave the renderer to fire naturally at the end of
  9538. * this frame but if the element is about to change layout as the result
  9539. * of a re-render we want to ensure the browser can read the latest
  9540. * bounding box to ensure the pointer and element don't fall out of sync.
  9541. */
  9542. _this.visualElement.syncRender();
  9543. /**
  9544. * This must fire after the syncRender call as it might trigger a state
  9545. * change which itself might trigger a layout update.
  9546. */
  9547. onDrag === null || onDrag === void 0 ? void 0 : onDrag(event, info);
  9548. };
  9549. var onSessionEnd = function (event, info) {
  9550. return _this.stop(event, info);
  9551. };
  9552. this.panSession = new PanSession(originEvent, {
  9553. onSessionStart: onSessionStart,
  9554. onStart: onStart,
  9555. onMove: onMove,
  9556. onSessionEnd: onSessionEnd,
  9557. }, { transformPagePoint: this.visualElement.getTransformPagePoint() });
  9558. };
  9559. VisualElementDragControls.prototype.stop = function (event, info) {
  9560. var isDragging = this.isDragging;
  9561. this.cancel();
  9562. if (!isDragging)
  9563. return;
  9564. var velocity = info.velocity;
  9565. this.startAnimation(velocity);
  9566. var onDragEnd = this.getProps().onDragEnd;
  9567. onDragEnd === null || onDragEnd === void 0 ? void 0 : onDragEnd(event, info);
  9568. };
  9569. VisualElementDragControls.prototype.cancel = function () {
  9570. var _a, _b;
  9571. this.isDragging = false;
  9572. if (this.visualElement.projection) {
  9573. this.visualElement.projection.isAnimationBlocked = false;
  9574. }
  9575. (_a = this.panSession) === null || _a === void 0 ? void 0 : _a.end();
  9576. this.panSession = undefined;
  9577. var dragPropagation = this.getProps().dragPropagation;
  9578. if (!dragPropagation && this.openGlobalLock) {
  9579. this.openGlobalLock();
  9580. this.openGlobalLock = null;
  9581. }
  9582. (_b = this.visualElement.animationState) === null || _b === void 0 ? void 0 : _b.setActive(AnimationType.Drag, false);
  9583. };
  9584. VisualElementDragControls.prototype.updateAxis = function (axis, _point, offset) {
  9585. var drag = this.getProps().drag;
  9586. // If we're not dragging this axis, do an early return.
  9587. if (!offset || !shouldDrag(axis, drag, this.currentDirection))
  9588. return;
  9589. var axisValue = this.getAxisMotionValue(axis);
  9590. var next = this.originPoint[axis] + offset[axis];
  9591. // Apply constraints
  9592. if (this.constraints && this.constraints[axis]) {
  9593. next = applyConstraints(next, this.constraints[axis], this.elastic[axis]);
  9594. }
  9595. axisValue.set(next);
  9596. };
  9597. VisualElementDragControls.prototype.resolveConstraints = function () {
  9598. var _this = this;
  9599. var _a = this.getProps(), dragConstraints = _a.dragConstraints, dragElastic = _a.dragElastic;
  9600. var layout = (this.visualElement.projection || {}).layout;
  9601. var prevConstraints = this.constraints;
  9602. if (dragConstraints && is_ref_object_isRefObject(dragConstraints)) {
  9603. if (!this.constraints) {
  9604. this.constraints = this.resolveRefConstraints();
  9605. }
  9606. }
  9607. else {
  9608. if (dragConstraints && layout) {
  9609. this.constraints = calcRelativeConstraints(layout.actual, dragConstraints);
  9610. }
  9611. else {
  9612. this.constraints = false;
  9613. }
  9614. }
  9615. this.elastic = resolveDragElastic(dragElastic);
  9616. /**
  9617. * If we're outputting to external MotionValues, we want to rebase the measured constraints
  9618. * from viewport-relative to component-relative.
  9619. */
  9620. if (prevConstraints !== this.constraints &&
  9621. layout &&
  9622. this.constraints &&
  9623. !this.hasMutatedConstraints) {
  9624. eachAxis(function (axis) {
  9625. if (_this.getAxisMotionValue(axis)) {
  9626. _this.constraints[axis] = rebaseAxisConstraints(layout.actual[axis], _this.constraints[axis]);
  9627. }
  9628. });
  9629. }
  9630. };
  9631. VisualElementDragControls.prototype.resolveRefConstraints = function () {
  9632. var _a = this.getProps(), constraints = _a.dragConstraints, onMeasureDragConstraints = _a.onMeasureDragConstraints;
  9633. if (!constraints || !is_ref_object_isRefObject(constraints))
  9634. return false;
  9635. var constraintsElement = constraints.current;
  9636. invariant(constraintsElement !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");
  9637. var projection = this.visualElement.projection;
  9638. // TODO
  9639. if (!projection || !projection.layout)
  9640. return false;
  9641. var constraintsBox = measurePageBox(constraintsElement, projection.root, this.visualElement.getTransformPagePoint());
  9642. var measuredConstraints = calcViewportConstraints(projection.layout.actual, constraintsBox);
  9643. /**
  9644. * If there's an onMeasureDragConstraints listener we call it and
  9645. * if different constraints are returned, set constraints to that
  9646. */
  9647. if (onMeasureDragConstraints) {
  9648. var userConstraints = onMeasureDragConstraints(convertBoxToBoundingBox(measuredConstraints));
  9649. this.hasMutatedConstraints = !!userConstraints;
  9650. if (userConstraints) {
  9651. measuredConstraints = convertBoundingBoxToBox(userConstraints);
  9652. }
  9653. }
  9654. return measuredConstraints;
  9655. };
  9656. VisualElementDragControls.prototype.startAnimation = function (velocity) {
  9657. var _this = this;
  9658. var _a = this.getProps(), drag = _a.drag, dragMomentum = _a.dragMomentum, dragElastic = _a.dragElastic, dragTransition = _a.dragTransition, dragSnapToOrigin = _a.dragSnapToOrigin, onDragTransitionEnd = _a.onDragTransitionEnd;
  9659. var constraints = this.constraints || {};
  9660. var momentumAnimations = eachAxis(function (axis) {
  9661. var _a;
  9662. if (!shouldDrag(axis, drag, _this.currentDirection)) {
  9663. return;
  9664. }
  9665. var transition = (_a = constraints === null || constraints === void 0 ? void 0 : constraints[axis]) !== null && _a !== void 0 ? _a : {};
  9666. if (dragSnapToOrigin)
  9667. transition = { min: 0, max: 0 };
  9668. /**
  9669. * Overdamp the boundary spring if `dragElastic` is disabled. There's still a frame
  9670. * of spring animations so we should look into adding a disable spring option to `inertia`.
  9671. * We could do something here where we affect the `bounceStiffness` and `bounceDamping`
  9672. * using the value of `dragElastic`.
  9673. */
  9674. var bounceStiffness = dragElastic ? 200 : 1000000;
  9675. var bounceDamping = dragElastic ? 40 : 10000000;
  9676. var inertia = __assign(__assign({ type: "inertia", velocity: dragMomentum ? velocity[axis] : 0, bounceStiffness: bounceStiffness, bounceDamping: bounceDamping, timeConstant: 750, restDelta: 1, restSpeed: 10 }, dragTransition), transition);
  9677. // If we're not animating on an externally-provided `MotionValue` we can use the
  9678. // component's animation controls which will handle interactions with whileHover (etc),
  9679. // otherwise we just have to animate the `MotionValue` itself.
  9680. return _this.startAxisValueAnimation(axis, inertia);
  9681. });
  9682. // Run all animations and then resolve the new drag constraints.
  9683. return Promise.all(momentumAnimations).then(onDragTransitionEnd);
  9684. };
  9685. VisualElementDragControls.prototype.startAxisValueAnimation = function (axis, transition) {
  9686. var axisValue = this.getAxisMotionValue(axis);
  9687. return startAnimation(axis, axisValue, 0, transition);
  9688. };
  9689. VisualElementDragControls.prototype.stopAnimation = function () {
  9690. var _this = this;
  9691. eachAxis(function (axis) { return _this.getAxisMotionValue(axis).stop(); });
  9692. };
  9693. /**
  9694. * Drag works differently depending on which props are provided.
  9695. *
  9696. * - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.
  9697. * - Otherwise, we apply the delta to the x/y motion values.
  9698. */
  9699. VisualElementDragControls.prototype.getAxisMotionValue = function (axis) {
  9700. var _a, _b;
  9701. var dragKey = "_drag" + axis.toUpperCase();
  9702. var externalMotionValue = this.visualElement.getProps()[dragKey];
  9703. return externalMotionValue
  9704. ? externalMotionValue
  9705. : this.visualElement.getValue(axis, (_b = (_a = this.visualElement.getProps().initial) === null || _a === void 0 ? void 0 : _a[axis]) !== null && _b !== void 0 ? _b : 0);
  9706. };
  9707. VisualElementDragControls.prototype.snapToCursor = function (point) {
  9708. var _this = this;
  9709. eachAxis(function (axis) {
  9710. var drag = _this.getProps().drag;
  9711. // If we're not dragging this axis, do an early return.
  9712. if (!shouldDrag(axis, drag, _this.currentDirection))
  9713. return;
  9714. var projection = _this.visualElement.projection;
  9715. var axisValue = _this.getAxisMotionValue(axis);
  9716. if (projection && projection.layout) {
  9717. var _a = projection.layout.actual[axis], min = _a.min, max = _a.max;
  9718. axisValue.set(point[axis] - mix(min, max, 0.5));
  9719. }
  9720. });
  9721. };
  9722. /**
  9723. * When the viewport resizes we want to check if the measured constraints
  9724. * have changed and, if so, reposition the element within those new constraints
  9725. * relative to where it was before the resize.
  9726. */
  9727. VisualElementDragControls.prototype.scalePositionWithinConstraints = function () {
  9728. var _this = this;
  9729. var _a;
  9730. var _b = this.getProps(), drag = _b.drag, dragConstraints = _b.dragConstraints;
  9731. var projection = this.visualElement.projection;
  9732. if (!is_ref_object_isRefObject(dragConstraints) || !projection || !this.constraints)
  9733. return;
  9734. /**
  9735. * Stop current animations as there can be visual glitching if we try to do
  9736. * this mid-animation
  9737. */
  9738. this.stopAnimation();
  9739. /**
  9740. * Record the relative position of the dragged element relative to the
  9741. * constraints box and save as a progress value.
  9742. */
  9743. var boxProgress = { x: 0, y: 0 };
  9744. eachAxis(function (axis) {
  9745. var axisValue = _this.getAxisMotionValue(axis);
  9746. if (axisValue) {
  9747. var latest = axisValue.get();
  9748. boxProgress[axis] = constraints_calcOrigin({ min: latest, max: latest }, _this.constraints[axis]);
  9749. }
  9750. });
  9751. /**
  9752. * Update the layout of this element and resolve the latest drag constraints
  9753. */
  9754. var transformTemplate = this.visualElement.getProps().transformTemplate;
  9755. this.visualElement.getInstance().style.transform = transformTemplate
  9756. ? transformTemplate({}, "")
  9757. : "none";
  9758. (_a = projection.root) === null || _a === void 0 ? void 0 : _a.updateScroll();
  9759. projection.updateLayout();
  9760. this.resolveConstraints();
  9761. /**
  9762. * For each axis, calculate the current progress of the layout axis
  9763. * within the new constraints.
  9764. */
  9765. eachAxis(function (axis) {
  9766. if (!shouldDrag(axis, drag, null))
  9767. return;
  9768. /**
  9769. * Calculate a new transform based on the previous box progress
  9770. */
  9771. var axisValue = _this.getAxisMotionValue(axis);
  9772. var _a = _this.constraints[axis], min = _a.min, max = _a.max;
  9773. axisValue.set(mix(min, max, boxProgress[axis]));
  9774. });
  9775. };
  9776. VisualElementDragControls.prototype.addListeners = function () {
  9777. var _this = this;
  9778. var _a;
  9779. elementDragControls.set(this.visualElement, this);
  9780. var element = this.visualElement.getInstance();
  9781. /**
  9782. * Attach a pointerdown event listener on this DOM element to initiate drag tracking.
  9783. */
  9784. var stopPointerListener = addPointerEvent(element, "pointerdown", function (event) {
  9785. var _a = _this.getProps(), drag = _a.drag, _b = _a.dragListener, dragListener = _b === void 0 ? true : _b;
  9786. drag && dragListener && _this.start(event);
  9787. });
  9788. var measureDragConstraints = function () {
  9789. var dragConstraints = _this.getProps().dragConstraints;
  9790. if (is_ref_object_isRefObject(dragConstraints)) {
  9791. _this.constraints = _this.resolveRefConstraints();
  9792. }
  9793. };
  9794. var projection = this.visualElement.projection;
  9795. var stopMeasureLayoutListener = projection.addEventListener("measure", measureDragConstraints);
  9796. if (projection && !projection.layout) {
  9797. (_a = projection.root) === null || _a === void 0 ? void 0 : _a.updateScroll();
  9798. projection.updateLayout();
  9799. }
  9800. measureDragConstraints();
  9801. /**
  9802. * Attach a window resize listener to scale the draggable target within its defined
  9803. * constraints as the window resizes.
  9804. */
  9805. var stopResizeListener = addDomEvent(window, "resize", function () {
  9806. return _this.scalePositionWithinConstraints();
  9807. });
  9808. /**
  9809. * If the element's layout changes, calculate the delta and apply that to
  9810. * the drag gesture's origin point.
  9811. */
  9812. projection.addEventListener("didUpdate", (function (_a) {
  9813. var delta = _a.delta, hasLayoutChanged = _a.hasLayoutChanged;
  9814. if (_this.isDragging && hasLayoutChanged) {
  9815. eachAxis(function (axis) {
  9816. var motionValue = _this.getAxisMotionValue(axis);
  9817. if (!motionValue)
  9818. return;
  9819. _this.originPoint[axis] += delta[axis].translate;
  9820. motionValue.set(motionValue.get() + delta[axis].translate);
  9821. });
  9822. _this.visualElement.syncRender();
  9823. }
  9824. }));
  9825. return function () {
  9826. stopResizeListener();
  9827. stopPointerListener();
  9828. stopMeasureLayoutListener();
  9829. };
  9830. };
  9831. VisualElementDragControls.prototype.getProps = function () {
  9832. var props = this.visualElement.getProps();
  9833. 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;
  9834. return __assign(__assign({}, props), { drag: drag, dragDirectionLock: dragDirectionLock, dragPropagation: dragPropagation, dragConstraints: dragConstraints, dragElastic: dragElastic, dragMomentum: dragMomentum });
  9835. };
  9836. return VisualElementDragControls;
  9837. }());
  9838. function shouldDrag(direction, drag, currentDirection) {
  9839. return ((drag === true || drag === direction) &&
  9840. (currentDirection === null || currentDirection === direction));
  9841. }
  9842. /**
  9843. * Based on an x/y offset determine the current drag direction. If both axis' offsets are lower
  9844. * than the provided threshold, return `null`.
  9845. *
  9846. * @param offset - The x/y offset from origin.
  9847. * @param lockThreshold - (Optional) - the minimum absolute offset before we can determine a drag direction.
  9848. */
  9849. function getCurrentDirection(offset, lockThreshold) {
  9850. if (lockThreshold === void 0) { lockThreshold = 10; }
  9851. var direction = null;
  9852. if (Math.abs(offset.y) > lockThreshold) {
  9853. direction = "y";
  9854. }
  9855. else if (Math.abs(offset.x) > lockThreshold) {
  9856. direction = "x";
  9857. }
  9858. return direction;
  9859. }
  9860. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/drag/use-drag.mjs
  9861. /**
  9862. * A hook that allows an element to be dragged.
  9863. *
  9864. * @internal
  9865. */
  9866. function useDrag(props) {
  9867. var groupDragControls = props.dragControls, visualElement = props.visualElement;
  9868. var dragControls = useConstant(function () { return new VisualElementDragControls(visualElement); });
  9869. // If we've been provided a DragControls for manual control over the drag gesture,
  9870. // subscribe this component to it on mount.
  9871. (0,external_React_namespaceObject.useEffect)(function () { return groupDragControls && groupDragControls.subscribe(dragControls); }, [dragControls, groupDragControls]);
  9872. // Apply the event listeners to the element
  9873. (0,external_React_namespaceObject.useEffect)(function () { return dragControls.addListeners(); }, [dragControls]);
  9874. }
  9875. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/gestures/use-pan-gesture.mjs
  9876. /**
  9877. *
  9878. * @param handlers -
  9879. * @param ref -
  9880. *
  9881. * @privateRemarks
  9882. * Currently this sets new pan gesture functions every render. The memo route has been explored
  9883. * in the past but ultimately we're still creating new functions every render. An optimisation
  9884. * to explore is creating the pan gestures and loading them into a `ref`.
  9885. *
  9886. * @internal
  9887. */
  9888. function usePanGesture(_a) {
  9889. var onPan = _a.onPan, onPanStart = _a.onPanStart, onPanEnd = _a.onPanEnd, onPanSessionStart = _a.onPanSessionStart, visualElement = _a.visualElement;
  9890. var hasPanEvents = onPan || onPanStart || onPanEnd || onPanSessionStart;
  9891. var panSession = (0,external_React_namespaceObject.useRef)(null);
  9892. var transformPagePoint = (0,external_React_namespaceObject.useContext)(MotionConfigContext).transformPagePoint;
  9893. var handlers = {
  9894. onSessionStart: onPanSessionStart,
  9895. onStart: onPanStart,
  9896. onMove: onPan,
  9897. onEnd: function (event, info) {
  9898. panSession.current = null;
  9899. onPanEnd && onPanEnd(event, info);
  9900. },
  9901. };
  9902. (0,external_React_namespaceObject.useEffect)(function () {
  9903. if (panSession.current !== null) {
  9904. panSession.current.updateHandlers(handlers);
  9905. }
  9906. });
  9907. function onPointerDown(event) {
  9908. panSession.current = new PanSession(event, handlers, {
  9909. transformPagePoint: transformPagePoint,
  9910. });
  9911. }
  9912. usePointerEvent(visualElement, "pointerdown", hasPanEvents && onPointerDown);
  9913. useUnmountEffect(function () { return panSession.current && panSession.current.end(); });
  9914. }
  9915. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/drag.mjs
  9916. var drag = {
  9917. pan: makeRenderlessComponent(usePanGesture),
  9918. drag: makeRenderlessComponent(useDrag),
  9919. };
  9920. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/lifecycles.mjs
  9921. var names = [
  9922. "LayoutMeasure",
  9923. "BeforeLayoutMeasure",
  9924. "LayoutUpdate",
  9925. "ViewportBoxUpdate",
  9926. "Update",
  9927. "Render",
  9928. "AnimationComplete",
  9929. "LayoutAnimationComplete",
  9930. "AnimationStart",
  9931. "LayoutAnimationStart",
  9932. "SetAxisTarget",
  9933. "Unmount",
  9934. ];
  9935. function createLifecycles() {
  9936. var managers = names.map(function () { return new SubscriptionManager(); });
  9937. var propSubscriptions = {};
  9938. var lifecycles = {
  9939. clearAllListeners: function () { return managers.forEach(function (manager) { return manager.clear(); }); },
  9940. updatePropListeners: function (props) {
  9941. names.forEach(function (name) {
  9942. var _a;
  9943. var on = "on" + name;
  9944. var propListener = props[on];
  9945. // Unsubscribe existing subscription
  9946. (_a = propSubscriptions[name]) === null || _a === void 0 ? void 0 : _a.call(propSubscriptions);
  9947. // Add new subscription
  9948. if (propListener) {
  9949. propSubscriptions[name] = lifecycles[on](propListener);
  9950. }
  9951. });
  9952. },
  9953. };
  9954. managers.forEach(function (manager, i) {
  9955. lifecycles["on" + names[i]] = function (handler) { return manager.add(handler); };
  9956. lifecycles["notify" + names[i]] = function () {
  9957. var args = [];
  9958. for (var _i = 0; _i < arguments.length; _i++) {
  9959. args[_i] = arguments[_i];
  9960. }
  9961. return manager.notify.apply(manager, tslib_es6_spreadArray([], tslib_es6_read(args), false));
  9962. };
  9963. });
  9964. return lifecycles;
  9965. }
  9966. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/motion-values.mjs
  9967. function updateMotionValuesFromProps(element, next, prev) {
  9968. var _a;
  9969. for (var key in next) {
  9970. var nextValue = next[key];
  9971. var prevValue = prev[key];
  9972. if (isMotionValue(nextValue)) {
  9973. /**
  9974. * If this is a motion value found in props or style, we want to add it
  9975. * to our visual element's motion value map.
  9976. */
  9977. element.addValue(key, nextValue);
  9978. /**
  9979. * Check the version of the incoming motion value with this version
  9980. * and warn against mismatches.
  9981. */
  9982. if (false) {}
  9983. }
  9984. else if (isMotionValue(prevValue)) {
  9985. /**
  9986. * If we're swapping to a new motion value, create a new motion value
  9987. * from that
  9988. */
  9989. element.addValue(key, motionValue(nextValue));
  9990. }
  9991. else if (prevValue !== nextValue) {
  9992. /**
  9993. * If this is a flat value that has changed, update the motion value
  9994. * or create one if it doesn't exist. We only want to do this if we're
  9995. * not handling the value with our animation state.
  9996. */
  9997. if (element.hasValue(key)) {
  9998. var existingValue = element.getValue(key);
  9999. // TODO: Only update values that aren't being animated or even looked at
  10000. !existingValue.hasAnimated && existingValue.set(nextValue);
  10001. }
  10002. else {
  10003. element.addValue(key, motionValue((_a = element.getStaticValue(key)) !== null && _a !== void 0 ? _a : nextValue));
  10004. }
  10005. }
  10006. }
  10007. // Handle removed values
  10008. for (var key in prev) {
  10009. if (next[key] === undefined)
  10010. element.removeValue(key);
  10011. }
  10012. return next;
  10013. }
  10014. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/index.mjs
  10015. var visualElement = function (_a) {
  10016. 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;
  10017. return function (_a, options) {
  10018. var parent = _a.parent, props = _a.props, presenceId = _a.presenceId, blockInitialAnimation = _a.blockInitialAnimation, visualState = _a.visualState, shouldReduceMotion = _a.shouldReduceMotion;
  10019. if (options === void 0) { options = {}; }
  10020. var isMounted = false;
  10021. var latestValues = visualState.latestValues, renderState = visualState.renderState;
  10022. /**
  10023. * The instance of the render-specific node that will be hydrated by the
  10024. * exposed React ref. So for example, this visual element can host a
  10025. * HTMLElement, plain object, or Three.js object. The functions provided
  10026. * in VisualElementConfig allow us to interface with this instance.
  10027. */
  10028. var instance;
  10029. /**
  10030. * Manages the subscriptions for a visual element's lifecycle, for instance
  10031. * onRender
  10032. */
  10033. var lifecycles = createLifecycles();
  10034. /**
  10035. * A map of all motion values attached to this visual element. Motion
  10036. * values are source of truth for any given animated value. A motion
  10037. * value might be provided externally by the component via props.
  10038. */
  10039. var values = new Map();
  10040. /**
  10041. * A map of every subscription that binds the provided or generated
  10042. * motion values onChange listeners to this visual element.
  10043. */
  10044. var valueSubscriptions = new Map();
  10045. /**
  10046. * A reference to the previously-provided motion values as returned
  10047. * from scrapeMotionValuesFromProps. We use the keys in here to determine
  10048. * if any motion values need to be removed after props are updated.
  10049. */
  10050. var prevMotionValues = {};
  10051. /**
  10052. * When values are removed from all animation props we need to search
  10053. * for a fallback value to animate to. These values are tracked in baseTarget.
  10054. */
  10055. var baseTarget = __assign({}, latestValues);
  10056. // Internal methods ========================
  10057. /**
  10058. * On mount, this will be hydrated with a callback to disconnect
  10059. * this visual element from its parent on unmount.
  10060. */
  10061. var removeFromVariantTree;
  10062. /**
  10063. * Render the element with the latest styles outside of the React
  10064. * render lifecycle
  10065. */
  10066. function render() {
  10067. if (!instance || !isMounted)
  10068. return;
  10069. triggerBuild();
  10070. renderInstance(instance, renderState, props.style, element.projection);
  10071. }
  10072. function triggerBuild() {
  10073. build(element, renderState, latestValues, options, props);
  10074. }
  10075. function update() {
  10076. lifecycles.notifyUpdate(latestValues);
  10077. }
  10078. /**
  10079. *
  10080. */
  10081. function bindToMotionValue(key, value) {
  10082. var removeOnChange = value.onChange(function (latestValue) {
  10083. latestValues[key] = latestValue;
  10084. props.onUpdate && es.update(update, false, true);
  10085. });
  10086. var removeOnRenderRequest = value.onRenderRequest(element.scheduleRender);
  10087. valueSubscriptions.set(key, function () {
  10088. removeOnChange();
  10089. removeOnRenderRequest();
  10090. });
  10091. }
  10092. /**
  10093. * Any motion values that are provided to the element when created
  10094. * aren't yet bound to the element, as this would technically be impure.
  10095. * However, we iterate through the motion values and set them to the
  10096. * initial values for this component.
  10097. *
  10098. * TODO: This is impure and we should look at changing this to run on mount.
  10099. * Doing so will break some tests but this isn't neccessarily a breaking change,
  10100. * more a reflection of the test.
  10101. */
  10102. var initialMotionValues = scrapeMotionValuesFromProps(props);
  10103. for (var key in initialMotionValues) {
  10104. var value = initialMotionValues[key];
  10105. if (latestValues[key] !== undefined && isMotionValue(value)) {
  10106. value.set(latestValues[key], false);
  10107. }
  10108. }
  10109. /**
  10110. * Determine what role this visual element should take in the variant tree.
  10111. */
  10112. var isControllingVariants = checkIfControllingVariants(props);
  10113. var isVariantNode = checkIfVariantNode(props);
  10114. var element = __assign(__assign({ treeType: treeType,
  10115. /**
  10116. * This is a mirror of the internal instance prop, which keeps
  10117. * VisualElement type-compatible with React's RefObject.
  10118. */
  10119. current: null,
  10120. /**
  10121. * The depth of this visual element within the visual element tree.
  10122. */
  10123. depth: parent ? parent.depth + 1 : 0, parent: parent, children: new Set(),
  10124. /**
  10125. *
  10126. */
  10127. presenceId: presenceId, shouldReduceMotion: shouldReduceMotion,
  10128. /**
  10129. * If this component is part of the variant tree, it should track
  10130. * any children that are also part of the tree. This is essentially
  10131. * a shadow tree to simplify logic around how to stagger over children.
  10132. */
  10133. variantChildren: isVariantNode ? new Set() : undefined,
  10134. /**
  10135. * Whether this instance is visible. This can be changed imperatively
  10136. * by the projection tree, is analogous to CSS's visibility in that
  10137. * hidden elements should take up layout, and needs enacting by the configured
  10138. * render function.
  10139. */
  10140. isVisible: undefined,
  10141. /**
  10142. * Normally, if a component is controlled by a parent's variants, it can
  10143. * rely on that ancestor to trigger animations further down the tree.
  10144. * However, if a component is created after its parent is mounted, the parent
  10145. * won't trigger that mount animation so the child needs to.
  10146. *
  10147. * TODO: This might be better replaced with a method isParentMounted
  10148. */
  10149. manuallyAnimateOnMount: Boolean(parent === null || parent === void 0 ? void 0 : parent.isMounted()),
  10150. /**
  10151. * This can be set by AnimatePresence to force components that mount
  10152. * at the same time as it to mount as if they have initial={false} set.
  10153. */
  10154. blockInitialAnimation: blockInitialAnimation,
  10155. /**
  10156. * Determine whether this component has mounted yet. This is mostly used
  10157. * by variant children to determine whether they need to trigger their
  10158. * own animations on mount.
  10159. */
  10160. isMounted: function () { return Boolean(instance); }, mount: function (newInstance) {
  10161. isMounted = true;
  10162. instance = element.current = newInstance;
  10163. if (element.projection) {
  10164. element.projection.mount(newInstance);
  10165. }
  10166. if (isVariantNode && parent && !isControllingVariants) {
  10167. removeFromVariantTree = parent === null || parent === void 0 ? void 0 : parent.addVariantChild(element);
  10168. }
  10169. values.forEach(function (value, key) { return bindToMotionValue(key, value); });
  10170. parent === null || parent === void 0 ? void 0 : parent.children.add(element);
  10171. element.setProps(props);
  10172. },
  10173. /**
  10174. *
  10175. */
  10176. unmount: function () {
  10177. var _a;
  10178. (_a = element.projection) === null || _a === void 0 ? void 0 : _a.unmount();
  10179. cancelSync.update(update);
  10180. cancelSync.render(render);
  10181. valueSubscriptions.forEach(function (remove) { return remove(); });
  10182. removeFromVariantTree === null || removeFromVariantTree === void 0 ? void 0 : removeFromVariantTree();
  10183. parent === null || parent === void 0 ? void 0 : parent.children.delete(element);
  10184. lifecycles.clearAllListeners();
  10185. instance = undefined;
  10186. isMounted = false;
  10187. },
  10188. /**
  10189. * Add a child visual element to our set of children.
  10190. */
  10191. addVariantChild: function (child) {
  10192. var _a;
  10193. var closestVariantNode = element.getClosestVariantNode();
  10194. if (closestVariantNode) {
  10195. (_a = closestVariantNode.variantChildren) === null || _a === void 0 ? void 0 : _a.add(child);
  10196. return function () {
  10197. return closestVariantNode.variantChildren.delete(child);
  10198. };
  10199. }
  10200. }, sortNodePosition: function (other) {
  10201. /**
  10202. * If these nodes aren't even of the same type we can't compare their depth.
  10203. */
  10204. if (!sortNodePosition || treeType !== other.treeType)
  10205. return 0;
  10206. return sortNodePosition(element.getInstance(), other.getInstance());
  10207. },
  10208. /**
  10209. * Returns the closest variant node in the tree starting from
  10210. * this visual element.
  10211. */
  10212. getClosestVariantNode: function () {
  10213. return isVariantNode ? element : parent === null || parent === void 0 ? void 0 : parent.getClosestVariantNode();
  10214. },
  10215. /**
  10216. * Expose the latest layoutId prop.
  10217. */
  10218. getLayoutId: function () { return props.layoutId; },
  10219. /**
  10220. * Returns the current instance.
  10221. */
  10222. getInstance: function () { return instance; },
  10223. /**
  10224. * Get/set the latest static values.
  10225. */
  10226. getStaticValue: function (key) { return latestValues[key]; }, setStaticValue: function (key, value) { return (latestValues[key] = value); },
  10227. /**
  10228. * Returns the latest motion value state. Currently only used to take
  10229. * a snapshot of the visual element - perhaps this can return the whole
  10230. * visual state
  10231. */
  10232. getLatestValues: function () { return latestValues; },
  10233. /**
  10234. * Set the visiblity of the visual element. If it's changed, schedule
  10235. * a render to reflect these changes.
  10236. */
  10237. setVisibility: function (visibility) {
  10238. if (element.isVisible === visibility)
  10239. return;
  10240. element.isVisible = visibility;
  10241. element.scheduleRender();
  10242. },
  10243. /**
  10244. * Make a target animatable by Popmotion. For instance, if we're
  10245. * trying to animate width from 100px to 100vw we need to measure 100vw
  10246. * in pixels to determine what we really need to animate to. This is also
  10247. * pluggable to support Framer's custom value types like Color,
  10248. * and CSS variables.
  10249. */
  10250. makeTargetAnimatable: function (target, canMutate) {
  10251. if (canMutate === void 0) { canMutate = true; }
  10252. return makeTargetAnimatable(element, target, props, canMutate);
  10253. },
  10254. /**
  10255. * Measure the current viewport box with or without transforms.
  10256. * Only measures axis-aligned boxes, rotate and skew must be manually
  10257. * removed with a re-render to work.
  10258. */
  10259. measureViewportBox: function () {
  10260. return measureViewportBox(instance, props);
  10261. },
  10262. // Motion values ========================
  10263. /**
  10264. * Add a motion value and bind it to this visual element.
  10265. */
  10266. addValue: function (key, value) {
  10267. // Remove existing value if it exists
  10268. if (element.hasValue(key))
  10269. element.removeValue(key);
  10270. values.set(key, value);
  10271. latestValues[key] = value.get();
  10272. bindToMotionValue(key, value);
  10273. },
  10274. /**
  10275. * Remove a motion value and unbind any active subscriptions.
  10276. */
  10277. removeValue: function (key) {
  10278. var _a;
  10279. values.delete(key);
  10280. (_a = valueSubscriptions.get(key)) === null || _a === void 0 ? void 0 : _a();
  10281. valueSubscriptions.delete(key);
  10282. delete latestValues[key];
  10283. removeValueFromRenderState(key, renderState);
  10284. },
  10285. /**
  10286. * Check whether we have a motion value for this key
  10287. */
  10288. hasValue: function (key) { return values.has(key); },
  10289. /**
  10290. * Get a motion value for this key. If called with a default
  10291. * value, we'll create one if none exists.
  10292. */
  10293. getValue: function (key, defaultValue) {
  10294. var value = values.get(key);
  10295. if (value === undefined && defaultValue !== undefined) {
  10296. value = motionValue(defaultValue);
  10297. element.addValue(key, value);
  10298. }
  10299. return value;
  10300. },
  10301. /**
  10302. * Iterate over our motion values.
  10303. */
  10304. forEachValue: function (callback) { return values.forEach(callback); },
  10305. /**
  10306. * If we're trying to animate to a previously unencountered value,
  10307. * we need to check for it in our state and as a last resort read it
  10308. * directly from the instance (which might have performance implications).
  10309. */
  10310. readValue: function (key) {
  10311. var _a;
  10312. return (_a = latestValues[key]) !== null && _a !== void 0 ? _a : readValueFromInstance(instance, key, options);
  10313. },
  10314. /**
  10315. * Set the base target to later animate back to. This is currently
  10316. * only hydrated on creation and when we first read a value.
  10317. */
  10318. setBaseTarget: function (key, value) {
  10319. baseTarget[key] = value;
  10320. },
  10321. /**
  10322. * Find the base target for a value thats been removed from all animation
  10323. * props.
  10324. */
  10325. getBaseTarget: function (key) {
  10326. if (getBaseTarget) {
  10327. var target = getBaseTarget(props, key);
  10328. if (target !== undefined && !isMotionValue(target))
  10329. return target;
  10330. }
  10331. return baseTarget[key];
  10332. } }, lifecycles), {
  10333. /**
  10334. * Build the renderer state based on the latest visual state.
  10335. */
  10336. build: function () {
  10337. triggerBuild();
  10338. return renderState;
  10339. },
  10340. /**
  10341. * Schedule a render on the next animation frame.
  10342. */
  10343. scheduleRender: function () {
  10344. es.render(render, false, true);
  10345. },
  10346. /**
  10347. * Synchronously fire render. It's prefered that we batch renders but
  10348. * in many circumstances, like layout measurement, we need to run this
  10349. * synchronously. However in those instances other measures should be taken
  10350. * to batch reads/writes.
  10351. */
  10352. syncRender: render,
  10353. /**
  10354. * Update the provided props. Ensure any newly-added motion values are
  10355. * added to our map, old ones removed, and listeners updated.
  10356. */
  10357. setProps: function (newProps) {
  10358. if (newProps.transformTemplate || props.transformTemplate) {
  10359. element.scheduleRender();
  10360. }
  10361. props = newProps;
  10362. lifecycles.updatePropListeners(newProps);
  10363. prevMotionValues = updateMotionValuesFromProps(element, scrapeMotionValuesFromProps(props), prevMotionValues);
  10364. }, getProps: function () { return props; },
  10365. // Variants ==============================
  10366. /**
  10367. * Returns the variant definition with a given name.
  10368. */
  10369. getVariant: function (name) { var _a; return (_a = props.variants) === null || _a === void 0 ? void 0 : _a[name]; },
  10370. /**
  10371. * Returns the defined default transition on this component.
  10372. */
  10373. getDefaultTransition: function () { return props.transition; }, getTransformPagePoint: function () {
  10374. return props.transformPagePoint;
  10375. },
  10376. /**
  10377. * Used by child variant nodes to get the closest ancestor variant props.
  10378. */
  10379. getVariantContext: function (startAtParent) {
  10380. if (startAtParent === void 0) { startAtParent = false; }
  10381. if (startAtParent)
  10382. return parent === null || parent === void 0 ? void 0 : parent.getVariantContext();
  10383. if (!isControllingVariants) {
  10384. var context_1 = (parent === null || parent === void 0 ? void 0 : parent.getVariantContext()) || {};
  10385. if (props.initial !== undefined) {
  10386. context_1.initial = props.initial;
  10387. }
  10388. return context_1;
  10389. }
  10390. var context = {};
  10391. for (var i = 0; i < numVariantProps; i++) {
  10392. var name_1 = variantProps[i];
  10393. var prop = props[name_1];
  10394. if (isVariantLabel(prop) || prop === false) {
  10395. context[name_1] = prop;
  10396. }
  10397. }
  10398. return context;
  10399. } });
  10400. return element;
  10401. };
  10402. };
  10403. var variantProps = tslib_es6_spreadArray(["initial"], tslib_es6_read(variantPriorityOrder), false);
  10404. var numVariantProps = variantProps.length;
  10405. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/css-variables-conversion.mjs
  10406. function css_variables_conversion_isCSSVariable(value) {
  10407. return typeof value === "string" && value.startsWith("var(--");
  10408. }
  10409. /**
  10410. * Parse Framer's special CSS variable format into a CSS token and a fallback.
  10411. *
  10412. * ```
  10413. * `var(--foo, #fff)` => [`--foo`, '#fff']
  10414. * ```
  10415. *
  10416. * @param current
  10417. */
  10418. var cssVariableRegex = /var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;
  10419. function parseCSSVariable(current) {
  10420. var match = cssVariableRegex.exec(current);
  10421. if (!match)
  10422. return [,];
  10423. var _a = tslib_es6_read(match, 3), token = _a[1], fallback = _a[2];
  10424. return [token, fallback];
  10425. }
  10426. var maxDepth = 4;
  10427. function getVariableValue(current, element, depth) {
  10428. if (depth === void 0) { depth = 1; }
  10429. invariant(depth <= maxDepth, "Max CSS variable fallback depth detected in property \"".concat(current, "\". This may indicate a circular fallback dependency."));
  10430. var _a = tslib_es6_read(parseCSSVariable(current), 2), token = _a[0], fallback = _a[1];
  10431. // No CSS variable detected
  10432. if (!token)
  10433. return;
  10434. // Attempt to read this CSS variable off the element
  10435. var resolved = window.getComputedStyle(element).getPropertyValue(token);
  10436. if (resolved) {
  10437. return resolved.trim();
  10438. }
  10439. else if (css_variables_conversion_isCSSVariable(fallback)) {
  10440. // The fallback might itself be a CSS variable, in which case we attempt to resolve it too.
  10441. return getVariableValue(fallback, element, depth + 1);
  10442. }
  10443. else {
  10444. return fallback;
  10445. }
  10446. }
  10447. /**
  10448. * Resolve CSS variables from
  10449. *
  10450. * @internal
  10451. */
  10452. function resolveCSSVariables(visualElement, _a, transitionEnd) {
  10453. var _b;
  10454. var target = __rest(_a, []);
  10455. var element = visualElement.getInstance();
  10456. if (!(element instanceof Element))
  10457. return { target: target, transitionEnd: transitionEnd };
  10458. // If `transitionEnd` isn't `undefined`, clone it. We could clone `target` and `transitionEnd`
  10459. // only if they change but I think this reads clearer and this isn't a performance-critical path.
  10460. if (transitionEnd) {
  10461. transitionEnd = __assign({}, transitionEnd);
  10462. }
  10463. // Go through existing `MotionValue`s and ensure any existing CSS variables are resolved
  10464. visualElement.forEachValue(function (value) {
  10465. var current = value.get();
  10466. if (!css_variables_conversion_isCSSVariable(current))
  10467. return;
  10468. var resolved = getVariableValue(current, element);
  10469. if (resolved)
  10470. value.set(resolved);
  10471. });
  10472. // Cycle through every target property and resolve CSS variables. Currently
  10473. // we only read single-var properties like `var(--foo)`, not `calc(var(--foo) + 20px)`
  10474. for (var key in target) {
  10475. var current = target[key];
  10476. if (!css_variables_conversion_isCSSVariable(current))
  10477. continue;
  10478. var resolved = getVariableValue(current, element);
  10479. if (!resolved)
  10480. continue;
  10481. // Clone target if it hasn't already been
  10482. target[key] = resolved;
  10483. // If the user hasn't already set this key on `transitionEnd`, set it to the unresolved
  10484. // CSS variable. This will ensure that after the animation the component will reflect
  10485. // changes in the value of the CSS variable.
  10486. if (transitionEnd)
  10487. (_b = transitionEnd[key]) !== null && _b !== void 0 ? _b : (transitionEnd[key] = current);
  10488. }
  10489. return { target: target, transitionEnd: transitionEnd };
  10490. }
  10491. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/unit-conversion.mjs
  10492. var positionalKeys = new Set([
  10493. "width",
  10494. "height",
  10495. "top",
  10496. "left",
  10497. "right",
  10498. "bottom",
  10499. "x",
  10500. "y",
  10501. ]);
  10502. var isPositionalKey = function (key) { return positionalKeys.has(key); };
  10503. var hasPositionalKey = function (target) {
  10504. return Object.keys(target).some(isPositionalKey);
  10505. };
  10506. var setAndResetVelocity = function (value, to) {
  10507. // Looks odd but setting it twice doesn't render, it'll just
  10508. // set both prev and current to the latest value
  10509. value.set(to, false);
  10510. value.set(to);
  10511. };
  10512. var isNumOrPxType = function (v) {
  10513. return v === number || v === px;
  10514. };
  10515. var BoundingBoxDimension;
  10516. (function (BoundingBoxDimension) {
  10517. BoundingBoxDimension["width"] = "width";
  10518. BoundingBoxDimension["height"] = "height";
  10519. BoundingBoxDimension["left"] = "left";
  10520. BoundingBoxDimension["right"] = "right";
  10521. BoundingBoxDimension["top"] = "top";
  10522. BoundingBoxDimension["bottom"] = "bottom";
  10523. })(BoundingBoxDimension || (BoundingBoxDimension = {}));
  10524. var getPosFromMatrix = function (matrix, pos) {
  10525. return parseFloat(matrix.split(", ")[pos]);
  10526. };
  10527. var getTranslateFromMatrix = function (pos2, pos3) {
  10528. return function (_bbox, _a) {
  10529. var transform = _a.transform;
  10530. if (transform === "none" || !transform)
  10531. return 0;
  10532. var matrix3d = transform.match(/^matrix3d\((.+)\)$/);
  10533. if (matrix3d) {
  10534. return getPosFromMatrix(matrix3d[1], pos3);
  10535. }
  10536. else {
  10537. var matrix = transform.match(/^matrix\((.+)\)$/);
  10538. if (matrix) {
  10539. return getPosFromMatrix(matrix[1], pos2);
  10540. }
  10541. else {
  10542. return 0;
  10543. }
  10544. }
  10545. };
  10546. };
  10547. var transformKeys = new Set(["x", "y", "z"]);
  10548. var nonTranslationalTransformKeys = transformProps.filter(function (key) { return !transformKeys.has(key); });
  10549. function removeNonTranslationalTransform(visualElement) {
  10550. var removedTransforms = [];
  10551. nonTranslationalTransformKeys.forEach(function (key) {
  10552. var value = visualElement.getValue(key);
  10553. if (value !== undefined) {
  10554. removedTransforms.push([key, value.get()]);
  10555. value.set(key.startsWith("scale") ? 1 : 0);
  10556. }
  10557. });
  10558. // Apply changes to element before measurement
  10559. if (removedTransforms.length)
  10560. visualElement.syncRender();
  10561. return removedTransforms;
  10562. }
  10563. var positionalValues = {
  10564. // Dimensions
  10565. width: function (_a, _b) {
  10566. var x = _a.x;
  10567. var _c = _b.paddingLeft, paddingLeft = _c === void 0 ? "0" : _c, _d = _b.paddingRight, paddingRight = _d === void 0 ? "0" : _d;
  10568. return x.max - x.min - parseFloat(paddingLeft) - parseFloat(paddingRight);
  10569. },
  10570. height: function (_a, _b) {
  10571. var y = _a.y;
  10572. var _c = _b.paddingTop, paddingTop = _c === void 0 ? "0" : _c, _d = _b.paddingBottom, paddingBottom = _d === void 0 ? "0" : _d;
  10573. return y.max - y.min - parseFloat(paddingTop) - parseFloat(paddingBottom);
  10574. },
  10575. top: function (_bbox, _a) {
  10576. var top = _a.top;
  10577. return parseFloat(top);
  10578. },
  10579. left: function (_bbox, _a) {
  10580. var left = _a.left;
  10581. return parseFloat(left);
  10582. },
  10583. bottom: function (_a, _b) {
  10584. var y = _a.y;
  10585. var top = _b.top;
  10586. return parseFloat(top) + (y.max - y.min);
  10587. },
  10588. right: function (_a, _b) {
  10589. var x = _a.x;
  10590. var left = _b.left;
  10591. return parseFloat(left) + (x.max - x.min);
  10592. },
  10593. // Transform
  10594. x: getTranslateFromMatrix(4, 13),
  10595. y: getTranslateFromMatrix(5, 14),
  10596. };
  10597. var convertChangedValueTypes = function (target, visualElement, changedKeys) {
  10598. var originBbox = visualElement.measureViewportBox();
  10599. var element = visualElement.getInstance();
  10600. var elementComputedStyle = getComputedStyle(element);
  10601. var display = elementComputedStyle.display;
  10602. var origin = {};
  10603. // If the element is currently set to display: "none", make it visible before
  10604. // measuring the target bounding box
  10605. if (display === "none") {
  10606. visualElement.setStaticValue("display", target.display || "block");
  10607. }
  10608. /**
  10609. * Record origins before we render and update styles
  10610. */
  10611. changedKeys.forEach(function (key) {
  10612. origin[key] = positionalValues[key](originBbox, elementComputedStyle);
  10613. });
  10614. // Apply the latest values (as set in checkAndConvertChangedValueTypes)
  10615. visualElement.syncRender();
  10616. var targetBbox = visualElement.measureViewportBox();
  10617. changedKeys.forEach(function (key) {
  10618. // Restore styles to their **calculated computed style**, not their actual
  10619. // originally set style. This allows us to animate between equivalent pixel units.
  10620. var value = visualElement.getValue(key);
  10621. setAndResetVelocity(value, origin[key]);
  10622. target[key] = positionalValues[key](targetBbox, elementComputedStyle);
  10623. });
  10624. return target;
  10625. };
  10626. var checkAndConvertChangedValueTypes = function (visualElement, target, origin, transitionEnd) {
  10627. if (origin === void 0) { origin = {}; }
  10628. if (transitionEnd === void 0) { transitionEnd = {}; }
  10629. target = __assign({}, target);
  10630. transitionEnd = __assign({}, transitionEnd);
  10631. var targetPositionalKeys = Object.keys(target).filter(isPositionalKey);
  10632. // We want to remove any transform values that could affect the element's bounding box before
  10633. // it's measured. We'll reapply these later.
  10634. var removedTransformValues = [];
  10635. var hasAttemptedToRemoveTransformValues = false;
  10636. var changedValueTypeKeys = [];
  10637. targetPositionalKeys.forEach(function (key) {
  10638. var value = visualElement.getValue(key);
  10639. if (!visualElement.hasValue(key))
  10640. return;
  10641. var from = origin[key];
  10642. var fromType = findDimensionValueType(from);
  10643. var to = target[key];
  10644. var toType;
  10645. // TODO: The current implementation of this basically throws an error
  10646. // if you try and do value conversion via keyframes. There's probably
  10647. // a way of doing this but the performance implications would need greater scrutiny,
  10648. // as it'd be doing multiple resize-remeasure operations.
  10649. if (isKeyframesTarget(to)) {
  10650. var numKeyframes = to.length;
  10651. var fromIndex = to[0] === null ? 1 : 0;
  10652. from = to[fromIndex];
  10653. fromType = findDimensionValueType(from);
  10654. for (var i = fromIndex; i < numKeyframes; i++) {
  10655. if (!toType) {
  10656. toType = findDimensionValueType(to[i]);
  10657. invariant(toType === fromType ||
  10658. (isNumOrPxType(fromType) && isNumOrPxType(toType)), "Keyframes must be of the same dimension as the current value");
  10659. }
  10660. else {
  10661. invariant(findDimensionValueType(to[i]) === toType, "All keyframes must be of the same type");
  10662. }
  10663. }
  10664. }
  10665. else {
  10666. toType = findDimensionValueType(to);
  10667. }
  10668. if (fromType !== toType) {
  10669. // If they're both just number or px, convert them both to numbers rather than
  10670. // relying on resize/remeasure to convert (which is wasteful in this situation)
  10671. if (isNumOrPxType(fromType) && isNumOrPxType(toType)) {
  10672. var current = value.get();
  10673. if (typeof current === "string") {
  10674. value.set(parseFloat(current));
  10675. }
  10676. if (typeof to === "string") {
  10677. target[key] = parseFloat(to);
  10678. }
  10679. else if (Array.isArray(to) && toType === px) {
  10680. target[key] = to.map(parseFloat);
  10681. }
  10682. }
  10683. else if ((fromType === null || fromType === void 0 ? void 0 : fromType.transform) &&
  10684. (toType === null || toType === void 0 ? void 0 : toType.transform) &&
  10685. (from === 0 || to === 0)) {
  10686. // If one or the other value is 0, it's safe to coerce it to the
  10687. // type of the other without measurement
  10688. if (from === 0) {
  10689. value.set(toType.transform(from));
  10690. }
  10691. else {
  10692. target[key] = fromType.transform(to);
  10693. }
  10694. }
  10695. else {
  10696. // If we're going to do value conversion via DOM measurements, we first
  10697. // need to remove non-positional transform values that could affect the bbox measurements.
  10698. if (!hasAttemptedToRemoveTransformValues) {
  10699. removedTransformValues =
  10700. removeNonTranslationalTransform(visualElement);
  10701. hasAttemptedToRemoveTransformValues = true;
  10702. }
  10703. changedValueTypeKeys.push(key);
  10704. transitionEnd[key] =
  10705. transitionEnd[key] !== undefined
  10706. ? transitionEnd[key]
  10707. : target[key];
  10708. setAndResetVelocity(value, to);
  10709. }
  10710. }
  10711. });
  10712. if (changedValueTypeKeys.length) {
  10713. var scrollY_1 = changedValueTypeKeys.indexOf("height") >= 0
  10714. ? window.pageYOffset
  10715. : null;
  10716. var convertedTarget = convertChangedValueTypes(target, visualElement, changedValueTypeKeys);
  10717. // If we removed transform values, reapply them before the next render
  10718. if (removedTransformValues.length) {
  10719. removedTransformValues.forEach(function (_a) {
  10720. var _b = tslib_es6_read(_a, 2), key = _b[0], value = _b[1];
  10721. visualElement.getValue(key).set(value);
  10722. });
  10723. }
  10724. // Reapply original values
  10725. visualElement.syncRender();
  10726. // Restore scroll position
  10727. if (scrollY_1 !== null)
  10728. window.scrollTo({ top: scrollY_1 });
  10729. return { target: convertedTarget, transitionEnd: transitionEnd };
  10730. }
  10731. else {
  10732. return { target: target, transitionEnd: transitionEnd };
  10733. }
  10734. };
  10735. /**
  10736. * Convert value types for x/y/width/height/top/left/bottom/right
  10737. *
  10738. * Allows animation between `'auto'` -> `'100%'` or `0` -> `'calc(50% - 10vw)'`
  10739. *
  10740. * @internal
  10741. */
  10742. function unitConversion(visualElement, target, origin, transitionEnd) {
  10743. return hasPositionalKey(target)
  10744. ? checkAndConvertChangedValueTypes(visualElement, target, origin, transitionEnd)
  10745. : { target: target, transitionEnd: transitionEnd };
  10746. }
  10747. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/utils/parse-dom-variant.mjs
  10748. /**
  10749. * Parse a DOM variant to make it animatable. This involves resolving CSS variables
  10750. * and ensuring animations like "20%" => "calc(50vw)" are performed in pixels.
  10751. */
  10752. var parseDomVariant = function (visualElement, target, origin, transitionEnd) {
  10753. var resolved = resolveCSSVariables(visualElement, target, transitionEnd);
  10754. target = resolved.target;
  10755. transitionEnd = resolved.transitionEnd;
  10756. return unitConversion(visualElement, target, origin, transitionEnd);
  10757. };
  10758. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/html/visual-element.mjs
  10759. function visual_element_getComputedStyle(element) {
  10760. return window.getComputedStyle(element);
  10761. }
  10762. var htmlConfig = {
  10763. treeType: "dom",
  10764. readValueFromInstance: function (domElement, key) {
  10765. if (isTransformProp(key)) {
  10766. var defaultType = getDefaultValueType(key);
  10767. return defaultType ? defaultType.default || 0 : 0;
  10768. }
  10769. else {
  10770. var computedStyle = visual_element_getComputedStyle(domElement);
  10771. return ((isCSSVariable(key)
  10772. ? computedStyle.getPropertyValue(key)
  10773. : computedStyle[key]) || 0);
  10774. }
  10775. },
  10776. sortNodePosition: function (a, b) {
  10777. /**
  10778. * compareDocumentPosition returns a bitmask, by using the bitwise &
  10779. * we're returning true if 2 in that bitmask is set to true. 2 is set
  10780. * to true if b preceeds a.
  10781. */
  10782. return a.compareDocumentPosition(b) & 2 ? 1 : -1;
  10783. },
  10784. getBaseTarget: function (props, key) {
  10785. var _a;
  10786. return (_a = props.style) === null || _a === void 0 ? void 0 : _a[key];
  10787. },
  10788. measureViewportBox: function (element, _a) {
  10789. var transformPagePoint = _a.transformPagePoint;
  10790. return measureViewportBox(element, transformPagePoint);
  10791. },
  10792. /**
  10793. * Reset the transform on the current Element. This is called as part
  10794. * of a batched process across the entire layout tree. To remove this write
  10795. * cycle it'd be interesting to see if it's possible to "undo" all the current
  10796. * layout transforms up the tree in the same way this.getBoundingBoxWithoutTransforms
  10797. * works
  10798. */
  10799. resetTransform: function (element, domElement, props) {
  10800. var transformTemplate = props.transformTemplate;
  10801. domElement.style.transform = transformTemplate
  10802. ? transformTemplate({}, "")
  10803. : "none";
  10804. // Ensure that whatever happens next, we restore our transform on the next frame
  10805. element.scheduleRender();
  10806. },
  10807. restoreTransform: function (instance, mutableState) {
  10808. instance.style.transform = mutableState.style.transform;
  10809. },
  10810. removeValueFromRenderState: function (key, _a) {
  10811. var vars = _a.vars, style = _a.style;
  10812. delete vars[key];
  10813. delete style[key];
  10814. },
  10815. /**
  10816. * Ensure that HTML and Framer-specific value types like `px`->`%` and `Color`
  10817. * can be animated by Motion.
  10818. */
  10819. makeTargetAnimatable: function (element, _a, _b, isMounted) {
  10820. var transformValues = _b.transformValues;
  10821. if (isMounted === void 0) { isMounted = true; }
  10822. var transition = _a.transition, transitionEnd = _a.transitionEnd, target = __rest(_a, ["transition", "transitionEnd"]);
  10823. var origin = getOrigin(target, transition || {}, element);
  10824. /**
  10825. * If Framer has provided a function to convert `Color` etc value types, convert them
  10826. */
  10827. if (transformValues) {
  10828. if (transitionEnd)
  10829. transitionEnd = transformValues(transitionEnd);
  10830. if (target)
  10831. target = transformValues(target);
  10832. if (origin)
  10833. origin = transformValues(origin);
  10834. }
  10835. if (isMounted) {
  10836. checkTargetForNewValues(element, target, origin);
  10837. var parsed = parseDomVariant(element, target, origin, transitionEnd);
  10838. transitionEnd = parsed.transitionEnd;
  10839. target = parsed.target;
  10840. }
  10841. return __assign({ transition: transition, transitionEnd: transitionEnd }, target);
  10842. },
  10843. scrapeMotionValuesFromProps: scrapeMotionValuesFromProps,
  10844. build: function (element, renderState, latestValues, options, props) {
  10845. if (element.isVisible !== undefined) {
  10846. renderState.style.visibility = element.isVisible
  10847. ? "visible"
  10848. : "hidden";
  10849. }
  10850. buildHTMLStyles(renderState, latestValues, options, props.transformTemplate);
  10851. },
  10852. render: renderHTML,
  10853. };
  10854. var htmlVisualElement = visualElement(htmlConfig);
  10855. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/svg/visual-element.mjs
  10856. var svgVisualElement = visualElement(__assign(__assign({}, htmlConfig), { getBaseTarget: function (props, key) {
  10857. return props[key];
  10858. }, readValueFromInstance: function (domElement, key) {
  10859. var _a;
  10860. if (isTransformProp(key)) {
  10861. return ((_a = getDefaultValueType(key)) === null || _a === void 0 ? void 0 : _a.default) || 0;
  10862. }
  10863. key = !camelCaseAttributes.has(key) ? camelToDash(key) : key;
  10864. return domElement.getAttribute(key);
  10865. }, scrapeMotionValuesFromProps: scrape_motion_values_scrapeMotionValuesFromProps, build: function (_element, renderState, latestValues, options, props) {
  10866. buildSVGAttrs(renderState, latestValues, options, props.transformTemplate);
  10867. }, render: renderSVG }));
  10868. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/create-visual-element.mjs
  10869. var create_visual_element_createDomVisualElement = function (Component, options) {
  10870. return isSVGComponent(Component)
  10871. ? svgVisualElement(options, { enableHardwareAcceleration: false })
  10872. : htmlVisualElement(options, { enableHardwareAcceleration: true });
  10873. };
  10874. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/styles/scale-border-radius.mjs
  10875. function pixelsToPercent(pixels, axis) {
  10876. if (axis.max === axis.min)
  10877. return 0;
  10878. return (pixels / (axis.max - axis.min)) * 100;
  10879. }
  10880. /**
  10881. * We always correct borderRadius as a percentage rather than pixels to reduce paints.
  10882. * For example, if you are projecting a box that is 100px wide with a 10px borderRadius
  10883. * into a box that is 200px wide with a 20px borderRadius, that is actually a 10%
  10884. * borderRadius in both states. If we animate between the two in pixels that will trigger
  10885. * a paint each time. If we animate between the two in percentage we'll avoid a paint.
  10886. */
  10887. var correctBorderRadius = {
  10888. correct: function (latest, node) {
  10889. if (!node.target)
  10890. return latest;
  10891. /**
  10892. * If latest is a string, if it's a percentage we can return immediately as it's
  10893. * going to be stretched appropriately. Otherwise, if it's a pixel, convert it to a number.
  10894. */
  10895. if (typeof latest === "string") {
  10896. if (px.test(latest)) {
  10897. latest = parseFloat(latest);
  10898. }
  10899. else {
  10900. return latest;
  10901. }
  10902. }
  10903. /**
  10904. * If latest is a number, it's a pixel value. We use the current viewportBox to calculate that
  10905. * pixel value as a percentage of each axis
  10906. */
  10907. var x = pixelsToPercent(latest, node.target.x);
  10908. var y = pixelsToPercent(latest, node.target.y);
  10909. return "".concat(x, "% ").concat(y, "%");
  10910. },
  10911. };
  10912. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/styles/scale-box-shadow.mjs
  10913. var varToken = "_$css";
  10914. var correctBoxShadow = {
  10915. correct: function (latest, _a) {
  10916. var treeScale = _a.treeScale, projectionDelta = _a.projectionDelta;
  10917. var original = latest;
  10918. /**
  10919. * We need to first strip and store CSS variables from the string.
  10920. */
  10921. var containsCSSVariables = latest.includes("var(");
  10922. var cssVariables = [];
  10923. if (containsCSSVariables) {
  10924. latest = latest.replace(cssVariableRegex, function (match) {
  10925. cssVariables.push(match);
  10926. return varToken;
  10927. });
  10928. }
  10929. var shadow = complex.parse(latest);
  10930. // TODO: Doesn't support multiple shadows
  10931. if (shadow.length > 5)
  10932. return original;
  10933. var template = complex.createTransformer(latest);
  10934. var offset = typeof shadow[0] !== "number" ? 1 : 0;
  10935. // Calculate the overall context scale
  10936. var xScale = projectionDelta.x.scale * treeScale.x;
  10937. var yScale = projectionDelta.y.scale * treeScale.y;
  10938. shadow[0 + offset] /= xScale;
  10939. shadow[1 + offset] /= yScale;
  10940. /**
  10941. * Ideally we'd correct x and y scales individually, but because blur and
  10942. * spread apply to both we have to take a scale average and apply that instead.
  10943. * We could potentially improve the outcome of this by incorporating the ratio between
  10944. * the two scales.
  10945. */
  10946. var averageScale = mix(xScale, yScale, 0.5);
  10947. // Blur
  10948. if (typeof shadow[2 + offset] === "number")
  10949. shadow[2 + offset] /= averageScale;
  10950. // Spread
  10951. if (typeof shadow[3 + offset] === "number")
  10952. shadow[3 + offset] /= averageScale;
  10953. var output = template(shadow);
  10954. if (containsCSSVariables) {
  10955. var i_1 = 0;
  10956. output = output.replace(varToken, function () {
  10957. var cssVariable = cssVariables[i_1];
  10958. i_1++;
  10959. return cssVariable;
  10960. });
  10961. }
  10962. return output;
  10963. },
  10964. };
  10965. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/layout/MeasureLayout.mjs
  10966. var MeasureLayoutWithContext = /** @class */ (function (_super) {
  10967. __extends(MeasureLayoutWithContext, _super);
  10968. function MeasureLayoutWithContext() {
  10969. return _super !== null && _super.apply(this, arguments) || this;
  10970. }
  10971. /**
  10972. * This only mounts projection nodes for components that
  10973. * need measuring, we might want to do it for all components
  10974. * in order to incorporate transforms
  10975. */
  10976. MeasureLayoutWithContext.prototype.componentDidMount = function () {
  10977. var _this = this;
  10978. var _a = this.props, visualElement = _a.visualElement, layoutGroup = _a.layoutGroup, switchLayoutGroup = _a.switchLayoutGroup, layoutId = _a.layoutId;
  10979. var projection = visualElement.projection;
  10980. addScaleCorrector(defaultScaleCorrectors);
  10981. if (projection) {
  10982. if (layoutGroup === null || layoutGroup === void 0 ? void 0 : layoutGroup.group)
  10983. layoutGroup.group.add(projection);
  10984. if ((switchLayoutGroup === null || switchLayoutGroup === void 0 ? void 0 : switchLayoutGroup.register) && layoutId) {
  10985. switchLayoutGroup.register(projection);
  10986. }
  10987. projection.root.didUpdate();
  10988. projection.addEventListener("animationComplete", function () {
  10989. _this.safeToRemove();
  10990. });
  10991. projection.setOptions(__assign(__assign({}, projection.options), { onExitComplete: function () { return _this.safeToRemove(); } }));
  10992. }
  10993. globalProjectionState.hasEverUpdated = true;
  10994. };
  10995. MeasureLayoutWithContext.prototype.getSnapshotBeforeUpdate = function (prevProps) {
  10996. var _this = this;
  10997. var _a = this.props, layoutDependency = _a.layoutDependency, visualElement = _a.visualElement, drag = _a.drag, isPresent = _a.isPresent;
  10998. var projection = visualElement.projection;
  10999. if (!projection)
  11000. return null;
  11001. /**
  11002. * TODO: We use this data in relegate to determine whether to
  11003. * promote a previous element. There's no guarantee its presence data
  11004. * will have updated by this point - if a bug like this arises it will
  11005. * have to be that we markForRelegation and then find a new lead some other way,
  11006. * perhaps in didUpdate
  11007. */
  11008. projection.isPresent = isPresent;
  11009. if (drag ||
  11010. prevProps.layoutDependency !== layoutDependency ||
  11011. layoutDependency === undefined) {
  11012. projection.willUpdate();
  11013. }
  11014. else {
  11015. this.safeToRemove();
  11016. }
  11017. if (prevProps.isPresent !== isPresent) {
  11018. if (isPresent) {
  11019. projection.promote();
  11020. }
  11021. else if (!projection.relegate()) {
  11022. /**
  11023. * If there's another stack member taking over from this one,
  11024. * it's in charge of the exit animation and therefore should
  11025. * be in charge of the safe to remove. Otherwise we call it here.
  11026. */
  11027. es.postRender(function () {
  11028. var _a;
  11029. if (!((_a = projection.getStack()) === null || _a === void 0 ? void 0 : _a.members.length)) {
  11030. _this.safeToRemove();
  11031. }
  11032. });
  11033. }
  11034. }
  11035. return null;
  11036. };
  11037. MeasureLayoutWithContext.prototype.componentDidUpdate = function () {
  11038. var projection = this.props.visualElement.projection;
  11039. if (projection) {
  11040. projection.root.didUpdate();
  11041. if (!projection.currentAnimation && projection.isLead()) {
  11042. this.safeToRemove();
  11043. }
  11044. }
  11045. };
  11046. MeasureLayoutWithContext.prototype.componentWillUnmount = function () {
  11047. var _a = this.props, visualElement = _a.visualElement, layoutGroup = _a.layoutGroup, promoteContext = _a.switchLayoutGroup;
  11048. var projection = visualElement.projection;
  11049. if (projection) {
  11050. projection.scheduleCheckAfterUnmount();
  11051. if (layoutGroup === null || layoutGroup === void 0 ? void 0 : layoutGroup.group)
  11052. layoutGroup.group.remove(projection);
  11053. if (promoteContext === null || promoteContext === void 0 ? void 0 : promoteContext.deregister)
  11054. promoteContext.deregister(projection);
  11055. }
  11056. };
  11057. MeasureLayoutWithContext.prototype.safeToRemove = function () {
  11058. var safeToRemove = this.props.safeToRemove;
  11059. safeToRemove === null || safeToRemove === void 0 ? void 0 : safeToRemove();
  11060. };
  11061. MeasureLayoutWithContext.prototype.render = function () {
  11062. return null;
  11063. };
  11064. return MeasureLayoutWithContext;
  11065. }(external_React_namespaceObject.Component));
  11066. function MeasureLayout(props) {
  11067. var _a = tslib_es6_read(usePresence(), 2), isPresent = _a[0], safeToRemove = _a[1];
  11068. var layoutGroup = (0,external_React_namespaceObject.useContext)(LayoutGroupContext);
  11069. return (external_React_namespaceObject.createElement(MeasureLayoutWithContext, __assign({}, props, { layoutGroup: layoutGroup, switchLayoutGroup: (0,external_React_namespaceObject.useContext)(SwitchLayoutGroupContext), isPresent: isPresent, safeToRemove: safeToRemove })));
  11070. }
  11071. var defaultScaleCorrectors = {
  11072. borderRadius: __assign(__assign({}, correctBorderRadius), { applyTo: [
  11073. "borderTopLeftRadius",
  11074. "borderTopRightRadius",
  11075. "borderBottomLeftRadius",
  11076. "borderBottomRightRadius",
  11077. ] }),
  11078. borderTopLeftRadius: correctBorderRadius,
  11079. borderTopRightRadius: correctBorderRadius,
  11080. borderBottomLeftRadius: correctBorderRadius,
  11081. borderBottomRightRadius: correctBorderRadius,
  11082. boxShadow: correctBoxShadow,
  11083. };
  11084. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/motion/features/layout/index.mjs
  11085. var layoutFeatures = {
  11086. measureLayout: MeasureLayout,
  11087. };
  11088. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/animation/animate.mjs
  11089. /**
  11090. * Animate a single value or a `MotionValue`.
  11091. *
  11092. * The first argument is either a `MotionValue` to animate, or an initial animation value.
  11093. *
  11094. * The second is either a value to animate to, or an array of keyframes to animate through.
  11095. *
  11096. * The third argument can be either tween or spring options, and optional lifecycle methods: `onUpdate`, `onPlay`, `onComplete`, `onRepeat` and `onStop`.
  11097. *
  11098. * Returns `AnimationPlaybackControls`, currently just a `stop` method.
  11099. *
  11100. * ```javascript
  11101. * const x = useMotionValue(0)
  11102. *
  11103. * useEffect(() => {
  11104. * const controls = animate(x, 100, {
  11105. * type: "spring",
  11106. * stiffness: 2000,
  11107. * onComplete: v => {}
  11108. * })
  11109. *
  11110. * return controls.stop
  11111. * })
  11112. * ```
  11113. *
  11114. * @public
  11115. */
  11116. function animate_animate(from, to, transition) {
  11117. if (transition === void 0) { transition = {}; }
  11118. var value = isMotionValue(from) ? from : motionValue(from);
  11119. startAnimation("", value, to, transition);
  11120. return {
  11121. stop: function () { return value.stop(); },
  11122. isAnimating: function () { return value.isAnimating(); },
  11123. };
  11124. }
  11125. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/animation/mix-values.mjs
  11126. var borders = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"];
  11127. var numBorders = borders.length;
  11128. var asNumber = function (value) {
  11129. return typeof value === "string" ? parseFloat(value) : value;
  11130. };
  11131. var isPx = function (value) {
  11132. return typeof value === "number" || px.test(value);
  11133. };
  11134. function mixValues(target, follow, lead, progress, shouldCrossfadeOpacity, isOnlyMember) {
  11135. var _a, _b, _c, _d;
  11136. if (shouldCrossfadeOpacity) {
  11137. target.opacity = mix(0,
  11138. // (follow?.opacity as number) ?? 0,
  11139. // TODO Reinstate this if only child
  11140. (_a = lead.opacity) !== null && _a !== void 0 ? _a : 1, easeCrossfadeIn(progress));
  11141. target.opacityExit = mix((_b = follow.opacity) !== null && _b !== void 0 ? _b : 1, 0, easeCrossfadeOut(progress));
  11142. }
  11143. else if (isOnlyMember) {
  11144. target.opacity = mix((_c = follow.opacity) !== null && _c !== void 0 ? _c : 1, (_d = lead.opacity) !== null && _d !== void 0 ? _d : 1, progress);
  11145. }
  11146. /**
  11147. * Mix border radius
  11148. */
  11149. for (var i = 0; i < numBorders; i++) {
  11150. var borderLabel = "border".concat(borders[i], "Radius");
  11151. var followRadius = getRadius(follow, borderLabel);
  11152. var leadRadius = getRadius(lead, borderLabel);
  11153. if (followRadius === undefined && leadRadius === undefined)
  11154. continue;
  11155. followRadius || (followRadius = 0);
  11156. leadRadius || (leadRadius = 0);
  11157. var canMix = followRadius === 0 ||
  11158. leadRadius === 0 ||
  11159. isPx(followRadius) === isPx(leadRadius);
  11160. if (canMix) {
  11161. target[borderLabel] = Math.max(mix(asNumber(followRadius), asNumber(leadRadius), progress), 0);
  11162. if (percent.test(leadRadius) || percent.test(followRadius)) {
  11163. target[borderLabel] += "%";
  11164. }
  11165. }
  11166. else {
  11167. target[borderLabel] = leadRadius;
  11168. }
  11169. }
  11170. /**
  11171. * Mix rotation
  11172. */
  11173. if (follow.rotate || lead.rotate) {
  11174. target.rotate = mix(follow.rotate || 0, lead.rotate || 0, progress);
  11175. }
  11176. }
  11177. function getRadius(values, radiusName) {
  11178. var _a;
  11179. return (_a = values[radiusName]) !== null && _a !== void 0 ? _a : values.borderRadius;
  11180. }
  11181. // /**
  11182. // * We only want to mix the background color if there's a follow element
  11183. // * that we're not crossfading opacity between. For instance with switch
  11184. // * AnimateSharedLayout animations, this helps the illusion of a continuous
  11185. // * element being animated but also cuts down on the number of paints triggered
  11186. // * for elements where opacity is doing that work for us.
  11187. // */
  11188. // if (
  11189. // !hasFollowElement &&
  11190. // latestLeadValues.backgroundColor &&
  11191. // latestFollowValues.backgroundColor
  11192. // ) {
  11193. // /**
  11194. // * This isn't ideal performance-wise as mixColor is creating a new function every frame.
  11195. // * We could probably create a mixer that runs at the start of the animation but
  11196. // * the idea behind the crossfader is that it runs dynamically between two potentially
  11197. // * changing targets (ie opacity or borderRadius may be animating independently via variants)
  11198. // */
  11199. // leadState.backgroundColor = followState.backgroundColor = mixColor(
  11200. // latestFollowValues.backgroundColor as string,
  11201. // latestLeadValues.backgroundColor as string
  11202. // )(p)
  11203. // }
  11204. var easeCrossfadeIn = compress(0, 0.5, circOut);
  11205. var easeCrossfadeOut = compress(0.5, 0.95, linear);
  11206. function compress(min, max, easing) {
  11207. return function (p) {
  11208. // Could replace ifs with clamp
  11209. if (p < min)
  11210. return 0;
  11211. if (p > max)
  11212. return 1;
  11213. return easing(progress(min, max, p));
  11214. };
  11215. }
  11216. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/geometry/copy.mjs
  11217. /**
  11218. * Reset an axis to the provided origin box.
  11219. *
  11220. * This is a mutative operation.
  11221. */
  11222. function copyAxisInto(axis, originAxis) {
  11223. axis.min = originAxis.min;
  11224. axis.max = originAxis.max;
  11225. }
  11226. /**
  11227. * Reset a box to the provided origin box.
  11228. *
  11229. * This is a mutative operation.
  11230. */
  11231. function copyBoxInto(box, originBox) {
  11232. copyAxisInto(box.x, originBox.x);
  11233. copyAxisInto(box.y, originBox.y);
  11234. }
  11235. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/geometry/delta-remove.mjs
  11236. /**
  11237. * Remove a delta from a point. This is essentially the steps of applyPointDelta in reverse
  11238. */
  11239. function removePointDelta(point, translate, scale, originPoint, boxScale) {
  11240. point -= translate;
  11241. point = scalePoint(point, 1 / scale, originPoint);
  11242. if (boxScale !== undefined) {
  11243. point = scalePoint(point, 1 / boxScale, originPoint);
  11244. }
  11245. return point;
  11246. }
  11247. /**
  11248. * Remove a delta from an axis. This is essentially the steps of applyAxisDelta in reverse
  11249. */
  11250. function removeAxisDelta(axis, translate, scale, origin, boxScale, originAxis, sourceAxis) {
  11251. if (translate === void 0) { translate = 0; }
  11252. if (scale === void 0) { scale = 1; }
  11253. if (origin === void 0) { origin = 0.5; }
  11254. if (originAxis === void 0) { originAxis = axis; }
  11255. if (sourceAxis === void 0) { sourceAxis = axis; }
  11256. if (percent.test(translate)) {
  11257. translate = parseFloat(translate);
  11258. var relativeProgress = mix(sourceAxis.min, sourceAxis.max, translate / 100);
  11259. translate = relativeProgress - sourceAxis.min;
  11260. }
  11261. if (typeof translate !== "number")
  11262. return;
  11263. var originPoint = mix(originAxis.min, originAxis.max, origin);
  11264. if (axis === originAxis)
  11265. originPoint -= translate;
  11266. axis.min = removePointDelta(axis.min, translate, scale, originPoint, boxScale);
  11267. axis.max = removePointDelta(axis.max, translate, scale, originPoint, boxScale);
  11268. }
  11269. /**
  11270. * Remove a transforms from an axis. This is essentially the steps of applyAxisTransforms in reverse
  11271. * and acts as a bridge between motion values and removeAxisDelta
  11272. */
  11273. function removeAxisTransforms(axis, transforms, _a, origin, sourceAxis) {
  11274. var _b = tslib_es6_read(_a, 3), key = _b[0], scaleKey = _b[1], originKey = _b[2];
  11275. removeAxisDelta(axis, transforms[key], transforms[scaleKey], transforms[originKey], transforms.scale, origin, sourceAxis);
  11276. }
  11277. /**
  11278. * The names of the motion values we want to apply as translation, scale and origin.
  11279. */
  11280. var delta_remove_xKeys = ["x", "scaleX", "originX"];
  11281. var delta_remove_yKeys = ["y", "scaleY", "originY"];
  11282. /**
  11283. * Remove a transforms from an box. This is essentially the steps of applyAxisBox in reverse
  11284. * and acts as a bridge between motion values and removeAxisDelta
  11285. */
  11286. function removeBoxTransforms(box, transforms, originBox, sourceBox) {
  11287. 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);
  11288. 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);
  11289. }
  11290. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/geometry/utils.mjs
  11291. function isAxisDeltaZero(delta) {
  11292. return delta.translate === 0 && delta.scale === 1;
  11293. }
  11294. function isDeltaZero(delta) {
  11295. return isAxisDeltaZero(delta.x) && isAxisDeltaZero(delta.y);
  11296. }
  11297. function boxEquals(a, b) {
  11298. return (a.x.min === b.x.min &&
  11299. a.x.max === b.x.max &&
  11300. a.y.min === b.y.min &&
  11301. a.y.max === b.y.max);
  11302. }
  11303. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/shared/stack.mjs
  11304. var NodeStack = /** @class */ (function () {
  11305. function NodeStack() {
  11306. this.members = [];
  11307. }
  11308. NodeStack.prototype.add = function (node) {
  11309. addUniqueItem(this.members, node);
  11310. node.scheduleRender();
  11311. };
  11312. NodeStack.prototype.remove = function (node) {
  11313. removeItem(this.members, node);
  11314. if (node === this.prevLead) {
  11315. this.prevLead = undefined;
  11316. }
  11317. if (node === this.lead) {
  11318. var prevLead = this.members[this.members.length - 1];
  11319. if (prevLead) {
  11320. this.promote(prevLead);
  11321. }
  11322. }
  11323. };
  11324. NodeStack.prototype.relegate = function (node) {
  11325. var indexOfNode = this.members.findIndex(function (member) { return node === member; });
  11326. if (indexOfNode === 0)
  11327. return false;
  11328. /**
  11329. * Find the next projection node that is present
  11330. */
  11331. var prevLead;
  11332. for (var i = indexOfNode; i >= 0; i--) {
  11333. var member = this.members[i];
  11334. if (member.isPresent !== false) {
  11335. prevLead = member;
  11336. break;
  11337. }
  11338. }
  11339. if (prevLead) {
  11340. this.promote(prevLead);
  11341. return true;
  11342. }
  11343. else {
  11344. return false;
  11345. }
  11346. };
  11347. NodeStack.prototype.promote = function (node, preserveFollowOpacity) {
  11348. var _a;
  11349. var prevLead = this.lead;
  11350. if (node === prevLead)
  11351. return;
  11352. this.prevLead = prevLead;
  11353. this.lead = node;
  11354. node.show();
  11355. if (prevLead) {
  11356. prevLead.instance && prevLead.scheduleRender();
  11357. node.scheduleRender();
  11358. node.resumeFrom = prevLead;
  11359. if (preserveFollowOpacity) {
  11360. node.resumeFrom.preserveOpacity = true;
  11361. }
  11362. if (prevLead.snapshot) {
  11363. node.snapshot = prevLead.snapshot;
  11364. node.snapshot.latestValues =
  11365. prevLead.animationValues || prevLead.latestValues;
  11366. node.snapshot.isShared = true;
  11367. }
  11368. if ((_a = node.root) === null || _a === void 0 ? void 0 : _a.isUpdating) {
  11369. node.isLayoutDirty = true;
  11370. }
  11371. var crossfade = node.options.crossfade;
  11372. if (crossfade === false) {
  11373. prevLead.hide();
  11374. }
  11375. /**
  11376. * TODO:
  11377. * - Test border radius when previous node was deleted
  11378. * - boxShadow mixing
  11379. * - Shared between element A in scrolled container and element B (scroll stays the same or changes)
  11380. * - Shared between element A in transformed container and element B (transform stays the same or changes)
  11381. * - Shared between element A in scrolled page and element B (scroll stays the same or changes)
  11382. * ---
  11383. * - Crossfade opacity of root nodes
  11384. * - layoutId changes after animation
  11385. * - layoutId changes mid animation
  11386. */
  11387. }
  11388. };
  11389. NodeStack.prototype.exitAnimationComplete = function () {
  11390. this.members.forEach(function (node) {
  11391. var _a, _b, _c, _d, _e;
  11392. (_b = (_a = node.options).onExitComplete) === null || _b === void 0 ? void 0 : _b.call(_a);
  11393. (_e = (_c = node.resumingFrom) === null || _c === void 0 ? void 0 : (_d = _c.options).onExitComplete) === null || _e === void 0 ? void 0 : _e.call(_d);
  11394. });
  11395. };
  11396. NodeStack.prototype.scheduleRender = function () {
  11397. this.members.forEach(function (node) {
  11398. node.instance && node.scheduleRender(false);
  11399. });
  11400. };
  11401. /**
  11402. * Clear any leads that have been removed this render to prevent them from being
  11403. * used in future animations and to prevent memory leaks
  11404. */
  11405. NodeStack.prototype.removeLeadSnapshot = function () {
  11406. if (this.lead && this.lead.snapshot) {
  11407. this.lead.snapshot = undefined;
  11408. }
  11409. };
  11410. return NodeStack;
  11411. }());
  11412. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/styles/transform.mjs
  11413. var identityProjection = "translate3d(0px, 0px, 0) scale(1, 1) scale(1, 1)";
  11414. function buildProjectionTransform(delta, treeScale, latestTransform) {
  11415. /**
  11416. * The translations we use to calculate are always relative to the viewport coordinate space.
  11417. * But when we apply scales, we also scale the coordinate space of an element and its children.
  11418. * For instance if we have a treeScale (the culmination of all parent scales) of 0.5 and we need
  11419. * to move an element 100 pixels, we actually need to move it 200 in within that scaled space.
  11420. */
  11421. var xTranslate = delta.x.translate / treeScale.x;
  11422. var yTranslate = delta.y.translate / treeScale.y;
  11423. var transform = "translate3d(".concat(xTranslate, "px, ").concat(yTranslate, "px, 0) ");
  11424. /**
  11425. * Apply scale correction for the tree transform.
  11426. * This will apply scale to the screen-orientated axes.
  11427. */
  11428. transform += "scale(".concat(1 / treeScale.x, ", ").concat(1 / treeScale.y, ") ");
  11429. if (latestTransform) {
  11430. var rotate = latestTransform.rotate, rotateX = latestTransform.rotateX, rotateY = latestTransform.rotateY;
  11431. if (rotate)
  11432. transform += "rotate(".concat(rotate, "deg) ");
  11433. if (rotateX)
  11434. transform += "rotateX(".concat(rotateX, "deg) ");
  11435. if (rotateY)
  11436. transform += "rotateY(".concat(rotateY, "deg) ");
  11437. }
  11438. /**
  11439. * Apply scale to match the size of the element to the size we want it.
  11440. * This will apply scale to the element-orientated axes.
  11441. */
  11442. var elementScaleX = delta.x.scale * treeScale.x;
  11443. var elementScaleY = delta.y.scale * treeScale.y;
  11444. transform += "scale(".concat(elementScaleX, ", ").concat(elementScaleY, ")");
  11445. return transform === identityProjection ? "none" : transform;
  11446. }
  11447. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/compare-by-depth.mjs
  11448. var compareByDepth = function (a, b) {
  11449. return a.depth - b.depth;
  11450. };
  11451. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/utils/flat-tree.mjs
  11452. var FlatTree = /** @class */ (function () {
  11453. function FlatTree() {
  11454. this.children = [];
  11455. this.isDirty = false;
  11456. }
  11457. FlatTree.prototype.add = function (child) {
  11458. addUniqueItem(this.children, child);
  11459. this.isDirty = true;
  11460. };
  11461. FlatTree.prototype.remove = function (child) {
  11462. removeItem(this.children, child);
  11463. this.isDirty = true;
  11464. };
  11465. FlatTree.prototype.forEach = function (callback) {
  11466. this.isDirty && this.children.sort(compareByDepth);
  11467. this.isDirty = false;
  11468. this.children.forEach(callback);
  11469. };
  11470. return FlatTree;
  11471. }());
  11472. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/node/create-projection-node.mjs
  11473. /**
  11474. * We use 1000 as the animation target as 0-1000 maps better to pixels than 0-1
  11475. * which has a noticeable difference in spring animations
  11476. */
  11477. var animationTarget = 1000;
  11478. function createProjectionNode(_a) {
  11479. var attachResizeListener = _a.attachResizeListener, defaultParent = _a.defaultParent, measureScroll = _a.measureScroll, checkIsScrollRoot = _a.checkIsScrollRoot, resetTransform = _a.resetTransform;
  11480. return /** @class */ (function () {
  11481. function ProjectionNode(id, latestValues, parent) {
  11482. var _this = this;
  11483. if (latestValues === void 0) { latestValues = {}; }
  11484. if (parent === void 0) { parent = defaultParent === null || defaultParent === void 0 ? void 0 : defaultParent(); }
  11485. /**
  11486. * A Set containing all this component's children. This is used to iterate
  11487. * through the children.
  11488. *
  11489. * TODO: This could be faster to iterate as a flat array stored on the root node.
  11490. */
  11491. this.children = new Set();
  11492. /**
  11493. * Options for the node. We use this to configure what kind of layout animations
  11494. * we should perform (if any).
  11495. */
  11496. this.options = {};
  11497. /**
  11498. * We use this to detect when its safe to shut down part of a projection tree.
  11499. * We have to keep projecting children for scale correction and relative projection
  11500. * until all their parents stop performing layout animations.
  11501. */
  11502. this.isTreeAnimating = false;
  11503. this.isAnimationBlocked = false;
  11504. /**
  11505. * Flag to true if we think this layout has been changed. We can't always know this,
  11506. * currently we set it to true every time a component renders, or if it has a layoutDependency
  11507. * if that has changed between renders. Additionally, components can be grouped by LayoutGroup
  11508. * and if one node is dirtied, they all are.
  11509. */
  11510. this.isLayoutDirty = false;
  11511. /**
  11512. * Block layout updates for instant layout transitions throughout the tree.
  11513. */
  11514. this.updateManuallyBlocked = false;
  11515. this.updateBlockedByResize = false;
  11516. /**
  11517. * Set to true between the start of the first `willUpdate` call and the end of the `didUpdate`
  11518. * call.
  11519. */
  11520. this.isUpdating = false;
  11521. /**
  11522. * If this is an SVG element we currently disable projection transforms
  11523. */
  11524. this.isSVG = false;
  11525. /**
  11526. * Flag to true (during promotion) if a node doing an instant layout transition needs to reset
  11527. * its projection styles.
  11528. */
  11529. this.needsReset = false;
  11530. /**
  11531. * Flags whether this node should have its transform reset prior to measuring.
  11532. */
  11533. this.shouldResetTransform = false;
  11534. /**
  11535. * An object representing the calculated contextual/accumulated/tree scale.
  11536. * This will be used to scale calculcated projection transforms, as these are
  11537. * calculated in screen-space but need to be scaled for elements to actually
  11538. * make it to their calculated destinations.
  11539. *
  11540. * TODO: Lazy-init
  11541. */
  11542. this.treeScale = { x: 1, y: 1 };
  11543. /**
  11544. *
  11545. */
  11546. this.eventHandlers = new Map();
  11547. // Note: Currently only running on root node
  11548. this.potentialNodes = new Map();
  11549. this.checkUpdateFailed = function () {
  11550. if (_this.isUpdating) {
  11551. _this.isUpdating = false;
  11552. _this.clearAllSnapshots();
  11553. }
  11554. };
  11555. this.updateProjection = function () {
  11556. _this.nodes.forEach(resolveTargetDelta);
  11557. _this.nodes.forEach(calcProjection);
  11558. };
  11559. this.hasProjected = false;
  11560. this.isVisible = true;
  11561. this.animationProgress = 0;
  11562. /**
  11563. * Shared layout
  11564. */
  11565. // TODO Only running on root node
  11566. this.sharedNodes = new Map();
  11567. this.id = id;
  11568. this.latestValues = latestValues;
  11569. this.root = parent ? parent.root || parent : this;
  11570. this.path = parent ? tslib_es6_spreadArray(tslib_es6_spreadArray([], tslib_es6_read(parent.path), false), [parent], false) : [];
  11571. this.parent = parent;
  11572. this.depth = parent ? parent.depth + 1 : 0;
  11573. id && this.root.registerPotentialNode(id, this);
  11574. for (var i = 0; i < this.path.length; i++) {
  11575. this.path[i].shouldResetTransform = true;
  11576. }
  11577. if (this.root === this)
  11578. this.nodes = new FlatTree();
  11579. }
  11580. ProjectionNode.prototype.addEventListener = function (name, handler) {
  11581. if (!this.eventHandlers.has(name)) {
  11582. this.eventHandlers.set(name, new SubscriptionManager());
  11583. }
  11584. return this.eventHandlers.get(name).add(handler);
  11585. };
  11586. ProjectionNode.prototype.notifyListeners = function (name) {
  11587. var args = [];
  11588. for (var _i = 1; _i < arguments.length; _i++) {
  11589. args[_i - 1] = arguments[_i];
  11590. }
  11591. var subscriptionManager = this.eventHandlers.get(name);
  11592. subscriptionManager === null || subscriptionManager === void 0 ? void 0 : subscriptionManager.notify.apply(subscriptionManager, tslib_es6_spreadArray([], tslib_es6_read(args), false));
  11593. };
  11594. ProjectionNode.prototype.hasListeners = function (name) {
  11595. return this.eventHandlers.has(name);
  11596. };
  11597. ProjectionNode.prototype.registerPotentialNode = function (id, node) {
  11598. this.potentialNodes.set(id, node);
  11599. };
  11600. /**
  11601. * Lifecycles
  11602. */
  11603. ProjectionNode.prototype.mount = function (instance, isLayoutDirty) {
  11604. var _this = this;
  11605. var _a;
  11606. if (isLayoutDirty === void 0) { isLayoutDirty = false; }
  11607. if (this.instance)
  11608. return;
  11609. this.isSVG =
  11610. instance instanceof SVGElement && instance.tagName !== "svg";
  11611. this.instance = instance;
  11612. var _b = this.options, layoutId = _b.layoutId, layout = _b.layout, visualElement = _b.visualElement;
  11613. if (visualElement && !visualElement.getInstance()) {
  11614. visualElement.mount(instance);
  11615. }
  11616. this.root.nodes.add(this);
  11617. (_a = this.parent) === null || _a === void 0 ? void 0 : _a.children.add(this);
  11618. this.id && this.root.potentialNodes.delete(this.id);
  11619. if (isLayoutDirty && (layout || layoutId)) {
  11620. this.isLayoutDirty = true;
  11621. }
  11622. if (attachResizeListener) {
  11623. var unblockTimeout_1;
  11624. var resizeUnblockUpdate_1 = function () {
  11625. return (_this.root.updateBlockedByResize = false);
  11626. };
  11627. attachResizeListener(instance, function () {
  11628. _this.root.updateBlockedByResize = true;
  11629. clearTimeout(unblockTimeout_1);
  11630. unblockTimeout_1 = window.setTimeout(resizeUnblockUpdate_1, 250);
  11631. if (globalProjectionState.hasAnimatedSinceResize) {
  11632. globalProjectionState.hasAnimatedSinceResize = false;
  11633. _this.nodes.forEach(finishAnimation);
  11634. }
  11635. });
  11636. }
  11637. if (layoutId) {
  11638. this.root.registerSharedNode(layoutId, this);
  11639. }
  11640. // Only register the handler if it requires layout animation
  11641. if (this.options.animate !== false &&
  11642. visualElement &&
  11643. (layoutId || layout)) {
  11644. this.addEventListener("didUpdate", function (_a) {
  11645. var _b, _c, _d, _e, _f;
  11646. var delta = _a.delta, hasLayoutChanged = _a.hasLayoutChanged, hasRelativeTargetChanged = _a.hasRelativeTargetChanged, newLayout = _a.layout;
  11647. if (_this.isTreeAnimationBlocked()) {
  11648. _this.target = undefined;
  11649. _this.relativeTarget = undefined;
  11650. return;
  11651. }
  11652. // TODO: Check here if an animation exists
  11653. var layoutTransition = (_c = (_b = _this.options.transition) !== null && _b !== void 0 ? _b : visualElement.getDefaultTransition()) !== null && _c !== void 0 ? _c : defaultLayoutTransition;
  11654. var _g = visualElement.getProps(), onLayoutAnimationStart = _g.onLayoutAnimationStart, onLayoutAnimationComplete = _g.onLayoutAnimationComplete;
  11655. /**
  11656. * The target layout of the element might stay the same,
  11657. * but its position relative to its parent has changed.
  11658. */
  11659. var targetChanged = !_this.targetLayout ||
  11660. !boxEquals(_this.targetLayout, newLayout) ||
  11661. hasRelativeTargetChanged;
  11662. /**
  11663. * If the layout hasn't seemed to have changed, it might be that the
  11664. * element is visually in the same place in the document but its position
  11665. * relative to its parent has indeed changed. So here we check for that.
  11666. */
  11667. var hasOnlyRelativeTargetChanged = !hasLayoutChanged && hasRelativeTargetChanged;
  11668. if (((_d = _this.resumeFrom) === null || _d === void 0 ? void 0 : _d.instance) ||
  11669. hasOnlyRelativeTargetChanged ||
  11670. (hasLayoutChanged &&
  11671. (targetChanged || !_this.currentAnimation))) {
  11672. if (_this.resumeFrom) {
  11673. _this.resumingFrom = _this.resumeFrom;
  11674. _this.resumingFrom.resumingFrom = undefined;
  11675. }
  11676. _this.setAnimationOrigin(delta, hasOnlyRelativeTargetChanged);
  11677. var animationOptions = __assign(__assign({}, getValueTransition(layoutTransition, "layout")), { onPlay: onLayoutAnimationStart, onComplete: onLayoutAnimationComplete });
  11678. if (visualElement.shouldReduceMotion) {
  11679. animationOptions.delay = 0;
  11680. animationOptions.type = false;
  11681. }
  11682. _this.startAnimation(animationOptions);
  11683. }
  11684. else {
  11685. /**
  11686. * If the layout hasn't changed and we have an animation that hasn't started yet,
  11687. * finish it immediately. Otherwise it will be animating from a location
  11688. * that was probably never commited to screen and look like a jumpy box.
  11689. */
  11690. if (!hasLayoutChanged &&
  11691. _this.animationProgress === 0) {
  11692. _this.finishAnimation();
  11693. }
  11694. _this.isLead() && ((_f = (_e = _this.options).onExitComplete) === null || _f === void 0 ? void 0 : _f.call(_e));
  11695. }
  11696. _this.targetLayout = newLayout;
  11697. });
  11698. }
  11699. };
  11700. ProjectionNode.prototype.unmount = function () {
  11701. var _a, _b;
  11702. this.options.layoutId && this.willUpdate();
  11703. this.root.nodes.remove(this);
  11704. (_a = this.getStack()) === null || _a === void 0 ? void 0 : _a.remove(this);
  11705. (_b = this.parent) === null || _b === void 0 ? void 0 : _b.children.delete(this);
  11706. this.instance = undefined;
  11707. cancelSync.preRender(this.updateProjection);
  11708. };
  11709. // only on the root
  11710. ProjectionNode.prototype.blockUpdate = function () {
  11711. this.updateManuallyBlocked = true;
  11712. };
  11713. ProjectionNode.prototype.unblockUpdate = function () {
  11714. this.updateManuallyBlocked = false;
  11715. };
  11716. ProjectionNode.prototype.isUpdateBlocked = function () {
  11717. return this.updateManuallyBlocked || this.updateBlockedByResize;
  11718. };
  11719. ProjectionNode.prototype.isTreeAnimationBlocked = function () {
  11720. var _a;
  11721. return (this.isAnimationBlocked ||
  11722. ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isTreeAnimationBlocked()) ||
  11723. false);
  11724. };
  11725. // Note: currently only running on root node
  11726. ProjectionNode.prototype.startUpdate = function () {
  11727. var _a;
  11728. if (this.isUpdateBlocked())
  11729. return;
  11730. this.isUpdating = true;
  11731. (_a = this.nodes) === null || _a === void 0 ? void 0 : _a.forEach(resetRotation);
  11732. };
  11733. ProjectionNode.prototype.willUpdate = function (shouldNotifyListeners) {
  11734. var _a, _b, _c;
  11735. if (shouldNotifyListeners === void 0) { shouldNotifyListeners = true; }
  11736. if (this.root.isUpdateBlocked()) {
  11737. (_b = (_a = this.options).onExitComplete) === null || _b === void 0 ? void 0 : _b.call(_a);
  11738. return;
  11739. }
  11740. !this.root.isUpdating && this.root.startUpdate();
  11741. if (this.isLayoutDirty)
  11742. return;
  11743. this.isLayoutDirty = true;
  11744. for (var i = 0; i < this.path.length; i++) {
  11745. var node = this.path[i];
  11746. node.shouldResetTransform = true;
  11747. /**
  11748. * TODO: Check we haven't updated the scroll
  11749. * since the last didUpdate
  11750. */
  11751. node.updateScroll();
  11752. }
  11753. var _d = this.options, layoutId = _d.layoutId, layout = _d.layout;
  11754. if (layoutId === undefined && !layout)
  11755. return;
  11756. var transformTemplate = (_c = this.options.visualElement) === null || _c === void 0 ? void 0 : _c.getProps().transformTemplate;
  11757. this.prevTransformTemplateValue = transformTemplate === null || transformTemplate === void 0 ? void 0 : transformTemplate(this.latestValues, "");
  11758. this.updateSnapshot();
  11759. shouldNotifyListeners && this.notifyListeners("willUpdate");
  11760. };
  11761. // Note: Currently only running on root node
  11762. ProjectionNode.prototype.didUpdate = function () {
  11763. var updateWasBlocked = this.isUpdateBlocked();
  11764. // When doing an instant transition, we skip the layout update,
  11765. // but should still clean up the measurements so that the next
  11766. // snapshot could be taken correctly.
  11767. if (updateWasBlocked) {
  11768. this.unblockUpdate();
  11769. this.clearAllSnapshots();
  11770. this.nodes.forEach(clearMeasurements);
  11771. return;
  11772. }
  11773. if (!this.isUpdating)
  11774. return;
  11775. this.isUpdating = false;
  11776. /**
  11777. * Search for and mount newly-added projection elements.
  11778. *
  11779. * TODO: Every time a new component is rendered we could search up the tree for
  11780. * the closest mounted node and query from there rather than document.
  11781. */
  11782. if (this.potentialNodes.size) {
  11783. this.potentialNodes.forEach(mountNodeEarly);
  11784. this.potentialNodes.clear();
  11785. }
  11786. /**
  11787. * Write
  11788. */
  11789. this.nodes.forEach(resetTransformStyle);
  11790. /**
  11791. * Read ==================
  11792. */
  11793. // Update layout measurements of updated children
  11794. this.nodes.forEach(updateLayout);
  11795. /**
  11796. * Write
  11797. */
  11798. // Notify listeners that the layout is updated
  11799. this.nodes.forEach(notifyLayoutUpdate);
  11800. this.clearAllSnapshots();
  11801. // Flush any scheduled updates
  11802. flushSync.update();
  11803. flushSync.preRender();
  11804. flushSync.render();
  11805. };
  11806. ProjectionNode.prototype.clearAllSnapshots = function () {
  11807. this.nodes.forEach(clearSnapshot);
  11808. this.sharedNodes.forEach(removeLeadSnapshots);
  11809. };
  11810. ProjectionNode.prototype.scheduleUpdateProjection = function () {
  11811. es.preRender(this.updateProjection, false, true);
  11812. };
  11813. ProjectionNode.prototype.scheduleCheckAfterUnmount = function () {
  11814. var _this = this;
  11815. /**
  11816. * If the unmounting node is in a layoutGroup and did trigger a willUpdate,
  11817. * we manually call didUpdate to give a chance to the siblings to animate.
  11818. * Otherwise, cleanup all snapshots to prevents future nodes from reusing them.
  11819. */
  11820. es.postRender(function () {
  11821. if (_this.isLayoutDirty) {
  11822. _this.root.didUpdate();
  11823. }
  11824. else {
  11825. _this.root.checkUpdateFailed();
  11826. }
  11827. });
  11828. };
  11829. /**
  11830. * Update measurements
  11831. */
  11832. ProjectionNode.prototype.updateSnapshot = function () {
  11833. if (this.snapshot || !this.instance)
  11834. return;
  11835. var measured = this.measure();
  11836. var layout = this.removeTransform(this.removeElementScroll(measured));
  11837. roundBox(layout);
  11838. this.snapshot = {
  11839. measured: measured,
  11840. layout: layout,
  11841. latestValues: {},
  11842. };
  11843. };
  11844. ProjectionNode.prototype.updateLayout = function () {
  11845. var _a;
  11846. if (!this.instance)
  11847. return;
  11848. // TODO: Incorporate into a forwarded scroll offset
  11849. this.updateScroll();
  11850. if (!(this.options.alwaysMeasureLayout && this.isLead()) &&
  11851. !this.isLayoutDirty) {
  11852. return;
  11853. }
  11854. /**
  11855. * When a node is mounted, it simply resumes from the prevLead's
  11856. * snapshot instead of taking a new one, but the ancestors scroll
  11857. * might have updated while the prevLead is unmounted. We need to
  11858. * update the scroll again to make sure the layout we measure is
  11859. * up to date.
  11860. */
  11861. if (this.resumeFrom && !this.resumeFrom.instance) {
  11862. for (var i = 0; i < this.path.length; i++) {
  11863. var node = this.path[i];
  11864. node.updateScroll();
  11865. }
  11866. }
  11867. var measured = this.measure();
  11868. roundBox(measured);
  11869. var prevLayout = this.layout;
  11870. this.layout = {
  11871. measured: measured,
  11872. actual: this.removeElementScroll(measured),
  11873. };
  11874. this.layoutCorrected = createBox();
  11875. this.isLayoutDirty = false;
  11876. this.projectionDelta = undefined;
  11877. this.notifyListeners("measure", this.layout.actual);
  11878. (_a = this.options.visualElement) === null || _a === void 0 ? void 0 : _a.notifyLayoutMeasure(this.layout.actual, prevLayout === null || prevLayout === void 0 ? void 0 : prevLayout.actual);
  11879. };
  11880. ProjectionNode.prototype.updateScroll = function () {
  11881. if (this.options.layoutScroll && this.instance) {
  11882. this.isScrollRoot = checkIsScrollRoot(this.instance);
  11883. this.scroll = measureScroll(this.instance);
  11884. }
  11885. };
  11886. ProjectionNode.prototype.resetTransform = function () {
  11887. var _a;
  11888. if (!resetTransform)
  11889. return;
  11890. var isResetRequested = this.isLayoutDirty || this.shouldResetTransform;
  11891. var hasProjection = this.projectionDelta && !isDeltaZero(this.projectionDelta);
  11892. var transformTemplate = (_a = this.options.visualElement) === null || _a === void 0 ? void 0 : _a.getProps().transformTemplate;
  11893. var transformTemplateValue = transformTemplate === null || transformTemplate === void 0 ? void 0 : transformTemplate(this.latestValues, "");
  11894. var transformTemplateHasChanged = transformTemplateValue !== this.prevTransformTemplateValue;
  11895. if (isResetRequested &&
  11896. (hasProjection ||
  11897. hasTransform(this.latestValues) ||
  11898. transformTemplateHasChanged)) {
  11899. resetTransform(this.instance, transformTemplateValue);
  11900. this.shouldResetTransform = false;
  11901. this.scheduleRender();
  11902. }
  11903. };
  11904. ProjectionNode.prototype.measure = function () {
  11905. var visualElement = this.options.visualElement;
  11906. if (!visualElement)
  11907. return createBox();
  11908. var box = visualElement.measureViewportBox();
  11909. // Remove viewport scroll to give page-relative coordinates
  11910. var scroll = this.root.scroll;
  11911. if (scroll) {
  11912. translateAxis(box.x, scroll.x);
  11913. translateAxis(box.y, scroll.y);
  11914. }
  11915. return box;
  11916. };
  11917. ProjectionNode.prototype.removeElementScroll = function (box) {
  11918. var boxWithoutScroll = createBox();
  11919. copyBoxInto(boxWithoutScroll, box);
  11920. /**
  11921. * Performance TODO: Keep a cumulative scroll offset down the tree
  11922. * rather than loop back up the path.
  11923. */
  11924. for (var i = 0; i < this.path.length; i++) {
  11925. var node = this.path[i];
  11926. var scroll_1 = node.scroll, options = node.options, isScrollRoot = node.isScrollRoot;
  11927. if (node !== this.root && scroll_1 && options.layoutScroll) {
  11928. /**
  11929. * If this is a new scroll root, we want to remove all previous scrolls
  11930. * from the viewport box.
  11931. */
  11932. if (isScrollRoot) {
  11933. copyBoxInto(boxWithoutScroll, box);
  11934. var rootScroll = this.root.scroll;
  11935. /**
  11936. * Undo the application of page scroll that was originally added
  11937. * to the measured bounding box.
  11938. */
  11939. if (rootScroll) {
  11940. translateAxis(boxWithoutScroll.x, -rootScroll.x);
  11941. translateAxis(boxWithoutScroll.y, -rootScroll.y);
  11942. }
  11943. }
  11944. translateAxis(boxWithoutScroll.x, scroll_1.x);
  11945. translateAxis(boxWithoutScroll.y, scroll_1.y);
  11946. }
  11947. }
  11948. return boxWithoutScroll;
  11949. };
  11950. ProjectionNode.prototype.applyTransform = function (box, transformOnly) {
  11951. if (transformOnly === void 0) { transformOnly = false; }
  11952. var withTransforms = createBox();
  11953. copyBoxInto(withTransforms, box);
  11954. for (var i = 0; i < this.path.length; i++) {
  11955. var node = this.path[i];
  11956. if (!transformOnly &&
  11957. node.options.layoutScroll &&
  11958. node.scroll &&
  11959. node !== node.root) {
  11960. transformBox(withTransforms, {
  11961. x: -node.scroll.x,
  11962. y: -node.scroll.y,
  11963. });
  11964. }
  11965. if (!hasTransform(node.latestValues))
  11966. continue;
  11967. transformBox(withTransforms, node.latestValues);
  11968. }
  11969. if (hasTransform(this.latestValues)) {
  11970. transformBox(withTransforms, this.latestValues);
  11971. }
  11972. return withTransforms;
  11973. };
  11974. ProjectionNode.prototype.removeTransform = function (box) {
  11975. var _a;
  11976. var boxWithoutTransform = createBox();
  11977. copyBoxInto(boxWithoutTransform, box);
  11978. for (var i = 0; i < this.path.length; i++) {
  11979. var node = this.path[i];
  11980. if (!node.instance)
  11981. continue;
  11982. if (!hasTransform(node.latestValues))
  11983. continue;
  11984. hasScale(node.latestValues) && node.updateSnapshot();
  11985. var sourceBox = createBox();
  11986. var nodeBox = node.measure();
  11987. copyBoxInto(sourceBox, nodeBox);
  11988. removeBoxTransforms(boxWithoutTransform, node.latestValues, (_a = node.snapshot) === null || _a === void 0 ? void 0 : _a.layout, sourceBox);
  11989. }
  11990. if (hasTransform(this.latestValues)) {
  11991. removeBoxTransforms(boxWithoutTransform, this.latestValues);
  11992. }
  11993. return boxWithoutTransform;
  11994. };
  11995. /**
  11996. *
  11997. */
  11998. ProjectionNode.prototype.setTargetDelta = function (delta) {
  11999. this.targetDelta = delta;
  12000. this.root.scheduleUpdateProjection();
  12001. };
  12002. ProjectionNode.prototype.setOptions = function (options) {
  12003. var _a;
  12004. this.options = __assign(__assign(__assign({}, this.options), options), { crossfade: (_a = options.crossfade) !== null && _a !== void 0 ? _a : true });
  12005. };
  12006. ProjectionNode.prototype.clearMeasurements = function () {
  12007. this.scroll = undefined;
  12008. this.layout = undefined;
  12009. this.snapshot = undefined;
  12010. this.prevTransformTemplateValue = undefined;
  12011. this.targetDelta = undefined;
  12012. this.target = undefined;
  12013. this.isLayoutDirty = false;
  12014. };
  12015. /**
  12016. * Frame calculations
  12017. */
  12018. ProjectionNode.prototype.resolveTargetDelta = function () {
  12019. var _a;
  12020. var _b = this.options, layout = _b.layout, layoutId = _b.layoutId;
  12021. /**
  12022. * If we have no layout, we can't perform projection, so early return
  12023. */
  12024. if (!this.layout || !(layout || layoutId))
  12025. return;
  12026. /**
  12027. * If we don't have a targetDelta but do have a layout, we can attempt to resolve
  12028. * a relativeParent. This will allow a component to perform scale correction
  12029. * even if no animation has started.
  12030. */
  12031. // TODO If this is unsuccessful this currently happens every frame
  12032. if (!this.targetDelta && !this.relativeTarget) {
  12033. // TODO: This is a semi-repetition of further down this function, make DRY
  12034. this.relativeParent = this.getClosestProjectingParent();
  12035. if (this.relativeParent && this.relativeParent.layout) {
  12036. this.relativeTarget = createBox();
  12037. this.relativeTargetOrigin = createBox();
  12038. calcRelativePosition(this.relativeTargetOrigin, this.layout.actual, this.relativeParent.layout.actual);
  12039. copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
  12040. }
  12041. }
  12042. /**
  12043. * If we have no relative target or no target delta our target isn't valid
  12044. * for this frame.
  12045. */
  12046. if (!this.relativeTarget && !this.targetDelta)
  12047. return;
  12048. /**
  12049. * Lazy-init target data structure
  12050. */
  12051. if (!this.target) {
  12052. this.target = createBox();
  12053. this.targetWithTransforms = createBox();
  12054. }
  12055. /**
  12056. * If we've got a relative box for this component, resolve it into a target relative to the parent.
  12057. */
  12058. if (this.relativeTarget &&
  12059. this.relativeTargetOrigin &&
  12060. ((_a = this.relativeParent) === null || _a === void 0 ? void 0 : _a.target)) {
  12061. calcRelativeBox(this.target, this.relativeTarget, this.relativeParent.target);
  12062. /**
  12063. * If we've only got a targetDelta, resolve it into a target
  12064. */
  12065. }
  12066. else if (this.targetDelta) {
  12067. if (Boolean(this.resumingFrom)) {
  12068. // TODO: This is creating a new object every frame
  12069. this.target = this.applyTransform(this.layout.actual);
  12070. }
  12071. else {
  12072. copyBoxInto(this.target, this.layout.actual);
  12073. }
  12074. applyBoxDelta(this.target, this.targetDelta);
  12075. }
  12076. else {
  12077. /**
  12078. * If no target, use own layout as target
  12079. */
  12080. copyBoxInto(this.target, this.layout.actual);
  12081. }
  12082. /**
  12083. * If we've been told to attempt to resolve a relative target, do so.
  12084. */
  12085. if (this.attemptToResolveRelativeTarget) {
  12086. this.attemptToResolveRelativeTarget = false;
  12087. this.relativeParent = this.getClosestProjectingParent();
  12088. if (this.relativeParent &&
  12089. Boolean(this.relativeParent.resumingFrom) ===
  12090. Boolean(this.resumingFrom) &&
  12091. !this.relativeParent.options.layoutScroll &&
  12092. this.relativeParent.target) {
  12093. this.relativeTarget = createBox();
  12094. this.relativeTargetOrigin = createBox();
  12095. calcRelativePosition(this.relativeTargetOrigin, this.target, this.relativeParent.target);
  12096. copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
  12097. }
  12098. }
  12099. };
  12100. ProjectionNode.prototype.getClosestProjectingParent = function () {
  12101. if (!this.parent || hasTransform(this.parent.latestValues))
  12102. return undefined;
  12103. if ((this.parent.relativeTarget || this.parent.targetDelta) &&
  12104. this.parent.layout) {
  12105. return this.parent;
  12106. }
  12107. else {
  12108. return this.parent.getClosestProjectingParent();
  12109. }
  12110. };
  12111. ProjectionNode.prototype.calcProjection = function () {
  12112. var _a;
  12113. var _b = this.options, layout = _b.layout, layoutId = _b.layoutId;
  12114. /**
  12115. * If this section of the tree isn't animating we can
  12116. * delete our target sources for the following frame.
  12117. */
  12118. this.isTreeAnimating = Boolean(((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isTreeAnimating) ||
  12119. this.currentAnimation ||
  12120. this.pendingAnimation);
  12121. if (!this.isTreeAnimating) {
  12122. this.targetDelta = this.relativeTarget = undefined;
  12123. }
  12124. if (!this.layout || !(layout || layoutId))
  12125. return;
  12126. var lead = this.getLead();
  12127. /**
  12128. * Reset the corrected box with the latest values from box, as we're then going
  12129. * to perform mutative operations on it.
  12130. */
  12131. copyBoxInto(this.layoutCorrected, this.layout.actual);
  12132. /**
  12133. * Apply all the parent deltas to this box to produce the corrected box. This
  12134. * is the layout box, as it will appear on screen as a result of the transforms of its parents.
  12135. */
  12136. applyTreeDeltas(this.layoutCorrected, this.treeScale, this.path, Boolean(this.resumingFrom) || this !== lead);
  12137. var target = lead.target;
  12138. if (!target)
  12139. return;
  12140. if (!this.projectionDelta) {
  12141. this.projectionDelta = createDelta();
  12142. this.projectionDeltaWithTransform = createDelta();
  12143. }
  12144. var prevTreeScaleX = this.treeScale.x;
  12145. var prevTreeScaleY = this.treeScale.y;
  12146. var prevProjectionTransform = this.projectionTransform;
  12147. /**
  12148. * Update the delta between the corrected box and the target box before user-set transforms were applied.
  12149. * This will allow us to calculate the corrected borderRadius and boxShadow to compensate
  12150. * for our layout reprojection, but still allow them to be scaled correctly by the user.
  12151. * It might be that to simplify this we may want to accept that user-set scale is also corrected
  12152. * and we wouldn't have to keep and calc both deltas, OR we could support a user setting
  12153. * to allow people to choose whether these styles are corrected based on just the
  12154. * layout reprojection or the final bounding box.
  12155. */
  12156. calcBoxDelta(this.projectionDelta, this.layoutCorrected, target, this.latestValues);
  12157. this.projectionTransform = buildProjectionTransform(this.projectionDelta, this.treeScale);
  12158. if (this.projectionTransform !== prevProjectionTransform ||
  12159. this.treeScale.x !== prevTreeScaleX ||
  12160. this.treeScale.y !== prevTreeScaleY) {
  12161. this.hasProjected = true;
  12162. this.scheduleRender();
  12163. this.notifyListeners("projectionUpdate", target);
  12164. }
  12165. };
  12166. ProjectionNode.prototype.hide = function () {
  12167. this.isVisible = false;
  12168. // TODO: Schedule render
  12169. };
  12170. ProjectionNode.prototype.show = function () {
  12171. this.isVisible = true;
  12172. // TODO: Schedule render
  12173. };
  12174. ProjectionNode.prototype.scheduleRender = function (notifyAll) {
  12175. var _a, _b, _c;
  12176. if (notifyAll === void 0) { notifyAll = true; }
  12177. (_b = (_a = this.options).scheduleRender) === null || _b === void 0 ? void 0 : _b.call(_a);
  12178. notifyAll && ((_c = this.getStack()) === null || _c === void 0 ? void 0 : _c.scheduleRender());
  12179. if (this.resumingFrom && !this.resumingFrom.instance) {
  12180. this.resumingFrom = undefined;
  12181. }
  12182. };
  12183. ProjectionNode.prototype.setAnimationOrigin = function (delta, hasOnlyRelativeTargetChanged) {
  12184. var _this = this;
  12185. var _a;
  12186. if (hasOnlyRelativeTargetChanged === void 0) { hasOnlyRelativeTargetChanged = false; }
  12187. var snapshot = this.snapshot;
  12188. var snapshotLatestValues = (snapshot === null || snapshot === void 0 ? void 0 : snapshot.latestValues) || {};
  12189. var mixedValues = __assign({}, this.latestValues);
  12190. var targetDelta = createDelta();
  12191. this.relativeTarget = this.relativeTargetOrigin = undefined;
  12192. this.attemptToResolveRelativeTarget = !hasOnlyRelativeTargetChanged;
  12193. var relativeLayout = createBox();
  12194. var isSharedLayoutAnimation = snapshot === null || snapshot === void 0 ? void 0 : snapshot.isShared;
  12195. var isOnlyMember = (((_a = this.getStack()) === null || _a === void 0 ? void 0 : _a.members.length) || 0) <= 1;
  12196. var shouldCrossfadeOpacity = Boolean(isSharedLayoutAnimation &&
  12197. !isOnlyMember &&
  12198. this.options.crossfade === true &&
  12199. !this.path.some(hasOpacityCrossfade));
  12200. this.animationProgress = 0;
  12201. this.mixTargetDelta = function (latest) {
  12202. var _a;
  12203. var progress = latest / 1000;
  12204. mixAxisDelta(targetDelta.x, delta.x, progress);
  12205. mixAxisDelta(targetDelta.y, delta.y, progress);
  12206. _this.setTargetDelta(targetDelta);
  12207. if (_this.relativeTarget &&
  12208. _this.relativeTargetOrigin &&
  12209. _this.layout &&
  12210. ((_a = _this.relativeParent) === null || _a === void 0 ? void 0 : _a.layout)) {
  12211. calcRelativePosition(relativeLayout, _this.layout.actual, _this.relativeParent.layout.actual);
  12212. mixBox(_this.relativeTarget, _this.relativeTargetOrigin, relativeLayout, progress);
  12213. }
  12214. if (isSharedLayoutAnimation) {
  12215. _this.animationValues = mixedValues;
  12216. mixValues(mixedValues, snapshotLatestValues, _this.latestValues, progress, shouldCrossfadeOpacity, isOnlyMember);
  12217. }
  12218. _this.root.scheduleUpdateProjection();
  12219. _this.scheduleRender();
  12220. _this.animationProgress = progress;
  12221. };
  12222. this.mixTargetDelta(0);
  12223. };
  12224. ProjectionNode.prototype.startAnimation = function (options) {
  12225. var _this = this;
  12226. var _a, _b;
  12227. this.notifyListeners("animationStart");
  12228. (_a = this.currentAnimation) === null || _a === void 0 ? void 0 : _a.stop();
  12229. if (this.resumingFrom) {
  12230. (_b = this.resumingFrom.currentAnimation) === null || _b === void 0 ? void 0 : _b.stop();
  12231. }
  12232. if (this.pendingAnimation) {
  12233. cancelSync.update(this.pendingAnimation);
  12234. this.pendingAnimation = undefined;
  12235. }
  12236. /**
  12237. * Start the animation in the next frame to have a frame with progress 0,
  12238. * where the target is the same as when the animation started, so we can
  12239. * calculate the relative positions correctly for instant transitions.
  12240. */
  12241. this.pendingAnimation = es.update(function () {
  12242. globalProjectionState.hasAnimatedSinceResize = true;
  12243. _this.currentAnimation = animate_animate(0, animationTarget, __assign(__assign({}, options), { onUpdate: function (latest) {
  12244. var _a;
  12245. _this.mixTargetDelta(latest);
  12246. (_a = options.onUpdate) === null || _a === void 0 ? void 0 : _a.call(options, latest);
  12247. }, onComplete: function () {
  12248. var _a;
  12249. (_a = options.onComplete) === null || _a === void 0 ? void 0 : _a.call(options);
  12250. _this.completeAnimation();
  12251. } }));
  12252. if (_this.resumingFrom) {
  12253. _this.resumingFrom.currentAnimation = _this.currentAnimation;
  12254. }
  12255. _this.pendingAnimation = undefined;
  12256. });
  12257. };
  12258. ProjectionNode.prototype.completeAnimation = function () {
  12259. var _a;
  12260. if (this.resumingFrom) {
  12261. this.resumingFrom.currentAnimation = undefined;
  12262. this.resumingFrom.preserveOpacity = undefined;
  12263. }
  12264. (_a = this.getStack()) === null || _a === void 0 ? void 0 : _a.exitAnimationComplete();
  12265. this.resumingFrom =
  12266. this.currentAnimation =
  12267. this.animationValues =
  12268. undefined;
  12269. this.notifyListeners("animationComplete");
  12270. };
  12271. ProjectionNode.prototype.finishAnimation = function () {
  12272. var _a;
  12273. if (this.currentAnimation) {
  12274. (_a = this.mixTargetDelta) === null || _a === void 0 ? void 0 : _a.call(this, animationTarget);
  12275. this.currentAnimation.stop();
  12276. }
  12277. this.completeAnimation();
  12278. };
  12279. ProjectionNode.prototype.applyTransformsToTarget = function () {
  12280. var _a = this.getLead(), targetWithTransforms = _a.targetWithTransforms, target = _a.target, layout = _a.layout, latestValues = _a.latestValues;
  12281. if (!targetWithTransforms || !target || !layout)
  12282. return;
  12283. copyBoxInto(targetWithTransforms, target);
  12284. /**
  12285. * Apply the latest user-set transforms to the targetBox to produce the targetBoxFinal.
  12286. * This is the final box that we will then project into by calculating a transform delta and
  12287. * applying it to the corrected box.
  12288. */
  12289. transformBox(targetWithTransforms, latestValues);
  12290. /**
  12291. * Update the delta between the corrected box and the final target box, after
  12292. * user-set transforms are applied to it. This will be used by the renderer to
  12293. * create a transform style that will reproject the element from its actual layout
  12294. * into the desired bounding box.
  12295. */
  12296. calcBoxDelta(this.projectionDeltaWithTransform, this.layoutCorrected, targetWithTransforms, latestValues);
  12297. };
  12298. ProjectionNode.prototype.registerSharedNode = function (layoutId, node) {
  12299. var _a, _b, _c;
  12300. if (!this.sharedNodes.has(layoutId)) {
  12301. this.sharedNodes.set(layoutId, new NodeStack());
  12302. }
  12303. var stack = this.sharedNodes.get(layoutId);
  12304. stack.add(node);
  12305. node.promote({
  12306. transition: (_a = node.options.initialPromotionConfig) === null || _a === void 0 ? void 0 : _a.transition,
  12307. preserveFollowOpacity: (_c = (_b = node.options.initialPromotionConfig) === null || _b === void 0 ? void 0 : _b.shouldPreserveFollowOpacity) === null || _c === void 0 ? void 0 : _c.call(_b, node),
  12308. });
  12309. };
  12310. ProjectionNode.prototype.isLead = function () {
  12311. var stack = this.getStack();
  12312. return stack ? stack.lead === this : true;
  12313. };
  12314. ProjectionNode.prototype.getLead = function () {
  12315. var _a;
  12316. var layoutId = this.options.layoutId;
  12317. return layoutId ? ((_a = this.getStack()) === null || _a === void 0 ? void 0 : _a.lead) || this : this;
  12318. };
  12319. ProjectionNode.prototype.getPrevLead = function () {
  12320. var _a;
  12321. var layoutId = this.options.layoutId;
  12322. return layoutId ? (_a = this.getStack()) === null || _a === void 0 ? void 0 : _a.prevLead : undefined;
  12323. };
  12324. ProjectionNode.prototype.getStack = function () {
  12325. var layoutId = this.options.layoutId;
  12326. if (layoutId)
  12327. return this.root.sharedNodes.get(layoutId);
  12328. };
  12329. ProjectionNode.prototype.promote = function (_a) {
  12330. var _b = _a === void 0 ? {} : _a, needsReset = _b.needsReset, transition = _b.transition, preserveFollowOpacity = _b.preserveFollowOpacity;
  12331. var stack = this.getStack();
  12332. if (stack)
  12333. stack.promote(this, preserveFollowOpacity);
  12334. if (needsReset) {
  12335. this.projectionDelta = undefined;
  12336. this.needsReset = true;
  12337. }
  12338. if (transition)
  12339. this.setOptions({ transition: transition });
  12340. };
  12341. ProjectionNode.prototype.relegate = function () {
  12342. var stack = this.getStack();
  12343. if (stack) {
  12344. return stack.relegate(this);
  12345. }
  12346. else {
  12347. return false;
  12348. }
  12349. };
  12350. ProjectionNode.prototype.resetRotation = function () {
  12351. var visualElement = this.options.visualElement;
  12352. if (!visualElement)
  12353. return;
  12354. // If there's no detected rotation values, we can early return without a forced render.
  12355. var hasRotate = false;
  12356. // Keep a record of all the values we've reset
  12357. var resetValues = {};
  12358. // Check the rotate value of all axes and reset to 0
  12359. for (var i = 0; i < transformAxes.length; i++) {
  12360. var axis = transformAxes[i];
  12361. var key = "rotate" + axis;
  12362. // If this rotation doesn't exist as a motion value, then we don't
  12363. // need to reset it
  12364. if (!visualElement.getStaticValue(key)) {
  12365. continue;
  12366. }
  12367. hasRotate = true;
  12368. // Record the rotation and then temporarily set it to 0
  12369. resetValues[key] = visualElement.getStaticValue(key);
  12370. visualElement.setStaticValue(key, 0);
  12371. }
  12372. // If there's no rotation values, we don't need to do any more.
  12373. if (!hasRotate)
  12374. return;
  12375. // Force a render of this element to apply the transform with all rotations
  12376. // set to 0.
  12377. visualElement === null || visualElement === void 0 ? void 0 : visualElement.syncRender();
  12378. // Put back all the values we reset
  12379. for (var key in resetValues) {
  12380. visualElement.setStaticValue(key, resetValues[key]);
  12381. }
  12382. // Schedule a render for the next frame. This ensures we won't visually
  12383. // see the element with the reset rotate value applied.
  12384. visualElement.scheduleRender();
  12385. };
  12386. ProjectionNode.prototype.getProjectionStyles = function (styleProp) {
  12387. var _a, _b, _c, _d, _e, _f;
  12388. if (styleProp === void 0) { styleProp = {}; }
  12389. // TODO: Return lifecycle-persistent object
  12390. var styles = {};
  12391. if (!this.instance || this.isSVG)
  12392. return styles;
  12393. if (!this.isVisible) {
  12394. return { visibility: "hidden" };
  12395. }
  12396. else {
  12397. styles.visibility = "";
  12398. }
  12399. var transformTemplate = (_a = this.options.visualElement) === null || _a === void 0 ? void 0 : _a.getProps().transformTemplate;
  12400. if (this.needsReset) {
  12401. this.needsReset = false;
  12402. styles.opacity = "";
  12403. styles.pointerEvents =
  12404. resolveMotionValue(styleProp.pointerEvents) || "";
  12405. styles.transform = transformTemplate
  12406. ? transformTemplate(this.latestValues, "")
  12407. : "none";
  12408. return styles;
  12409. }
  12410. var lead = this.getLead();
  12411. if (!this.projectionDelta || !this.layout || !lead.target) {
  12412. var emptyStyles = {};
  12413. if (this.options.layoutId) {
  12414. emptyStyles.opacity = (_b = this.latestValues.opacity) !== null && _b !== void 0 ? _b : 1;
  12415. emptyStyles.pointerEvents =
  12416. resolveMotionValue(styleProp.pointerEvents) || "";
  12417. }
  12418. if (this.hasProjected && !hasTransform(this.latestValues)) {
  12419. emptyStyles.transform = transformTemplate
  12420. ? transformTemplate({}, "")
  12421. : "none";
  12422. this.hasProjected = false;
  12423. }
  12424. return emptyStyles;
  12425. }
  12426. var valuesToRender = lead.animationValues || lead.latestValues;
  12427. this.applyTransformsToTarget();
  12428. styles.transform = buildProjectionTransform(this.projectionDeltaWithTransform, this.treeScale, valuesToRender);
  12429. if (transformTemplate) {
  12430. styles.transform = transformTemplate(valuesToRender, styles.transform);
  12431. }
  12432. var _g = this.projectionDelta, x = _g.x, y = _g.y;
  12433. styles.transformOrigin = "".concat(x.origin * 100, "% ").concat(y.origin * 100, "% 0");
  12434. if (lead.animationValues) {
  12435. /**
  12436. * If the lead component is animating, assign this either the entering/leaving
  12437. * opacity
  12438. */
  12439. styles.opacity =
  12440. lead === this
  12441. ? (_d = (_c = valuesToRender.opacity) !== null && _c !== void 0 ? _c : this.latestValues.opacity) !== null && _d !== void 0 ? _d : 1
  12442. : this.preserveOpacity
  12443. ? this.latestValues.opacity
  12444. : valuesToRender.opacityExit;
  12445. }
  12446. else {
  12447. /**
  12448. * Or we're not animating at all, set the lead component to its actual
  12449. * opacity and other components to hidden.
  12450. */
  12451. styles.opacity =
  12452. lead === this
  12453. ? (_e = valuesToRender.opacity) !== null && _e !== void 0 ? _e : ""
  12454. : (_f = valuesToRender.opacityExit) !== null && _f !== void 0 ? _f : 0;
  12455. }
  12456. /**
  12457. * Apply scale correction
  12458. */
  12459. for (var key in scaleCorrectors) {
  12460. if (valuesToRender[key] === undefined)
  12461. continue;
  12462. var _h = scaleCorrectors[key], correct = _h.correct, applyTo = _h.applyTo;
  12463. var corrected = correct(valuesToRender[key], lead);
  12464. if (applyTo) {
  12465. var num = applyTo.length;
  12466. for (var i = 0; i < num; i++) {
  12467. styles[applyTo[i]] = corrected;
  12468. }
  12469. }
  12470. else {
  12471. styles[key] = corrected;
  12472. }
  12473. }
  12474. /**
  12475. * Disable pointer events on follow components. This is to ensure
  12476. * that if a follow component covers a lead component it doesn't block
  12477. * pointer events on the lead.
  12478. */
  12479. if (this.options.layoutId) {
  12480. styles.pointerEvents =
  12481. lead === this
  12482. ? resolveMotionValue(styleProp.pointerEvents) || ""
  12483. : "none";
  12484. }
  12485. return styles;
  12486. };
  12487. ProjectionNode.prototype.clearSnapshot = function () {
  12488. this.resumeFrom = this.snapshot = undefined;
  12489. };
  12490. // Only run on root
  12491. ProjectionNode.prototype.resetTree = function () {
  12492. this.root.nodes.forEach(function (node) { var _a; return (_a = node.currentAnimation) === null || _a === void 0 ? void 0 : _a.stop(); });
  12493. this.root.nodes.forEach(clearMeasurements);
  12494. this.root.sharedNodes.clear();
  12495. };
  12496. return ProjectionNode;
  12497. }());
  12498. }
  12499. function updateLayout(node) {
  12500. node.updateLayout();
  12501. }
  12502. function notifyLayoutUpdate(node) {
  12503. var _a, _b, _c, _d;
  12504. var snapshot = (_b = (_a = node.resumeFrom) === null || _a === void 0 ? void 0 : _a.snapshot) !== null && _b !== void 0 ? _b : node.snapshot;
  12505. if (node.isLead() &&
  12506. node.layout &&
  12507. snapshot &&
  12508. node.hasListeners("didUpdate")) {
  12509. var _e = node.layout, layout_1 = _e.actual, measuredLayout = _e.measured;
  12510. // TODO Maybe we want to also resize the layout snapshot so we don't trigger
  12511. // animations for instance if layout="size" and an element has only changed position
  12512. if (node.options.animationType === "size") {
  12513. eachAxis(function (axis) {
  12514. var axisSnapshot = snapshot.isShared
  12515. ? snapshot.measured[axis]
  12516. : snapshot.layout[axis];
  12517. var length = calcLength(axisSnapshot);
  12518. axisSnapshot.min = layout_1[axis].min;
  12519. axisSnapshot.max = axisSnapshot.min + length;
  12520. });
  12521. }
  12522. else if (node.options.animationType === "position") {
  12523. eachAxis(function (axis) {
  12524. var axisSnapshot = snapshot.isShared
  12525. ? snapshot.measured[axis]
  12526. : snapshot.layout[axis];
  12527. var length = calcLength(layout_1[axis]);
  12528. axisSnapshot.max = axisSnapshot.min + length;
  12529. });
  12530. }
  12531. var layoutDelta = createDelta();
  12532. calcBoxDelta(layoutDelta, layout_1, snapshot.layout);
  12533. var visualDelta = createDelta();
  12534. if (snapshot.isShared) {
  12535. calcBoxDelta(visualDelta, node.applyTransform(measuredLayout, true), snapshot.measured);
  12536. }
  12537. else {
  12538. calcBoxDelta(visualDelta, layout_1, snapshot.layout);
  12539. }
  12540. var hasLayoutChanged = !isDeltaZero(layoutDelta);
  12541. var hasRelativeTargetChanged = false;
  12542. if (!node.resumeFrom) {
  12543. node.relativeParent = node.getClosestProjectingParent();
  12544. /**
  12545. * If the relativeParent is itself resuming from a different element then
  12546. * the relative snapshot is not relavent
  12547. */
  12548. if (node.relativeParent && !node.relativeParent.resumeFrom) {
  12549. var _f = node.relativeParent, parentSnapshot = _f.snapshot, parentLayout = _f.layout;
  12550. if (parentSnapshot && parentLayout) {
  12551. var relativeSnapshot = createBox();
  12552. calcRelativePosition(relativeSnapshot, snapshot.layout, parentSnapshot.layout);
  12553. var relativeLayout = createBox();
  12554. calcRelativePosition(relativeLayout, layout_1, parentLayout.actual);
  12555. if (!boxEquals(relativeSnapshot, relativeLayout)) {
  12556. hasRelativeTargetChanged = true;
  12557. }
  12558. }
  12559. }
  12560. }
  12561. node.notifyListeners("didUpdate", {
  12562. layout: layout_1,
  12563. snapshot: snapshot,
  12564. delta: visualDelta,
  12565. layoutDelta: layoutDelta,
  12566. hasLayoutChanged: hasLayoutChanged,
  12567. hasRelativeTargetChanged: hasRelativeTargetChanged,
  12568. });
  12569. }
  12570. else if (node.isLead()) {
  12571. (_d = (_c = node.options).onExitComplete) === null || _d === void 0 ? void 0 : _d.call(_c);
  12572. }
  12573. /**
  12574. * Clearing transition
  12575. * TODO: Investigate why this transition is being passed in as {type: false } from Framer
  12576. * and why we need it at all
  12577. */
  12578. node.options.transition = undefined;
  12579. }
  12580. function clearSnapshot(node) {
  12581. node.clearSnapshot();
  12582. }
  12583. function clearMeasurements(node) {
  12584. node.clearMeasurements();
  12585. }
  12586. function resetTransformStyle(node) {
  12587. var visualElement = node.options.visualElement;
  12588. if (visualElement === null || visualElement === void 0 ? void 0 : visualElement.getProps().onBeforeLayoutMeasure) {
  12589. visualElement.notifyBeforeLayoutMeasure();
  12590. }
  12591. node.resetTransform();
  12592. }
  12593. function finishAnimation(node) {
  12594. node.finishAnimation();
  12595. node.targetDelta = node.relativeTarget = node.target = undefined;
  12596. }
  12597. function resolveTargetDelta(node) {
  12598. node.resolveTargetDelta();
  12599. }
  12600. function calcProjection(node) {
  12601. node.calcProjection();
  12602. }
  12603. function resetRotation(node) {
  12604. node.resetRotation();
  12605. }
  12606. function removeLeadSnapshots(stack) {
  12607. stack.removeLeadSnapshot();
  12608. }
  12609. function mixAxisDelta(output, delta, p) {
  12610. output.translate = mix(delta.translate, 0, p);
  12611. output.scale = mix(delta.scale, 1, p);
  12612. output.origin = delta.origin;
  12613. output.originPoint = delta.originPoint;
  12614. }
  12615. function mixAxis(output, from, to, p) {
  12616. output.min = mix(from.min, to.min, p);
  12617. output.max = mix(from.max, to.max, p);
  12618. }
  12619. function mixBox(output, from, to, p) {
  12620. mixAxis(output.x, from.x, to.x, p);
  12621. mixAxis(output.y, from.y, to.y, p);
  12622. }
  12623. function hasOpacityCrossfade(node) {
  12624. return (node.animationValues && node.animationValues.opacityExit !== undefined);
  12625. }
  12626. var defaultLayoutTransition = {
  12627. duration: 0.45,
  12628. ease: [0.4, 0, 0.1, 1],
  12629. };
  12630. function mountNodeEarly(node, id) {
  12631. /**
  12632. * Rather than searching the DOM from document we can search the
  12633. * path for the deepest mounted ancestor and search from there
  12634. */
  12635. var searchNode = node.root;
  12636. for (var i = node.path.length - 1; i >= 0; i--) {
  12637. if (Boolean(node.path[i].instance)) {
  12638. searchNode = node.path[i];
  12639. break;
  12640. }
  12641. }
  12642. var searchElement = searchNode && searchNode !== node.root ? searchNode.instance : document;
  12643. var element = searchElement.querySelector("[data-projection-id=\"".concat(id, "\"]"));
  12644. if (element)
  12645. node.mount(element, true);
  12646. }
  12647. function roundAxis(axis) {
  12648. axis.min = Math.round(axis.min);
  12649. axis.max = Math.round(axis.max);
  12650. }
  12651. function roundBox(box) {
  12652. roundAxis(box.x);
  12653. roundAxis(box.y);
  12654. }
  12655. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/node/DocumentProjectionNode.mjs
  12656. var DocumentProjectionNode = createProjectionNode({
  12657. attachResizeListener: function (ref, notify) { return addDomEvent(ref, "resize", notify); },
  12658. measureScroll: function () { return ({
  12659. x: document.documentElement.scrollLeft || document.body.scrollLeft,
  12660. y: document.documentElement.scrollTop || document.body.scrollTop,
  12661. }); },
  12662. checkIsScrollRoot: function () { return true; },
  12663. });
  12664. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/projection/node/HTMLProjectionNode.mjs
  12665. var rootProjectionNode = {
  12666. current: undefined,
  12667. };
  12668. var HTMLProjectionNode_HTMLProjectionNode = createProjectionNode({
  12669. measureScroll: function (instance) { return ({
  12670. x: instance.scrollLeft,
  12671. y: instance.scrollTop,
  12672. }); },
  12673. defaultParent: function () {
  12674. if (!rootProjectionNode.current) {
  12675. var documentNode = new DocumentProjectionNode(0, {});
  12676. documentNode.mount(window);
  12677. documentNode.setOptions({ layoutScroll: true });
  12678. rootProjectionNode.current = documentNode;
  12679. }
  12680. return rootProjectionNode.current;
  12681. },
  12682. resetTransform: function (instance, value) {
  12683. instance.style.transform = value !== null && value !== void 0 ? value : "none";
  12684. },
  12685. checkIsScrollRoot: function (instance) {
  12686. return Boolean(window.getComputedStyle(instance).position === "fixed");
  12687. },
  12688. });
  12689. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/render/dom/motion.mjs
  12690. var featureBundle = __assign(__assign(__assign(__assign({}, animations), gestureAnimations), drag), layoutFeatures);
  12691. /**
  12692. * HTML & SVG components, optimised for use with gestures and animation. These can be used as
  12693. * drop-in replacements for any HTML & SVG component, all CSS & SVG properties are supported.
  12694. *
  12695. * @public
  12696. */
  12697. var motion = /*@__PURE__*/ createMotionProxy(function (Component, config) {
  12698. return create_config_createDomMotionConfig(Component, config, featureBundle, create_visual_element_createDomVisualElement, HTMLProjectionNode_HTMLProjectionNode);
  12699. });
  12700. /**
  12701. * Create a DOM `motion` component with the provided string. This is primarily intended
  12702. * as a full alternative to `motion` for consumers who have to support environments that don't
  12703. * support `Proxy`.
  12704. *
  12705. * ```javascript
  12706. * import { createDomMotionComponent } from "framer-motion"
  12707. *
  12708. * const motion = {
  12709. * div: createDomMotionComponent('div')
  12710. * }
  12711. * ```
  12712. *
  12713. * @public
  12714. */
  12715. function createDomMotionComponent(key) {
  12716. return createMotionComponent(createDomMotionConfig(key, { forwardMotionProps: false }, featureBundle, createDomVisualElement, HTMLProjectionNode));
  12717. }
  12718. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js
  12719. /**
  12720. * WordPress dependencies
  12721. */
  12722. const close_close = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  12723. xmlns: "http://www.w3.org/2000/svg",
  12724. viewBox: "0 0 24 24"
  12725. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  12726. 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"
  12727. }));
  12728. /* harmony default export */ var library_close = (close_close);
  12729. ;// CONCATENATED MODULE: external ["wp","deprecated"]
  12730. var external_wp_deprecated_namespaceObject = window["wp"]["deprecated"];
  12731. var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject);
  12732. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/dashicon/index.js
  12733. /**
  12734. * @typedef OwnProps
  12735. *
  12736. * @property {import('./types').IconKey} icon Icon name
  12737. * @property {string} [className] Class name
  12738. */
  12739. /** @typedef {import('react').ComponentPropsWithoutRef<'span'> & OwnProps} Props */
  12740. /**
  12741. * @param {Props} props
  12742. * @return {JSX.Element} Element
  12743. */
  12744. function Dashicon(_ref) {
  12745. let {
  12746. icon,
  12747. className,
  12748. ...extraProps
  12749. } = _ref;
  12750. const iconClass = ['dashicon', 'dashicons', 'dashicons-' + icon, className].filter(Boolean).join(' ');
  12751. return (0,external_wp_element_namespaceObject.createElement)("span", extends_extends({
  12752. className: iconClass
  12753. }, extraProps));
  12754. }
  12755. /* harmony default export */ var dashicon = (Dashicon);
  12756. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/icon/index.js
  12757. /**
  12758. * External dependencies
  12759. */
  12760. /**
  12761. * WordPress dependencies
  12762. */
  12763. /**
  12764. * Internal dependencies
  12765. */
  12766. function Icon(_ref) {
  12767. let {
  12768. icon = null,
  12769. size = 24,
  12770. ...additionalProps
  12771. } = _ref;
  12772. if ('string' === typeof icon) {
  12773. return (0,external_wp_element_namespaceObject.createElement)(dashicon, extends_extends({
  12774. icon: icon
  12775. }, additionalProps));
  12776. }
  12777. if ((0,external_wp_element_namespaceObject.isValidElement)(icon) && dashicon === icon.type) {
  12778. return (0,external_wp_element_namespaceObject.cloneElement)(icon, { ...additionalProps
  12779. });
  12780. }
  12781. if ('function' === typeof icon) {
  12782. if (icon.prototype instanceof external_wp_element_namespaceObject.Component) {
  12783. return (0,external_wp_element_namespaceObject.createElement)(icon, {
  12784. size,
  12785. ...additionalProps
  12786. });
  12787. }
  12788. return icon({
  12789. size,
  12790. ...additionalProps
  12791. });
  12792. }
  12793. if (icon && (icon.type === 'svg' || icon.type === external_wp_primitives_namespaceObject.SVG)) {
  12794. const appliedProps = { ...icon.props,
  12795. width: size,
  12796. height: size,
  12797. ...additionalProps
  12798. };
  12799. return (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, appliedProps);
  12800. }
  12801. if ((0,external_wp_element_namespaceObject.isValidElement)(icon)) {
  12802. return (0,external_wp_element_namespaceObject.cloneElement)(icon, {
  12803. // @ts-ignore Just forwarding the size prop along
  12804. size,
  12805. ...additionalProps
  12806. });
  12807. }
  12808. return icon;
  12809. }
  12810. /* harmony default export */ var build_module_icon = (Icon);
  12811. ;// CONCATENATED MODULE: external ["wp","warning"]
  12812. var external_wp_warning_namespaceObject = window["wp"]["warning"];
  12813. ;// CONCATENATED MODULE: external "lodash"
  12814. var external_lodash_namespaceObject = window["lodash"];
  12815. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/context/context-system-provider.js
  12816. /**
  12817. * External dependencies
  12818. */
  12819. /**
  12820. * WordPress dependencies
  12821. */
  12822. const ComponentsContext = (0,external_wp_element_namespaceObject.createContext)(
  12823. /** @type {Record<string, any>} */
  12824. {});
  12825. const useComponentsContext = () => (0,external_wp_element_namespaceObject.useContext)(ComponentsContext);
  12826. /**
  12827. * Runs an effect only on update (i.e., ignores the first render)
  12828. *
  12829. * @param {import('react').EffectCallback} effect
  12830. * @param {import('react').DependencyList} deps
  12831. */
  12832. function useUpdateEffect(effect, deps) {
  12833. const mounted = (0,external_wp_element_namespaceObject.useRef)(false);
  12834. (0,external_wp_element_namespaceObject.useEffect)(() => {
  12835. if (mounted.current) {
  12836. return effect();
  12837. }
  12838. mounted.current = true;
  12839. return undefined;
  12840. }, deps);
  12841. }
  12842. /**
  12843. * Consolidates incoming ContextSystem values with a (potential) parent ContextSystem value.
  12844. *
  12845. * Note: This function will warn if it detects an un-memoized `value`
  12846. *
  12847. * @param {Object} props
  12848. * @param {Record<string, any>} props.value
  12849. * @return {Record<string, any>} The consolidated value.
  12850. */
  12851. function useContextSystemBridge(_ref) {
  12852. let {
  12853. value
  12854. } = _ref;
  12855. const parentContext = useComponentsContext();
  12856. const valueRef = (0,external_wp_element_namespaceObject.useRef)(value);
  12857. useUpdateEffect(() => {
  12858. if ( // Objects are equivalent.
  12859. (0,external_lodash_namespaceObject.isEqual)(valueRef.current, value) && // But not the same reference.
  12860. valueRef.current !== value) {
  12861. typeof process !== "undefined" && process.env && "production" !== "production" ? 0 : void 0;
  12862. }
  12863. }, [value]); // `parentContext` will always be memoized (i.e., the result of this hook itself)
  12864. // or the default value from when the `ComponentsContext` was originally
  12865. // initialized (which will never change, it's a static variable)
  12866. // so this memoization will prevent `merge` and `JSON.parse/stringify` from rerunning unless
  12867. // the references to `value` change OR the `parentContext` has an actual material change
  12868. // (because again, it's guaranteed to be memoized or a static reference to the empty object
  12869. // so we know that the only changes for `parentContext` are material ones... i.e., why we
  12870. // don't have to warn in the `useUpdateEffect` hook above for `parentContext` and we only
  12871. // need to bother with the `value`). The `useUpdateEffect` above will ensure that we are
  12872. // correctly warning when the `value` isn't being properly memoized. All of that to say
  12873. // that this should be super safe to assume that `useMemo` will only run on actual
  12874. // changes to the two dependencies, therefore saving us calls to `merge` and `JSON.parse/stringify`!
  12875. const config = (0,external_wp_element_namespaceObject.useMemo)(() => {
  12876. // Deep clone `parentContext` to avoid mutating it later.
  12877. return (0,external_lodash_namespaceObject.merge)(JSON.parse(JSON.stringify(parentContext)), value);
  12878. }, [parentContext, value]);
  12879. return config;
  12880. }
  12881. /**
  12882. * A Provider component that can modify props for connected components within
  12883. * the Context system.
  12884. *
  12885. * @example
  12886. * ```jsx
  12887. * <ContextSystemProvider value={{ Button: { size: 'small' }}}>
  12888. * <Button>...</Button>
  12889. * </ContextSystemProvider>
  12890. * ```
  12891. *
  12892. * @template {Record<string, any>} T
  12893. * @param {Object} options
  12894. * @param {import('react').ReactNode} options.children Children to render.
  12895. * @param {T} options.value Props to render into connected components.
  12896. * @return {JSX.Element} A Provider wrapped component.
  12897. */
  12898. const BaseContextSystemProvider = _ref2 => {
  12899. let {
  12900. children,
  12901. value
  12902. } = _ref2;
  12903. const contextValue = useContextSystemBridge({
  12904. value
  12905. });
  12906. return (0,external_wp_element_namespaceObject.createElement)(ComponentsContext.Provider, {
  12907. value: contextValue
  12908. }, children);
  12909. };
  12910. const ContextSystemProvider = (0,external_wp_element_namespaceObject.memo)(BaseContextSystemProvider);
  12911. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/context/constants.js
  12912. const REACT_TYPEOF_KEY = '$$typeof';
  12913. const COMPONENT_NAMESPACE = 'data-wp-component';
  12914. const CONNECTED_NAMESPACE = 'data-wp-c16t';
  12915. const CONTEXT_COMPONENT_NAMESPACE = 'data-wp-c5tc8t';
  12916. /**
  12917. * Special key where the connected namespaces are stored.
  12918. * This is attached to Context connected components as a static property.
  12919. */
  12920. const CONNECT_STATIC_NAMESPACE = '__contextSystemKey__';
  12921. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/context/utils.js
  12922. /**
  12923. * Internal dependencies
  12924. */
  12925. /**
  12926. * Creates a dedicated context namespace HTML attribute for components.
  12927. * ns is short for "namespace"
  12928. *
  12929. * @example
  12930. * ```jsx
  12931. * <div {...ns('Container')} />
  12932. * ```
  12933. *
  12934. * @param {string} componentName The name for the component.
  12935. * @return {Record<string, any>} A props object with the namespaced HTML attribute.
  12936. */
  12937. function getNamespace(componentName) {
  12938. return {
  12939. [COMPONENT_NAMESPACE]: componentName
  12940. };
  12941. }
  12942. /**
  12943. * Creates a dedicated connected context namespace HTML attribute for components.
  12944. * ns is short for "namespace"
  12945. *
  12946. * @example
  12947. * ```jsx
  12948. * <div {...cns()} />
  12949. * ```
  12950. *
  12951. * @return {Record<string, any>} A props object with the namespaced HTML attribute.
  12952. */
  12953. function getConnectedNamespace() {
  12954. return {
  12955. [CONNECTED_NAMESPACE]: true
  12956. };
  12957. }
  12958. // EXTERNAL MODULE: ./node_modules/memize/index.js
  12959. var memize = __webpack_require__(9756);
  12960. var memize_default = /*#__PURE__*/__webpack_require__.n(memize);
  12961. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/context/get-styled-class-name-from-key.js
  12962. /**
  12963. * External dependencies
  12964. */
  12965. /**
  12966. * Generates the connected component CSS className based on the namespace.
  12967. *
  12968. * @param namespace The name of the connected component.
  12969. * @return The generated CSS className.
  12970. */
  12971. function getStyledClassName(namespace) {
  12972. const kebab = (0,external_lodash_namespaceObject.kebabCase)(namespace);
  12973. return `components-${kebab}`;
  12974. }
  12975. const getStyledClassNameFromKey = memize_default()(getStyledClassName);
  12976. ;// CONCATENATED MODULE: ./node_modules/@emotion/sheet/dist/emotion-sheet.browser.esm.js
  12977. /*
  12978. Based off glamor's StyleSheet, thanks Sunil ❤️
  12979. high performance StyleSheet for css-in-js systems
  12980. - uses multiple style tags behind the scenes for millions of rules
  12981. - uses `insertRule` for appending in production for *much* faster performance
  12982. // usage
  12983. import { StyleSheet } from '@emotion/sheet'
  12984. let styleSheet = new StyleSheet({ key: '', container: document.head })
  12985. styleSheet.insert('#box { border: 1px solid red; }')
  12986. - appends a css rule into the stylesheet
  12987. styleSheet.flush()
  12988. - empties the stylesheet of all its contents
  12989. */
  12990. // $FlowFixMe
  12991. function sheetForTag(tag) {
  12992. if (tag.sheet) {
  12993. // $FlowFixMe
  12994. return tag.sheet;
  12995. } // this weirdness brought to you by firefox
  12996. /* istanbul ignore next */
  12997. for (var i = 0; i < document.styleSheets.length; i++) {
  12998. if (document.styleSheets[i].ownerNode === tag) {
  12999. // $FlowFixMe
  13000. return document.styleSheets[i];
  13001. }
  13002. }
  13003. }
  13004. function createStyleElement(options) {
  13005. var tag = document.createElement('style');
  13006. tag.setAttribute('data-emotion', options.key);
  13007. if (options.nonce !== undefined) {
  13008. tag.setAttribute('nonce', options.nonce);
  13009. }
  13010. tag.appendChild(document.createTextNode(''));
  13011. tag.setAttribute('data-s', '');
  13012. return tag;
  13013. }
  13014. var StyleSheet = /*#__PURE__*/function () {
  13015. // Using Node instead of HTMLElement since container may be a ShadowRoot
  13016. function StyleSheet(options) {
  13017. var _this = this;
  13018. this._insertTag = function (tag) {
  13019. var before;
  13020. if (_this.tags.length === 0) {
  13021. if (_this.insertionPoint) {
  13022. before = _this.insertionPoint.nextSibling;
  13023. } else if (_this.prepend) {
  13024. before = _this.container.firstChild;
  13025. } else {
  13026. before = _this.before;
  13027. }
  13028. } else {
  13029. before = _this.tags[_this.tags.length - 1].nextSibling;
  13030. }
  13031. _this.container.insertBefore(tag, before);
  13032. _this.tags.push(tag);
  13033. };
  13034. this.isSpeedy = options.speedy === undefined ? "production" === 'production' : options.speedy;
  13035. this.tags = [];
  13036. this.ctr = 0;
  13037. this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets
  13038. this.key = options.key;
  13039. this.container = options.container;
  13040. this.prepend = options.prepend;
  13041. this.insertionPoint = options.insertionPoint;
  13042. this.before = null;
  13043. }
  13044. var _proto = StyleSheet.prototype;
  13045. _proto.hydrate = function hydrate(nodes) {
  13046. nodes.forEach(this._insertTag);
  13047. };
  13048. _proto.insert = function insert(rule) {
  13049. // the max length is how many rules we have per style tag, it's 65000 in speedy mode
  13050. // it's 1 in dev because we insert source maps that map a single rule to a location
  13051. // and you can only have one source map per style tag
  13052. if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) {
  13053. this._insertTag(createStyleElement(this));
  13054. }
  13055. var tag = this.tags[this.tags.length - 1];
  13056. if (false) { var isImportRule; }
  13057. if (this.isSpeedy) {
  13058. var sheet = sheetForTag(tag);
  13059. try {
  13060. // this is the ultrafast version, works across browsers
  13061. // the big drawback is that the css won't be editable in devtools
  13062. sheet.insertRule(rule, sheet.cssRules.length);
  13063. } catch (e) {
  13064. if (false) {}
  13065. }
  13066. } else {
  13067. tag.appendChild(document.createTextNode(rule));
  13068. }
  13069. this.ctr++;
  13070. };
  13071. _proto.flush = function flush() {
  13072. // $FlowFixMe
  13073. this.tags.forEach(function (tag) {
  13074. return tag.parentNode && tag.parentNode.removeChild(tag);
  13075. });
  13076. this.tags = [];
  13077. this.ctr = 0;
  13078. if (false) {}
  13079. };
  13080. return StyleSheet;
  13081. }();
  13082. ;// CONCATENATED MODULE: ./node_modules/stylis/src/Utility.js
  13083. /**
  13084. * @param {number}
  13085. * @return {number}
  13086. */
  13087. var abs = Math.abs
  13088. /**
  13089. * @param {number}
  13090. * @return {string}
  13091. */
  13092. var Utility_from = String.fromCharCode
  13093. /**
  13094. * @param {object}
  13095. * @return {object}
  13096. */
  13097. var Utility_assign = Object.assign
  13098. /**
  13099. * @param {string} value
  13100. * @param {number} length
  13101. * @return {number}
  13102. */
  13103. function hash (value, length) {
  13104. return Utility_charat(value, 0) ^ 45 ? (((((((length << 2) ^ Utility_charat(value, 0)) << 2) ^ Utility_charat(value, 1)) << 2) ^ Utility_charat(value, 2)) << 2) ^ Utility_charat(value, 3) : 0
  13105. }
  13106. /**
  13107. * @param {string} value
  13108. * @return {string}
  13109. */
  13110. function trim (value) {
  13111. return value.trim()
  13112. }
  13113. /**
  13114. * @param {string} value
  13115. * @param {RegExp} pattern
  13116. * @return {string?}
  13117. */
  13118. function Utility_match (value, pattern) {
  13119. return (value = pattern.exec(value)) ? value[0] : value
  13120. }
  13121. /**
  13122. * @param {string} value
  13123. * @param {(string|RegExp)} pattern
  13124. * @param {string} replacement
  13125. * @return {string}
  13126. */
  13127. function Utility_replace (value, pattern, replacement) {
  13128. return value.replace(pattern, replacement)
  13129. }
  13130. /**
  13131. * @param {string} value
  13132. * @param {string} search
  13133. * @return {number}
  13134. */
  13135. function indexof (value, search) {
  13136. return value.indexOf(search)
  13137. }
  13138. /**
  13139. * @param {string} value
  13140. * @param {number} index
  13141. * @return {number}
  13142. */
  13143. function Utility_charat (value, index) {
  13144. return value.charCodeAt(index) | 0
  13145. }
  13146. /**
  13147. * @param {string} value
  13148. * @param {number} begin
  13149. * @param {number} end
  13150. * @return {string}
  13151. */
  13152. function Utility_substr (value, begin, end) {
  13153. return value.slice(begin, end)
  13154. }
  13155. /**
  13156. * @param {string} value
  13157. * @return {number}
  13158. */
  13159. function Utility_strlen (value) {
  13160. return value.length
  13161. }
  13162. /**
  13163. * @param {any[]} value
  13164. * @return {number}
  13165. */
  13166. function Utility_sizeof (value) {
  13167. return value.length
  13168. }
  13169. /**
  13170. * @param {any} value
  13171. * @param {any[]} array
  13172. * @return {any}
  13173. */
  13174. function Utility_append (value, array) {
  13175. return array.push(value), value
  13176. }
  13177. /**
  13178. * @param {string[]} array
  13179. * @param {function} callback
  13180. * @return {string}
  13181. */
  13182. function Utility_combine (array, callback) {
  13183. return array.map(callback).join('')
  13184. }
  13185. ;// CONCATENATED MODULE: ./node_modules/stylis/src/Tokenizer.js
  13186. var line = 1
  13187. var column = 1
  13188. var Tokenizer_length = 0
  13189. var position = 0
  13190. var character = 0
  13191. var characters = ''
  13192. /**
  13193. * @param {string} value
  13194. * @param {object | null} root
  13195. * @param {object | null} parent
  13196. * @param {string} type
  13197. * @param {string[] | string} props
  13198. * @param {object[] | string} children
  13199. * @param {number} length
  13200. */
  13201. function node (value, root, parent, type, props, children, length) {
  13202. return {value: value, root: root, parent: parent, type: type, props: props, children: children, line: line, column: column, length: length, return: ''}
  13203. }
  13204. /**
  13205. * @param {object} root
  13206. * @param {object} props
  13207. * @return {object}
  13208. */
  13209. function Tokenizer_copy (root, props) {
  13210. return Utility_assign(node('', null, null, '', null, null, 0), root, {length: -root.length}, props)
  13211. }
  13212. /**
  13213. * @return {number}
  13214. */
  13215. function Tokenizer_char () {
  13216. return character
  13217. }
  13218. /**
  13219. * @return {number}
  13220. */
  13221. function prev () {
  13222. character = position > 0 ? Utility_charat(characters, --position) : 0
  13223. if (column--, character === 10)
  13224. column = 1, line--
  13225. return character
  13226. }
  13227. /**
  13228. * @return {number}
  13229. */
  13230. function next () {
  13231. character = position < Tokenizer_length ? Utility_charat(characters, position++) : 0
  13232. if (column++, character === 10)
  13233. column = 1, line++
  13234. return character
  13235. }
  13236. /**
  13237. * @return {number}
  13238. */
  13239. function peek () {
  13240. return Utility_charat(characters, position)
  13241. }
  13242. /**
  13243. * @return {number}
  13244. */
  13245. function caret () {
  13246. return position
  13247. }
  13248. /**
  13249. * @param {number} begin
  13250. * @param {number} end
  13251. * @return {string}
  13252. */
  13253. function slice (begin, end) {
  13254. return Utility_substr(characters, begin, end)
  13255. }
  13256. /**
  13257. * @param {number} type
  13258. * @return {number}
  13259. */
  13260. function token (type) {
  13261. switch (type) {
  13262. // \0 \t \n \r \s whitespace token
  13263. case 0: case 9: case 10: case 13: case 32:
  13264. return 5
  13265. // ! + , / > @ ~ isolate token
  13266. case 33: case 43: case 44: case 47: case 62: case 64: case 126:
  13267. // ; { } breakpoint token
  13268. case 59: case 123: case 125:
  13269. return 4
  13270. // : accompanied token
  13271. case 58:
  13272. return 3
  13273. // " ' ( [ opening delimit token
  13274. case 34: case 39: case 40: case 91:
  13275. return 2
  13276. // ) ] closing delimit token
  13277. case 41: case 93:
  13278. return 1
  13279. }
  13280. return 0
  13281. }
  13282. /**
  13283. * @param {string} value
  13284. * @return {any[]}
  13285. */
  13286. function alloc (value) {
  13287. return line = column = 1, Tokenizer_length = Utility_strlen(characters = value), position = 0, []
  13288. }
  13289. /**
  13290. * @param {any} value
  13291. * @return {any}
  13292. */
  13293. function dealloc (value) {
  13294. return characters = '', value
  13295. }
  13296. /**
  13297. * @param {number} type
  13298. * @return {string}
  13299. */
  13300. function delimit (type) {
  13301. return trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)))
  13302. }
  13303. /**
  13304. * @param {string} value
  13305. * @return {string[]}
  13306. */
  13307. function Tokenizer_tokenize (value) {
  13308. return dealloc(tokenizer(alloc(value)))
  13309. }
  13310. /**
  13311. * @param {number} type
  13312. * @return {string}
  13313. */
  13314. function whitespace (type) {
  13315. while (character = peek())
  13316. if (character < 33)
  13317. next()
  13318. else
  13319. break
  13320. return token(type) > 2 || token(character) > 3 ? '' : ' '
  13321. }
  13322. /**
  13323. * @param {string[]} children
  13324. * @return {string[]}
  13325. */
  13326. function tokenizer (children) {
  13327. while (next())
  13328. switch (token(character)) {
  13329. case 0: append(identifier(position - 1), children)
  13330. break
  13331. case 2: append(delimit(character), children)
  13332. break
  13333. default: append(from(character), children)
  13334. }
  13335. return children
  13336. }
  13337. /**
  13338. * @param {number} index
  13339. * @param {number} count
  13340. * @return {string}
  13341. */
  13342. function escaping (index, count) {
  13343. while (--count && next())
  13344. // not 0-9 A-F a-f
  13345. if (character < 48 || character > 102 || (character > 57 && character < 65) || (character > 70 && character < 97))
  13346. break
  13347. return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32))
  13348. }
  13349. /**
  13350. * @param {number} type
  13351. * @return {number}
  13352. */
  13353. function delimiter (type) {
  13354. while (next())
  13355. switch (character) {
  13356. // ] ) " '
  13357. case type:
  13358. return position
  13359. // " '
  13360. case 34: case 39:
  13361. if (type !== 34 && type !== 39)
  13362. delimiter(character)
  13363. break
  13364. // (
  13365. case 40:
  13366. if (type === 41)
  13367. delimiter(type)
  13368. break
  13369. // \
  13370. case 92:
  13371. next()
  13372. break
  13373. }
  13374. return position
  13375. }
  13376. /**
  13377. * @param {number} type
  13378. * @param {number} index
  13379. * @return {number}
  13380. */
  13381. function commenter (type, index) {
  13382. while (next())
  13383. // //
  13384. if (type + character === 47 + 10)
  13385. break
  13386. // /*
  13387. else if (type + character === 42 + 42 && peek() === 47)
  13388. break
  13389. return '/*' + slice(index, position - 1) + '*' + Utility_from(type === 47 ? type : next())
  13390. }
  13391. /**
  13392. * @param {number} index
  13393. * @return {string}
  13394. */
  13395. function identifier (index) {
  13396. while (!token(peek()))
  13397. next()
  13398. return slice(index, position)
  13399. }
  13400. ;// CONCATENATED MODULE: ./node_modules/stylis/src/Enum.js
  13401. var Enum_MS = '-ms-'
  13402. var Enum_MOZ = '-moz-'
  13403. var Enum_WEBKIT = '-webkit-'
  13404. var COMMENT = 'comm'
  13405. var Enum_RULESET = 'rule'
  13406. var Enum_DECLARATION = 'decl'
  13407. var PAGE = '@page'
  13408. var MEDIA = '@media'
  13409. var IMPORT = '@import'
  13410. var CHARSET = '@charset'
  13411. var VIEWPORT = '@viewport'
  13412. var SUPPORTS = '@supports'
  13413. var DOCUMENT = '@document'
  13414. var NAMESPACE = '@namespace'
  13415. var Enum_KEYFRAMES = '@keyframes'
  13416. var FONT_FACE = '@font-face'
  13417. var COUNTER_STYLE = '@counter-style'
  13418. var FONT_FEATURE_VALUES = '@font-feature-values'
  13419. ;// CONCATENATED MODULE: ./node_modules/stylis/src/Serializer.js
  13420. /**
  13421. * @param {object[]} children
  13422. * @param {function} callback
  13423. * @return {string}
  13424. */
  13425. function Serializer_serialize (children, callback) {
  13426. var output = ''
  13427. var length = Utility_sizeof(children)
  13428. for (var i = 0; i < length; i++)
  13429. output += callback(children[i], i, children, callback) || ''
  13430. return output
  13431. }
  13432. /**
  13433. * @param {object} element
  13434. * @param {number} index
  13435. * @param {object[]} children
  13436. * @param {function} callback
  13437. * @return {string}
  13438. */
  13439. function stringify (element, index, children, callback) {
  13440. switch (element.type) {
  13441. case IMPORT: case Enum_DECLARATION: return element.return = element.return || element.value
  13442. case COMMENT: return ''
  13443. case Enum_KEYFRAMES: return element.return = element.value + '{' + Serializer_serialize(element.children, callback) + '}'
  13444. case Enum_RULESET: element.value = element.props.join(',')
  13445. }
  13446. return Utility_strlen(children = Serializer_serialize(element.children, callback)) ? element.return = element.value + '{' + children + '}' : ''
  13447. }
  13448. ;// CONCATENATED MODULE: ./node_modules/stylis/src/Middleware.js
  13449. /**
  13450. * @param {function[]} collection
  13451. * @return {function}
  13452. */
  13453. function middleware (collection) {
  13454. var length = Utility_sizeof(collection)
  13455. return function (element, index, children, callback) {
  13456. var output = ''
  13457. for (var i = 0; i < length; i++)
  13458. output += collection[i](element, index, children, callback) || ''
  13459. return output
  13460. }
  13461. }
  13462. /**
  13463. * @param {function} callback
  13464. * @return {function}
  13465. */
  13466. function rulesheet (callback) {
  13467. return function (element) {
  13468. if (!element.root)
  13469. if (element = element.return)
  13470. callback(element)
  13471. }
  13472. }
  13473. /**
  13474. * @param {object} element
  13475. * @param {number} index
  13476. * @param {object[]} children
  13477. * @param {function} callback
  13478. */
  13479. function prefixer (element, index, children, callback) {
  13480. if (element.length > -1)
  13481. if (!element.return)
  13482. switch (element.type) {
  13483. case DECLARATION: element.return = prefix(element.value, element.length, children)
  13484. return
  13485. case KEYFRAMES:
  13486. return serialize([copy(element, {value: replace(element.value, '@', '@' + WEBKIT)})], callback)
  13487. case RULESET:
  13488. if (element.length)
  13489. return combine(element.props, function (value) {
  13490. switch (match(value, /(::plac\w+|:read-\w+)/)) {
  13491. // :read-(only|write)
  13492. case ':read-only': case ':read-write':
  13493. return serialize([copy(element, {props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]})], callback)
  13494. // :placeholder
  13495. case '::placeholder':
  13496. return serialize([
  13497. copy(element, {props: [replace(value, /:(plac\w+)/, ':' + WEBKIT + 'input-$1')]}),
  13498. copy(element, {props: [replace(value, /:(plac\w+)/, ':' + MOZ + '$1')]}),
  13499. copy(element, {props: [replace(value, /:(plac\w+)/, MS + 'input-$1')]})
  13500. ], callback)
  13501. }
  13502. return ''
  13503. })
  13504. }
  13505. }
  13506. /**
  13507. * @param {object} element
  13508. * @param {number} index
  13509. * @param {object[]} children
  13510. */
  13511. function namespace (element) {
  13512. switch (element.type) {
  13513. case RULESET:
  13514. element.props = element.props.map(function (value) {
  13515. return combine(tokenize(value), function (value, index, children) {
  13516. switch (charat(value, 0)) {
  13517. // \f
  13518. case 12:
  13519. return substr(value, 1, strlen(value))
  13520. // \0 ( + > ~
  13521. case 0: case 40: case 43: case 62: case 126:
  13522. return value
  13523. // :
  13524. case 58:
  13525. if (children[++index] === 'global')
  13526. children[index] = '', children[++index] = '\f' + substr(children[index], index = 1, -1)
  13527. // \s
  13528. case 32:
  13529. return index === 1 ? '' : value
  13530. default:
  13531. switch (index) {
  13532. case 0: element = value
  13533. return sizeof(children) > 1 ? '' : value
  13534. case index = sizeof(children) - 1: case 2:
  13535. return index === 2 ? value + element + element : value + element
  13536. default:
  13537. return value
  13538. }
  13539. }
  13540. })
  13541. })
  13542. }
  13543. }
  13544. ;// CONCATENATED MODULE: ./node_modules/stylis/src/Parser.js
  13545. /**
  13546. * @param {string} value
  13547. * @return {object[]}
  13548. */
  13549. function compile (value) {
  13550. return dealloc(Parser_parse('', null, null, null, [''], value = alloc(value), 0, [0], value))
  13551. }
  13552. /**
  13553. * @param {string} value
  13554. * @param {object} root
  13555. * @param {object?} parent
  13556. * @param {string[]} rule
  13557. * @param {string[]} rules
  13558. * @param {string[]} rulesets
  13559. * @param {number[]} pseudo
  13560. * @param {number[]} points
  13561. * @param {string[]} declarations
  13562. * @return {object}
  13563. */
  13564. function Parser_parse (value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {
  13565. var index = 0
  13566. var offset = 0
  13567. var length = pseudo
  13568. var atrule = 0
  13569. var property = 0
  13570. var previous = 0
  13571. var variable = 1
  13572. var scanning = 1
  13573. var ampersand = 1
  13574. var character = 0
  13575. var type = ''
  13576. var props = rules
  13577. var children = rulesets
  13578. var reference = rule
  13579. var characters = type
  13580. while (scanning)
  13581. switch (previous = character, character = next()) {
  13582. // (
  13583. case 40:
  13584. if (previous != 108 && Utility_charat(characters, length - 1) == 58) {
  13585. if (indexof(characters += Utility_replace(delimit(character), '&', '&\f'), '&\f') != -1)
  13586. ampersand = -1
  13587. break
  13588. }
  13589. // " ' [
  13590. case 34: case 39: case 91:
  13591. characters += delimit(character)
  13592. break
  13593. // \t \n \r \s
  13594. case 9: case 10: case 13: case 32:
  13595. characters += whitespace(previous)
  13596. break
  13597. // \
  13598. case 92:
  13599. characters += escaping(caret() - 1, 7)
  13600. continue
  13601. // /
  13602. case 47:
  13603. switch (peek()) {
  13604. case 42: case 47:
  13605. Utility_append(comment(commenter(next(), caret()), root, parent), declarations)
  13606. break
  13607. default:
  13608. characters += '/'
  13609. }
  13610. break
  13611. // {
  13612. case 123 * variable:
  13613. points[index++] = Utility_strlen(characters) * ampersand
  13614. // } ; \0
  13615. case 125 * variable: case 59: case 0:
  13616. switch (character) {
  13617. // \0 }
  13618. case 0: case 125: scanning = 0
  13619. // ;
  13620. case 59 + offset:
  13621. if (property > 0 && (Utility_strlen(characters) - length))
  13622. Utility_append(property > 32 ? declaration(characters + ';', rule, parent, length - 1) : declaration(Utility_replace(characters, ' ', '') + ';', rule, parent, length - 2), declarations)
  13623. break
  13624. // @ ;
  13625. case 59: characters += ';'
  13626. // { rule/at-rule
  13627. default:
  13628. Utility_append(reference = ruleset(characters, root, parent, index, offset, rules, points, type, props = [], children = [], length), rulesets)
  13629. if (character === 123)
  13630. if (offset === 0)
  13631. Parser_parse(characters, root, reference, reference, props, rulesets, length, points, children)
  13632. else
  13633. switch (atrule === 99 && Utility_charat(characters, 3) === 110 ? 100 : atrule) {
  13634. // d m s
  13635. case 100: case 109: case 115:
  13636. Parser_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)
  13637. break
  13638. default:
  13639. Parser_parse(characters, reference, reference, reference, [''], children, 0, points, children)
  13640. }
  13641. }
  13642. index = offset = property = 0, variable = ampersand = 1, type = characters = '', length = pseudo
  13643. break
  13644. // :
  13645. case 58:
  13646. length = 1 + Utility_strlen(characters), property = previous
  13647. default:
  13648. if (variable < 1)
  13649. if (character == 123)
  13650. --variable
  13651. else if (character == 125 && variable++ == 0 && prev() == 125)
  13652. continue
  13653. switch (characters += Utility_from(character), character * variable) {
  13654. // &
  13655. case 38:
  13656. ampersand = offset > 0 ? 1 : (characters += '\f', -1)
  13657. break
  13658. // ,
  13659. case 44:
  13660. points[index++] = (Utility_strlen(characters) - 1) * ampersand, ampersand = 1
  13661. break
  13662. // @
  13663. case 64:
  13664. // -
  13665. if (peek() === 45)
  13666. characters += delimit(next())
  13667. atrule = peek(), offset = length = Utility_strlen(type = characters += identifier(caret())), character++
  13668. break
  13669. // -
  13670. case 45:
  13671. if (previous === 45 && Utility_strlen(characters) == 2)
  13672. variable = 0
  13673. }
  13674. }
  13675. return rulesets
  13676. }
  13677. /**
  13678. * @param {string} value
  13679. * @param {object} root
  13680. * @param {object?} parent
  13681. * @param {number} index
  13682. * @param {number} offset
  13683. * @param {string[]} rules
  13684. * @param {number[]} points
  13685. * @param {string} type
  13686. * @param {string[]} props
  13687. * @param {string[]} children
  13688. * @param {number} length
  13689. * @return {object}
  13690. */
  13691. function ruleset (value, root, parent, index, offset, rules, points, type, props, children, length) {
  13692. var post = offset - 1
  13693. var rule = offset === 0 ? rules : ['']
  13694. var size = Utility_sizeof(rule)
  13695. for (var i = 0, j = 0, k = 0; i < index; ++i)
  13696. for (var x = 0, y = Utility_substr(value, post + 1, post = abs(j = points[i])), z = value; x < size; ++x)
  13697. if (z = trim(j > 0 ? rule[x] + ' ' + y : Utility_replace(y, /&\f/g, rule[x])))
  13698. props[k++] = z
  13699. return node(value, root, parent, offset === 0 ? Enum_RULESET : type, props, children, length)
  13700. }
  13701. /**
  13702. * @param {number} value
  13703. * @param {object} root
  13704. * @param {object?} parent
  13705. * @return {object}
  13706. */
  13707. function comment (value, root, parent) {
  13708. return node(value, root, parent, COMMENT, Utility_from(Tokenizer_char()), Utility_substr(value, 2, -2), 0)
  13709. }
  13710. /**
  13711. * @param {string} value
  13712. * @param {object} root
  13713. * @param {object?} parent
  13714. * @param {number} length
  13715. * @return {object}
  13716. */
  13717. function declaration (value, root, parent, length) {
  13718. return node(value, root, parent, Enum_DECLARATION, Utility_substr(value, 0, length), Utility_substr(value, length + 1, -1), length)
  13719. }
  13720. ;// CONCATENATED MODULE: ./node_modules/@emotion/cache/dist/emotion-cache.browser.esm.js
  13721. var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
  13722. var previous = 0;
  13723. var character = 0;
  13724. while (true) {
  13725. previous = character;
  13726. character = peek(); // &\f
  13727. if (previous === 38 && character === 12) {
  13728. points[index] = 1;
  13729. }
  13730. if (token(character)) {
  13731. break;
  13732. }
  13733. next();
  13734. }
  13735. return slice(begin, position);
  13736. };
  13737. var toRules = function toRules(parsed, points) {
  13738. // pretend we've started with a comma
  13739. var index = -1;
  13740. var character = 44;
  13741. do {
  13742. switch (token(character)) {
  13743. case 0:
  13744. // &\f
  13745. if (character === 38 && peek() === 12) {
  13746. // this is not 100% correct, we don't account for literal sequences here - like for example quoted strings
  13747. // stylis inserts \f after & to know when & where it should replace this sequence with the context selector
  13748. // and when it should just concatenate the outer and inner selectors
  13749. // it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here
  13750. points[index] = 1;
  13751. }
  13752. parsed[index] += identifierWithPointTracking(position - 1, points, index);
  13753. break;
  13754. case 2:
  13755. parsed[index] += delimit(character);
  13756. break;
  13757. case 4:
  13758. // comma
  13759. if (character === 44) {
  13760. // colon
  13761. parsed[++index] = peek() === 58 ? '&\f' : '';
  13762. points[index] = parsed[index].length;
  13763. break;
  13764. }
  13765. // fallthrough
  13766. default:
  13767. parsed[index] += Utility_from(character);
  13768. }
  13769. } while (character = next());
  13770. return parsed;
  13771. };
  13772. var getRules = function getRules(value, points) {
  13773. return dealloc(toRules(alloc(value), points));
  13774. }; // WeakSet would be more appropriate, but only WeakMap is supported in IE11
  13775. var fixedElements = /* #__PURE__ */new WeakMap();
  13776. var compat = function compat(element) {
  13777. if (element.type !== 'rule' || !element.parent || // positive .length indicates that this rule contains pseudo
  13778. // negative .length indicates that this rule has been already prefixed
  13779. element.length < 1) {
  13780. return;
  13781. }
  13782. var value = element.value,
  13783. parent = element.parent;
  13784. var isImplicitRule = element.column === parent.column && element.line === parent.line;
  13785. while (parent.type !== 'rule') {
  13786. parent = parent.parent;
  13787. if (!parent) return;
  13788. } // short-circuit for the simplest case
  13789. if (element.props.length === 1 && value.charCodeAt(0) !== 58
  13790. /* colon */
  13791. && !fixedElements.get(parent)) {
  13792. return;
  13793. } // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)
  13794. // then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent"
  13795. if (isImplicitRule) {
  13796. return;
  13797. }
  13798. fixedElements.set(element, true);
  13799. var points = [];
  13800. var rules = getRules(value, points);
  13801. var parentRules = parent.props;
  13802. for (var i = 0, k = 0; i < rules.length; i++) {
  13803. for (var j = 0; j < parentRules.length; j++, k++) {
  13804. element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i];
  13805. }
  13806. }
  13807. };
  13808. var removeLabel = function removeLabel(element) {
  13809. if (element.type === 'decl') {
  13810. var value = element.value;
  13811. if ( // charcode for l
  13812. value.charCodeAt(0) === 108 && // charcode for b
  13813. value.charCodeAt(2) === 98) {
  13814. // this ignores label
  13815. element["return"] = '';
  13816. element.value = '';
  13817. }
  13818. }
  13819. };
  13820. var ignoreFlag = 'emotion-disable-server-rendering-unsafe-selector-warning-please-do-not-use-this-the-warning-exists-for-a-reason';
  13821. var isIgnoringComment = function isIgnoringComment(element) {
  13822. return element.type === 'comm' && element.children.indexOf(ignoreFlag) > -1;
  13823. };
  13824. var createUnsafeSelectorsAlarm = function createUnsafeSelectorsAlarm(cache) {
  13825. return function (element, index, children) {
  13826. if (element.type !== 'rule' || cache.compat) return;
  13827. var unsafePseudoClasses = element.value.match(/(:first|:nth|:nth-last)-child/g);
  13828. if (unsafePseudoClasses) {
  13829. var isNested = element.parent === children[0]; // in nested rules comments become children of the "auto-inserted" rule
  13830. //
  13831. // considering this input:
  13832. // .a {
  13833. // .b /* comm */ {}
  13834. // color: hotpink;
  13835. // }
  13836. // we get output corresponding to this:
  13837. // .a {
  13838. // & {
  13839. // /* comm */
  13840. // color: hotpink;
  13841. // }
  13842. // .b {}
  13843. // }
  13844. var commentContainer = isNested ? children[0].children : // global rule at the root level
  13845. children;
  13846. for (var i = commentContainer.length - 1; i >= 0; i--) {
  13847. var node = commentContainer[i];
  13848. if (node.line < element.line) {
  13849. break;
  13850. } // it is quite weird but comments are *usually* put at `column: element.column - 1`
  13851. // so we seek *from the end* for the node that is earlier than the rule's `element` and check that
  13852. // this will also match inputs like this:
  13853. // .a {
  13854. // /* comm */
  13855. // .b {}
  13856. // }
  13857. //
  13858. // but that is fine
  13859. //
  13860. // it would be the easiest to change the placement of the comment to be the first child of the rule:
  13861. // .a {
  13862. // .b { /* comm */ }
  13863. // }
  13864. // with such inputs we wouldn't have to search for the comment at all
  13865. // TODO: consider changing this comment placement in the next major version
  13866. if (node.column < element.column) {
  13867. if (isIgnoringComment(node)) {
  13868. return;
  13869. }
  13870. break;
  13871. }
  13872. }
  13873. unsafePseudoClasses.forEach(function (unsafePseudoClass) {
  13874. console.error("The pseudo class \"" + unsafePseudoClass + "\" is potentially unsafe when doing server-side rendering. Try changing it to \"" + unsafePseudoClass.split('-child')[0] + "-of-type\".");
  13875. });
  13876. }
  13877. };
  13878. };
  13879. var isImportRule = function isImportRule(element) {
  13880. return element.type.charCodeAt(1) === 105 && element.type.charCodeAt(0) === 64;
  13881. };
  13882. var isPrependedWithRegularRules = function isPrependedWithRegularRules(index, children) {
  13883. for (var i = index - 1; i >= 0; i--) {
  13884. if (!isImportRule(children[i])) {
  13885. return true;
  13886. }
  13887. }
  13888. return false;
  13889. }; // use this to remove incorrect elements from further processing
  13890. // so they don't get handed to the `sheet` (or anything else)
  13891. // as that could potentially lead to additional logs which in turn could be overhelming to the user
  13892. var nullifyElement = function nullifyElement(element) {
  13893. element.type = '';
  13894. element.value = '';
  13895. element["return"] = '';
  13896. element.children = '';
  13897. element.props = '';
  13898. };
  13899. var incorrectImportAlarm = function incorrectImportAlarm(element, index, children) {
  13900. if (!isImportRule(element)) {
  13901. return;
  13902. }
  13903. if (element.parent) {
  13904. 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.");
  13905. nullifyElement(element);
  13906. } else if (isPrependedWithRegularRules(index, children)) {
  13907. console.error("`@import` rules can't be after other rules. Please put your `@import` rules before your other rules.");
  13908. nullifyElement(element);
  13909. }
  13910. };
  13911. /* eslint-disable no-fallthrough */
  13912. function emotion_cache_browser_esm_prefix(value, length) {
  13913. switch (hash(value, length)) {
  13914. // color-adjust
  13915. case 5103:
  13916. return Enum_WEBKIT + 'print-' + value + value;
  13917. // animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
  13918. case 5737:
  13919. case 4201:
  13920. case 3177:
  13921. case 3433:
  13922. case 1641:
  13923. case 4457:
  13924. case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
  13925. case 5572:
  13926. case 6356:
  13927. case 5844:
  13928. case 3191:
  13929. case 6645:
  13930. case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
  13931. case 6391:
  13932. case 5879:
  13933. case 5623:
  13934. case 6135:
  13935. case 4599:
  13936. case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
  13937. case 4215:
  13938. case 6389:
  13939. case 5109:
  13940. case 5365:
  13941. case 5621:
  13942. case 3829:
  13943. return Enum_WEBKIT + value + value;
  13944. // appearance, user-select, transform, hyphens, text-size-adjust
  13945. case 5349:
  13946. case 4246:
  13947. case 4810:
  13948. case 6968:
  13949. case 2756:
  13950. return Enum_WEBKIT + value + Enum_MOZ + value + Enum_MS + value + value;
  13951. // flex, flex-direction
  13952. case 6828:
  13953. case 4268:
  13954. return Enum_WEBKIT + value + Enum_MS + value + value;
  13955. // order
  13956. case 6165:
  13957. return Enum_WEBKIT + value + Enum_MS + 'flex-' + value + value;
  13958. // align-items
  13959. case 5187:
  13960. return Enum_WEBKIT + value + Utility_replace(value, /(\w+).+(:[^]+)/, Enum_WEBKIT + 'box-$1$2' + Enum_MS + 'flex-$1$2') + value;
  13961. // align-self
  13962. case 5443:
  13963. return Enum_WEBKIT + value + Enum_MS + 'flex-item-' + Utility_replace(value, /flex-|-self/, '') + value;
  13964. // align-content
  13965. case 4675:
  13966. return Enum_WEBKIT + value + Enum_MS + 'flex-line-pack' + Utility_replace(value, /align-content|flex-|-self/, '') + value;
  13967. // flex-shrink
  13968. case 5548:
  13969. return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, 'shrink', 'negative') + value;
  13970. // flex-basis
  13971. case 5292:
  13972. return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, 'basis', 'preferred-size') + value;
  13973. // flex-grow
  13974. case 6060:
  13975. return Enum_WEBKIT + 'box-' + Utility_replace(value, '-grow', '') + Enum_WEBKIT + value + Enum_MS + Utility_replace(value, 'grow', 'positive') + value;
  13976. // transition
  13977. case 4554:
  13978. return Enum_WEBKIT + Utility_replace(value, /([^-])(transform)/g, '$1' + Enum_WEBKIT + '$2') + value;
  13979. // cursor
  13980. case 6187:
  13981. return Utility_replace(Utility_replace(Utility_replace(value, /(zoom-|grab)/, Enum_WEBKIT + '$1'), /(image-set)/, Enum_WEBKIT + '$1'), value, '') + value;
  13982. // background, background-image
  13983. case 5495:
  13984. case 3959:
  13985. return Utility_replace(value, /(image-set\([^]*)/, Enum_WEBKIT + '$1' + '$`$1');
  13986. // justify-content
  13987. case 4968:
  13988. return Utility_replace(Utility_replace(value, /(.+:)(flex-)?(.*)/, Enum_WEBKIT + 'box-pack:$3' + Enum_MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + Enum_WEBKIT + value + value;
  13989. // (margin|padding)-inline-(start|end)
  13990. case 4095:
  13991. case 3583:
  13992. case 4068:
  13993. case 2532:
  13994. return Utility_replace(value, /(.+)-inline(.+)/, Enum_WEBKIT + '$1$2') + value;
  13995. // (min|max)?(width|height|inline-size|block-size)
  13996. case 8116:
  13997. case 7059:
  13998. case 5753:
  13999. case 5535:
  14000. case 5445:
  14001. case 5701:
  14002. case 4933:
  14003. case 4677:
  14004. case 5533:
  14005. case 5789:
  14006. case 5021:
  14007. case 4765:
  14008. // stretch, max-content, min-content, fill-available
  14009. if (Utility_strlen(value) - 1 - length > 6) switch (Utility_charat(value, length + 1)) {
  14010. // (m)ax-content, (m)in-content
  14011. case 109:
  14012. // -
  14013. if (Utility_charat(value, length + 4) !== 45) break;
  14014. // (f)ill-available, (f)it-content
  14015. case 102:
  14016. return Utility_replace(value, /(.+:)(.+)-([^]+)/, '$1' + Enum_WEBKIT + '$2-$3' + '$1' + Enum_MOZ + (Utility_charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value;
  14017. // (s)tretch
  14018. case 115:
  14019. return ~indexof(value, 'stretch') ? emotion_cache_browser_esm_prefix(Utility_replace(value, 'stretch', 'fill-available'), length) + value : value;
  14020. }
  14021. break;
  14022. // position: sticky
  14023. case 4949:
  14024. // (s)ticky?
  14025. if (Utility_charat(value, length + 1) !== 115) break;
  14026. // display: (flex|inline-flex)
  14027. case 6444:
  14028. switch (Utility_charat(value, Utility_strlen(value) - 3 - (~indexof(value, '!important') && 10))) {
  14029. // stic(k)y
  14030. case 107:
  14031. return Utility_replace(value, ':', ':' + Enum_WEBKIT) + value;
  14032. // (inline-)?fl(e)x
  14033. case 101:
  14034. return Utility_replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + Enum_WEBKIT + (Utility_charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + Enum_WEBKIT + '$2$3' + '$1' + Enum_MS + '$2box$3') + value;
  14035. }
  14036. break;
  14037. // writing-mode
  14038. case 5936:
  14039. switch (Utility_charat(value, length + 11)) {
  14040. // vertical-l(r)
  14041. case 114:
  14042. return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value;
  14043. // vertical-r(l)
  14044. case 108:
  14045. return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value;
  14046. // horizontal(-)tb
  14047. case 45:
  14048. return Enum_WEBKIT + value + Enum_MS + Utility_replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value;
  14049. }
  14050. return Enum_WEBKIT + value + Enum_MS + value + value;
  14051. }
  14052. return value;
  14053. }
  14054. var emotion_cache_browser_esm_prefixer = function prefixer(element, index, children, callback) {
  14055. if (element.length > -1) if (!element["return"]) switch (element.type) {
  14056. case Enum_DECLARATION:
  14057. element["return"] = emotion_cache_browser_esm_prefix(element.value, element.length);
  14058. break;
  14059. case Enum_KEYFRAMES:
  14060. return Serializer_serialize([Tokenizer_copy(element, {
  14061. value: Utility_replace(element.value, '@', '@' + Enum_WEBKIT)
  14062. })], callback);
  14063. case Enum_RULESET:
  14064. if (element.length) return Utility_combine(element.props, function (value) {
  14065. switch (Utility_match(value, /(::plac\w+|:read-\w+)/)) {
  14066. // :read-(only|write)
  14067. case ':read-only':
  14068. case ':read-write':
  14069. return Serializer_serialize([Tokenizer_copy(element, {
  14070. props: [Utility_replace(value, /:(read-\w+)/, ':' + Enum_MOZ + '$1')]
  14071. })], callback);
  14072. // :placeholder
  14073. case '::placeholder':
  14074. return Serializer_serialize([Tokenizer_copy(element, {
  14075. props: [Utility_replace(value, /:(plac\w+)/, ':' + Enum_WEBKIT + 'input-$1')]
  14076. }), Tokenizer_copy(element, {
  14077. props: [Utility_replace(value, /:(plac\w+)/, ':' + Enum_MOZ + '$1')]
  14078. }), Tokenizer_copy(element, {
  14079. props: [Utility_replace(value, /:(plac\w+)/, Enum_MS + 'input-$1')]
  14080. })], callback);
  14081. }
  14082. return '';
  14083. });
  14084. }
  14085. };
  14086. var defaultStylisPlugins = [emotion_cache_browser_esm_prefixer];
  14087. var createCache = function createCache(options) {
  14088. var key = options.key;
  14089. if (false) {}
  14090. if ( key === 'css') {
  14091. var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration
  14092. // document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)
  14093. // note this very very intentionally targets all style elements regardless of the key to ensure
  14094. // that creating a cache works inside of render of a React component
  14095. Array.prototype.forEach.call(ssrStyles, function (node) {
  14096. // we want to only move elements which have a space in the data-emotion attribute value
  14097. // because that indicates that it is an Emotion 11 server-side rendered style elements
  14098. // while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector
  14099. // Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes)
  14100. // so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles
  14101. // will not result in the Emotion 10 styles being destroyed
  14102. var dataEmotionAttribute = node.getAttribute('data-emotion');
  14103. if (dataEmotionAttribute.indexOf(' ') === -1) {
  14104. return;
  14105. }
  14106. document.head.appendChild(node);
  14107. node.setAttribute('data-s', '');
  14108. });
  14109. }
  14110. var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
  14111. if (false) {}
  14112. var inserted = {};
  14113. var container;
  14114. var nodesToHydrate = [];
  14115. {
  14116. container = options.container || document.head;
  14117. Array.prototype.forEach.call( // this means we will ignore elements which don't have a space in them which
  14118. // means that the style elements we're looking at are only Emotion 11 server-rendered style elements
  14119. document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) {
  14120. var attrib = node.getAttribute("data-emotion").split(' '); // $FlowFixMe
  14121. for (var i = 1; i < attrib.length; i++) {
  14122. inserted[attrib[i]] = true;
  14123. }
  14124. nodesToHydrate.push(node);
  14125. });
  14126. }
  14127. var _insert;
  14128. var omnipresentPlugins = [compat, removeLabel];
  14129. if (false) {}
  14130. {
  14131. var currentSheet;
  14132. var finalizingPlugins = [stringify, false ? 0 : rulesheet(function (rule) {
  14133. currentSheet.insert(rule);
  14134. })];
  14135. var serializer = middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
  14136. var stylis = function stylis(styles) {
  14137. return Serializer_serialize(compile(styles), serializer);
  14138. };
  14139. _insert = function insert(selector, serialized, sheet, shouldCache) {
  14140. currentSheet = sheet;
  14141. if (false) {}
  14142. stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
  14143. if (shouldCache) {
  14144. cache.inserted[serialized.name] = true;
  14145. }
  14146. };
  14147. }
  14148. var cache = {
  14149. key: key,
  14150. sheet: new StyleSheet({
  14151. key: key,
  14152. container: container,
  14153. nonce: options.nonce,
  14154. speedy: options.speedy,
  14155. prepend: options.prepend,
  14156. insertionPoint: options.insertionPoint
  14157. }),
  14158. nonce: options.nonce,
  14159. inserted: inserted,
  14160. registered: {},
  14161. insert: _insert
  14162. };
  14163. cache.sheet.hydrate(nodesToHydrate);
  14164. return cache;
  14165. };
  14166. /* harmony default export */ var emotion_cache_browser_esm = (createCache);
  14167. ;// CONCATENATED MODULE: ./node_modules/@emotion/hash/dist/emotion-hash.esm.js
  14168. /* eslint-disable */
  14169. // Inspired by https://github.com/garycourt/murmurhash-js
  14170. // Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86
  14171. function murmur2(str) {
  14172. // 'm' and 'r' are mixing constants generated offline.
  14173. // They're not really 'magic', they just happen to work well.
  14174. // const m = 0x5bd1e995;
  14175. // const r = 24;
  14176. // Initialize the hash
  14177. var h = 0; // Mix 4 bytes at a time into the hash
  14178. var k,
  14179. i = 0,
  14180. len = str.length;
  14181. for (; len >= 4; ++i, len -= 4) {
  14182. k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;
  14183. k =
  14184. /* Math.imul(k, m): */
  14185. (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16);
  14186. k ^=
  14187. /* k >>> r: */
  14188. k >>> 24;
  14189. h =
  14190. /* Math.imul(k, m): */
  14191. (k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^
  14192. /* Math.imul(h, m): */
  14193. (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
  14194. } // Handle the last few bytes of the input array
  14195. switch (len) {
  14196. case 3:
  14197. h ^= (str.charCodeAt(i + 2) & 0xff) << 16;
  14198. case 2:
  14199. h ^= (str.charCodeAt(i + 1) & 0xff) << 8;
  14200. case 1:
  14201. h ^= str.charCodeAt(i) & 0xff;
  14202. h =
  14203. /* Math.imul(h, m): */
  14204. (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
  14205. } // Do a few final mixes of the hash to ensure the last few
  14206. // bytes are well-incorporated.
  14207. h ^= h >>> 13;
  14208. h =
  14209. /* Math.imul(h, m): */
  14210. (h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
  14211. return ((h ^ h >>> 15) >>> 0).toString(36);
  14212. }
  14213. /* harmony default export */ var emotion_hash_esm = (murmur2);
  14214. ;// CONCATENATED MODULE: ./node_modules/@emotion/unitless/dist/emotion-unitless.esm.js
  14215. var unitlessKeys = {
  14216. animationIterationCount: 1,
  14217. borderImageOutset: 1,
  14218. borderImageSlice: 1,
  14219. borderImageWidth: 1,
  14220. boxFlex: 1,
  14221. boxFlexGroup: 1,
  14222. boxOrdinalGroup: 1,
  14223. columnCount: 1,
  14224. columns: 1,
  14225. flex: 1,
  14226. flexGrow: 1,
  14227. flexPositive: 1,
  14228. flexShrink: 1,
  14229. flexNegative: 1,
  14230. flexOrder: 1,
  14231. gridRow: 1,
  14232. gridRowEnd: 1,
  14233. gridRowSpan: 1,
  14234. gridRowStart: 1,
  14235. gridColumn: 1,
  14236. gridColumnEnd: 1,
  14237. gridColumnSpan: 1,
  14238. gridColumnStart: 1,
  14239. msGridRow: 1,
  14240. msGridRowSpan: 1,
  14241. msGridColumn: 1,
  14242. msGridColumnSpan: 1,
  14243. fontWeight: 1,
  14244. lineHeight: 1,
  14245. opacity: 1,
  14246. order: 1,
  14247. orphans: 1,
  14248. tabSize: 1,
  14249. widows: 1,
  14250. zIndex: 1,
  14251. zoom: 1,
  14252. WebkitLineClamp: 1,
  14253. // SVG-related properties
  14254. fillOpacity: 1,
  14255. floodOpacity: 1,
  14256. stopOpacity: 1,
  14257. strokeDasharray: 1,
  14258. strokeDashoffset: 1,
  14259. strokeMiterlimit: 1,
  14260. strokeOpacity: 1,
  14261. strokeWidth: 1
  14262. };
  14263. /* harmony default export */ var emotion_unitless_esm = (unitlessKeys);
  14264. ;// CONCATENATED MODULE: ./node_modules/@emotion/memoize/dist/emotion-memoize.esm.js
  14265. function memoize(fn) {
  14266. var cache = Object.create(null);
  14267. return function (arg) {
  14268. if (cache[arg] === undefined) cache[arg] = fn(arg);
  14269. return cache[arg];
  14270. };
  14271. }
  14272. /* harmony default export */ var emotion_memoize_esm = (memoize);
  14273. ;// CONCATENATED MODULE: ./node_modules/@emotion/serialize/dist/emotion-serialize.browser.esm.js
  14274. 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";
  14275. 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).";
  14276. var hyphenateRegex = /[A-Z]|^ms/g;
  14277. var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g;
  14278. var isCustomProperty = function isCustomProperty(property) {
  14279. return property.charCodeAt(1) === 45;
  14280. };
  14281. var isProcessableValue = function isProcessableValue(value) {
  14282. return value != null && typeof value !== 'boolean';
  14283. };
  14284. var processStyleName = /* #__PURE__ */emotion_memoize_esm(function (styleName) {
  14285. return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase();
  14286. });
  14287. var processStyleValue = function processStyleValue(key, value) {
  14288. switch (key) {
  14289. case 'animation':
  14290. case 'animationName':
  14291. {
  14292. if (typeof value === 'string') {
  14293. return value.replace(animationRegex, function (match, p1, p2) {
  14294. cursor = {
  14295. name: p1,
  14296. styles: p2,
  14297. next: cursor
  14298. };
  14299. return p1;
  14300. });
  14301. }
  14302. }
  14303. }
  14304. if (emotion_unitless_esm[key] !== 1 && !isCustomProperty(key) && typeof value === 'number' && value !== 0) {
  14305. return value + 'px';
  14306. }
  14307. return value;
  14308. };
  14309. if (false) { var hyphenatedCache, hyphenPattern, msPattern, oldProcessStyleValue, contentValues, contentValuePattern; }
  14310. var noComponentSelectorMessage = (/* unused pure expression or super */ null && ('Component selectors can only be used in conjunction with ' + '@emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware ' + 'compiler transform.'));
  14311. function handleInterpolation(mergedProps, registered, interpolation) {
  14312. if (interpolation == null) {
  14313. return '';
  14314. }
  14315. if (interpolation.__emotion_styles !== undefined) {
  14316. if (false) {}
  14317. return interpolation;
  14318. }
  14319. switch (typeof interpolation) {
  14320. case 'boolean':
  14321. {
  14322. return '';
  14323. }
  14324. case 'object':
  14325. {
  14326. if (interpolation.anim === 1) {
  14327. cursor = {
  14328. name: interpolation.name,
  14329. styles: interpolation.styles,
  14330. next: cursor
  14331. };
  14332. return interpolation.name;
  14333. }
  14334. if (interpolation.styles !== undefined) {
  14335. var next = interpolation.next;
  14336. if (next !== undefined) {
  14337. // not the most efficient thing ever but this is a pretty rare case
  14338. // and there will be very few iterations of this generally
  14339. while (next !== undefined) {
  14340. cursor = {
  14341. name: next.name,
  14342. styles: next.styles,
  14343. next: cursor
  14344. };
  14345. next = next.next;
  14346. }
  14347. }
  14348. var styles = interpolation.styles + ";";
  14349. if (false) {}
  14350. return styles;
  14351. }
  14352. return createStringFromObject(mergedProps, registered, interpolation);
  14353. }
  14354. case 'function':
  14355. {
  14356. if (mergedProps !== undefined) {
  14357. var previousCursor = cursor;
  14358. var result = interpolation(mergedProps);
  14359. cursor = previousCursor;
  14360. return handleInterpolation(mergedProps, registered, result);
  14361. } else if (false) {}
  14362. break;
  14363. }
  14364. case 'string':
  14365. if (false) { var replaced, matched; }
  14366. break;
  14367. } // finalize string values (regular strings and functions interpolated into css calls)
  14368. if (registered == null) {
  14369. return interpolation;
  14370. }
  14371. var cached = registered[interpolation];
  14372. return cached !== undefined ? cached : interpolation;
  14373. }
  14374. function createStringFromObject(mergedProps, registered, obj) {
  14375. var string = '';
  14376. if (Array.isArray(obj)) {
  14377. for (var i = 0; i < obj.length; i++) {
  14378. string += handleInterpolation(mergedProps, registered, obj[i]) + ";";
  14379. }
  14380. } else {
  14381. for (var _key in obj) {
  14382. var value = obj[_key];
  14383. if (typeof value !== 'object') {
  14384. if (registered != null && registered[value] !== undefined) {
  14385. string += _key + "{" + registered[value] + "}";
  14386. } else if (isProcessableValue(value)) {
  14387. string += processStyleName(_key) + ":" + processStyleValue(_key, value) + ";";
  14388. }
  14389. } else {
  14390. if (_key === 'NO_COMPONENT_SELECTOR' && "production" !== 'production') {}
  14391. if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) {
  14392. for (var _i = 0; _i < value.length; _i++) {
  14393. if (isProcessableValue(value[_i])) {
  14394. string += processStyleName(_key) + ":" + processStyleValue(_key, value[_i]) + ";";
  14395. }
  14396. }
  14397. } else {
  14398. var interpolated = handleInterpolation(mergedProps, registered, value);
  14399. switch (_key) {
  14400. case 'animation':
  14401. case 'animationName':
  14402. {
  14403. string += processStyleName(_key) + ":" + interpolated + ";";
  14404. break;
  14405. }
  14406. default:
  14407. {
  14408. if (false) {}
  14409. string += _key + "{" + interpolated + "}";
  14410. }
  14411. }
  14412. }
  14413. }
  14414. }
  14415. }
  14416. return string;
  14417. }
  14418. var labelPattern = /label:\s*([^\s;\n{]+)\s*(;|$)/g;
  14419. var sourceMapPattern;
  14420. if (false) {} // this is the cursor for keyframes
  14421. // keyframes are stored on the SerializedStyles object as a linked list
  14422. var cursor;
  14423. var emotion_serialize_browser_esm_serializeStyles = function serializeStyles(args, registered, mergedProps) {
  14424. if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) {
  14425. return args[0];
  14426. }
  14427. var stringMode = true;
  14428. var styles = '';
  14429. cursor = undefined;
  14430. var strings = args[0];
  14431. if (strings == null || strings.raw === undefined) {
  14432. stringMode = false;
  14433. styles += handleInterpolation(mergedProps, registered, strings);
  14434. } else {
  14435. if (false) {}
  14436. styles += strings[0];
  14437. } // we start at 1 since we've already handled the first arg
  14438. for (var i = 1; i < args.length; i++) {
  14439. styles += handleInterpolation(mergedProps, registered, args[i]);
  14440. if (stringMode) {
  14441. if (false) {}
  14442. styles += strings[i];
  14443. }
  14444. }
  14445. var sourceMap;
  14446. if (false) {} // using a global regex with .exec is stateful so lastIndex has to be reset each time
  14447. labelPattern.lastIndex = 0;
  14448. var identifierName = '';
  14449. var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5
  14450. while ((match = labelPattern.exec(styles)) !== null) {
  14451. identifierName += '-' + // $FlowFixMe we know it's not null
  14452. match[1];
  14453. }
  14454. var name = emotion_hash_esm(styles) + identifierName;
  14455. if (false) {}
  14456. return {
  14457. name: name,
  14458. styles: styles,
  14459. next: cursor
  14460. };
  14461. };
  14462. ;// CONCATENATED MODULE: ./node_modules/@emotion/use-insertion-effect-with-fallbacks/dist/emotion-use-insertion-effect-with-fallbacks.browser.esm.js
  14463. var syncFallback = function syncFallback(create) {
  14464. return create();
  14465. };
  14466. var useInsertionEffect = external_React_namespaceObject['useInsertion' + 'Effect'] ? external_React_namespaceObject['useInsertion' + 'Effect'] : false;
  14467. var emotion_use_insertion_effect_with_fallbacks_browser_esm_useInsertionEffectAlwaysWithSyncFallback = useInsertionEffect || syncFallback;
  14468. var emotion_use_insertion_effect_with_fallbacks_browser_esm_useInsertionEffectWithLayoutFallback = useInsertionEffect || external_React_namespaceObject.useLayoutEffect;
  14469. ;// CONCATENATED MODULE: ./node_modules/@emotion/react/dist/emotion-element-6a883da9.browser.esm.js
  14470. var emotion_element_6a883da9_browser_esm_hasOwnProperty = {}.hasOwnProperty;
  14471. var EmotionCacheContext = /* #__PURE__ */(0,external_React_namespaceObject.createContext)( // we're doing this to avoid preconstruct's dead code elimination in this one case
  14472. // because this module is primarily intended for the browser and node
  14473. // but it's also required in react native and similar environments sometimes
  14474. // and we could have a special build just for that
  14475. // but this is much easier and the native packages
  14476. // might use a different theme context in the future anyway
  14477. typeof HTMLElement !== 'undefined' ? /* #__PURE__ */emotion_cache_browser_esm({
  14478. key: 'css'
  14479. }) : null);
  14480. if (false) {}
  14481. var CacheProvider = EmotionCacheContext.Provider;
  14482. var __unsafe_useEmotionCache = function useEmotionCache() {
  14483. return (0,external_React_namespaceObject.useContext)(EmotionCacheContext);
  14484. };
  14485. var emotion_element_6a883da9_browser_esm_withEmotionCache = function withEmotionCache(func) {
  14486. // $FlowFixMe
  14487. return /*#__PURE__*/(0,external_React_namespaceObject.forwardRef)(function (props, ref) {
  14488. // the cache will never be null in the browser
  14489. var cache = (0,external_React_namespaceObject.useContext)(EmotionCacheContext);
  14490. return func(props, cache, ref);
  14491. });
  14492. };
  14493. var emotion_element_6a883da9_browser_esm_ThemeContext = /* #__PURE__ */(0,external_React_namespaceObject.createContext)({});
  14494. if (false) {}
  14495. var useTheme = function useTheme() {
  14496. return useContext(emotion_element_6a883da9_browser_esm_ThemeContext);
  14497. };
  14498. var getTheme = function getTheme(outerTheme, theme) {
  14499. if (typeof theme === 'function') {
  14500. var mergedTheme = theme(outerTheme);
  14501. if (false) {}
  14502. return mergedTheme;
  14503. }
  14504. if (false) {}
  14505. return _extends({}, outerTheme, theme);
  14506. };
  14507. var createCacheWithTheme = /* #__PURE__ */(/* unused pure expression or super */ null && (weakMemoize(function (outerTheme) {
  14508. return weakMemoize(function (theme) {
  14509. return getTheme(outerTheme, theme);
  14510. });
  14511. })));
  14512. var ThemeProvider = function ThemeProvider(props) {
  14513. var theme = useContext(emotion_element_6a883da9_browser_esm_ThemeContext);
  14514. if (props.theme !== theme) {
  14515. theme = createCacheWithTheme(theme)(props.theme);
  14516. }
  14517. return /*#__PURE__*/createElement(emotion_element_6a883da9_browser_esm_ThemeContext.Provider, {
  14518. value: theme
  14519. }, props.children);
  14520. };
  14521. function withTheme(Component) {
  14522. var componentName = Component.displayName || Component.name || 'Component';
  14523. var render = function render(props, ref) {
  14524. var theme = useContext(emotion_element_6a883da9_browser_esm_ThemeContext);
  14525. return /*#__PURE__*/createElement(Component, _extends({
  14526. theme: theme,
  14527. ref: ref
  14528. }, props));
  14529. }; // $FlowFixMe
  14530. var WithTheme = /*#__PURE__*/forwardRef(render);
  14531. WithTheme.displayName = "WithTheme(" + componentName + ")";
  14532. return hoistNonReactStatics(WithTheme, Component);
  14533. }
  14534. var getLastPart = function getLastPart(functionName) {
  14535. // The match may be something like 'Object.createEmotionProps' or
  14536. // 'Loader.prototype.render'
  14537. var parts = functionName.split('.');
  14538. return parts[parts.length - 1];
  14539. };
  14540. var getFunctionNameFromStackTraceLine = function getFunctionNameFromStackTraceLine(line) {
  14541. // V8
  14542. var match = /^\s+at\s+([A-Za-z0-9$.]+)\s/.exec(line);
  14543. if (match) return getLastPart(match[1]); // Safari / Firefox
  14544. match = /^([A-Za-z0-9$.]+)@/.exec(line);
  14545. if (match) return getLastPart(match[1]);
  14546. return undefined;
  14547. };
  14548. var internalReactFunctionNames = /* #__PURE__ */new Set(['renderWithHooks', 'processChild', 'finishClassComponent', 'renderToString']); // These identifiers come from error stacks, so they have to be valid JS
  14549. // identifiers, thus we only need to replace what is a valid character for JS,
  14550. // but not for CSS.
  14551. var sanitizeIdentifier = function sanitizeIdentifier(identifier) {
  14552. return identifier.replace(/\$/g, '-');
  14553. };
  14554. var getLabelFromStackTrace = function getLabelFromStackTrace(stackTrace) {
  14555. if (!stackTrace) return undefined;
  14556. var lines = stackTrace.split('\n');
  14557. for (var i = 0; i < lines.length; i++) {
  14558. var functionName = getFunctionNameFromStackTraceLine(lines[i]); // The first line of V8 stack traces is just "Error"
  14559. if (!functionName) continue; // If we reach one of these, we have gone too far and should quit
  14560. if (internalReactFunctionNames.has(functionName)) break; // The component name is the first function in the stack that starts with an
  14561. // uppercase letter
  14562. if (/^[A-Z]/.test(functionName)) return sanitizeIdentifier(functionName);
  14563. }
  14564. return undefined;
  14565. };
  14566. var typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__';
  14567. var labelPropName = '__EMOTION_LABEL_PLEASE_DO_NOT_USE__';
  14568. var emotion_element_6a883da9_browser_esm_createEmotionProps = function createEmotionProps(type, props) {
  14569. if (false) {}
  14570. var newProps = {};
  14571. for (var key in props) {
  14572. if (emotion_element_6a883da9_browser_esm_hasOwnProperty.call(props, key)) {
  14573. newProps[key] = props[key];
  14574. }
  14575. }
  14576. newProps[typePropName] = type; // For performance, only call getLabelFromStackTrace in development and when
  14577. // the label hasn't already been computed
  14578. if (false) { var label; }
  14579. return newProps;
  14580. };
  14581. var Insertion = function Insertion(_ref) {
  14582. var cache = _ref.cache,
  14583. serialized = _ref.serialized,
  14584. isStringTag = _ref.isStringTag;
  14585. registerStyles(cache, serialized, isStringTag);
  14586. var rules = useInsertionEffectAlwaysWithSyncFallback(function () {
  14587. return insertStyles(cache, serialized, isStringTag);
  14588. });
  14589. return null;
  14590. };
  14591. var emotion_element_6a883da9_browser_esm_Emotion = /* #__PURE__ */(/* unused pure expression or super */ null && (emotion_element_6a883da9_browser_esm_withEmotionCache(function (props, cache, ref) {
  14592. var cssProp = props.css; // so that using `css` from `emotion` and passing the result to the css prop works
  14593. // not passing the registered cache to serializeStyles because it would
  14594. // make certain babel optimisations not possible
  14595. if (typeof cssProp === 'string' && cache.registered[cssProp] !== undefined) {
  14596. cssProp = cache.registered[cssProp];
  14597. }
  14598. var WrappedComponent = props[typePropName];
  14599. var registeredStyles = [cssProp];
  14600. var className = '';
  14601. if (typeof props.className === 'string') {
  14602. className = getRegisteredStyles(cache.registered, registeredStyles, props.className);
  14603. } else if (props.className != null) {
  14604. className = props.className + " ";
  14605. }
  14606. var serialized = serializeStyles(registeredStyles, undefined, useContext(emotion_element_6a883da9_browser_esm_ThemeContext));
  14607. if (false) { var labelFromStack; }
  14608. className += cache.key + "-" + serialized.name;
  14609. var newProps = {};
  14610. for (var key in props) {
  14611. if (emotion_element_6a883da9_browser_esm_hasOwnProperty.call(props, key) && key !== 'css' && key !== typePropName && ( true || 0)) {
  14612. newProps[key] = props[key];
  14613. }
  14614. }
  14615. newProps.ref = ref;
  14616. newProps.className = className;
  14617. return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(Insertion, {
  14618. cache: cache,
  14619. serialized: serialized,
  14620. isStringTag: typeof WrappedComponent === 'string'
  14621. }), /*#__PURE__*/createElement(WrappedComponent, newProps));
  14622. })));
  14623. if (false) {}
  14624. ;// CONCATENATED MODULE: ./node_modules/@emotion/utils/dist/emotion-utils.browser.esm.js
  14625. var emotion_utils_browser_esm_isBrowser = "object" !== 'undefined';
  14626. function emotion_utils_browser_esm_getRegisteredStyles(registered, registeredStyles, classNames) {
  14627. var rawClassName = '';
  14628. classNames.split(' ').forEach(function (className) {
  14629. if (registered[className] !== undefined) {
  14630. registeredStyles.push(registered[className] + ";");
  14631. } else {
  14632. rawClassName += className + " ";
  14633. }
  14634. });
  14635. return rawClassName;
  14636. }
  14637. var emotion_utils_browser_esm_registerStyles = function registerStyles(cache, serialized, isStringTag) {
  14638. var className = cache.key + "-" + serialized.name;
  14639. if ( // we only need to add the styles to the registered cache if the
  14640. // class name could be used further down
  14641. // the tree but if it's a string tag, we know it won't
  14642. // so we don't have to add it to registered cache.
  14643. // this improves memory usage since we can avoid storing the whole style string
  14644. (isStringTag === false || // we need to always store it if we're in compat mode and
  14645. // in node since emotion-server relies on whether a style is in
  14646. // the registered cache to know whether a style is global or not
  14647. // also, note that this check will be dead code eliminated in the browser
  14648. emotion_utils_browser_esm_isBrowser === false ) && cache.registered[className] === undefined) {
  14649. cache.registered[className] = serialized.styles;
  14650. }
  14651. };
  14652. var emotion_utils_browser_esm_insertStyles = function insertStyles(cache, serialized, isStringTag) {
  14653. emotion_utils_browser_esm_registerStyles(cache, serialized, isStringTag);
  14654. var className = cache.key + "-" + serialized.name;
  14655. if (cache.inserted[serialized.name] === undefined) {
  14656. var current = serialized;
  14657. do {
  14658. var maybeStyles = cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true);
  14659. current = current.next;
  14660. } while (current !== undefined);
  14661. }
  14662. };
  14663. ;// CONCATENATED MODULE: ./node_modules/@emotion/css/create-instance/dist/emotion-css-create-instance.esm.js
  14664. function insertWithoutScoping(cache, serialized) {
  14665. if (cache.inserted[serialized.name] === undefined) {
  14666. return cache.insert('', serialized, cache.sheet, true);
  14667. }
  14668. }
  14669. function merge(registered, css, className) {
  14670. var registeredStyles = [];
  14671. var rawClassName = emotion_utils_browser_esm_getRegisteredStyles(registered, registeredStyles, className);
  14672. if (registeredStyles.length < 2) {
  14673. return className;
  14674. }
  14675. return rawClassName + css(registeredStyles);
  14676. }
  14677. var createEmotion = function createEmotion(options) {
  14678. var cache = emotion_cache_browser_esm(options); // $FlowFixMe
  14679. cache.sheet.speedy = function (value) {
  14680. if (false) {}
  14681. this.isSpeedy = value;
  14682. };
  14683. cache.compat = true;
  14684. var css = function css() {
  14685. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  14686. args[_key] = arguments[_key];
  14687. }
  14688. var serialized = emotion_serialize_browser_esm_serializeStyles(args, cache.registered, undefined);
  14689. emotion_utils_browser_esm_insertStyles(cache, serialized, false);
  14690. return cache.key + "-" + serialized.name;
  14691. };
  14692. var keyframes = function keyframes() {
  14693. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  14694. args[_key2] = arguments[_key2];
  14695. }
  14696. var serialized = emotion_serialize_browser_esm_serializeStyles(args, cache.registered);
  14697. var animation = "animation-" + serialized.name;
  14698. insertWithoutScoping(cache, {
  14699. name: serialized.name,
  14700. styles: "@keyframes " + animation + "{" + serialized.styles + "}"
  14701. });
  14702. return animation;
  14703. };
  14704. var injectGlobal = function injectGlobal() {
  14705. for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  14706. args[_key3] = arguments[_key3];
  14707. }
  14708. var serialized = emotion_serialize_browser_esm_serializeStyles(args, cache.registered);
  14709. insertWithoutScoping(cache, serialized);
  14710. };
  14711. var cx = function cx() {
  14712. for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  14713. args[_key4] = arguments[_key4];
  14714. }
  14715. return merge(cache.registered, css, emotion_css_create_instance_esm_classnames(args));
  14716. };
  14717. return {
  14718. css: css,
  14719. cx: cx,
  14720. injectGlobal: injectGlobal,
  14721. keyframes: keyframes,
  14722. hydrate: function hydrate(ids) {
  14723. ids.forEach(function (key) {
  14724. cache.inserted[key] = true;
  14725. });
  14726. },
  14727. flush: function flush() {
  14728. cache.registered = {};
  14729. cache.inserted = {};
  14730. cache.sheet.flush();
  14731. },
  14732. // $FlowFixMe
  14733. sheet: cache.sheet,
  14734. cache: cache,
  14735. getRegisteredStyles: emotion_utils_browser_esm_getRegisteredStyles.bind(null, cache.registered),
  14736. merge: merge.bind(null, cache.registered, css)
  14737. };
  14738. };
  14739. var emotion_css_create_instance_esm_classnames = function classnames(args) {
  14740. var cls = '';
  14741. for (var i = 0; i < args.length; i++) {
  14742. var arg = args[i];
  14743. if (arg == null) continue;
  14744. var toAdd = void 0;
  14745. switch (typeof arg) {
  14746. case 'boolean':
  14747. break;
  14748. case 'object':
  14749. {
  14750. if (Array.isArray(arg)) {
  14751. toAdd = classnames(arg);
  14752. } else {
  14753. toAdd = '';
  14754. for (var k in arg) {
  14755. if (arg[k] && k) {
  14756. toAdd && (toAdd += ' ');
  14757. toAdd += k;
  14758. }
  14759. }
  14760. }
  14761. break;
  14762. }
  14763. default:
  14764. {
  14765. toAdd = arg;
  14766. }
  14767. }
  14768. if (toAdd) {
  14769. cls && (cls += ' ');
  14770. cls += toAdd;
  14771. }
  14772. }
  14773. return cls;
  14774. };
  14775. /* harmony default export */ var emotion_css_create_instance_esm = (createEmotion);
  14776. ;// CONCATENATED MODULE: ./node_modules/@emotion/css/dist/emotion-css.esm.js
  14777. var _createEmotion = emotion_css_create_instance_esm({
  14778. key: 'css'
  14779. }),
  14780. flush = _createEmotion.flush,
  14781. hydrate = _createEmotion.hydrate,
  14782. emotion_css_esm_cx = _createEmotion.cx,
  14783. emotion_css_esm_merge = _createEmotion.merge,
  14784. emotion_css_esm_getRegisteredStyles = _createEmotion.getRegisteredStyles,
  14785. injectGlobal = _createEmotion.injectGlobal,
  14786. emotion_css_esm_keyframes = _createEmotion.keyframes,
  14787. css = _createEmotion.css,
  14788. sheet = _createEmotion.sheet,
  14789. cache = _createEmotion.cache;
  14790. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/hooks/use-cx.js
  14791. /**
  14792. * External dependencies
  14793. */
  14794. // eslint-disable-next-line no-restricted-imports
  14795. /**
  14796. * WordPress dependencies
  14797. */
  14798. const isSerializedStyles = o => typeof o !== 'undefined' && o !== null && ['name', 'styles'].every(p => typeof o[p] !== 'undefined');
  14799. /**
  14800. * Retrieve a `cx` function that knows how to handle `SerializedStyles`
  14801. * returned by the `@emotion/react` `css` function in addition to what
  14802. * `cx` normally knows how to handle. It also hooks into the Emotion
  14803. * Cache, allowing `css` calls to work inside iframes.
  14804. *
  14805. * @example
  14806. * import { css } from '@emotion/react';
  14807. *
  14808. * const styles = css`
  14809. * color: red
  14810. * `;
  14811. *
  14812. * function RedText( { className, ...props } ) {
  14813. * const cx = useCx();
  14814. *
  14815. * const classes = cx(styles, className);
  14816. *
  14817. * return <span className={classes} {...props} />;
  14818. * }
  14819. */
  14820. const useCx = () => {
  14821. const cache = __unsafe_useEmotionCache();
  14822. const cx = (0,external_wp_element_namespaceObject.useCallback)(function () {
  14823. if (cache === null) {
  14824. throw new Error('The `useCx` hook should be only used within a valid Emotion Cache Context');
  14825. }
  14826. for (var _len = arguments.length, classNames = new Array(_len), _key = 0; _key < _len; _key++) {
  14827. classNames[_key] = arguments[_key];
  14828. }
  14829. return emotion_css_esm_cx(...classNames.map(arg => {
  14830. if (isSerializedStyles(arg)) {
  14831. emotion_utils_browser_esm_insertStyles(cache, arg, false);
  14832. return `${cache.key}-${arg.name}`;
  14833. }
  14834. return arg;
  14835. }));
  14836. }, [cache]);
  14837. return cx;
  14838. };
  14839. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/context/use-context-system.js
  14840. /**
  14841. * WordPress dependencies
  14842. */
  14843. /**
  14844. * Internal dependencies
  14845. */
  14846. /**
  14847. * @template TProps
  14848. * @typedef {TProps & { className: string }} ConnectedProps
  14849. */
  14850. /**
  14851. * Custom hook that derives registered props from the Context system.
  14852. * These derived props are then consolidated with incoming component props.
  14853. *
  14854. * @template {{ className?: string }} P
  14855. * @param {P} props Incoming props from the component.
  14856. * @param {string} namespace The namespace to register and to derive context props from.
  14857. * @return {ConnectedProps<P>} The connected props.
  14858. */
  14859. function useContextSystem(props, namespace) {
  14860. const contextSystemProps = useComponentsContext();
  14861. if (typeof namespace === 'undefined') {
  14862. typeof process !== "undefined" && process.env && "production" !== "production" ? 0 : void 0;
  14863. }
  14864. const contextProps = (contextSystemProps === null || contextSystemProps === void 0 ? void 0 : contextSystemProps[namespace]) || {};
  14865. /* eslint-disable jsdoc/no-undefined-types */
  14866. /** @type {ConnectedProps<P>} */
  14867. // @ts-ignore We fill in the missing properties below
  14868. const finalComponentProps = { ...getConnectedNamespace(),
  14869. ...getNamespace(namespace)
  14870. };
  14871. /* eslint-enable jsdoc/no-undefined-types */
  14872. const {
  14873. _overrides: overrideProps,
  14874. ...otherContextProps
  14875. } = contextProps;
  14876. const initialMergedProps = Object.entries(otherContextProps).length ? Object.assign({}, otherContextProps, props) : props;
  14877. const cx = useCx();
  14878. const classes = cx(getStyledClassNameFromKey(namespace), props.className); // Provides the ability to customize the render of the component.
  14879. const rendered = typeof initialMergedProps.renderChildren === 'function' ? initialMergedProps.renderChildren(initialMergedProps) : initialMergedProps.children;
  14880. for (const key in initialMergedProps) {
  14881. // @ts-ignore filling in missing props
  14882. finalComponentProps[key] = initialMergedProps[key];
  14883. }
  14884. for (const key in overrideProps) {
  14885. // @ts-ignore filling in missing props
  14886. finalComponentProps[key] = overrideProps[key];
  14887. } // Setting an `undefined` explicitly can cause unintended overwrites
  14888. // when a `cloneElement()` is involved.
  14889. if (rendered !== undefined) {
  14890. // @ts-ignore
  14891. finalComponentProps.children = rendered;
  14892. }
  14893. finalComponentProps.className = classes;
  14894. return finalComponentProps;
  14895. }
  14896. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/context/context-connect.js
  14897. /**
  14898. * External dependencies
  14899. */
  14900. /**
  14901. * WordPress dependencies
  14902. */
  14903. /**
  14904. * Internal dependencies
  14905. */
  14906. /**
  14907. * Forwards ref (React.ForwardRef) and "Connects" (or registers) a component
  14908. * within the Context system under a specified namespace.
  14909. *
  14910. * @param Component The component to register into the Context system.
  14911. * @param namespace The namespace to register the component under.
  14912. * @return The connected WordPressComponent
  14913. */
  14914. function contextConnect(Component, namespace) {
  14915. return _contextConnect(Component, namespace, {
  14916. forwardsRef: true
  14917. });
  14918. }
  14919. /**
  14920. * "Connects" (or registers) a component within the Context system under a specified namespace.
  14921. * Does not forward a ref.
  14922. *
  14923. * @param Component The component to register into the Context system.
  14924. * @param namespace The namespace to register the component under.
  14925. * @return The connected WordPressComponent
  14926. */
  14927. function contextConnectWithoutRef(Component, namespace) {
  14928. return _contextConnect(Component, namespace);
  14929. } // This is an (experimental) evolution of the initial connect() HOC.
  14930. // The hope is that we can improve render performance by removing functional
  14931. // component wrappers.
  14932. function _contextConnect(Component, namespace, options) {
  14933. const WrappedComponent = options !== null && options !== void 0 && options.forwardsRef ? (0,external_wp_element_namespaceObject.forwardRef)(Component) : Component;
  14934. if (typeof namespace === 'undefined') {
  14935. typeof process !== "undefined" && process.env && "production" !== "production" ? 0 : void 0;
  14936. } // @ts-expect-error internal property
  14937. let mergedNamespace = WrappedComponent[CONNECT_STATIC_NAMESPACE] || [namespace];
  14938. /**
  14939. * Consolidate (merge) namespaces before attaching it to the WrappedComponent.
  14940. */
  14941. if (Array.isArray(namespace)) {
  14942. mergedNamespace = [...mergedNamespace, ...namespace];
  14943. }
  14944. if (typeof namespace === 'string') {
  14945. mergedNamespace = [...mergedNamespace, namespace];
  14946. } // @ts-expect-error We can't rely on inferred types here because of the
  14947. // `as` prop polymorphism we're handling in https://github.com/WordPress/gutenberg/blob/9620bae6fef4fde7cc2b7833f416e240207cda29/packages/components/src/ui/context/wordpress-component.ts#L32-L33
  14948. return Object.assign(WrappedComponent, {
  14949. [CONNECT_STATIC_NAMESPACE]: [...new Set(mergedNamespace)],
  14950. displayName: namespace,
  14951. selector: `.${getStyledClassNameFromKey(namespace)}`
  14952. });
  14953. }
  14954. /**
  14955. * Attempts to retrieve the connected namespace from a component.
  14956. *
  14957. * @param Component The component to retrieve a namespace from.
  14958. * @return The connected namespaces.
  14959. */
  14960. function getConnectNamespace(Component) {
  14961. if (!Component) return [];
  14962. let namespaces = []; // @ts-ignore internal property
  14963. if (Component[CONNECT_STATIC_NAMESPACE]) {
  14964. // @ts-ignore internal property
  14965. namespaces = Component[CONNECT_STATIC_NAMESPACE];
  14966. } // @ts-ignore
  14967. if (Component.type && Component.type[CONNECT_STATIC_NAMESPACE]) {
  14968. // @ts-ignore
  14969. namespaces = Component.type[CONNECT_STATIC_NAMESPACE];
  14970. }
  14971. return namespaces;
  14972. }
  14973. /**
  14974. * Checks to see if a component is connected within the Context system.
  14975. *
  14976. * @param Component The component to retrieve a namespace from.
  14977. * @param match The namespace to check.
  14978. */
  14979. function hasConnectNamespace(Component, match) {
  14980. if (!Component) return false;
  14981. if (typeof match === 'string') {
  14982. return getConnectNamespace(Component).includes(match);
  14983. }
  14984. if (Array.isArray(match)) {
  14985. return match.some(result => getConnectNamespace(Component).includes(result));
  14986. }
  14987. return false;
  14988. }
  14989. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/visually-hidden/styles.js
  14990. /**
  14991. * External dependencies
  14992. */
  14993. const visuallyHidden = {
  14994. border: 0,
  14995. clip: 'rect(1px, 1px, 1px, 1px)',
  14996. WebkitClipPath: 'inset( 50% )',
  14997. clipPath: 'inset( 50% )',
  14998. height: '1px',
  14999. margin: '-1px',
  15000. overflow: 'hidden',
  15001. padding: 0,
  15002. position: 'absolute',
  15003. width: '1px',
  15004. wordWrap: 'normal'
  15005. };
  15006. ;// CONCATENATED MODULE: ./node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js
  15007. 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
  15008. var isPropValid = /* #__PURE__ */emotion_memoize_esm(function (prop) {
  15009. return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111
  15010. /* o */
  15011. && prop.charCodeAt(1) === 110
  15012. /* n */
  15013. && prop.charCodeAt(2) < 91;
  15014. }
  15015. /* Z+1 */
  15016. );
  15017. /* harmony default export */ var emotion_is_prop_valid_esm = (isPropValid);
  15018. ;// CONCATENATED MODULE: ./node_modules/@emotion/styled/base/dist/emotion-styled-base.browser.esm.js
  15019. var testOmitPropsOnStringTag = emotion_is_prop_valid_esm;
  15020. var testOmitPropsOnComponent = function testOmitPropsOnComponent(key) {
  15021. return key !== 'theme';
  15022. };
  15023. var getDefaultShouldForwardProp = function getDefaultShouldForwardProp(tag) {
  15024. return typeof tag === 'string' && // 96 is one less than the char code
  15025. // for "a" so this is checking that
  15026. // it's a lowercase character
  15027. tag.charCodeAt(0) > 96 ? testOmitPropsOnStringTag : testOmitPropsOnComponent;
  15028. };
  15029. var composeShouldForwardProps = function composeShouldForwardProps(tag, options, isReal) {
  15030. var shouldForwardProp;
  15031. if (options) {
  15032. var optionsShouldForwardProp = options.shouldForwardProp;
  15033. shouldForwardProp = tag.__emotion_forwardProp && optionsShouldForwardProp ? function (propName) {
  15034. return tag.__emotion_forwardProp(propName) && optionsShouldForwardProp(propName);
  15035. } : optionsShouldForwardProp;
  15036. }
  15037. if (typeof shouldForwardProp !== 'function' && isReal) {
  15038. shouldForwardProp = tag.__emotion_forwardProp;
  15039. }
  15040. return shouldForwardProp;
  15041. };
  15042. 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";
  15043. var emotion_styled_base_browser_esm_Insertion = function Insertion(_ref) {
  15044. var cache = _ref.cache,
  15045. serialized = _ref.serialized,
  15046. isStringTag = _ref.isStringTag;
  15047. emotion_utils_browser_esm_registerStyles(cache, serialized, isStringTag);
  15048. var rules = emotion_use_insertion_effect_with_fallbacks_browser_esm_useInsertionEffectAlwaysWithSyncFallback(function () {
  15049. return emotion_utils_browser_esm_insertStyles(cache, serialized, isStringTag);
  15050. });
  15051. return null;
  15052. };
  15053. var createStyled = function createStyled(tag, options) {
  15054. if (false) {}
  15055. var isReal = tag.__emotion_real === tag;
  15056. var baseTag = isReal && tag.__emotion_base || tag;
  15057. var identifierName;
  15058. var targetClassName;
  15059. if (options !== undefined) {
  15060. identifierName = options.label;
  15061. targetClassName = options.target;
  15062. }
  15063. var shouldForwardProp = composeShouldForwardProps(tag, options, isReal);
  15064. var defaultShouldForwardProp = shouldForwardProp || getDefaultShouldForwardProp(baseTag);
  15065. var shouldUseAs = !defaultShouldForwardProp('as');
  15066. return function () {
  15067. var args = arguments;
  15068. var styles = isReal && tag.__emotion_styles !== undefined ? tag.__emotion_styles.slice(0) : [];
  15069. if (identifierName !== undefined) {
  15070. styles.push("label:" + identifierName + ";");
  15071. }
  15072. if (args[0] == null || args[0].raw === undefined) {
  15073. styles.push.apply(styles, args);
  15074. } else {
  15075. if (false) {}
  15076. styles.push(args[0][0]);
  15077. var len = args.length;
  15078. var i = 1;
  15079. for (; i < len; i++) {
  15080. if (false) {}
  15081. styles.push(args[i], args[0][i]);
  15082. }
  15083. } // $FlowFixMe: we need to cast StatelessFunctionalComponent to our PrivateStyledComponent class
  15084. var Styled = emotion_element_6a883da9_browser_esm_withEmotionCache(function (props, cache, ref) {
  15085. var FinalTag = shouldUseAs && props.as || baseTag;
  15086. var className = '';
  15087. var classInterpolations = [];
  15088. var mergedProps = props;
  15089. if (props.theme == null) {
  15090. mergedProps = {};
  15091. for (var key in props) {
  15092. mergedProps[key] = props[key];
  15093. }
  15094. mergedProps.theme = (0,external_React_namespaceObject.useContext)(emotion_element_6a883da9_browser_esm_ThemeContext);
  15095. }
  15096. if (typeof props.className === 'string') {
  15097. className = emotion_utils_browser_esm_getRegisteredStyles(cache.registered, classInterpolations, props.className);
  15098. } else if (props.className != null) {
  15099. className = props.className + " ";
  15100. }
  15101. var serialized = emotion_serialize_browser_esm_serializeStyles(styles.concat(classInterpolations), cache.registered, mergedProps);
  15102. className += cache.key + "-" + serialized.name;
  15103. if (targetClassName !== undefined) {
  15104. className += " " + targetClassName;
  15105. }
  15106. var finalShouldForwardProp = shouldUseAs && shouldForwardProp === undefined ? getDefaultShouldForwardProp(FinalTag) : defaultShouldForwardProp;
  15107. var newProps = {};
  15108. for (var _key in props) {
  15109. if (shouldUseAs && _key === 'as') continue;
  15110. if ( // $FlowFixMe
  15111. finalShouldForwardProp(_key)) {
  15112. newProps[_key] = props[_key];
  15113. }
  15114. }
  15115. newProps.className = className;
  15116. newProps.ref = ref;
  15117. return /*#__PURE__*/(0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, /*#__PURE__*/(0,external_React_namespaceObject.createElement)(emotion_styled_base_browser_esm_Insertion, {
  15118. cache: cache,
  15119. serialized: serialized,
  15120. isStringTag: typeof FinalTag === 'string'
  15121. }), /*#__PURE__*/(0,external_React_namespaceObject.createElement)(FinalTag, newProps));
  15122. });
  15123. Styled.displayName = identifierName !== undefined ? identifierName : "Styled(" + (typeof baseTag === 'string' ? baseTag : baseTag.displayName || baseTag.name || 'Component') + ")";
  15124. Styled.defaultProps = tag.defaultProps;
  15125. Styled.__emotion_real = Styled;
  15126. Styled.__emotion_base = baseTag;
  15127. Styled.__emotion_styles = styles;
  15128. Styled.__emotion_forwardProp = shouldForwardProp;
  15129. Object.defineProperty(Styled, 'toString', {
  15130. value: function value() {
  15131. if (targetClassName === undefined && "production" !== 'production') {} // $FlowFixMe: coerce undefined to string
  15132. return "." + targetClassName;
  15133. }
  15134. });
  15135. Styled.withComponent = function (nextTag, nextOptions) {
  15136. return createStyled(nextTag, extends_extends({}, options, nextOptions, {
  15137. shouldForwardProp: composeShouldForwardProps(Styled, nextOptions, true)
  15138. })).apply(void 0, styles);
  15139. };
  15140. return Styled;
  15141. };
  15142. };
  15143. /* harmony default export */ var emotion_styled_base_browser_esm = (createStyled);
  15144. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/view/component.js
  15145. /**
  15146. * External dependencies
  15147. */
  15148. /**
  15149. * `View` is a core component that renders everything in the library.
  15150. * It is the principle component in the entire library.
  15151. *
  15152. * @example
  15153. * ```jsx
  15154. * import { View } from `@wordpress/components`;
  15155. *
  15156. * function Example() {
  15157. * return (
  15158. * <View>
  15159. * Code is Poetry
  15160. * </View>
  15161. * );
  15162. * }
  15163. * ```
  15164. */
  15165. // @ts-expect-error
  15166. const View = emotion_styled_base_browser_esm("div", true ? {
  15167. target: "e19lxcc00"
  15168. } : 0)( true ? "" : 0);
  15169. View.selector = '.components-view';
  15170. View.displayName = 'View';
  15171. /* harmony default export */ var component = (View);
  15172. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/visually-hidden/component.js
  15173. /**
  15174. * External dependencies
  15175. */
  15176. /**
  15177. * Internal dependencies
  15178. */
  15179. function UnconnectedVisuallyHidden(props, forwardedRef) {
  15180. const {
  15181. style: styleProp,
  15182. ...contextProps
  15183. } = useContextSystem(props, 'VisuallyHidden');
  15184. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({
  15185. ref: forwardedRef
  15186. }, contextProps, {
  15187. style: { ...visuallyHidden,
  15188. ...(styleProp || {})
  15189. }
  15190. }));
  15191. }
  15192. /**
  15193. * `VisuallyHidden` is a component used to render text intended to be visually
  15194. * hidden, but will show for alternate devices, for example a screen reader.
  15195. *
  15196. * ```jsx
  15197. * import { VisuallyHidden } from `@wordpress/components`;
  15198. *
  15199. * function Example() {
  15200. * return (
  15201. * <VisuallyHidden>
  15202. * <label>Code is Poetry</label>
  15203. * </VisuallyHidden>
  15204. * );
  15205. * }
  15206. * ```
  15207. */
  15208. const VisuallyHidden = contextConnect(UnconnectedVisuallyHidden, 'VisuallyHidden');
  15209. /* harmony default export */ var visually_hidden_component = (VisuallyHidden);
  15210. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/button/index.js
  15211. // @ts-nocheck
  15212. /**
  15213. * External dependencies
  15214. */
  15215. /**
  15216. * WordPress dependencies
  15217. */
  15218. /**
  15219. * Internal dependencies
  15220. */
  15221. const disabledEventsOnDisabledButton = ['onMouseDown', 'onClick'];
  15222. function useDeprecatedProps(_ref) {
  15223. let {
  15224. isDefault,
  15225. isPrimary,
  15226. isSecondary,
  15227. isTertiary,
  15228. isLink,
  15229. variant,
  15230. ...otherProps
  15231. } = _ref;
  15232. let computedVariant = variant;
  15233. if (isPrimary) {
  15234. var _computedVariant;
  15235. (_computedVariant = computedVariant) !== null && _computedVariant !== void 0 ? _computedVariant : computedVariant = 'primary';
  15236. }
  15237. if (isTertiary) {
  15238. var _computedVariant2;
  15239. (_computedVariant2 = computedVariant) !== null && _computedVariant2 !== void 0 ? _computedVariant2 : computedVariant = 'tertiary';
  15240. }
  15241. if (isSecondary) {
  15242. var _computedVariant3;
  15243. (_computedVariant3 = computedVariant) !== null && _computedVariant3 !== void 0 ? _computedVariant3 : computedVariant = 'secondary';
  15244. }
  15245. if (isDefault) {
  15246. var _computedVariant4;
  15247. external_wp_deprecated_default()('Button isDefault prop', {
  15248. since: '5.4',
  15249. alternative: 'variant="secondary"',
  15250. version: '6.2'
  15251. });
  15252. (_computedVariant4 = computedVariant) !== null && _computedVariant4 !== void 0 ? _computedVariant4 : computedVariant = 'secondary';
  15253. }
  15254. if (isLink) {
  15255. var _computedVariant5;
  15256. (_computedVariant5 = computedVariant) !== null && _computedVariant5 !== void 0 ? _computedVariant5 : computedVariant = 'link';
  15257. }
  15258. return { ...otherProps,
  15259. variant: computedVariant
  15260. };
  15261. }
  15262. function Button(props, ref) {
  15263. const {
  15264. href,
  15265. target,
  15266. isSmall,
  15267. isPressed,
  15268. isBusy,
  15269. isDestructive,
  15270. className,
  15271. disabled,
  15272. icon,
  15273. iconPosition = 'left',
  15274. iconSize,
  15275. showTooltip,
  15276. tooltipPosition,
  15277. shortcut,
  15278. label,
  15279. children,
  15280. text,
  15281. variant,
  15282. __experimentalIsFocusable: isFocusable,
  15283. describedBy,
  15284. ...additionalProps
  15285. } = useDeprecatedProps(props);
  15286. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(Button, 'components-button__description');
  15287. const classes = classnames_default()('components-button', className, {
  15288. 'is-secondary': variant === 'secondary',
  15289. 'is-primary': variant === 'primary',
  15290. 'is-small': isSmall,
  15291. 'is-tertiary': variant === 'tertiary',
  15292. 'is-pressed': isPressed,
  15293. 'is-busy': isBusy,
  15294. 'is-link': variant === 'link',
  15295. 'is-destructive': isDestructive,
  15296. 'has-text': !!icon && !!children,
  15297. 'has-icon': !!icon
  15298. });
  15299. const trulyDisabled = disabled && !isFocusable;
  15300. const Tag = href !== undefined && !trulyDisabled ? 'a' : 'button';
  15301. const tagProps = Tag === 'a' ? {
  15302. href,
  15303. target
  15304. } : {
  15305. type: 'button',
  15306. disabled: trulyDisabled,
  15307. 'aria-pressed': isPressed
  15308. };
  15309. if (disabled && isFocusable) {
  15310. // In this case, the button will be disabled, but still focusable and
  15311. // perceivable by screen reader users.
  15312. tagProps['aria-disabled'] = true;
  15313. for (const disabledEvent of disabledEventsOnDisabledButton) {
  15314. additionalProps[disabledEvent] = event => {
  15315. event.stopPropagation();
  15316. event.preventDefault();
  15317. };
  15318. }
  15319. } // Should show the tooltip if...
  15320. const shouldShowTooltip = !trulyDisabled && ( // An explicit tooltip is passed or...
  15321. showTooltip && label || // There's a shortcut or...
  15322. shortcut || // There's a label and...
  15323. !!label && // The children are empty and...
  15324. !(children !== null && children !== void 0 && children.length) && // The tooltip is not explicitly disabled.
  15325. false !== showTooltip);
  15326. const descriptionId = describedBy ? instanceId : null;
  15327. const describedById = additionalProps['aria-describedby'] || descriptionId;
  15328. const element = (0,external_wp_element_namespaceObject.createElement)(Tag, extends_extends({}, tagProps, additionalProps, {
  15329. className: classes,
  15330. "aria-label": additionalProps['aria-label'] || label,
  15331. "aria-describedby": describedById,
  15332. ref: ref
  15333. }), icon && iconPosition === 'left' && (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
  15334. icon: icon,
  15335. size: iconSize
  15336. }), 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, {
  15337. icon: icon,
  15338. size: iconSize
  15339. }), children);
  15340. if (!shouldShowTooltip) {
  15341. 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", {
  15342. id: descriptionId
  15343. }, describedBy)));
  15344. }
  15345. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(tooltip, {
  15346. text: children !== null && children !== void 0 && children.length && describedBy ? describedBy : label,
  15347. shortcut: shortcut,
  15348. position: tooltipPosition
  15349. }, element), describedBy && (0,external_wp_element_namespaceObject.createElement)(visually_hidden_component, null, (0,external_wp_element_namespaceObject.createElement)("span", {
  15350. id: descriptionId
  15351. }, describedBy)));
  15352. }
  15353. /* harmony default export */ var build_module_button = ((0,external_wp_element_namespaceObject.forwardRef)(Button));
  15354. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/scroll-lock/index.js
  15355. /**
  15356. * WordPress dependencies
  15357. */
  15358. /*
  15359. * Setting `overflow: hidden` on html and body elements resets body scroll in iOS.
  15360. * Save scroll top so we can restore it after locking scroll.
  15361. *
  15362. * NOTE: It would be cleaner and possibly safer to find a localized solution such
  15363. * as preventing default on certain touchmove events.
  15364. */
  15365. let previousScrollTop = 0;
  15366. function setLocked(locked) {
  15367. const scrollingElement = document.scrollingElement || document.body;
  15368. if (locked) {
  15369. previousScrollTop = scrollingElement.scrollTop;
  15370. }
  15371. const methodName = locked ? 'add' : 'remove';
  15372. scrollingElement.classList[methodName]('lockscroll'); // Adding the class to the document element seems to be necessary in iOS.
  15373. document.documentElement.classList[methodName]('lockscroll');
  15374. if (!locked) {
  15375. scrollingElement.scrollTop = previousScrollTop;
  15376. }
  15377. }
  15378. let lockCounter = 0;
  15379. /**
  15380. * ScrollLock is a content-free React component for declaratively preventing
  15381. * scroll bleed from modal UI to the page body. This component applies a
  15382. * `lockscroll` class to the `document.documentElement` and
  15383. * `document.scrollingElement` elements to stop the body from scrolling. When it
  15384. * is present, the lock is applied.
  15385. *
  15386. * ```jsx
  15387. * import { ScrollLock, Button } from '@wordpress/components';
  15388. * import { useState } from '@wordpress/element';
  15389. *
  15390. * const MyScrollLock = () => {
  15391. * const [ isScrollLocked, setIsScrollLocked ] = useState( false );
  15392. *
  15393. * const toggleLock = () => {
  15394. * setIsScrollLocked( ( locked ) => ! locked ) );
  15395. * };
  15396. *
  15397. * return (
  15398. * <div>
  15399. * <Button variant="secondary" onClick={ toggleLock }>
  15400. * Toggle scroll lock
  15401. * </Button>
  15402. * { isScrollLocked && <ScrollLock /> }
  15403. * <p>
  15404. * Scroll locked:
  15405. * <strong>{ isScrollLocked ? 'Yes' : 'No' }</strong>
  15406. * </p>
  15407. * </div>
  15408. * );
  15409. * };
  15410. * ```
  15411. */
  15412. function ScrollLock() {
  15413. (0,external_wp_element_namespaceObject.useEffect)(() => {
  15414. if (lockCounter === 0) {
  15415. setLocked(true);
  15416. }
  15417. ++lockCounter;
  15418. return () => {
  15419. if (lockCounter === 1) {
  15420. setLocked(false);
  15421. }
  15422. --lockCounter;
  15423. };
  15424. }, []);
  15425. return null;
  15426. }
  15427. /* harmony default export */ var scroll_lock = (ScrollLock);
  15428. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/slot-fill-context.js
  15429. // @ts-nocheck
  15430. /**
  15431. * WordPress dependencies
  15432. */
  15433. const SlotFillContext = (0,external_wp_element_namespaceObject.createContext)({
  15434. slots: {},
  15435. fills: {},
  15436. registerSlot: () => {
  15437. typeof process !== "undefined" && process.env && "production" !== "production" ? 0 : void 0;
  15438. },
  15439. updateSlot: () => {},
  15440. unregisterSlot: () => {},
  15441. registerFill: () => {},
  15442. unregisterFill: () => {}
  15443. });
  15444. /* harmony default export */ var slot_fill_context = (SlotFillContext);
  15445. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/use-slot.js
  15446. // @ts-nocheck
  15447. /**
  15448. * WordPress dependencies
  15449. */
  15450. /**
  15451. * Internal dependencies
  15452. */
  15453. function useSlot(name) {
  15454. const registry = (0,external_wp_element_namespaceObject.useContext)(slot_fill_context);
  15455. const slot = registry.slots[name] || {};
  15456. const slotFills = registry.fills[name];
  15457. const fills = (0,external_wp_element_namespaceObject.useMemo)(() => slotFills || [], [slotFills]);
  15458. const updateSlot = (0,external_wp_element_namespaceObject.useCallback)(fillProps => {
  15459. registry.updateSlot(name, fillProps);
  15460. }, [name, registry.updateSlot]);
  15461. const unregisterSlot = (0,external_wp_element_namespaceObject.useCallback)(slotRef => {
  15462. registry.unregisterSlot(name, slotRef);
  15463. }, [name, registry.unregisterSlot]);
  15464. const registerFill = (0,external_wp_element_namespaceObject.useCallback)(fillRef => {
  15465. registry.registerFill(name, fillRef);
  15466. }, [name, registry.registerFill]);
  15467. const unregisterFill = (0,external_wp_element_namespaceObject.useCallback)(fillRef => {
  15468. registry.unregisterFill(name, fillRef);
  15469. }, [name, registry.unregisterFill]);
  15470. return { ...slot,
  15471. updateSlot,
  15472. unregisterSlot,
  15473. fills,
  15474. registerFill,
  15475. unregisterFill
  15476. };
  15477. }
  15478. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/context.js
  15479. // @ts-nocheck
  15480. /**
  15481. * WordPress dependencies
  15482. */
  15483. const context_SlotFillContext = (0,external_wp_element_namespaceObject.createContext)({
  15484. registerSlot: () => {},
  15485. unregisterSlot: () => {},
  15486. registerFill: () => {},
  15487. unregisterFill: () => {},
  15488. getSlot: () => {},
  15489. getFills: () => {},
  15490. subscribe: () => {}
  15491. });
  15492. /* harmony default export */ var context = (context_SlotFillContext);
  15493. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/use-slot.js
  15494. // @ts-nocheck
  15495. /**
  15496. * WordPress dependencies
  15497. */
  15498. /**
  15499. * Internal dependencies
  15500. */
  15501. /**
  15502. * React hook returning the active slot given a name.
  15503. *
  15504. * @param {string} name Slot name.
  15505. * @return {Object} Slot object.
  15506. */
  15507. const use_slot_useSlot = name => {
  15508. const {
  15509. getSlot,
  15510. subscribe
  15511. } = (0,external_wp_element_namespaceObject.useContext)(context);
  15512. const [slot, setSlot] = (0,external_wp_element_namespaceObject.useState)(getSlot(name));
  15513. (0,external_wp_element_namespaceObject.useEffect)(() => {
  15514. setSlot(getSlot(name));
  15515. const unsubscribe = subscribe(() => {
  15516. setSlot(getSlot(name));
  15517. });
  15518. return unsubscribe;
  15519. }, [name]);
  15520. return slot;
  15521. };
  15522. /* harmony default export */ var use_slot = (use_slot_useSlot);
  15523. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/fill.js
  15524. // @ts-nocheck
  15525. /**
  15526. * WordPress dependencies
  15527. */
  15528. /**
  15529. * Internal dependencies
  15530. */
  15531. function FillComponent(_ref) {
  15532. let {
  15533. name,
  15534. children,
  15535. registerFill,
  15536. unregisterFill
  15537. } = _ref;
  15538. const slot = use_slot(name);
  15539. const ref = (0,external_wp_element_namespaceObject.useRef)({
  15540. name,
  15541. children
  15542. });
  15543. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
  15544. registerFill(name, ref.current);
  15545. return () => unregisterFill(name, ref.current);
  15546. }, []);
  15547. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
  15548. ref.current.children = children;
  15549. if (slot) {
  15550. slot.forceUpdate();
  15551. }
  15552. }, [children]);
  15553. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
  15554. if (name === ref.current.name) {
  15555. // Ignore initial effect.
  15556. return;
  15557. }
  15558. unregisterFill(ref.current.name, ref.current);
  15559. ref.current.name = name;
  15560. registerFill(name, ref.current);
  15561. }, [name]);
  15562. if (!slot || !slot.node) {
  15563. return null;
  15564. } // If a function is passed as a child, provide it with the fillProps.
  15565. if (typeof children === 'function') {
  15566. children = children(slot.props.fillProps);
  15567. }
  15568. return (0,external_wp_element_namespaceObject.createPortal)(children, slot.node);
  15569. }
  15570. const Fill = props => (0,external_wp_element_namespaceObject.createElement)(context.Consumer, null, _ref2 => {
  15571. let {
  15572. registerFill,
  15573. unregisterFill
  15574. } = _ref2;
  15575. return (0,external_wp_element_namespaceObject.createElement)(FillComponent, extends_extends({}, props, {
  15576. registerFill: registerFill,
  15577. unregisterFill: unregisterFill
  15578. }));
  15579. });
  15580. /* harmony default export */ var fill = (Fill);
  15581. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/slot.js
  15582. // @ts-nocheck
  15583. /**
  15584. * WordPress dependencies
  15585. */
  15586. /**
  15587. * Internal dependencies
  15588. */
  15589. /**
  15590. * Whether the argument is a function.
  15591. *
  15592. * @param {*} maybeFunc The argument to check.
  15593. * @return {boolean} True if the argument is a function, false otherwise.
  15594. */
  15595. function isFunction(maybeFunc) {
  15596. return typeof maybeFunc === 'function';
  15597. }
  15598. class SlotComponent extends external_wp_element_namespaceObject.Component {
  15599. constructor() {
  15600. super(...arguments);
  15601. this.isUnmounted = false;
  15602. this.bindNode = this.bindNode.bind(this);
  15603. }
  15604. componentDidMount() {
  15605. const {
  15606. registerSlot
  15607. } = this.props;
  15608. registerSlot(this.props.name, this);
  15609. }
  15610. componentWillUnmount() {
  15611. const {
  15612. unregisterSlot
  15613. } = this.props;
  15614. this.isUnmounted = true;
  15615. unregisterSlot(this.props.name, this);
  15616. }
  15617. componentDidUpdate(prevProps) {
  15618. const {
  15619. name,
  15620. unregisterSlot,
  15621. registerSlot
  15622. } = this.props;
  15623. if (prevProps.name !== name) {
  15624. unregisterSlot(prevProps.name);
  15625. registerSlot(name, this);
  15626. }
  15627. }
  15628. bindNode(node) {
  15629. this.node = node;
  15630. }
  15631. forceUpdate() {
  15632. if (this.isUnmounted) {
  15633. return;
  15634. }
  15635. super.forceUpdate();
  15636. }
  15637. render() {
  15638. var _getFills;
  15639. const {
  15640. children,
  15641. name,
  15642. fillProps = {},
  15643. getFills
  15644. } = this.props;
  15645. const fills = ((_getFills = getFills(name, this)) !== null && _getFills !== void 0 ? _getFills : []).map(fill => {
  15646. const fillChildren = isFunction(fill.children) ? fill.children(fillProps) : fill.children;
  15647. return external_wp_element_namespaceObject.Children.map(fillChildren, (child, childIndex) => {
  15648. if (!child || typeof child === 'string') {
  15649. return child;
  15650. }
  15651. const childKey = child.key || childIndex;
  15652. return (0,external_wp_element_namespaceObject.cloneElement)(child, {
  15653. key: childKey
  15654. });
  15655. });
  15656. }).filter( // In some cases fills are rendered only when some conditions apply.
  15657. // This ensures that we only use non-empty fills when rendering, i.e.,
  15658. // it allows us to render wrappers only when the fills are actually present.
  15659. element => !(0,external_wp_element_namespaceObject.isEmptyElement)(element));
  15660. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isFunction(children) ? children(fills) : fills);
  15661. }
  15662. }
  15663. const Slot = props => (0,external_wp_element_namespaceObject.createElement)(context.Consumer, null, _ref => {
  15664. let {
  15665. registerSlot,
  15666. unregisterSlot,
  15667. getFills
  15668. } = _ref;
  15669. return (0,external_wp_element_namespaceObject.createElement)(SlotComponent, extends_extends({}, props, {
  15670. registerSlot: registerSlot,
  15671. unregisterSlot: unregisterSlot,
  15672. getFills: getFills
  15673. }));
  15674. });
  15675. /* harmony default export */ var slot = (Slot);
  15676. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/node_modules/uuid/dist/esm-browser/rng.js
  15677. // Unique ID creation requires a high quality random # generator. In the browser we therefore
  15678. // require the crypto API and do not support built-in fallback to lower quality random number
  15679. // generators (like Math.random()).
  15680. var getRandomValues;
  15681. var rnds8 = new Uint8Array(16);
  15682. function rng() {
  15683. // lazy load so that environments that need to polyfill have a chance to do so
  15684. if (!getRandomValues) {
  15685. // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
  15686. // find the complete implementation of crypto (msCrypto) on IE11.
  15687. getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
  15688. if (!getRandomValues) {
  15689. throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
  15690. }
  15691. }
  15692. return getRandomValues(rnds8);
  15693. }
  15694. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/node_modules/uuid/dist/esm-browser/regex.js
  15695. /* 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);
  15696. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/node_modules/uuid/dist/esm-browser/validate.js
  15697. function validate(uuid) {
  15698. return typeof uuid === 'string' && regex.test(uuid);
  15699. }
  15700. /* harmony default export */ var esm_browser_validate = (validate);
  15701. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/node_modules/uuid/dist/esm-browser/stringify.js
  15702. /**
  15703. * Convert array of 16 byte values to UUID string format of the form:
  15704. * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
  15705. */
  15706. var byteToHex = [];
  15707. for (var stringify_i = 0; stringify_i < 256; ++stringify_i) {
  15708. byteToHex.push((stringify_i + 0x100).toString(16).substr(1));
  15709. }
  15710. function stringify_stringify(arr) {
  15711. var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  15712. // Note: Be careful editing this code! It's been tuned for performance
  15713. // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
  15714. 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
  15715. // of the following:
  15716. // - One or more input array values don't map to a hex octet (leading to
  15717. // "undefined" in the uuid)
  15718. // - Invalid input values for the RFC `version` or `variant` fields
  15719. if (!esm_browser_validate(uuid)) {
  15720. throw TypeError('Stringified UUID is invalid');
  15721. }
  15722. return uuid;
  15723. }
  15724. /* harmony default export */ var esm_browser_stringify = (stringify_stringify);
  15725. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/node_modules/uuid/dist/esm-browser/v4.js
  15726. function v4(options, buf, offset) {
  15727. options = options || {};
  15728. var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
  15729. rnds[6] = rnds[6] & 0x0f | 0x40;
  15730. rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
  15731. if (buf) {
  15732. offset = offset || 0;
  15733. for (var i = 0; i < 16; ++i) {
  15734. buf[offset + i] = rnds[i];
  15735. }
  15736. return buf;
  15737. }
  15738. return esm_browser_stringify(rnds);
  15739. }
  15740. /* harmony default export */ var esm_browser_v4 = (v4);
  15741. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/style-provider/index.js
  15742. /**
  15743. * External dependencies
  15744. */
  15745. /**
  15746. * Internal dependencies
  15747. */
  15748. const uuidCache = new Set();
  15749. const memoizedCreateCacheWithContainer = memize_default()(container => {
  15750. // Emotion only accepts alphabetical and hyphenated keys so we just
  15751. // strip the numbers from the UUID. It _should_ be fine.
  15752. let key = esm_browser_v4().replace(/[0-9]/g, '');
  15753. while (uuidCache.has(key)) {
  15754. key = esm_browser_v4().replace(/[0-9]/g, '');
  15755. }
  15756. uuidCache.add(key);
  15757. return emotion_cache_browser_esm({
  15758. container,
  15759. key
  15760. });
  15761. });
  15762. function StyleProvider(props) {
  15763. const {
  15764. children,
  15765. document
  15766. } = props;
  15767. if (!document) {
  15768. return null;
  15769. }
  15770. const cache = memoizedCreateCacheWithContainer(document.head);
  15771. return (0,external_wp_element_namespaceObject.createElement)(CacheProvider, {
  15772. value: cache
  15773. }, children);
  15774. }
  15775. /* harmony default export */ var style_provider = (StyleProvider);
  15776. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/fill.js
  15777. // @ts-nocheck
  15778. /**
  15779. * WordPress dependencies
  15780. */
  15781. /**
  15782. * Internal dependencies
  15783. */
  15784. function useForceUpdate() {
  15785. const [, setState] = (0,external_wp_element_namespaceObject.useState)({});
  15786. const mounted = (0,external_wp_element_namespaceObject.useRef)(true);
  15787. (0,external_wp_element_namespaceObject.useEffect)(() => {
  15788. return () => {
  15789. mounted.current = false;
  15790. };
  15791. }, []);
  15792. return () => {
  15793. if (mounted.current) {
  15794. setState({});
  15795. }
  15796. };
  15797. }
  15798. function fill_Fill(_ref) {
  15799. let {
  15800. name,
  15801. children
  15802. } = _ref;
  15803. const slot = useSlot(name);
  15804. const ref = (0,external_wp_element_namespaceObject.useRef)({
  15805. rerender: useForceUpdate()
  15806. });
  15807. (0,external_wp_element_namespaceObject.useEffect)(() => {
  15808. // We register fills so we can keep track of their existance.
  15809. // Some Slot implementations need to know if there're already fills
  15810. // registered so they can choose to render themselves or not.
  15811. slot.registerFill(ref);
  15812. return () => {
  15813. slot.unregisterFill(ref);
  15814. };
  15815. }, [slot.registerFill, slot.unregisterFill]);
  15816. if (!slot.ref || !slot.ref.current) {
  15817. return null;
  15818. }
  15819. if (typeof children === 'function') {
  15820. children = children(slot.fillProps);
  15821. } // When using a `Fill`, the `children` will be rendered in the document of the
  15822. // `Slot`. This means that we need to wrap the `children` in a `StyleProvider`
  15823. // to make sure we're referencing the right document/iframe (instead of the
  15824. // context of the `Fill`'s parent).
  15825. const wrappedChildren = (0,external_wp_element_namespaceObject.createElement)(style_provider, {
  15826. document: slot.ref.current.ownerDocument
  15827. }, children);
  15828. return (0,external_wp_element_namespaceObject.createPortal)(wrappedChildren, slot.ref.current);
  15829. }
  15830. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/slot.js
  15831. // @ts-nocheck
  15832. /**
  15833. * WordPress dependencies
  15834. */
  15835. /**
  15836. * Internal dependencies
  15837. */
  15838. function slot_Slot(_ref, forwardedRef) {
  15839. let {
  15840. name,
  15841. fillProps = {},
  15842. as: Component = 'div',
  15843. ...props
  15844. } = _ref;
  15845. const registry = (0,external_wp_element_namespaceObject.useContext)(slot_fill_context);
  15846. const ref = (0,external_wp_element_namespaceObject.useRef)();
  15847. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
  15848. registry.registerSlot(name, ref, fillProps);
  15849. return () => {
  15850. registry.unregisterSlot(name, ref);
  15851. }; // We are not including fillProps in the deps because we don't want to
  15852. // unregister and register the slot whenever fillProps change, which would
  15853. // cause the fill to be re-mounted. We are only considering the initial value
  15854. // of fillProps.
  15855. }, [registry.registerSlot, registry.unregisterSlot, name]); // fillProps may be an update that interacts with the layout, so we
  15856. // useLayoutEffect.
  15857. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
  15858. registry.updateSlot(name, fillProps);
  15859. });
  15860. return (0,external_wp_element_namespaceObject.createElement)(Component, extends_extends({
  15861. ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([forwardedRef, ref])
  15862. }, props));
  15863. }
  15864. /* harmony default export */ var bubbles_virtually_slot = ((0,external_wp_element_namespaceObject.forwardRef)(slot_Slot));
  15865. ;// CONCATENATED MODULE: external ["wp","isShallowEqual"]
  15866. var external_wp_isShallowEqual_namespaceObject = window["wp"]["isShallowEqual"];
  15867. var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_namespaceObject);
  15868. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js
  15869. // @ts-nocheck
  15870. /**
  15871. * WordPress dependencies
  15872. */
  15873. /**
  15874. * Internal dependencies
  15875. */
  15876. function useSlotRegistry() {
  15877. const [slots, setSlots] = (0,external_wp_element_namespaceObject.useState)({});
  15878. const [fills, setFills] = (0,external_wp_element_namespaceObject.useState)({});
  15879. const registerSlot = (0,external_wp_element_namespaceObject.useCallback)((name, ref, fillProps) => {
  15880. setSlots(prevSlots => {
  15881. const slot = prevSlots[name] || {};
  15882. return { ...prevSlots,
  15883. [name]: { ...slot,
  15884. ref: ref || slot.ref,
  15885. fillProps: fillProps || slot.fillProps || {}
  15886. }
  15887. };
  15888. });
  15889. }, []);
  15890. const unregisterSlot = (0,external_wp_element_namespaceObject.useCallback)((name, ref) => {
  15891. setSlots(prevSlots => {
  15892. const {
  15893. [name]: slot,
  15894. ...nextSlots
  15895. } = prevSlots; // Make sure we're not unregistering a slot registered by another element
  15896. // See https://github.com/WordPress/gutenberg/pull/19242#issuecomment-590295412
  15897. if ((slot === null || slot === void 0 ? void 0 : slot.ref) === ref) {
  15898. return nextSlots;
  15899. }
  15900. return prevSlots;
  15901. });
  15902. }, []);
  15903. const updateSlot = (0,external_wp_element_namespaceObject.useCallback)((name, fillProps) => {
  15904. const slot = slots[name];
  15905. if (!slot) {
  15906. return;
  15907. }
  15908. if (!external_wp_isShallowEqual_default()(slot.fillProps, fillProps)) {
  15909. slot.fillProps = fillProps;
  15910. const slotFills = fills[name];
  15911. if (slotFills) {
  15912. // Force update fills.
  15913. slotFills.map(fill => fill.current.rerender());
  15914. }
  15915. }
  15916. }, [slots, fills]);
  15917. const registerFill = (0,external_wp_element_namespaceObject.useCallback)((name, ref) => {
  15918. setFills(prevFills => ({ ...prevFills,
  15919. [name]: [...(prevFills[name] || []), ref]
  15920. }));
  15921. }, []);
  15922. const unregisterFill = (0,external_wp_element_namespaceObject.useCallback)((name, ref) => {
  15923. setFills(prevFills => {
  15924. if (prevFills[name]) {
  15925. return { ...prevFills,
  15926. [name]: prevFills[name].filter(fillRef => fillRef !== ref)
  15927. };
  15928. }
  15929. return prevFills;
  15930. });
  15931. }, []); // Memoizing the return value so it can be directly passed to Provider value
  15932. const registry = (0,external_wp_element_namespaceObject.useMemo)(() => ({
  15933. slots,
  15934. fills,
  15935. registerSlot,
  15936. updateSlot,
  15937. unregisterSlot,
  15938. registerFill,
  15939. unregisterFill
  15940. }), [slots, fills, registerSlot, updateSlot, unregisterSlot, registerFill, unregisterFill]);
  15941. return registry;
  15942. }
  15943. function SlotFillProvider(_ref) {
  15944. let {
  15945. children
  15946. } = _ref;
  15947. const registry = useSlotRegistry();
  15948. return (0,external_wp_element_namespaceObject.createElement)(slot_fill_context.Provider, {
  15949. value: registry
  15950. }, children);
  15951. }
  15952. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/provider.js
  15953. // @ts-nocheck
  15954. /**
  15955. * WordPress dependencies
  15956. */
  15957. /**
  15958. * Internal dependencies
  15959. */
  15960. class provider_SlotFillProvider extends external_wp_element_namespaceObject.Component {
  15961. constructor() {
  15962. super(...arguments);
  15963. this.registerSlot = this.registerSlot.bind(this);
  15964. this.registerFill = this.registerFill.bind(this);
  15965. this.unregisterSlot = this.unregisterSlot.bind(this);
  15966. this.unregisterFill = this.unregisterFill.bind(this);
  15967. this.getSlot = this.getSlot.bind(this);
  15968. this.getFills = this.getFills.bind(this);
  15969. this.hasFills = this.hasFills.bind(this);
  15970. this.subscribe = this.subscribe.bind(this);
  15971. this.slots = {};
  15972. this.fills = {};
  15973. this.listeners = [];
  15974. this.contextValue = {
  15975. registerSlot: this.registerSlot,
  15976. unregisterSlot: this.unregisterSlot,
  15977. registerFill: this.registerFill,
  15978. unregisterFill: this.unregisterFill,
  15979. getSlot: this.getSlot,
  15980. getFills: this.getFills,
  15981. hasFills: this.hasFills,
  15982. subscribe: this.subscribe
  15983. };
  15984. }
  15985. registerSlot(name, slot) {
  15986. const previousSlot = this.slots[name];
  15987. this.slots[name] = slot;
  15988. this.triggerListeners(); // Sometimes the fills are registered after the initial render of slot
  15989. // But before the registerSlot call, we need to rerender the slot.
  15990. this.forceUpdateSlot(name); // If a new instance of a slot is being mounted while another with the
  15991. // same name exists, force its update _after_ the new slot has been
  15992. // assigned into the instance, such that its own rendering of children
  15993. // will be empty (the new Slot will subsume all fills for this name).
  15994. if (previousSlot) {
  15995. previousSlot.forceUpdate();
  15996. }
  15997. }
  15998. registerFill(name, instance) {
  15999. this.fills[name] = [...(this.fills[name] || []), instance];
  16000. this.forceUpdateSlot(name);
  16001. }
  16002. unregisterSlot(name, instance) {
  16003. // If a previous instance of a Slot by this name unmounts, do nothing,
  16004. // as the slot and its fills should only be removed for the current
  16005. // known instance.
  16006. if (this.slots[name] !== instance) {
  16007. return;
  16008. }
  16009. delete this.slots[name];
  16010. this.triggerListeners();
  16011. }
  16012. unregisterFill(name, instance) {
  16013. var _this$fills$name$filt, _this$fills$name;
  16014. this.fills[name] = (_this$fills$name$filt = (_this$fills$name = this.fills[name]) === null || _this$fills$name === void 0 ? void 0 : _this$fills$name.filter(fill => fill !== instance)) !== null && _this$fills$name$filt !== void 0 ? _this$fills$name$filt : [];
  16015. this.forceUpdateSlot(name);
  16016. }
  16017. getSlot(name) {
  16018. return this.slots[name];
  16019. }
  16020. getFills(name, slotInstance) {
  16021. // Fills should only be returned for the current instance of the slot
  16022. // in which they occupy.
  16023. if (this.slots[name] !== slotInstance) {
  16024. return [];
  16025. }
  16026. return this.fills[name];
  16027. }
  16028. hasFills(name) {
  16029. return this.fills[name] && !!this.fills[name].length;
  16030. }
  16031. forceUpdateSlot(name) {
  16032. const slot = this.getSlot(name);
  16033. if (slot) {
  16034. slot.forceUpdate();
  16035. }
  16036. }
  16037. triggerListeners() {
  16038. this.listeners.forEach(listener => listener());
  16039. }
  16040. subscribe(listener) {
  16041. this.listeners.push(listener);
  16042. return () => {
  16043. this.listeners = this.listeners.filter(l => l !== listener);
  16044. };
  16045. }
  16046. render() {
  16047. return (0,external_wp_element_namespaceObject.createElement)(context.Provider, {
  16048. value: this.contextValue
  16049. }, this.props.children);
  16050. }
  16051. }
  16052. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/index.js
  16053. // @ts-nocheck
  16054. /**
  16055. * WordPress dependencies
  16056. */
  16057. /**
  16058. * Internal dependencies
  16059. */
  16060. function slot_fill_Fill(props) {
  16061. // We're adding both Fills here so they can register themselves before
  16062. // their respective slot has been registered. Only the Fill that has a slot
  16063. // will render. The other one will return null.
  16064. 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));
  16065. }
  16066. const slot_fill_Slot = (0,external_wp_element_namespaceObject.forwardRef)((_ref, ref) => {
  16067. let {
  16068. bubblesVirtually,
  16069. ...props
  16070. } = _ref;
  16071. if (bubblesVirtually) {
  16072. return (0,external_wp_element_namespaceObject.createElement)(bubbles_virtually_slot, extends_extends({}, props, {
  16073. ref: ref
  16074. }));
  16075. }
  16076. return (0,external_wp_element_namespaceObject.createElement)(slot, props);
  16077. });
  16078. function Provider(_ref2) {
  16079. let {
  16080. children,
  16081. ...props
  16082. } = _ref2;
  16083. return (0,external_wp_element_namespaceObject.createElement)(provider_SlotFillProvider, props, (0,external_wp_element_namespaceObject.createElement)(SlotFillProvider, null, children));
  16084. }
  16085. function createSlotFill(name) {
  16086. const FillComponent = props => (0,external_wp_element_namespaceObject.createElement)(slot_fill_Fill, extends_extends({
  16087. name: name
  16088. }, props));
  16089. FillComponent.displayName = name + 'Fill';
  16090. const SlotComponent = props => (0,external_wp_element_namespaceObject.createElement)(slot_fill_Slot, extends_extends({
  16091. name: name
  16092. }, props));
  16093. SlotComponent.displayName = name + 'Slot';
  16094. SlotComponent.__unstableName = name;
  16095. return {
  16096. Fill: FillComponent,
  16097. Slot: SlotComponent
  16098. };
  16099. }
  16100. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/popover/utils.js
  16101. /**
  16102. * External dependencies
  16103. */
  16104. // eslint-disable-next-line no-restricted-imports
  16105. /**
  16106. * Internal dependencies
  16107. */
  16108. /**
  16109. * Converts the `Popover`'s legacy "position" prop to the new "placement" prop
  16110. * (used by `floating-ui`).
  16111. *
  16112. * @param position The legacy position
  16113. * @return The corresponding placement
  16114. */
  16115. const positionToPlacement = position => {
  16116. const [x, y, z] = position.split(' ');
  16117. if (['top', 'bottom'].includes(x)) {
  16118. let suffix = '';
  16119. if (!!z && z === 'left' || y === 'right') {
  16120. suffix = '-start';
  16121. } else if (!!z && z === 'right' || y === 'left') {
  16122. suffix = '-end';
  16123. }
  16124. return x + suffix;
  16125. }
  16126. return y;
  16127. };
  16128. /**
  16129. * @typedef AnimationOrigin
  16130. * @type {Object}
  16131. * @property {number} originX A number between 0 and 1 (in CSS logical properties jargon, 0 is "start", 0.5 is "center", and 1 is "end")
  16132. * @property {number} originY A number between 0 and 1 (0 is top, 0.5 is center, and 1 is bottom)
  16133. */
  16134. const PLACEMENT_TO_ANIMATION_ORIGIN = {
  16135. top: {
  16136. originX: 0.5,
  16137. originY: 1
  16138. },
  16139. // open from bottom, center
  16140. 'top-start': {
  16141. originX: 0,
  16142. originY: 1
  16143. },
  16144. // open from bottom, left
  16145. 'top-end': {
  16146. originX: 1,
  16147. originY: 1
  16148. },
  16149. // open from bottom, right
  16150. right: {
  16151. originX: 0,
  16152. originY: 0.5
  16153. },
  16154. // open from middle, left
  16155. 'right-start': {
  16156. originX: 0,
  16157. originY: 0
  16158. },
  16159. // open from top, left
  16160. 'right-end': {
  16161. originX: 0,
  16162. originY: 1
  16163. },
  16164. // open from bottom, left
  16165. bottom: {
  16166. originX: 0.5,
  16167. originY: 0
  16168. },
  16169. // open from top, center
  16170. 'bottom-start': {
  16171. originX: 0,
  16172. originY: 0
  16173. },
  16174. // open from top, left
  16175. 'bottom-end': {
  16176. originX: 1,
  16177. originY: 0
  16178. },
  16179. // open from top, right
  16180. left: {
  16181. originX: 1,
  16182. originY: 0.5
  16183. },
  16184. // open from middle, right
  16185. 'left-start': {
  16186. originX: 1,
  16187. originY: 0
  16188. },
  16189. // open from top, right
  16190. 'left-end': {
  16191. originX: 1,
  16192. originY: 1
  16193. } // open from bottom, right
  16194. };
  16195. /**
  16196. * Given the floating-ui `placement`, compute the framer-motion props for the
  16197. * popover's entry animation.
  16198. *
  16199. * @param placement A placement string from floating ui
  16200. * @return The object containing the motion props
  16201. */
  16202. const placementToMotionAnimationProps = placement => {
  16203. const translateProp = placement.startsWith('top') || placement.startsWith('bottom') ? 'translateY' : 'translateX';
  16204. const translateDirection = placement.startsWith('top') || placement.startsWith('left') ? 1 : -1;
  16205. return {
  16206. style: PLACEMENT_TO_ANIMATION_ORIGIN[placement],
  16207. initial: {
  16208. opacity: 0,
  16209. scale: 0,
  16210. [translateProp]: `${2 * translateDirection}em`
  16211. },
  16212. animate: {
  16213. opacity: 1,
  16214. scale: 1,
  16215. [translateProp]: 0
  16216. },
  16217. transition: {
  16218. duration: 0.1,
  16219. ease: [0, 0, 0.2, 1]
  16220. }
  16221. };
  16222. };
  16223. /**
  16224. * Returns the offset of a document's frame element.
  16225. *
  16226. * @param document The iframe's owner document.
  16227. *
  16228. * @return The offset of the document's frame element, or undefined if the
  16229. * document has no frame element.
  16230. */
  16231. const getFrameOffset = document => {
  16232. var _document$defaultView;
  16233. const frameElement = document === null || document === void 0 ? void 0 : (_document$defaultView = document.defaultView) === null || _document$defaultView === void 0 ? void 0 : _document$defaultView.frameElement;
  16234. if (!frameElement) {
  16235. return;
  16236. }
  16237. const iframeRect = frameElement.getBoundingClientRect();
  16238. return {
  16239. x: iframeRect.left,
  16240. y: iframeRect.top
  16241. };
  16242. };
  16243. const getReferenceOwnerDocument = _ref => {
  16244. var _resultingReferenceOw;
  16245. let {
  16246. anchor,
  16247. anchorRef,
  16248. anchorRect,
  16249. getAnchorRect,
  16250. fallbackReferenceElement,
  16251. fallbackDocument
  16252. } = _ref;
  16253. // In floating-ui's terms:
  16254. // - "reference" refers to the popover's anchor element.
  16255. // - "floating" refers the floating popover's element.
  16256. // A floating element can also be positioned relative to a virtual element,
  16257. // instead of a real one. A virtual element is represented by an object
  16258. // with the `getBoundingClientRect()` function (like real elements).
  16259. // See https://floating-ui.com/docs/virtual-elements for more info.
  16260. let resultingReferenceOwnerDoc;
  16261. if (anchor) {
  16262. resultingReferenceOwnerDoc = anchor.ownerDocument;
  16263. } else if (anchorRef !== null && anchorRef !== void 0 && anchorRef.top) {
  16264. resultingReferenceOwnerDoc = anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.top.ownerDocument;
  16265. } else if (anchorRef !== null && anchorRef !== void 0 && anchorRef.startContainer) {
  16266. resultingReferenceOwnerDoc = anchorRef.startContainer.ownerDocument;
  16267. } else if (anchorRef !== null && anchorRef !== void 0 && anchorRef.current) {
  16268. resultingReferenceOwnerDoc = anchorRef.current.ownerDocument;
  16269. } else if (anchorRef) {
  16270. // This one should be deprecated.
  16271. resultingReferenceOwnerDoc = anchorRef.ownerDocument;
  16272. } else if (anchorRect && anchorRect !== null && anchorRect !== void 0 && anchorRect.ownerDocument) {
  16273. resultingReferenceOwnerDoc = anchorRect.ownerDocument;
  16274. } else if (getAnchorRect) {
  16275. var _getAnchorRect;
  16276. resultingReferenceOwnerDoc = (_getAnchorRect = getAnchorRect(fallbackReferenceElement)) === null || _getAnchorRect === void 0 ? void 0 : _getAnchorRect.ownerDocument;
  16277. }
  16278. return (_resultingReferenceOw = resultingReferenceOwnerDoc) !== null && _resultingReferenceOw !== void 0 ? _resultingReferenceOw : fallbackDocument;
  16279. };
  16280. const getReferenceElement = _ref2 => {
  16281. var _referenceElement;
  16282. let {
  16283. anchor,
  16284. anchorRef,
  16285. anchorRect,
  16286. getAnchorRect,
  16287. fallbackReferenceElement
  16288. } = _ref2;
  16289. let referenceElement = null;
  16290. if (anchor) {
  16291. referenceElement = anchor;
  16292. } else if (anchorRef !== null && anchorRef !== void 0 && anchorRef.top) {
  16293. // Create a virtual element for the ref. The expectation is that
  16294. // if anchorRef.top is defined, then anchorRef.bottom is defined too.
  16295. // Seems to be used by the block toolbar, when multiple blocks are selected
  16296. // (top and bottom blocks are used to calculate the resulting rect).
  16297. referenceElement = {
  16298. getBoundingClientRect() {
  16299. const topRect = anchorRef.top.getBoundingClientRect();
  16300. const bottomRect = anchorRef.bottom.getBoundingClientRect();
  16301. return new window.DOMRect(topRect.x, topRect.y, topRect.width, bottomRect.bottom - topRect.top);
  16302. }
  16303. };
  16304. } else if (anchorRef !== null && anchorRef !== void 0 && anchorRef.current) {
  16305. // Standard React ref.
  16306. referenceElement = anchorRef.current;
  16307. } else if (anchorRef) {
  16308. // If `anchorRef` holds directly the element's value (no `current` key)
  16309. // This is a weird scenario and should be deprecated.
  16310. referenceElement = anchorRef;
  16311. } else if (anchorRect) {
  16312. // Create a virtual element for the ref.
  16313. referenceElement = {
  16314. getBoundingClientRect() {
  16315. return anchorRect;
  16316. }
  16317. };
  16318. } else if (getAnchorRect) {
  16319. // Create a virtual element for the ref.
  16320. referenceElement = {
  16321. getBoundingClientRect() {
  16322. var _rect$x, _rect$y, _rect$width, _rect$height;
  16323. const rect = getAnchorRect(fallbackReferenceElement);
  16324. return new window.DOMRect((_rect$x = rect.x) !== null && _rect$x !== void 0 ? _rect$x : rect.left, (_rect$y = rect.y) !== null && _rect$y !== void 0 ? _rect$y : rect.top, (_rect$width = rect.width) !== null && _rect$width !== void 0 ? _rect$width : rect.right - rect.left, (_rect$height = rect.height) !== null && _rect$height !== void 0 ? _rect$height : rect.bottom - rect.top);
  16325. }
  16326. };
  16327. } else if (fallbackReferenceElement) {
  16328. // If no explicit ref is passed via props, fall back to
  16329. // anchoring to the popover's parent node.
  16330. referenceElement = fallbackReferenceElement.parentElement;
  16331. } // Convert any `undefined` value to `null`.
  16332. return (_referenceElement = referenceElement) !== null && _referenceElement !== void 0 ? _referenceElement : null;
  16333. };
  16334. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/popover/limit-shift.js
  16335. /**
  16336. * External dependencies
  16337. */
  16338. /**
  16339. * Parts of this source were derived and modified from `floating-ui`,
  16340. * released under the MIT license.
  16341. *
  16342. * https://github.com/floating-ui/floating-ui
  16343. *
  16344. * Copyright (c) 2021 Floating UI contributors
  16345. *
  16346. * Permission is hereby granted, free of charge, to any person obtaining a copy
  16347. * of this software and associated documentation files (the "Software"), to deal
  16348. * in the Software without restriction, including without limitation the rights
  16349. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  16350. * copies of the Software, and to permit persons to whom the Software is
  16351. * furnished to do so, subject to the following conditions:
  16352. *
  16353. * The above copyright notice and this permission notice shall be included in all
  16354. * copies or substantial portions of the Software.
  16355. *
  16356. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16357. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16358. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16359. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16360. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16361. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  16362. * SOFTWARE.
  16363. */
  16364. /**
  16365. * Custom limiter function for the `shift` middleware.
  16366. * This function is mostly identical default `limitShift` from ``@floating-ui`;
  16367. * the only difference is that, when computing the min/max shift limits, it
  16368. * also takes into account the iframe offset that is added by the
  16369. * custom "frameOffset" middleware.
  16370. *
  16371. * All unexported types and functions are also from the `@floating-ui` library,
  16372. * and have been copied to this file for convenience.
  16373. */
  16374. function getSide(placement) {
  16375. return placement.split('-')[0];
  16376. }
  16377. function getMainAxisFromPlacement(placement) {
  16378. return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
  16379. }
  16380. function getCrossAxis(axis) {
  16381. return axis === 'x' ? 'y' : 'x';
  16382. }
  16383. const limitShift = function () {
  16384. let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  16385. return {
  16386. options,
  16387. fn(middlewareArguments) {
  16388. var _middlewareData$frame;
  16389. const {
  16390. x,
  16391. y,
  16392. placement,
  16393. rects,
  16394. middlewareData
  16395. } = middlewareArguments;
  16396. const {
  16397. offset = 0,
  16398. mainAxis: checkMainAxis = true,
  16399. crossAxis: checkCrossAxis = true
  16400. } = options;
  16401. const coords = {
  16402. x,
  16403. y
  16404. };
  16405. const mainAxis = getMainAxisFromPlacement(placement);
  16406. const crossAxis = getCrossAxis(mainAxis);
  16407. let mainAxisCoord = coords[mainAxis];
  16408. let crossAxisCoord = coords[crossAxis];
  16409. const rawOffset = typeof offset === 'function' ? offset(middlewareArguments) : offset;
  16410. const computedOffset = typeof rawOffset === 'number' ? {
  16411. mainAxis: rawOffset,
  16412. crossAxis: 0
  16413. } : {
  16414. mainAxis: 0,
  16415. crossAxis: 0,
  16416. ...rawOffset
  16417. }; // At the moment of writing, this is the only difference
  16418. // with the `limitShift` function from `@floating-ui`.
  16419. // This offset needs to be added to all min/max limits
  16420. // in order to make the shift-limiting work as expected.
  16421. const additionalFrameOffset = {
  16422. x: 0,
  16423. y: 0,
  16424. ...((_middlewareData$frame = middlewareData.frameOffset) === null || _middlewareData$frame === void 0 ? void 0 : _middlewareData$frame.amount)
  16425. };
  16426. if (checkMainAxis) {
  16427. const len = mainAxis === 'y' ? 'height' : 'width';
  16428. const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis + additionalFrameOffset[mainAxis];
  16429. const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis + additionalFrameOffset[mainAxis];
  16430. if (mainAxisCoord < limitMin) {
  16431. mainAxisCoord = limitMin;
  16432. } else if (mainAxisCoord > limitMax) {
  16433. mainAxisCoord = limitMax;
  16434. }
  16435. }
  16436. if (checkCrossAxis) {
  16437. var _middlewareData$offse, _middlewareData$offse2, _middlewareData$offse3, _middlewareData$offse4;
  16438. const len = mainAxis === 'y' ? 'width' : 'height';
  16439. const isOriginSide = ['top', 'left'].includes(getSide(placement));
  16440. const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? (_middlewareData$offse = (_middlewareData$offse2 = middlewareData.offset) === null || _middlewareData$offse2 === void 0 ? void 0 : _middlewareData$offse2[crossAxis]) !== null && _middlewareData$offse !== void 0 ? _middlewareData$offse : 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis) + additionalFrameOffset[crossAxis];
  16441. const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : (_middlewareData$offse3 = (_middlewareData$offse4 = middlewareData.offset) === null || _middlewareData$offse4 === void 0 ? void 0 : _middlewareData$offse4[crossAxis]) !== null && _middlewareData$offse3 !== void 0 ? _middlewareData$offse3 : 0) - (isOriginSide ? computedOffset.crossAxis : 0) + additionalFrameOffset[crossAxis];
  16442. if (crossAxisCoord < limitMin) {
  16443. crossAxisCoord = limitMin;
  16444. } else if (crossAxisCoord > limitMax) {
  16445. crossAxisCoord = limitMax;
  16446. }
  16447. }
  16448. return {
  16449. [mainAxis]: mainAxisCoord,
  16450. [crossAxis]: crossAxisCoord
  16451. };
  16452. }
  16453. };
  16454. };
  16455. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/popover/index.js
  16456. /**
  16457. * External dependencies
  16458. */
  16459. // eslint-disable-next-line no-restricted-imports
  16460. /**
  16461. * WordPress dependencies
  16462. */
  16463. /**
  16464. * Internal dependencies
  16465. */
  16466. /**
  16467. * Name of slot in which popover should fill.
  16468. *
  16469. * @type {string}
  16470. */
  16471. const SLOT_NAME = 'Popover'; // An SVG displaying a triangle facing down, filled with a solid
  16472. // color and bordered in such a way to create an arrow-like effect.
  16473. // Keeping the SVG's viewbox squared simplify the arrow positioning
  16474. // calculations.
  16475. const ArrowTriangle = () => (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  16476. xmlns: "http://www.w3.org/2000/svg",
  16477. viewBox: `0 0 100 100`,
  16478. className: "components-popover__triangle",
  16479. role: "presentation"
  16480. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  16481. className: "components-popover__triangle-bg",
  16482. d: "M 0 0 L 50 50 L 100 0"
  16483. }), (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  16484. className: "components-popover__triangle-border",
  16485. d: "M 0 0 L 50 50 L 100 0",
  16486. vectorEffect: "non-scaling-stroke"
  16487. }));
  16488. const AnimatedWrapper = (0,external_wp_element_namespaceObject.forwardRef)((_ref, forwardedRef) => {
  16489. let {
  16490. style: receivedInlineStyles,
  16491. placement,
  16492. shouldAnimate = false,
  16493. ...props
  16494. } = _ref;
  16495. // When animating, animate only once (i.e. when the popover is opened), and
  16496. // do not animate on subsequent prop changes (as it conflicts with
  16497. // floating-ui's positioning updates).
  16498. const [hasAnimatedOnce, setHasAnimatedOnce] = (0,external_wp_element_namespaceObject.useState)(false);
  16499. const shouldReduceMotion = useReducedMotion();
  16500. const {
  16501. style: motionInlineStyles,
  16502. ...otherMotionProps
  16503. } = (0,external_wp_element_namespaceObject.useMemo)(() => placementToMotionAnimationProps(placement), [placement]);
  16504. const onAnimationComplete = (0,external_wp_element_namespaceObject.useCallback)(() => setHasAnimatedOnce(true), []);
  16505. const computedAnimationProps = shouldAnimate && !shouldReduceMotion ? {
  16506. style: { ...motionInlineStyles,
  16507. ...receivedInlineStyles
  16508. },
  16509. ...otherMotionProps,
  16510. onAnimationComplete,
  16511. animate: hasAnimatedOnce ? false : otherMotionProps.animate
  16512. } : {
  16513. animate: false,
  16514. style: receivedInlineStyles
  16515. };
  16516. return (0,external_wp_element_namespaceObject.createElement)(motion.div, extends_extends({}, computedAnimationProps, props, {
  16517. ref: forwardedRef
  16518. }));
  16519. });
  16520. const slotNameContext = (0,external_wp_element_namespaceObject.createContext)(undefined);
  16521. const UnforwardedPopover = (props, forwardedRef) => {
  16522. var _frameOffsetRef$curre, _frameOffsetRef$curre2, _frameOffsetRef$curre3, _frameOffsetRef$curre4;
  16523. const {
  16524. animate = true,
  16525. headerTitle,
  16526. onClose,
  16527. children,
  16528. className,
  16529. noArrow = true,
  16530. isAlternate,
  16531. position,
  16532. placement: placementProp = 'bottom-start',
  16533. offset: offsetProp = 0,
  16534. focusOnMount = 'firstElement',
  16535. anchor,
  16536. expandOnMobile,
  16537. onFocusOutside,
  16538. __unstableSlotName = SLOT_NAME,
  16539. flip = true,
  16540. resize = true,
  16541. shift = false,
  16542. // Deprecated props
  16543. __unstableForcePosition,
  16544. anchorRef,
  16545. anchorRect,
  16546. getAnchorRect,
  16547. // Rest
  16548. ...contentProps
  16549. } = props;
  16550. let computedFlipProp = flip;
  16551. let computedResizeProp = resize;
  16552. if (__unstableForcePosition !== undefined) {
  16553. external_wp_deprecated_default()('`__unstableForcePosition` prop wp.components.Popover', {
  16554. since: '6.1',
  16555. version: '6.3',
  16556. alternative: '`flip={ false }` and `resize={ false }`'
  16557. }); // Back-compat, set the `flip` and `resize` props
  16558. // to `false` to replicate `__unstableForcePosition`.
  16559. computedFlipProp = !__unstableForcePosition;
  16560. computedResizeProp = !__unstableForcePosition;
  16561. }
  16562. if (anchorRef !== undefined) {
  16563. external_wp_deprecated_default()('`anchorRef` prop in wp.components.Popover', {
  16564. since: '6.1',
  16565. alternative: '`anchor` prop'
  16566. });
  16567. }
  16568. if (anchorRect !== undefined) {
  16569. external_wp_deprecated_default()('`anchorRect` prop in wp.components.Popover', {
  16570. since: '6.1',
  16571. alternative: '`anchor` prop'
  16572. });
  16573. }
  16574. if (getAnchorRect !== undefined) {
  16575. external_wp_deprecated_default()('`getAnchorRect` prop in wp.components.Popover', {
  16576. since: '6.1',
  16577. alternative: '`anchor` prop'
  16578. });
  16579. }
  16580. const arrowRef = (0,external_wp_element_namespaceObject.useRef)(null);
  16581. const [fallbackReferenceElement, setFallbackReferenceElement] = (0,external_wp_element_namespaceObject.useState)(null);
  16582. const [referenceOwnerDocument, setReferenceOwnerDocument] = (0,external_wp_element_namespaceObject.useState)();
  16583. const anchorRefFallback = (0,external_wp_element_namespaceObject.useCallback)(node => {
  16584. setFallbackReferenceElement(node);
  16585. }, []);
  16586. const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
  16587. const isExpanded = expandOnMobile && isMobileViewport;
  16588. const hasArrow = !isExpanded && !noArrow;
  16589. const normalizedPlacementFromProps = position ? positionToPlacement(position) : placementProp;
  16590. /**
  16591. * Offsets the position of the popover when the anchor is inside an iframe.
  16592. *
  16593. * Store the offset in a ref, due to constraints with floating-ui:
  16594. * https://floating-ui.com/docs/react-dom#variables-inside-middleware-functions.
  16595. */
  16596. const frameOffsetRef = (0,external_wp_element_namespaceObject.useRef)(getFrameOffset(referenceOwnerDocument));
  16597. const middleware = [// Custom middleware which adjusts the popover's position by taking into
  16598. // account the offset of the anchor's iframe (if any) compared to the page.
  16599. {
  16600. name: 'frameOffset',
  16601. fn(_ref2) {
  16602. let {
  16603. x,
  16604. y
  16605. } = _ref2;
  16606. if (!frameOffsetRef.current) {
  16607. return {
  16608. x,
  16609. y
  16610. };
  16611. }
  16612. return {
  16613. x: x + frameOffsetRef.current.x,
  16614. y: y + frameOffsetRef.current.y,
  16615. data: {
  16616. // This will be used in the customLimitShift() function.
  16617. amount: frameOffsetRef.current
  16618. }
  16619. };
  16620. }
  16621. }, T(offsetProp), computedFlipProp ? b() : undefined, computedResizeProp ? k({
  16622. apply(sizeProps) {
  16623. var _refs$floating$curren;
  16624. const {
  16625. firstElementChild
  16626. } = (_refs$floating$curren = refs.floating.current) !== null && _refs$floating$curren !== void 0 ? _refs$floating$curren : {}; // Only HTMLElement instances have the `style` property.
  16627. if (!(firstElementChild instanceof HTMLElement)) return; // Reduce the height of the popover to the available space.
  16628. Object.assign(firstElementChild.style, {
  16629. maxHeight: `${sizeProps.availableHeight}px`,
  16630. overflow: 'auto'
  16631. });
  16632. }
  16633. }) : undefined, shift ? L({
  16634. crossAxis: true,
  16635. limiter: limitShift(),
  16636. padding: 1 // Necessary to avoid flickering at the edge of the viewport.
  16637. }) : undefined, arrow({
  16638. element: arrowRef
  16639. })].filter(m => m !== undefined);
  16640. const slotName = (0,external_wp_element_namespaceObject.useContext)(slotNameContext) || __unstableSlotName;
  16641. const slot = useSlot(slotName);
  16642. let onDialogClose;
  16643. if (onClose || onFocusOutside) {
  16644. onDialogClose = (type, event) => {
  16645. // Ideally the popover should have just a single onClose prop and
  16646. // not three props that potentially do the same thing.
  16647. if (type === 'focus-outside' && onFocusOutside) {
  16648. onFocusOutside(event);
  16649. } else if (onClose) {
  16650. onClose();
  16651. }
  16652. };
  16653. }
  16654. const [dialogRef, dialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({
  16655. focusOnMount,
  16656. __unstableOnClose: onDialogClose,
  16657. // @ts-expect-error The __unstableOnClose property needs to be deprecated first (see https://github.com/WordPress/gutenberg/pull/27675)
  16658. onClose: onDialogClose
  16659. });
  16660. const {
  16661. // Positioning coordinates
  16662. x,
  16663. y,
  16664. // Callback refs (not regular refs). This allows the position to be updated.
  16665. // when either elements change.
  16666. reference: referenceCallbackRef,
  16667. floating,
  16668. // Object with "regular" refs to both "reference" and "floating"
  16669. refs,
  16670. // Type of CSS position property to use (absolute or fixed)
  16671. strategy,
  16672. update,
  16673. placement: computedPlacement,
  16674. middlewareData: {
  16675. arrow: arrowData
  16676. }
  16677. } = useFloating({
  16678. placement: normalizedPlacementFromProps,
  16679. middleware,
  16680. whileElementsMounted: (referenceParam, floatingParam, updateParam) => z(referenceParam, floatingParam, updateParam, {
  16681. animationFrame: true
  16682. })
  16683. });
  16684. const arrowCallbackRef = (0,external_wp_element_namespaceObject.useCallback)(node => {
  16685. arrowRef.current = node;
  16686. update();
  16687. }, [update]); // When any of the possible anchor "sources" change,
  16688. // recompute the reference element (real or virtual) and its owner document.
  16689. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
  16690. const resultingReferenceOwnerDoc = getReferenceOwnerDocument({
  16691. anchor,
  16692. anchorRef,
  16693. anchorRect,
  16694. getAnchorRect,
  16695. fallbackReferenceElement,
  16696. fallbackDocument: document
  16697. });
  16698. const resultingReferenceElement = getReferenceElement({
  16699. anchor,
  16700. anchorRef,
  16701. anchorRect,
  16702. getAnchorRect,
  16703. fallbackReferenceElement
  16704. });
  16705. referenceCallbackRef(resultingReferenceElement);
  16706. setReferenceOwnerDocument(resultingReferenceOwnerDoc);
  16707. }, [anchor, anchorRef, anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.top, anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.bottom, anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.startContainer, anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current, anchorRect, getAnchorRect, fallbackReferenceElement, referenceCallbackRef]); // If the reference element is in a different ownerDocument (e.g. iFrame),
  16708. // we need to manually update the floating's position as the reference's owner
  16709. // document scrolls. Also update the frame offset if the view resizes.
  16710. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
  16711. var _refs$floating, _refs$floating$curren2, _referenceOwnerDocume;
  16712. if ( // Reference and root documents are the same.
  16713. referenceOwnerDocument === document || // Reference and floating are in the same document.
  16714. referenceOwnerDocument === (refs === null || refs === void 0 ? void 0 : (_refs$floating = refs.floating) === null || _refs$floating === void 0 ? void 0 : (_refs$floating$curren2 = _refs$floating.current) === null || _refs$floating$curren2 === void 0 ? void 0 : _refs$floating$curren2.ownerDocument) || // The reference's document has no view (i.e. window)
  16715. // or frame element (ie. it's not an iframe).
  16716. !(referenceOwnerDocument !== null && referenceOwnerDocument !== void 0 && (_referenceOwnerDocume = referenceOwnerDocument.defaultView) !== null && _referenceOwnerDocume !== void 0 && _referenceOwnerDocume.frameElement)) {
  16717. frameOffsetRef.current = undefined;
  16718. return;
  16719. }
  16720. const {
  16721. defaultView
  16722. } = referenceOwnerDocument;
  16723. const updateFrameOffset = () => {
  16724. frameOffsetRef.current = getFrameOffset(referenceOwnerDocument);
  16725. update();
  16726. };
  16727. defaultView.addEventListener('resize', updateFrameOffset);
  16728. updateFrameOffset();
  16729. return () => {
  16730. defaultView.removeEventListener('resize', updateFrameOffset);
  16731. };
  16732. }, [referenceOwnerDocument, update]);
  16733. const mergedFloatingRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([floating, dialogRef, forwardedRef]); // Disable reason: We care to capture the _bubbled_ events from inputs
  16734. // within popover as inferring close intent.
  16735. let content = // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
  16736. // eslint-disable-next-line jsx-a11y/no-static-element-interactions
  16737. (0,external_wp_element_namespaceObject.createElement)(AnimatedWrapper, extends_extends({
  16738. shouldAnimate: animate && !isExpanded,
  16739. placement: computedPlacement,
  16740. className: classnames_default()('components-popover', className, {
  16741. 'is-expanded': isExpanded,
  16742. 'is-alternate': isAlternate
  16743. })
  16744. }, contentProps, {
  16745. ref: mergedFloatingRef
  16746. }, dialogProps, {
  16747. tabIndex: -1,
  16748. style: isExpanded ? undefined : {
  16749. position: strategy,
  16750. left: Number.isNaN(x) ? 0 : x !== null && x !== void 0 ? x : undefined,
  16751. top: Number.isNaN(y) ? 0 : y !== null && y !== void 0 ? y : undefined
  16752. }
  16753. }), isExpanded && (0,external_wp_element_namespaceObject.createElement)(scroll_lock, null), isExpanded && (0,external_wp_element_namespaceObject.createElement)("div", {
  16754. className: "components-popover__header"
  16755. }, (0,external_wp_element_namespaceObject.createElement)("span", {
  16756. className: "components-popover__header-title"
  16757. }, headerTitle), (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  16758. className: "components-popover__close",
  16759. icon: library_close,
  16760. onClick: onClose
  16761. })), (0,external_wp_element_namespaceObject.createElement)("div", {
  16762. className: "components-popover__content"
  16763. }, children), hasArrow && (0,external_wp_element_namespaceObject.createElement)("div", {
  16764. ref: arrowCallbackRef,
  16765. className: ['components-popover__arrow', `is-${computedPlacement.split('-')[0]}`].join(' '),
  16766. style: {
  16767. left: typeof (arrowData === null || arrowData === void 0 ? void 0 : arrowData.x) !== 'undefined' && Number.isFinite(arrowData.x) ? `${arrowData.x + ((_frameOffsetRef$curre = (_frameOffsetRef$curre2 = frameOffsetRef.current) === null || _frameOffsetRef$curre2 === void 0 ? void 0 : _frameOffsetRef$curre2.x) !== null && _frameOffsetRef$curre !== void 0 ? _frameOffsetRef$curre : 0)}px` : '',
  16768. top: typeof (arrowData === null || arrowData === void 0 ? void 0 : arrowData.y) !== 'undefined' && Number.isFinite(arrowData.y) ? `${arrowData.y + ((_frameOffsetRef$curre3 = (_frameOffsetRef$curre4 = frameOffsetRef.current) === null || _frameOffsetRef$curre4 === void 0 ? void 0 : _frameOffsetRef$curre4.y) !== null && _frameOffsetRef$curre3 !== void 0 ? _frameOffsetRef$curre3 : 0)}px` : ''
  16769. }
  16770. }, (0,external_wp_element_namespaceObject.createElement)(ArrowTriangle, null)));
  16771. if (slot.ref) {
  16772. content = (0,external_wp_element_namespaceObject.createElement)(slot_fill_Fill, {
  16773. name: slotName
  16774. }, content);
  16775. }
  16776. if (anchorRef || anchorRect || anchor) {
  16777. return content;
  16778. }
  16779. return (0,external_wp_element_namespaceObject.createElement)("span", {
  16780. ref: anchorRefFallback
  16781. }, content);
  16782. };
  16783. /**
  16784. * `Popover` renders its content in a floating modal. If no explicit anchor is passed via props, it anchors to its parent element by default.
  16785. *
  16786. * ```jsx
  16787. * import { Button, Popover } from '@wordpress/components';
  16788. * import { useState } from '@wordpress/element';
  16789. *
  16790. * const MyPopover = () => {
  16791. * const [ isVisible, setIsVisible ] = useState( false );
  16792. * const toggleVisible = () => {
  16793. * setIsVisible( ( state ) => ! state );
  16794. * };
  16795. *
  16796. * return (
  16797. * <Button variant="secondary" onClick={ toggleVisible }>
  16798. * Toggle Popover!
  16799. * { isVisible && <Popover>Popover is toggled!</Popover> }
  16800. * </Button>
  16801. * );
  16802. * };
  16803. * ```
  16804. *
  16805. */
  16806. const Popover = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedPopover);
  16807. function PopoverSlot(_ref3, ref) {
  16808. let {
  16809. name = SLOT_NAME
  16810. } = _ref3;
  16811. return (0,external_wp_element_namespaceObject.createElement)(slot_fill_Slot // @ts-expect-error Need to type `SlotFill`
  16812. , {
  16813. bubblesVirtually: true,
  16814. name: name,
  16815. className: "popover-slot",
  16816. ref: ref
  16817. });
  16818. } // @ts-expect-error For Legacy Reasons
  16819. Popover.Slot = (0,external_wp_element_namespaceObject.forwardRef)(PopoverSlot); // @ts-expect-error For Legacy Reasons
  16820. Popover.__unstableSlotNameProvider = slotNameContext.Provider;
  16821. /* harmony default export */ var popover = (Popover);
  16822. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/shortcut/index.js
  16823. /**
  16824. * Internal dependencies
  16825. */
  16826. function Shortcut(props) {
  16827. const {
  16828. shortcut,
  16829. className
  16830. } = props;
  16831. if (!shortcut) {
  16832. return null;
  16833. }
  16834. let displayText;
  16835. let ariaLabel;
  16836. if (typeof shortcut === 'string') {
  16837. displayText = shortcut;
  16838. }
  16839. if (shortcut !== null && typeof shortcut === 'object') {
  16840. displayText = shortcut.display;
  16841. ariaLabel = shortcut.ariaLabel;
  16842. }
  16843. return (0,external_wp_element_namespaceObject.createElement)("span", {
  16844. className: className,
  16845. "aria-label": ariaLabel
  16846. }, displayText);
  16847. }
  16848. /* harmony default export */ var build_module_shortcut = (Shortcut);
  16849. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tooltip/index.js
  16850. // @ts-nocheck
  16851. /**
  16852. * WordPress dependencies
  16853. */
  16854. /**
  16855. * Internal dependencies
  16856. */
  16857. /**
  16858. * Time over children to wait before showing tooltip
  16859. *
  16860. * @type {number}
  16861. */
  16862. const TOOLTIP_DELAY = 700;
  16863. const eventCatcher = (0,external_wp_element_namespaceObject.createElement)("div", {
  16864. className: "event-catcher"
  16865. });
  16866. const getDisabledElement = _ref => {
  16867. let {
  16868. eventHandlers,
  16869. child,
  16870. childrenWithPopover,
  16871. mergedRefs
  16872. } = _ref;
  16873. return (0,external_wp_element_namespaceObject.cloneElement)((0,external_wp_element_namespaceObject.createElement)("span", {
  16874. className: "disabled-element-wrapper"
  16875. }, (0,external_wp_element_namespaceObject.cloneElement)(eventCatcher, eventHandlers), (0,external_wp_element_namespaceObject.cloneElement)(child, {
  16876. children: childrenWithPopover,
  16877. ref: mergedRefs
  16878. })), { ...eventHandlers
  16879. });
  16880. };
  16881. const getRegularElement = _ref2 => {
  16882. let {
  16883. child,
  16884. eventHandlers,
  16885. childrenWithPopover,
  16886. mergedRefs
  16887. } = _ref2;
  16888. return (0,external_wp_element_namespaceObject.cloneElement)(child, { ...eventHandlers,
  16889. children: childrenWithPopover,
  16890. ref: mergedRefs
  16891. });
  16892. };
  16893. const addPopoverToGrandchildren = _ref3 => {
  16894. let {
  16895. anchor,
  16896. grandchildren,
  16897. isOver,
  16898. offset,
  16899. position,
  16900. shortcut,
  16901. text
  16902. } = _ref3;
  16903. return (0,external_wp_element_namespaceObject.concatChildren)(grandchildren, isOver && (0,external_wp_element_namespaceObject.createElement)(popover, {
  16904. focusOnMount: false,
  16905. position: position,
  16906. className: "components-tooltip",
  16907. "aria-hidden": "true",
  16908. animate: false,
  16909. offset: offset,
  16910. anchor: anchor,
  16911. shift: true
  16912. }, text, (0,external_wp_element_namespaceObject.createElement)(build_module_shortcut, {
  16913. className: "components-tooltip__shortcut",
  16914. shortcut: shortcut
  16915. })));
  16916. };
  16917. const emitToChild = (children, eventName, event) => {
  16918. if (external_wp_element_namespaceObject.Children.count(children) !== 1) {
  16919. return;
  16920. }
  16921. const child = external_wp_element_namespaceObject.Children.only(children); // If the underlying element is disabled, do not emit the event.
  16922. if (child.props.disabled) {
  16923. return;
  16924. }
  16925. if (typeof child.props[eventName] === 'function') {
  16926. child.props[eventName](event);
  16927. }
  16928. };
  16929. function Tooltip(props) {
  16930. var _Children$toArray$;
  16931. const {
  16932. children,
  16933. position = 'bottom middle',
  16934. text,
  16935. shortcut,
  16936. delay = TOOLTIP_DELAY
  16937. } = props;
  16938. /**
  16939. * Whether a mouse is currently pressed, used in determining whether
  16940. * to handle a focus event as displaying the tooltip immediately.
  16941. *
  16942. * @type {boolean}
  16943. */
  16944. const [isMouseDown, setIsMouseDown] = (0,external_wp_element_namespaceObject.useState)(false);
  16945. const [isOver, setIsOver] = (0,external_wp_element_namespaceObject.useState)(false);
  16946. const delayedSetIsOver = (0,external_wp_compose_namespaceObject.useDebounce)(setIsOver, delay); // Using internal state (instead of a ref) for the popover anchor to make sure
  16947. // that the component re-renders when the anchor updates.
  16948. const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); // Create a reference to the Tooltip's child, to be passed to the Popover
  16949. // so that the Tooltip can be correctly positioned. Also, merge with the
  16950. // existing ref for the first child, so that its ref is preserved.
  16951. const existingChildRef = (_Children$toArray$ = external_wp_element_namespaceObject.Children.toArray(children)[0]) === null || _Children$toArray$ === void 0 ? void 0 : _Children$toArray$.ref;
  16952. const mergedChildRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([setPopoverAnchor, existingChildRef]);
  16953. const createMouseDown = event => {
  16954. // In firefox, the mouse down event is also fired when the select
  16955. // list is chosen.
  16956. // Cancel further processing because re-rendering of child components
  16957. // causes onChange to be triggered with the old value.
  16958. // See https://github.com/WordPress/gutenberg/pull/42483
  16959. if (event.target.tagName === 'OPTION') {
  16960. return;
  16961. } // Preserve original child callback behavior.
  16962. emitToChild(children, 'onMouseDown', event); // On mouse down, the next `mouseup` should revert the value of the
  16963. // instance property and remove its own event handler. The bind is
  16964. // made on the document since the `mouseup` might not occur within
  16965. // the bounds of the element.
  16966. document.addEventListener('mouseup', cancelIsMouseDown);
  16967. setIsMouseDown(true);
  16968. };
  16969. const createMouseUp = event => {
  16970. // In firefox, the mouse up event is also fired when the select
  16971. // list is chosen.
  16972. // Cancel further processing because re-rendering of child components
  16973. // causes onChange to be triggered with the old value.
  16974. // See https://github.com/WordPress/gutenberg/pull/42483
  16975. if (event.target.tagName === 'OPTION') {
  16976. return;
  16977. }
  16978. emitToChild(children, 'onMouseUp', event);
  16979. document.removeEventListener('mouseup', cancelIsMouseDown);
  16980. setIsMouseDown(false);
  16981. };
  16982. const createMouseEvent = type => {
  16983. if (type === 'mouseUp') return createMouseUp;
  16984. if (type === 'mouseDown') return createMouseDown;
  16985. };
  16986. /**
  16987. * Prebound `isInMouseDown` handler, created as a constant reference to
  16988. * assure ability to remove in component unmount.
  16989. *
  16990. * @type {Function}
  16991. */
  16992. const cancelIsMouseDown = createMouseEvent('mouseUp');
  16993. const createToggleIsOver = (eventName, isDelayed) => {
  16994. return event => {
  16995. // Preserve original child callback behavior.
  16996. emitToChild(children, eventName, event); // Mouse events behave unreliably in React for disabled elements,
  16997. // firing on mouseenter but not mouseleave. Further, the default
  16998. // behavior for disabled elements in some browsers is to ignore
  16999. // mouse events. Don't bother trying to handle them.
  17000. //
  17001. // See: https://github.com/facebook/react/issues/4251
  17002. if (event.currentTarget.disabled) {
  17003. return;
  17004. } // A focus event will occur as a result of a mouse click, but it
  17005. // should be disambiguated between interacting with the button and
  17006. // using an explicit focus shift as a cue to display the tooltip.
  17007. if ('focus' === event.type && isMouseDown) {
  17008. return;
  17009. } // Needed in case unsetting is over while delayed set pending, i.e.
  17010. // quickly blur/mouseleave before delayedSetIsOver is called.
  17011. delayedSetIsOver.cancel();
  17012. const _isOver = ['focus', 'mouseenter'].includes(event.type);
  17013. if (_isOver === isOver) {
  17014. return;
  17015. }
  17016. if (isDelayed) {
  17017. delayedSetIsOver(_isOver);
  17018. } else {
  17019. setIsOver(_isOver);
  17020. }
  17021. };
  17022. };
  17023. const clearOnUnmount = () => {
  17024. delayedSetIsOver.cancel();
  17025. document.removeEventListener('mouseup', cancelIsMouseDown);
  17026. };
  17027. (0,external_wp_element_namespaceObject.useEffect)(() => clearOnUnmount, []);
  17028. if (external_wp_element_namespaceObject.Children.count(children) !== 1) {
  17029. if (false) {}
  17030. return children;
  17031. }
  17032. const eventHandlers = {
  17033. onMouseEnter: createToggleIsOver('onMouseEnter', true),
  17034. onMouseLeave: createToggleIsOver('onMouseLeave'),
  17035. onClick: createToggleIsOver('onClick'),
  17036. onFocus: createToggleIsOver('onFocus'),
  17037. onBlur: createToggleIsOver('onBlur'),
  17038. onMouseDown: createMouseEvent('mouseDown')
  17039. };
  17040. const child = external_wp_element_namespaceObject.Children.only(children);
  17041. const {
  17042. children: grandchildren,
  17043. disabled
  17044. } = child.props;
  17045. const getElementWithPopover = disabled ? getDisabledElement : getRegularElement;
  17046. const popoverData = {
  17047. anchor: popoverAnchor,
  17048. isOver,
  17049. offset: 4,
  17050. position,
  17051. shortcut,
  17052. text
  17053. };
  17054. const childrenWithPopover = addPopoverToGrandchildren({
  17055. grandchildren,
  17056. ...popoverData
  17057. });
  17058. return getElementWithPopover({
  17059. child,
  17060. eventHandlers,
  17061. childrenWithPopover,
  17062. mergedRefs: mergedChildRefs
  17063. });
  17064. }
  17065. /* harmony default export */ var tooltip = (Tooltip);
  17066. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/alignment-matrix-control/utils.js
  17067. /**
  17068. * WordPress dependencies
  17069. */
  17070. 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)
  17071. const ALIGNMENT_LABEL = {
  17072. 'top left': (0,external_wp_i18n_namespaceObject.__)('Top Left'),
  17073. 'top center': (0,external_wp_i18n_namespaceObject.__)('Top Center'),
  17074. 'top right': (0,external_wp_i18n_namespaceObject.__)('Top Right'),
  17075. 'center left': (0,external_wp_i18n_namespaceObject.__)('Center Left'),
  17076. 'center center': (0,external_wp_i18n_namespaceObject.__)('Center Center'),
  17077. 'center right': (0,external_wp_i18n_namespaceObject.__)('Center Right'),
  17078. 'bottom left': (0,external_wp_i18n_namespaceObject.__)('Bottom Left'),
  17079. 'bottom center': (0,external_wp_i18n_namespaceObject.__)('Bottom Center'),
  17080. 'bottom right': (0,external_wp_i18n_namespaceObject.__)('Bottom Right')
  17081. }; // Transforms GRID into a flat Array of values.
  17082. const ALIGNMENTS = GRID.flat();
  17083. /**
  17084. * Parses and transforms an incoming value to better match the alignment values
  17085. *
  17086. * @param {string} value An alignment value to parse.
  17087. *
  17088. * @return {string} The parsed value.
  17089. */
  17090. function transformValue(value) {
  17091. const nextValue = value === 'center' ? 'center center' : value;
  17092. return nextValue.replace('-', ' ');
  17093. }
  17094. /**
  17095. * Creates an item ID based on a prefix ID and an alignment value.
  17096. *
  17097. * @param {string} prefixId An ID to prefix.
  17098. * @param {string} value An alignment value.
  17099. *
  17100. * @return {string} The item id.
  17101. */
  17102. function getItemId(prefixId, value) {
  17103. const valueId = transformValue(value).replace(' ', '-');
  17104. return `${prefixId}-${valueId}`;
  17105. }
  17106. /**
  17107. * Retrieves the alignment index from a value.
  17108. *
  17109. * @param {string} alignment Value to check.
  17110. *
  17111. * @return {number} The index of a matching alignment.
  17112. */
  17113. function getAlignmentIndex() {
  17114. let alignment = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'center';
  17115. const item = transformValue(alignment).replace('-', ' ');
  17116. const index = ALIGNMENTS.indexOf(item);
  17117. return index > -1 ? index : undefined;
  17118. }
  17119. // EXTERNAL MODULE: ./node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js
  17120. var hoist_non_react_statics_cjs = __webpack_require__(1281);
  17121. ;// CONCATENATED MODULE: ./node_modules/@emotion/react/dist/emotion-react.browser.esm.js
  17122. var pkg = {
  17123. name: "@emotion/react",
  17124. version: "11.10.5",
  17125. main: "dist/emotion-react.cjs.js",
  17126. module: "dist/emotion-react.esm.js",
  17127. browser: {
  17128. "./dist/emotion-react.esm.js": "./dist/emotion-react.browser.esm.js"
  17129. },
  17130. exports: {
  17131. ".": {
  17132. module: {
  17133. worker: "./dist/emotion-react.worker.esm.js",
  17134. browser: "./dist/emotion-react.browser.esm.js",
  17135. "default": "./dist/emotion-react.esm.js"
  17136. },
  17137. "default": "./dist/emotion-react.cjs.js"
  17138. },
  17139. "./jsx-runtime": {
  17140. module: {
  17141. worker: "./jsx-runtime/dist/emotion-react-jsx-runtime.worker.esm.js",
  17142. browser: "./jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js",
  17143. "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.esm.js"
  17144. },
  17145. "default": "./jsx-runtime/dist/emotion-react-jsx-runtime.cjs.js"
  17146. },
  17147. "./_isolated-hnrs": {
  17148. module: {
  17149. worker: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.worker.esm.js",
  17150. browser: "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.browser.esm.js",
  17151. "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.esm.js"
  17152. },
  17153. "default": "./_isolated-hnrs/dist/emotion-react-_isolated-hnrs.cjs.js"
  17154. },
  17155. "./jsx-dev-runtime": {
  17156. module: {
  17157. worker: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.worker.esm.js",
  17158. browser: "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.browser.esm.js",
  17159. "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.esm.js"
  17160. },
  17161. "default": "./jsx-dev-runtime/dist/emotion-react-jsx-dev-runtime.cjs.js"
  17162. },
  17163. "./package.json": "./package.json",
  17164. "./types/css-prop": "./types/css-prop.d.ts",
  17165. "./macro": "./macro.js"
  17166. },
  17167. types: "types/index.d.ts",
  17168. files: [
  17169. "src",
  17170. "dist",
  17171. "jsx-runtime",
  17172. "jsx-dev-runtime",
  17173. "_isolated-hnrs",
  17174. "types/*.d.ts",
  17175. "macro.js",
  17176. "macro.d.ts",
  17177. "macro.js.flow"
  17178. ],
  17179. sideEffects: false,
  17180. author: "Emotion Contributors",
  17181. license: "MIT",
  17182. scripts: {
  17183. "test:typescript": "dtslint types"
  17184. },
  17185. dependencies: {
  17186. "@babel/runtime": "^7.18.3",
  17187. "@emotion/babel-plugin": "^11.10.5",
  17188. "@emotion/cache": "^11.10.5",
  17189. "@emotion/serialize": "^1.1.1",
  17190. "@emotion/use-insertion-effect-with-fallbacks": "^1.0.0",
  17191. "@emotion/utils": "^1.2.0",
  17192. "@emotion/weak-memoize": "^0.3.0",
  17193. "hoist-non-react-statics": "^3.3.1"
  17194. },
  17195. peerDependencies: {
  17196. "@babel/core": "^7.0.0",
  17197. react: ">=16.8.0"
  17198. },
  17199. peerDependenciesMeta: {
  17200. "@babel/core": {
  17201. optional: true
  17202. },
  17203. "@types/react": {
  17204. optional: true
  17205. }
  17206. },
  17207. devDependencies: {
  17208. "@babel/core": "^7.18.5",
  17209. "@definitelytyped/dtslint": "0.0.112",
  17210. "@emotion/css": "11.10.5",
  17211. "@emotion/css-prettifier": "1.1.1",
  17212. "@emotion/server": "11.10.0",
  17213. "@emotion/styled": "11.10.5",
  17214. "html-tag-names": "^1.1.2",
  17215. react: "16.14.0",
  17216. "svg-tag-names": "^1.1.1",
  17217. typescript: "^4.5.5"
  17218. },
  17219. repository: "https://github.com/emotion-js/emotion/tree/main/packages/react",
  17220. publishConfig: {
  17221. access: "public"
  17222. },
  17223. "umd:main": "dist/emotion-react.umd.min.js",
  17224. preconstruct: {
  17225. entrypoints: [
  17226. "./index.js",
  17227. "./jsx-runtime.js",
  17228. "./jsx-dev-runtime.js",
  17229. "./_isolated-hnrs.js"
  17230. ],
  17231. umdName: "emotionReact",
  17232. exports: {
  17233. envConditions: [
  17234. "browser",
  17235. "worker"
  17236. ],
  17237. extra: {
  17238. "./types/css-prop": "./types/css-prop.d.ts",
  17239. "./macro": "./macro.js"
  17240. }
  17241. }
  17242. }
  17243. };
  17244. var jsx = function jsx(type, props) {
  17245. var args = arguments;
  17246. if (props == null || !hasOwnProperty.call(props, 'css')) {
  17247. // $FlowFixMe
  17248. return createElement.apply(undefined, args);
  17249. }
  17250. var argsLength = args.length;
  17251. var createElementArgArray = new Array(argsLength);
  17252. createElementArgArray[0] = Emotion;
  17253. createElementArgArray[1] = createEmotionProps(type, props);
  17254. for (var i = 2; i < argsLength; i++) {
  17255. createElementArgArray[i] = args[i];
  17256. } // $FlowFixMe
  17257. return createElement.apply(null, createElementArgArray);
  17258. };
  17259. var warnedAboutCssPropForGlobal = false; // maintain place over rerenders.
  17260. // initial render from browser, insertBefore context.sheet.tags[0] or if a style hasn't been inserted there yet, appendChild
  17261. // initial client-side render from SSR, use place of hydrating tag
  17262. var Global = /* #__PURE__ */(/* unused pure expression or super */ null && (withEmotionCache(function (props, cache) {
  17263. if (false) {}
  17264. var styles = props.styles;
  17265. var serialized = serializeStyles([styles], undefined, useContext(ThemeContext));
  17266. // but it is based on a constant that will never change at runtime
  17267. // it's effectively like having two implementations and switching them out
  17268. // so it's not actually breaking anything
  17269. var sheetRef = useRef();
  17270. useInsertionEffectWithLayoutFallback(function () {
  17271. var key = cache.key + "-global"; // use case of https://github.com/emotion-js/emotion/issues/2675
  17272. var sheet = new cache.sheet.constructor({
  17273. key: key,
  17274. nonce: cache.sheet.nonce,
  17275. container: cache.sheet.container,
  17276. speedy: cache.sheet.isSpeedy
  17277. });
  17278. var rehydrating = false; // $FlowFixMe
  17279. var node = document.querySelector("style[data-emotion=\"" + key + " " + serialized.name + "\"]");
  17280. if (cache.sheet.tags.length) {
  17281. sheet.before = cache.sheet.tags[0];
  17282. }
  17283. if (node !== null) {
  17284. rehydrating = true; // clear the hash so this node won't be recognizable as rehydratable by other <Global/>s
  17285. node.setAttribute('data-emotion', key);
  17286. sheet.hydrate([node]);
  17287. }
  17288. sheetRef.current = [sheet, rehydrating];
  17289. return function () {
  17290. sheet.flush();
  17291. };
  17292. }, [cache]);
  17293. useInsertionEffectWithLayoutFallback(function () {
  17294. var sheetRefCurrent = sheetRef.current;
  17295. var sheet = sheetRefCurrent[0],
  17296. rehydrating = sheetRefCurrent[1];
  17297. if (rehydrating) {
  17298. sheetRefCurrent[1] = false;
  17299. return;
  17300. }
  17301. if (serialized.next !== undefined) {
  17302. // insert keyframes
  17303. insertStyles(cache, serialized.next, true);
  17304. }
  17305. if (sheet.tags.length) {
  17306. // if this doesn't exist then it will be null so the style element will be appended
  17307. var element = sheet.tags[sheet.tags.length - 1].nextElementSibling;
  17308. sheet.before = element;
  17309. sheet.flush();
  17310. }
  17311. cache.insert("", serialized, sheet, false);
  17312. }, [cache, serialized.name]);
  17313. return null;
  17314. })));
  17315. if (false) {}
  17316. function emotion_react_browser_esm_css() {
  17317. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  17318. args[_key] = arguments[_key];
  17319. }
  17320. return emotion_serialize_browser_esm_serializeStyles(args);
  17321. }
  17322. var emotion_react_browser_esm_keyframes = function keyframes() {
  17323. var insertable = emotion_react_browser_esm_css.apply(void 0, arguments);
  17324. var name = "animation-" + insertable.name; // $FlowFixMe
  17325. return {
  17326. name: name,
  17327. styles: "@keyframes " + name + "{" + insertable.styles + "}",
  17328. anim: 1,
  17329. toString: function toString() {
  17330. return "_EMO_" + this.name + "_" + this.styles + "_EMO_";
  17331. }
  17332. };
  17333. };
  17334. var emotion_react_browser_esm_classnames = function classnames(args) {
  17335. var len = args.length;
  17336. var i = 0;
  17337. var cls = '';
  17338. for (; i < len; i++) {
  17339. var arg = args[i];
  17340. if (arg == null) continue;
  17341. var toAdd = void 0;
  17342. switch (typeof arg) {
  17343. case 'boolean':
  17344. break;
  17345. case 'object':
  17346. {
  17347. if (Array.isArray(arg)) {
  17348. toAdd = classnames(arg);
  17349. } else {
  17350. if (false) {}
  17351. toAdd = '';
  17352. for (var k in arg) {
  17353. if (arg[k] && k) {
  17354. toAdd && (toAdd += ' ');
  17355. toAdd += k;
  17356. }
  17357. }
  17358. }
  17359. break;
  17360. }
  17361. default:
  17362. {
  17363. toAdd = arg;
  17364. }
  17365. }
  17366. if (toAdd) {
  17367. cls && (cls += ' ');
  17368. cls += toAdd;
  17369. }
  17370. }
  17371. return cls;
  17372. };
  17373. function emotion_react_browser_esm_merge(registered, css, className) {
  17374. var registeredStyles = [];
  17375. var rawClassName = getRegisteredStyles(registered, registeredStyles, className);
  17376. if (registeredStyles.length < 2) {
  17377. return className;
  17378. }
  17379. return rawClassName + css(registeredStyles);
  17380. }
  17381. var emotion_react_browser_esm_Insertion = function Insertion(_ref) {
  17382. var cache = _ref.cache,
  17383. serializedArr = _ref.serializedArr;
  17384. var rules = useInsertionEffectAlwaysWithSyncFallback(function () {
  17385. for (var i = 0; i < serializedArr.length; i++) {
  17386. var res = insertStyles(cache, serializedArr[i], false);
  17387. }
  17388. });
  17389. return null;
  17390. };
  17391. var ClassNames = /* #__PURE__ */(/* unused pure expression or super */ null && (withEmotionCache(function (props, cache) {
  17392. var hasRendered = false;
  17393. var serializedArr = [];
  17394. var css = function css() {
  17395. if (hasRendered && "production" !== 'production') {}
  17396. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  17397. args[_key] = arguments[_key];
  17398. }
  17399. var serialized = serializeStyles(args, cache.registered);
  17400. serializedArr.push(serialized); // registration has to happen here as the result of this might get consumed by `cx`
  17401. registerStyles(cache, serialized, false);
  17402. return cache.key + "-" + serialized.name;
  17403. };
  17404. var cx = function cx() {
  17405. if (hasRendered && "production" !== 'production') {}
  17406. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  17407. args[_key2] = arguments[_key2];
  17408. }
  17409. return emotion_react_browser_esm_merge(cache.registered, css, emotion_react_browser_esm_classnames(args));
  17410. };
  17411. var content = {
  17412. css: css,
  17413. cx: cx,
  17414. theme: useContext(ThemeContext)
  17415. };
  17416. var ele = props.children(content);
  17417. hasRendered = true;
  17418. return /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(emotion_react_browser_esm_Insertion, {
  17419. cache: cache,
  17420. serializedArr: serializedArr
  17421. }), ele);
  17422. })));
  17423. if (false) {}
  17424. if (false) { var globalKey, globalContext, isTestEnv, emotion_react_browser_esm_isBrowser; }
  17425. ;// CONCATENATED MODULE: ./node_modules/colord/index.mjs
  17426. var colord_r={grad:.9,turn:360,rad:360/(2*Math.PI)},colord_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},colord_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,colord_s=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},colord_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}},colord_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}},colord_g=function(r){return{h:colord_u(r.h),s:colord_e(r.s,0,100),l:colord_e(r.l,0,100),a:colord_e(r.a)}},colord_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)}},colord_f=function(r){return colord_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},colord_c=function(r){return{h:(t=colord_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},colord_l=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,colord_p=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,colord_v=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,colord_m=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,colord_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=colord_v.exec(r)||colord_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=colord_l.exec(t)||colord_p.exec(t);if(!n)return null;var e,u,a=colord_g({h:(e=n[1],u=n[2],void 0===u&&(u="deg"),Number(e)*(colord_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 colord_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 colord_t(n)&&colord_t(e)&&colord_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(!colord_t(n)||!colord_t(e)||!colord_t(u))return null;var i=colord_g({h:Number(n),s:Number(e),l:Number(u),a:Number(o)});return colord_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(!colord_t(n)||!colord_t(a)||!colord_t(o))return null;var h=function(r){return{h:colord_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 colord_b(h)},"hsv"]]},colord_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]},colord_x=function(r){return"string"==typeof r?colord_N(r.trim(),colord_y.string):"object"==typeof r&&null!==r?colord_N(r,colord_y.object):[null,void 0]},I=function(r){return colord_x(r)[1]},M=function(r,t){var n=colord_c(r);return{h:n.h,s:colord_e(n.s+100*t,0,100),l:n.l,a:n.a}},colord_H=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},$=function(r,t){var n=colord_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=colord_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(colord_H(this.rgba),2)},r.prototype.isDark=function(){return colord_H(this.rgba)<.5},r.prototype.isLight=function(){return colord_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?colord_s(colord_n(255*a)):"","#"+colord_s(t)+colord_s(e)+colord_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 colord_d(colord_c(this.rgba))},r.prototype.toHslString=function(){return r=colord_d(colord_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=colord_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 colord_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),colord_w(M(this.rgba,r))},r.prototype.desaturate=function(r){return void 0===r&&(r=.1),colord_w(M(this.rgba,-r))},r.prototype.grayscale=function(){return colord_w(M(this.rgba,-1))},r.prototype.lighten=function(r){return void 0===r&&(r=.1),colord_w($(this.rgba,r))},r.prototype.darken=function(r){return void 0===r&&(r=.1),colord_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?colord_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=colord_c(this.rgba);return"number"==typeof r?colord_w({h:r,s:t.s,l:t.l,a:t.a}):colord_n(t.h)},r.prototype.isEqual=function(r){return this.toHex()===colord_w(r).toHex()},r}(),colord_w=function(r){return r instanceof j?r:new j(r)},colord_S=[],colord_k=function(r){r.forEach(function(r){colord_S.indexOf(r)<0&&(r(j,colord_y),colord_S.push(r))})},colord_E=function(){return new j({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})};
  17427. ;// CONCATENATED MODULE: ./node_modules/colord/plugins/names.mjs
  17428. /* harmony default export */ function plugins_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"])}
  17429. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/colors.js
  17430. /**
  17431. * External dependencies
  17432. */
  17433. colord_k([plugins_names]);
  17434. /**
  17435. * Generating a CSS compliant rgba() color value.
  17436. *
  17437. * @param {string} hexValue The hex value to convert to rgba().
  17438. * @param {number} alpha The alpha value for opacity.
  17439. * @return {string} The converted rgba() color value.
  17440. *
  17441. * @example
  17442. * rgba( '#000000', 0.5 )
  17443. * // rgba(0, 0, 0, 0.5)
  17444. */
  17445. function colors_rgba() {
  17446. let hexValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  17447. let alpha = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
  17448. return colord_w(hexValue).alpha(alpha).toRgbString();
  17449. }
  17450. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/colors-values.js
  17451. /**
  17452. * Internal dependencies
  17453. */
  17454. const white = '#fff'; // Matches the grays in @wordpress/base-styles
  17455. const GRAY = {
  17456. 900: '#1e1e1e',
  17457. 800: '#2f2f2f',
  17458. /** Meets 4.6:1 text contrast against white. */
  17459. 700: '#757575',
  17460. /** Meets 3:1 UI or large text contrast against white. */
  17461. 600: '#949494',
  17462. 400: '#ccc',
  17463. /** Used for most borders. */
  17464. 300: '#ddd',
  17465. /** Used sparingly for light borders. */
  17466. 200: '#e0e0e0',
  17467. /** Used for light gray backgrounds. */
  17468. 100: '#f0f0f0'
  17469. }; // Matches @wordpress/base-styles
  17470. const ALERT = {
  17471. yellow: '#f0b849',
  17472. red: '#d94f4f',
  17473. green: '#4ab866'
  17474. }; // Matches @wordpress/base-styles
  17475. const ADMIN = {
  17476. theme: 'var( --wp-admin-theme-color, #007cba)',
  17477. themeDark10: 'var( --wp-admin-theme-color-darker-10, #006ba1)'
  17478. };
  17479. const UI = {
  17480. theme: ADMIN.theme,
  17481. background: white,
  17482. backgroundDisabled: GRAY[100],
  17483. border: GRAY[700],
  17484. borderHover: GRAY[700],
  17485. borderFocus: ADMIN.themeDark10,
  17486. borderDisabled: GRAY[400],
  17487. textDisabled: GRAY[600],
  17488. textDark: white,
  17489. // Matches @wordpress/base-styles
  17490. darkGrayPlaceholder: colors_rgba(GRAY[900], 0.62),
  17491. lightGrayPlaceholder: colors_rgba(white, 0.65)
  17492. };
  17493. const COLORS = Object.freeze({
  17494. /**
  17495. * The main gray color object.
  17496. */
  17497. gray: GRAY,
  17498. white,
  17499. alert: ALERT,
  17500. ui: UI
  17501. });
  17502. /* harmony default export */ var colors_values = ((/* unused pure expression or super */ null && (COLORS)));
  17503. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/reduce-motion.js
  17504. /**
  17505. * Allows users to opt-out of animations via OS-level preferences.
  17506. *
  17507. * @param {'transition' | 'animation' | string} [prop='transition'] CSS Property name
  17508. * @return {string} Generated CSS code for the reduced style
  17509. */
  17510. function reduceMotion() {
  17511. let prop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'transition';
  17512. let style;
  17513. switch (prop) {
  17514. case 'transition':
  17515. style = 'transition-duration: 0ms;';
  17516. break;
  17517. case 'animation':
  17518. style = 'animation-duration: 1ms;';
  17519. break;
  17520. default:
  17521. style = `
  17522. animation-duration: 1ms;
  17523. transition-duration: 0ms;
  17524. `;
  17525. }
  17526. return `
  17527. @media ( prefers-reduced-motion: reduce ) {
  17528. ${style};
  17529. }
  17530. `;
  17531. }
  17532. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js
  17533. 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)."; }
  17534. /**
  17535. * External dependencies
  17536. */
  17537. /**
  17538. * Internal dependencies
  17539. */
  17540. var _ref = true ? {
  17541. name: "93uojk",
  17542. styles: "border-radius:2px;box-sizing:border-box;direction:ltr;display:grid;grid-template-columns:repeat( 3, 1fr );outline:none"
  17543. } : 0;
  17544. const rootBase = () => {
  17545. return _ref;
  17546. };
  17547. const rootSize = _ref2 => {
  17548. let {
  17549. size = 92
  17550. } = _ref2;
  17551. return /*#__PURE__*/emotion_react_browser_esm_css("grid-template-rows:repeat( 3, calc( ", size, "px / 3 ) );width:", size, "px;" + ( true ? "" : 0), true ? "" : 0);
  17552. };
  17553. const Root = emotion_styled_base_browser_esm("div", true ? {
  17554. target: "e1od1u4s3"
  17555. } : 0)(rootBase, ";border:1px solid transparent;cursor:pointer;grid-template-columns:auto;", rootSize, ";" + ( true ? "" : 0));
  17556. const Row = emotion_styled_base_browser_esm("div", true ? {
  17557. target: "e1od1u4s2"
  17558. } : 0)( true ? {
  17559. name: "1x5gbbj",
  17560. styles: "box-sizing:border-box;display:grid;grid-template-columns:repeat( 3, 1fr )"
  17561. } : 0);
  17562. const pointActive = _ref3 => {
  17563. let {
  17564. isActive
  17565. } = _ref3;
  17566. const boxShadow = isActive ? `0 0 0 2px ${COLORS.gray[900]}` : null;
  17567. const pointColor = isActive ? COLORS.gray[900] : COLORS.gray[400];
  17568. const pointColorHover = isActive ? COLORS.gray[900] : COLORS.ui.theme;
  17569. return /*#__PURE__*/emotion_react_browser_esm_css("box-shadow:", boxShadow, ";color:", pointColor, ";*:hover>&{color:", pointColorHover, ";}" + ( true ? "" : 0), true ? "" : 0);
  17570. };
  17571. const pointBase = props => {
  17572. 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);
  17573. };
  17574. const Point = emotion_styled_base_browser_esm("span", true ? {
  17575. target: "e1od1u4s1"
  17576. } : 0)("height:6px;width:6px;", pointBase, ";" + ( true ? "" : 0));
  17577. const Cell = emotion_styled_base_browser_esm("span", true ? {
  17578. target: "e1od1u4s0"
  17579. } : 0)( true ? {
  17580. name: "rjf3ub",
  17581. 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"
  17582. } : 0);
  17583. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/alignment-matrix-control/cell.js
  17584. /**
  17585. * Internal dependencies
  17586. */
  17587. /**
  17588. * Internal dependencies
  17589. */
  17590. function cell_Cell(_ref) {
  17591. let {
  17592. isActive = false,
  17593. value,
  17594. ...props
  17595. } = _ref;
  17596. const tooltipText = ALIGNMENT_LABEL[value];
  17597. return (0,external_wp_element_namespaceObject.createElement)(tooltip, {
  17598. text: tooltipText
  17599. }, (0,external_wp_element_namespaceObject.createElement)(CompositeItem, extends_extends({
  17600. as: Cell,
  17601. role: "gridcell"
  17602. }, props), (0,external_wp_element_namespaceObject.createElement)(visually_hidden_component, null, value), (0,external_wp_element_namespaceObject.createElement)(Point, {
  17603. isActive: isActive,
  17604. role: "presentation"
  17605. })));
  17606. }
  17607. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/useSealedState.js
  17608. /**
  17609. * React custom hook that returns the very first value passed to `initialState`,
  17610. * even if it changes between re-renders.
  17611. */
  17612. function useSealedState(initialState) {
  17613. var _React$useState = (0,external_React_namespaceObject.useState)(initialState),
  17614. sealed = _React$useState[0];
  17615. return sealed;
  17616. }
  17617. ;// CONCATENATED MODULE: ./node_modules/reakit/es/reverse-30eaa122.js
  17618. function groupItems(items) {
  17619. var groups = [[]];
  17620. var _loop = function _loop() {
  17621. var item = _step.value;
  17622. var group = groups.find(function (g) {
  17623. return !g[0] || g[0].groupId === item.groupId;
  17624. });
  17625. if (group) {
  17626. group.push(item);
  17627. } else {
  17628. groups.push([item]);
  17629. }
  17630. };
  17631. for (var _iterator = _createForOfIteratorHelperLoose(items), _step; !(_step = _iterator()).done;) {
  17632. _loop();
  17633. }
  17634. return groups;
  17635. }
  17636. function flatten(grid) {
  17637. var flattened = [];
  17638. for (var _iterator = _createForOfIteratorHelperLoose(grid), _step; !(_step = _iterator()).done;) {
  17639. var row = _step.value;
  17640. flattened.push.apply(flattened, row);
  17641. }
  17642. return flattened;
  17643. }
  17644. function reverse(array) {
  17645. return array.slice().reverse();
  17646. }
  17647. ;// CONCATENATED MODULE: ./node_modules/reakit/es/findEnabledItemById-8ddca752.js
  17648. function findEnabledItemById(items, id) {
  17649. if (!id) return undefined;
  17650. return items === null || items === void 0 ? void 0 : items.find(function (item) {
  17651. return item.id === id && !item.disabled;
  17652. });
  17653. }
  17654. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/applyState.js
  17655. function isUpdater(argument) {
  17656. return typeof argument === "function";
  17657. }
  17658. /**
  17659. * Receives a `setState` argument and calls it with `currentValue` if it's a
  17660. * function. Otherwise return the argument as the new value.
  17661. *
  17662. * @example
  17663. * import { applyState } from "reakit-utils";
  17664. *
  17665. * applyState((value) => value + 1, 1); // 2
  17666. * applyState(2, 1); // 2
  17667. */
  17668. function applyState(argument, currentValue) {
  17669. if (isUpdater(argument)) {
  17670. return argument(currentValue);
  17671. }
  17672. return argument;
  17673. }
  17674. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Id/IdState.js
  17675. function unstable_useIdState(initialState) {
  17676. if (initialState === void 0) {
  17677. initialState = {};
  17678. }
  17679. var _useSealedState = useSealedState(initialState),
  17680. initialBaseId = _useSealedState.baseId;
  17681. var generateId = (0,external_React_namespaceObject.useContext)(unstable_IdContext);
  17682. var idCountRef = (0,external_React_namespaceObject.useRef)(0);
  17683. var _React$useState = (0,external_React_namespaceObject.useState)(function () {
  17684. return initialBaseId || generateId();
  17685. }),
  17686. baseId = _React$useState[0],
  17687. setBaseId = _React$useState[1];
  17688. return {
  17689. baseId: baseId,
  17690. setBaseId: setBaseId,
  17691. unstable_idCountRef: idCountRef
  17692. };
  17693. }
  17694. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Composite/CompositeState.js
  17695. function isElementPreceding(element1, element2) {
  17696. return Boolean(element2.compareDocumentPosition(element1) & Node.DOCUMENT_POSITION_PRECEDING);
  17697. }
  17698. function findDOMIndex(items, item) {
  17699. return items.findIndex(function (currentItem) {
  17700. if (!currentItem.ref.current || !item.ref.current) {
  17701. return false;
  17702. }
  17703. return isElementPreceding(item.ref.current, currentItem.ref.current);
  17704. });
  17705. }
  17706. function getMaxLength(rows) {
  17707. var maxLength = 0;
  17708. for (var _iterator = _createForOfIteratorHelperLoose(rows), _step; !(_step = _iterator()).done;) {
  17709. var length = _step.value.length;
  17710. if (length > maxLength) {
  17711. maxLength = length;
  17712. }
  17713. }
  17714. return maxLength;
  17715. }
  17716. /**
  17717. * Turns [row1, row1, row2, row2] into [row1, row2, row1, row2]
  17718. */
  17719. function verticalizeItems(items) {
  17720. var groups = groupItems(items);
  17721. var maxLength = getMaxLength(groups);
  17722. var verticalized = [];
  17723. for (var i = 0; i < maxLength; i += 1) {
  17724. for (var _iterator = _createForOfIteratorHelperLoose(groups), _step; !(_step = _iterator()).done;) {
  17725. var group = _step.value;
  17726. if (group[i]) {
  17727. verticalized.push(_objectSpread2(_objectSpread2({}, group[i]), {}, {
  17728. // If there's no groupId, it means that it's not a grid composite,
  17729. // but a single row instead. So, instead of verticalizing it, that
  17730. // is, assigning a different groupId based on the column index, we
  17731. // keep it undefined so they will be part of the same group.
  17732. // It's useful when using up/down on one-dimensional composites.
  17733. groupId: group[i].groupId ? "" + i : undefined
  17734. }));
  17735. }
  17736. }
  17737. }
  17738. return verticalized;
  17739. }
  17740. function createEmptyItem(groupId) {
  17741. return {
  17742. id: "__EMPTY_ITEM__",
  17743. disabled: true,
  17744. ref: {
  17745. current: null
  17746. },
  17747. groupId: groupId
  17748. };
  17749. }
  17750. /**
  17751. * Turns [[row1, row1], [row2]] into [[row1, row1], [row2, row2]]
  17752. */
  17753. function fillGroups(groups, currentId, shift) {
  17754. var maxLength = getMaxLength(groups);
  17755. for (var _iterator = _createForOfIteratorHelperLoose(groups), _step; !(_step = _iterator()).done;) {
  17756. var group = _step.value;
  17757. for (var i = 0; i < maxLength; i += 1) {
  17758. var item = group[i];
  17759. if (!item || shift && item.disabled) {
  17760. var isFrist = i === 0;
  17761. var previousItem = isFrist && shift ? findFirstEnabledItem(group) : group[i - 1];
  17762. 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);
  17763. }
  17764. }
  17765. }
  17766. return groups;
  17767. }
  17768. var nullItem = {
  17769. id: null,
  17770. ref: {
  17771. current: null
  17772. }
  17773. };
  17774. function placeItemsAfter(items, id, shouldInsertNullItem) {
  17775. var index = items.findIndex(function (item) {
  17776. return item.id === id;
  17777. });
  17778. return [].concat(items.slice(index + 1), shouldInsertNullItem ? [nullItem] : [], items.slice(0, index));
  17779. }
  17780. function getItemsInGroup(items, groupId) {
  17781. return items.filter(function (item) {
  17782. return item.groupId === groupId;
  17783. });
  17784. }
  17785. var map = {
  17786. horizontal: "vertical",
  17787. vertical: "horizontal"
  17788. };
  17789. function getOppositeOrientation(orientation) {
  17790. return orientation && map[orientation];
  17791. }
  17792. function addItemAtIndex(array, item, index) {
  17793. if (!(index in array)) {
  17794. return [].concat(array, [item]);
  17795. }
  17796. return [].concat(array.slice(0, index), [item], array.slice(index));
  17797. }
  17798. function sortBasedOnDOMPosition(items) {
  17799. var pairs = items.map(function (item, index) {
  17800. return [index, item];
  17801. });
  17802. var isOrderDifferent = false;
  17803. pairs.sort(function (_ref, _ref2) {
  17804. var indexA = _ref[0],
  17805. a = _ref[1];
  17806. var indexB = _ref2[0],
  17807. b = _ref2[1];
  17808. var elementA = a.ref.current;
  17809. var elementB = b.ref.current;
  17810. if (!elementA || !elementB) return 0; // a before b
  17811. if (isElementPreceding(elementA, elementB)) {
  17812. if (indexA > indexB) {
  17813. isOrderDifferent = true;
  17814. }
  17815. return -1;
  17816. } // a after b
  17817. if (indexA < indexB) {
  17818. isOrderDifferent = true;
  17819. }
  17820. return 1;
  17821. });
  17822. if (isOrderDifferent) {
  17823. return pairs.map(function (_ref3) {
  17824. var _ = _ref3[0],
  17825. item = _ref3[1];
  17826. return item;
  17827. });
  17828. }
  17829. return items;
  17830. }
  17831. function setItemsBasedOnDOMPosition(items, setItems) {
  17832. var sortedItems = sortBasedOnDOMPosition(items);
  17833. if (items !== sortedItems) {
  17834. setItems(sortedItems);
  17835. }
  17836. }
  17837. function getCommonParent(items) {
  17838. var _firstItem$ref$curren;
  17839. var firstItem = items[0],
  17840. nextItems = items.slice(1);
  17841. 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;
  17842. var _loop = function _loop() {
  17843. var parent = parentElement;
  17844. if (nextItems.every(function (item) {
  17845. return parent.contains(item.ref.current);
  17846. })) {
  17847. return {
  17848. v: parentElement
  17849. };
  17850. }
  17851. parentElement = parentElement.parentElement;
  17852. };
  17853. while (parentElement) {
  17854. var _ret = _loop();
  17855. if (typeof _ret === "object") return _ret.v;
  17856. }
  17857. return getDocument(parentElement).body;
  17858. } // istanbul ignore next: JSDOM doesn't support IntersectionObverser
  17859. // See https://github.com/jsdom/jsdom/issues/2032
  17860. function CompositeState_useIntersectionObserver(items, setItems) {
  17861. var previousItems = (0,external_React_namespaceObject.useRef)([]);
  17862. (0,external_React_namespaceObject.useEffect)(function () {
  17863. var callback = function callback() {
  17864. var hasPreviousItems = !!previousItems.current.length; // We don't want to sort items if items have been just registered.
  17865. if (hasPreviousItems) {
  17866. setItemsBasedOnDOMPosition(items, setItems);
  17867. }
  17868. previousItems.current = items;
  17869. };
  17870. var root = getCommonParent(items);
  17871. var observer = new IntersectionObserver(callback, {
  17872. root: root
  17873. });
  17874. for (var _iterator = _createForOfIteratorHelperLoose(items), _step; !(_step = _iterator()).done;) {
  17875. var item = _step.value;
  17876. if (item.ref.current) {
  17877. observer.observe(item.ref.current);
  17878. }
  17879. }
  17880. return function () {
  17881. observer.disconnect();
  17882. };
  17883. }, [items]);
  17884. }
  17885. function useTimeoutObserver(items, setItems) {
  17886. (0,external_React_namespaceObject.useEffect)(function () {
  17887. var callback = function callback() {
  17888. return setItemsBasedOnDOMPosition(items, setItems);
  17889. };
  17890. var timeout = setTimeout(callback, 250);
  17891. return function () {
  17892. return clearTimeout(timeout);
  17893. };
  17894. });
  17895. }
  17896. function useSortBasedOnDOMPosition(items, setItems) {
  17897. if (typeof IntersectionObserver === "function") {
  17898. CompositeState_useIntersectionObserver(items, setItems);
  17899. } else {
  17900. useTimeoutObserver(items, setItems);
  17901. }
  17902. }
  17903. function reducer(state, action) {
  17904. var virtual = state.unstable_virtual,
  17905. rtl = state.rtl,
  17906. orientation = state.orientation,
  17907. items = state.items,
  17908. groups = state.groups,
  17909. currentId = state.currentId,
  17910. loop = state.loop,
  17911. wrap = state.wrap,
  17912. pastIds = state.pastIds,
  17913. shift = state.shift,
  17914. moves = state.unstable_moves,
  17915. includesBaseElement = state.unstable_includesBaseElement,
  17916. initialVirtual = state.initialVirtual,
  17917. initialRTL = state.initialRTL,
  17918. initialOrientation = state.initialOrientation,
  17919. initialCurrentId = state.initialCurrentId,
  17920. initialLoop = state.initialLoop,
  17921. initialWrap = state.initialWrap,
  17922. initialShift = state.initialShift,
  17923. hasSetCurrentId = state.hasSetCurrentId;
  17924. switch (action.type) {
  17925. case "registerGroup":
  17926. {
  17927. var _group = action.group; // If there are no groups yet, just add it as the first one
  17928. if (groups.length === 0) {
  17929. return _objectSpread2(_objectSpread2({}, state), {}, {
  17930. groups: [_group]
  17931. });
  17932. } // Finds the group index based on DOM position
  17933. var index = findDOMIndex(groups, _group);
  17934. return _objectSpread2(_objectSpread2({}, state), {}, {
  17935. groups: addItemAtIndex(groups, _group, index)
  17936. });
  17937. }
  17938. case "unregisterGroup":
  17939. {
  17940. var _id = action.id;
  17941. var nextGroups = groups.filter(function (group) {
  17942. return group.id !== _id;
  17943. }); // The group isn't registered, so do nothing
  17944. if (nextGroups.length === groups.length) {
  17945. return state;
  17946. }
  17947. return _objectSpread2(_objectSpread2({}, state), {}, {
  17948. groups: nextGroups
  17949. });
  17950. }
  17951. case "registerItem":
  17952. {
  17953. var _item = action.item; // Finds the item group based on the DOM hierarchy
  17954. var _group2 = groups.find(function (r) {
  17955. var _r$ref$current;
  17956. return (_r$ref$current = r.ref.current) === null || _r$ref$current === void 0 ? void 0 : _r$ref$current.contains(_item.ref.current);
  17957. }); // Group will be null if it's a one-dimensional composite
  17958. var nextItem = _objectSpread2({
  17959. groupId: _group2 === null || _group2 === void 0 ? void 0 : _group2.id
  17960. }, _item);
  17961. var _index = findDOMIndex(items, nextItem);
  17962. var nextState = _objectSpread2(_objectSpread2({}, state), {}, {
  17963. items: addItemAtIndex(items, nextItem, _index)
  17964. });
  17965. if (!hasSetCurrentId && !moves && initialCurrentId === undefined) {
  17966. var _findFirstEnabledItem;
  17967. // Sets currentId to the first enabled item. This runs whenever an item
  17968. // is registered because the first enabled item may be registered
  17969. // asynchronously.
  17970. return _objectSpread2(_objectSpread2({}, nextState), {}, {
  17971. currentId: (_findFirstEnabledItem = findFirstEnabledItem(nextState.items)) === null || _findFirstEnabledItem === void 0 ? void 0 : _findFirstEnabledItem.id
  17972. });
  17973. }
  17974. return nextState;
  17975. }
  17976. case "unregisterItem":
  17977. {
  17978. var _id2 = action.id;
  17979. var nextItems = items.filter(function (item) {
  17980. return item.id !== _id2;
  17981. }); // The item isn't registered, so do nothing
  17982. if (nextItems.length === items.length) {
  17983. return state;
  17984. } // Filters out the item that is being removed from the pastIds list
  17985. var nextPastIds = pastIds.filter(function (pastId) {
  17986. return pastId !== _id2;
  17987. });
  17988. var _nextState = _objectSpread2(_objectSpread2({}, state), {}, {
  17989. pastIds: nextPastIds,
  17990. items: nextItems
  17991. }); // If the current item is the item that is being removed, focus pastId
  17992. if (currentId && currentId === _id2) {
  17993. var nextId = includesBaseElement ? null : getCurrentId(_objectSpread2(_objectSpread2({}, _nextState), {}, {
  17994. currentId: nextPastIds[0]
  17995. }));
  17996. return _objectSpread2(_objectSpread2({}, _nextState), {}, {
  17997. currentId: nextId
  17998. });
  17999. }
  18000. return _nextState;
  18001. }
  18002. case "move":
  18003. {
  18004. var _id3 = action.id; // move() does nothing
  18005. if (_id3 === undefined) {
  18006. return state;
  18007. } // Removes the current item and the item that is receiving focus from the
  18008. // pastIds list
  18009. var filteredPastIds = pastIds.filter(function (pastId) {
  18010. return pastId !== currentId && pastId !== _id3;
  18011. }); // If there's a currentId, add it to the pastIds list so it can be focused
  18012. // if the new item gets removed or disabled
  18013. var _nextPastIds = currentId ? [currentId].concat(filteredPastIds) : filteredPastIds;
  18014. var _nextState2 = _objectSpread2(_objectSpread2({}, state), {}, {
  18015. pastIds: _nextPastIds
  18016. }); // move(null) will focus the composite element itself, not an item
  18017. if (_id3 === null) {
  18018. return _objectSpread2(_objectSpread2({}, _nextState2), {}, {
  18019. unstable_moves: moves + 1,
  18020. currentId: getCurrentId(_nextState2, _id3)
  18021. });
  18022. }
  18023. var _item2 = findEnabledItemById(items, _id3);
  18024. return _objectSpread2(_objectSpread2({}, _nextState2), {}, {
  18025. unstable_moves: _item2 ? moves + 1 : moves,
  18026. currentId: getCurrentId(_nextState2, _item2 === null || _item2 === void 0 ? void 0 : _item2.id)
  18027. });
  18028. }
  18029. case "next":
  18030. {
  18031. // If there's no item focused, we just move the first one
  18032. if (currentId == null) {
  18033. return reducer(state, _objectSpread2(_objectSpread2({}, action), {}, {
  18034. type: "first"
  18035. }));
  18036. } // RTL doesn't make sense on vertical navigation
  18037. var isHorizontal = orientation !== "vertical";
  18038. var isRTL = rtl && isHorizontal;
  18039. var allItems = isRTL ? reverse(items) : items;
  18040. var currentItem = allItems.find(function (item) {
  18041. return item.id === currentId;
  18042. }); // If there's no item focused, we just move the first one
  18043. if (!currentItem) {
  18044. return reducer(state, _objectSpread2(_objectSpread2({}, action), {}, {
  18045. type: "first"
  18046. }));
  18047. }
  18048. var isGrid = !!currentItem.groupId;
  18049. var currentIndex = allItems.indexOf(currentItem);
  18050. var _nextItems = allItems.slice(currentIndex + 1);
  18051. var nextItemsInGroup = getItemsInGroup(_nextItems, currentItem.groupId); // Home, End
  18052. if (action.allTheWay) {
  18053. // We reverse so we can get the last enabled item in the group. If it's
  18054. // RTL, nextItems and nextItemsInGroup are already reversed and don't
  18055. // have the items before the current one anymore. So we have to get
  18056. // items in group again with allItems.
  18057. var _nextItem2 = findFirstEnabledItem(isRTL ? getItemsInGroup(allItems, currentItem.groupId) : reverse(nextItemsInGroup));
  18058. return reducer(state, _objectSpread2(_objectSpread2({}, action), {}, {
  18059. type: "move",
  18060. id: _nextItem2 === null || _nextItem2 === void 0 ? void 0 : _nextItem2.id
  18061. }));
  18062. }
  18063. var oppositeOrientation = getOppositeOrientation( // If it's a grid and orientation is not set, it's a next/previous
  18064. // call, which is inherently horizontal. up/down will call next with
  18065. // orientation set to vertical by default (see below on up/down cases).
  18066. isGrid ? orientation || "horizontal" : orientation);
  18067. var canLoop = loop && loop !== oppositeOrientation;
  18068. var canWrap = isGrid && wrap && wrap !== oppositeOrientation;
  18069. var hasNullItem = // `previous` and `up` will set action.hasNullItem, but when calling
  18070. // next directly, hasNullItem will only be true if it's not a grid and
  18071. // loop is set to true, which means that pressing right or down keys on
  18072. // grids will never focus the composite element. On one-dimensional
  18073. // composites that don't loop, pressing right or down keys also doesn't
  18074. // focus the composite element.
  18075. action.hasNullItem || !isGrid && canLoop && includesBaseElement;
  18076. if (canLoop) {
  18077. var loopItems = canWrap && !hasNullItem ? allItems : getItemsInGroup(allItems, currentItem.groupId); // Turns [0, 1, current, 3, 4] into [3, 4, 0, 1]
  18078. var sortedItems = placeItemsAfter(loopItems, currentId, hasNullItem);
  18079. var _nextItem3 = findFirstEnabledItem(sortedItems, currentId);
  18080. return reducer(state, _objectSpread2(_objectSpread2({}, action), {}, {
  18081. type: "move",
  18082. id: _nextItem3 === null || _nextItem3 === void 0 ? void 0 : _nextItem3.id
  18083. }));
  18084. }
  18085. if (canWrap) {
  18086. var _nextItem4 = findFirstEnabledItem( // We can use nextItems, which contains all the next items, including
  18087. // items from other groups, to wrap between groups. However, if there
  18088. // is a null item (the composite element), we'll only use the next
  18089. // items in the group. So moving next from the last item will focus
  18090. // the composite element (null). On grid composites, horizontal
  18091. // navigation never focuses the composite element, only vertical.
  18092. hasNullItem ? nextItemsInGroup : _nextItems, currentId);
  18093. var _nextId = hasNullItem ? (_nextItem4 === null || _nextItem4 === void 0 ? void 0 : _nextItem4.id) || null : _nextItem4 === null || _nextItem4 === void 0 ? void 0 : _nextItem4.id;
  18094. return reducer(state, _objectSpread2(_objectSpread2({}, action), {}, {
  18095. type: "move",
  18096. id: _nextId
  18097. }));
  18098. }
  18099. var _nextItem = findFirstEnabledItem(nextItemsInGroup, currentId);
  18100. if (!_nextItem && hasNullItem) {
  18101. return reducer(state, _objectSpread2(_objectSpread2({}, action), {}, {
  18102. type: "move",
  18103. id: null
  18104. }));
  18105. }
  18106. return reducer(state, _objectSpread2(_objectSpread2({}, action), {}, {
  18107. type: "move",
  18108. id: _nextItem === null || _nextItem === void 0 ? void 0 : _nextItem.id
  18109. }));
  18110. }
  18111. case "previous":
  18112. {
  18113. // If currentId is initially set to null, the composite element will be
  18114. // focusable while navigating with arrow keys. But, if it's a grid, we
  18115. // don't want to focus the composite element with horizontal navigation.
  18116. var _isGrid = !!groups.length;
  18117. var _hasNullItem = !_isGrid && includesBaseElement;
  18118. var _nextState3 = reducer(_objectSpread2(_objectSpread2({}, state), {}, {
  18119. items: reverse(items)
  18120. }), _objectSpread2(_objectSpread2({}, action), {}, {
  18121. type: "next",
  18122. hasNullItem: _hasNullItem
  18123. }));
  18124. return _objectSpread2(_objectSpread2({}, _nextState3), {}, {
  18125. items: items
  18126. });
  18127. }
  18128. case "down":
  18129. {
  18130. var shouldShift = shift && !action.allTheWay; // First, we make sure groups have the same number of items by filling it
  18131. // with disabled fake items. Then, we reorganize the items list so
  18132. // [1-1, 1-2, 2-1, 2-2] becomes [1-1, 2-1, 1-2, 2-2].
  18133. var verticalItems = verticalizeItems(flatten(fillGroups(groupItems(items), currentId, shouldShift)));
  18134. var _canLoop = loop && loop !== "horizontal"; // Pressing down arrow key will only focus the composite element if loop
  18135. // is true or vertical.
  18136. var _hasNullItem2 = _canLoop && includesBaseElement;
  18137. var _nextState4 = reducer(_objectSpread2(_objectSpread2({}, state), {}, {
  18138. orientation: "vertical",
  18139. items: verticalItems
  18140. }), _objectSpread2(_objectSpread2({}, action), {}, {
  18141. type: "next",
  18142. hasNullItem: _hasNullItem2
  18143. }));
  18144. return _objectSpread2(_objectSpread2({}, _nextState4), {}, {
  18145. orientation: orientation,
  18146. items: items
  18147. });
  18148. }
  18149. case "up":
  18150. {
  18151. var _shouldShift = shift && !action.allTheWay;
  18152. var _verticalItems = verticalizeItems(reverse(flatten(fillGroups(groupItems(items), currentId, _shouldShift)))); // If currentId is initially set to null, we'll always focus the
  18153. // composite element when the up arrow key is pressed in the first row.
  18154. var _hasNullItem3 = includesBaseElement;
  18155. var _nextState5 = reducer(_objectSpread2(_objectSpread2({}, state), {}, {
  18156. orientation: "vertical",
  18157. items: _verticalItems
  18158. }), _objectSpread2(_objectSpread2({}, action), {}, {
  18159. type: "next",
  18160. hasNullItem: _hasNullItem3
  18161. }));
  18162. return _objectSpread2(_objectSpread2({}, _nextState5), {}, {
  18163. orientation: orientation,
  18164. items: items
  18165. });
  18166. }
  18167. case "first":
  18168. {
  18169. var firstItem = findFirstEnabledItem(items);
  18170. return reducer(state, _objectSpread2(_objectSpread2({}, action), {}, {
  18171. type: "move",
  18172. id: firstItem === null || firstItem === void 0 ? void 0 : firstItem.id
  18173. }));
  18174. }
  18175. case "last":
  18176. {
  18177. var _nextState6 = reducer(_objectSpread2(_objectSpread2({}, state), {}, {
  18178. items: reverse(items)
  18179. }), _objectSpread2(_objectSpread2({}, action), {}, {
  18180. type: "first"
  18181. }));
  18182. return _objectSpread2(_objectSpread2({}, _nextState6), {}, {
  18183. items: items
  18184. });
  18185. }
  18186. case "sort":
  18187. {
  18188. return _objectSpread2(_objectSpread2({}, state), {}, {
  18189. items: sortBasedOnDOMPosition(items),
  18190. groups: sortBasedOnDOMPosition(groups)
  18191. });
  18192. }
  18193. case "setVirtual":
  18194. return _objectSpread2(_objectSpread2({}, state), {}, {
  18195. unstable_virtual: applyState(action.virtual, virtual)
  18196. });
  18197. case "setRTL":
  18198. return _objectSpread2(_objectSpread2({}, state), {}, {
  18199. rtl: applyState(action.rtl, rtl)
  18200. });
  18201. case "setOrientation":
  18202. return _objectSpread2(_objectSpread2({}, state), {}, {
  18203. orientation: applyState(action.orientation, orientation)
  18204. });
  18205. case "setCurrentId":
  18206. {
  18207. var nextCurrentId = getCurrentId(_objectSpread2(_objectSpread2({}, state), {}, {
  18208. currentId: applyState(action.currentId, currentId)
  18209. }));
  18210. return _objectSpread2(_objectSpread2({}, state), {}, {
  18211. currentId: nextCurrentId,
  18212. hasSetCurrentId: true
  18213. });
  18214. }
  18215. case "setLoop":
  18216. return _objectSpread2(_objectSpread2({}, state), {}, {
  18217. loop: applyState(action.loop, loop)
  18218. });
  18219. case "setWrap":
  18220. return _objectSpread2(_objectSpread2({}, state), {}, {
  18221. wrap: applyState(action.wrap, wrap)
  18222. });
  18223. case "setShift":
  18224. return _objectSpread2(_objectSpread2({}, state), {}, {
  18225. shift: applyState(action.shift, shift)
  18226. });
  18227. case "setIncludesBaseElement":
  18228. {
  18229. return _objectSpread2(_objectSpread2({}, state), {}, {
  18230. unstable_includesBaseElement: applyState(action.includesBaseElement, includesBaseElement)
  18231. });
  18232. }
  18233. case "reset":
  18234. return _objectSpread2(_objectSpread2({}, state), {}, {
  18235. unstable_virtual: initialVirtual,
  18236. rtl: initialRTL,
  18237. orientation: initialOrientation,
  18238. currentId: getCurrentId(_objectSpread2(_objectSpread2({}, state), {}, {
  18239. currentId: initialCurrentId
  18240. })),
  18241. loop: initialLoop,
  18242. wrap: initialWrap,
  18243. shift: initialShift,
  18244. unstable_moves: 0,
  18245. pastIds: []
  18246. });
  18247. case "setItems":
  18248. {
  18249. return _objectSpread2(_objectSpread2({}, state), {}, {
  18250. items: action.items
  18251. });
  18252. }
  18253. default:
  18254. throw new Error();
  18255. }
  18256. }
  18257. function useAction(fn) {
  18258. return (0,external_React_namespaceObject.useCallback)(fn, []);
  18259. }
  18260. function useIsUnmountedRef() {
  18261. var isUnmountedRef = (0,external_React_namespaceObject.useRef)(false);
  18262. useIsomorphicEffect(function () {
  18263. return function () {
  18264. isUnmountedRef.current = true;
  18265. };
  18266. }, []);
  18267. return isUnmountedRef;
  18268. }
  18269. function useCompositeState(initialState) {
  18270. if (initialState === void 0) {
  18271. initialState = {};
  18272. }
  18273. var _useSealedState = useSealedState(initialState),
  18274. _useSealedState$unsta = _useSealedState.unstable_virtual,
  18275. virtual = _useSealedState$unsta === void 0 ? false : _useSealedState$unsta,
  18276. _useSealedState$rtl = _useSealedState.rtl,
  18277. rtl = _useSealedState$rtl === void 0 ? false : _useSealedState$rtl,
  18278. orientation = _useSealedState.orientation,
  18279. currentId = _useSealedState.currentId,
  18280. _useSealedState$loop = _useSealedState.loop,
  18281. loop = _useSealedState$loop === void 0 ? false : _useSealedState$loop,
  18282. _useSealedState$wrap = _useSealedState.wrap,
  18283. wrap = _useSealedState$wrap === void 0 ? false : _useSealedState$wrap,
  18284. _useSealedState$shift = _useSealedState.shift,
  18285. shift = _useSealedState$shift === void 0 ? false : _useSealedState$shift,
  18286. unstable_includesBaseElement = _useSealedState.unstable_includesBaseElement,
  18287. sealed = _objectWithoutPropertiesLoose(_useSealedState, ["unstable_virtual", "rtl", "orientation", "currentId", "loop", "wrap", "shift", "unstable_includesBaseElement"]);
  18288. var idState = unstable_useIdState(sealed);
  18289. var _React$useReducer = (0,external_React_namespaceObject.useReducer)(reducer, {
  18290. unstable_virtual: virtual,
  18291. rtl: rtl,
  18292. orientation: orientation,
  18293. items: [],
  18294. groups: [],
  18295. currentId: currentId,
  18296. loop: loop,
  18297. wrap: wrap,
  18298. shift: shift,
  18299. unstable_moves: 0,
  18300. pastIds: [],
  18301. unstable_includesBaseElement: unstable_includesBaseElement != null ? unstable_includesBaseElement : currentId === null,
  18302. initialVirtual: virtual,
  18303. initialRTL: rtl,
  18304. initialOrientation: orientation,
  18305. initialCurrentId: currentId,
  18306. initialLoop: loop,
  18307. initialWrap: wrap,
  18308. initialShift: shift
  18309. }),
  18310. _React$useReducer$ = _React$useReducer[0],
  18311. pastIds = _React$useReducer$.pastIds,
  18312. initialVirtual = _React$useReducer$.initialVirtual,
  18313. initialRTL = _React$useReducer$.initialRTL,
  18314. initialOrientation = _React$useReducer$.initialOrientation,
  18315. initialCurrentId = _React$useReducer$.initialCurrentId,
  18316. initialLoop = _React$useReducer$.initialLoop,
  18317. initialWrap = _React$useReducer$.initialWrap,
  18318. initialShift = _React$useReducer$.initialShift,
  18319. hasSetCurrentId = _React$useReducer$.hasSetCurrentId,
  18320. state = _objectWithoutPropertiesLoose(_React$useReducer$, ["pastIds", "initialVirtual", "initialRTL", "initialOrientation", "initialCurrentId", "initialLoop", "initialWrap", "initialShift", "hasSetCurrentId"]),
  18321. dispatch = _React$useReducer[1];
  18322. var _React$useState = (0,external_React_namespaceObject.useState)(false),
  18323. hasActiveWidget = _React$useState[0],
  18324. setHasActiveWidget = _React$useState[1]; // register/unregister may be called when this component is unmounted. We
  18325. // store the unmounted state here so we don't update the state if it's true.
  18326. // This only happens in a very specific situation.
  18327. // See https://github.com/reakit/reakit/issues/650
  18328. var isUnmountedRef = useIsUnmountedRef();
  18329. var setItems = (0,external_React_namespaceObject.useCallback)(function (items) {
  18330. return dispatch({
  18331. type: "setItems",
  18332. items: items
  18333. });
  18334. }, []);
  18335. useSortBasedOnDOMPosition(state.items, setItems);
  18336. return _objectSpread2(_objectSpread2(_objectSpread2({}, idState), state), {}, {
  18337. unstable_hasActiveWidget: hasActiveWidget,
  18338. unstable_setHasActiveWidget: setHasActiveWidget,
  18339. registerItem: useAction(function (item) {
  18340. if (isUnmountedRef.current) return;
  18341. dispatch({
  18342. type: "registerItem",
  18343. item: item
  18344. });
  18345. }),
  18346. unregisterItem: useAction(function (id) {
  18347. if (isUnmountedRef.current) return;
  18348. dispatch({
  18349. type: "unregisterItem",
  18350. id: id
  18351. });
  18352. }),
  18353. registerGroup: useAction(function (group) {
  18354. if (isUnmountedRef.current) return;
  18355. dispatch({
  18356. type: "registerGroup",
  18357. group: group
  18358. });
  18359. }),
  18360. unregisterGroup: useAction(function (id) {
  18361. if (isUnmountedRef.current) return;
  18362. dispatch({
  18363. type: "unregisterGroup",
  18364. id: id
  18365. });
  18366. }),
  18367. move: useAction(function (id) {
  18368. return dispatch({
  18369. type: "move",
  18370. id: id
  18371. });
  18372. }),
  18373. next: useAction(function (allTheWay) {
  18374. return dispatch({
  18375. type: "next",
  18376. allTheWay: allTheWay
  18377. });
  18378. }),
  18379. previous: useAction(function (allTheWay) {
  18380. return dispatch({
  18381. type: "previous",
  18382. allTheWay: allTheWay
  18383. });
  18384. }),
  18385. up: useAction(function (allTheWay) {
  18386. return dispatch({
  18387. type: "up",
  18388. allTheWay: allTheWay
  18389. });
  18390. }),
  18391. down: useAction(function (allTheWay) {
  18392. return dispatch({
  18393. type: "down",
  18394. allTheWay: allTheWay
  18395. });
  18396. }),
  18397. first: useAction(function () {
  18398. return dispatch({
  18399. type: "first"
  18400. });
  18401. }),
  18402. last: useAction(function () {
  18403. return dispatch({
  18404. type: "last"
  18405. });
  18406. }),
  18407. sort: useAction(function () {
  18408. return dispatch({
  18409. type: "sort"
  18410. });
  18411. }),
  18412. unstable_setVirtual: useAction(function (value) {
  18413. return dispatch({
  18414. type: "setVirtual",
  18415. virtual: value
  18416. });
  18417. }),
  18418. setRTL: useAction(function (value) {
  18419. return dispatch({
  18420. type: "setRTL",
  18421. rtl: value
  18422. });
  18423. }),
  18424. setOrientation: useAction(function (value) {
  18425. return dispatch({
  18426. type: "setOrientation",
  18427. orientation: value
  18428. });
  18429. }),
  18430. setCurrentId: useAction(function (value) {
  18431. return dispatch({
  18432. type: "setCurrentId",
  18433. currentId: value
  18434. });
  18435. }),
  18436. setLoop: useAction(function (value) {
  18437. return dispatch({
  18438. type: "setLoop",
  18439. loop: value
  18440. });
  18441. }),
  18442. setWrap: useAction(function (value) {
  18443. return dispatch({
  18444. type: "setWrap",
  18445. wrap: value
  18446. });
  18447. }),
  18448. setShift: useAction(function (value) {
  18449. return dispatch({
  18450. type: "setShift",
  18451. shift: value
  18452. });
  18453. }),
  18454. unstable_setIncludesBaseElement: useAction(function (value) {
  18455. return dispatch({
  18456. type: "setIncludesBaseElement",
  18457. includesBaseElement: value
  18458. });
  18459. }),
  18460. reset: useAction(function () {
  18461. return dispatch({
  18462. type: "reset"
  18463. });
  18464. })
  18465. });
  18466. }
  18467. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/fireBlurEvent.js
  18468. function createFocusEvent(element, type, eventInit) {
  18469. if (eventInit === void 0) {
  18470. eventInit = {};
  18471. }
  18472. if (typeof FocusEvent === "function") {
  18473. return new FocusEvent(type, eventInit);
  18474. }
  18475. return createEvent(element, type, eventInit);
  18476. }
  18477. /**
  18478. * Creates and dispatches a blur event in a way that also works on IE 11.
  18479. *
  18480. * @example
  18481. * import { fireBlurEvent } from "reakit-utils";
  18482. *
  18483. * fireBlurEvent(document.getElementById("id"));
  18484. */
  18485. function fireBlurEvent(element, eventInit) {
  18486. var event = createFocusEvent(element, "blur", eventInit);
  18487. var defaultAllowed = element.dispatchEvent(event);
  18488. var bubbleInit = _rollupPluginBabelHelpers_1f0bf8c2_objectSpread2(_rollupPluginBabelHelpers_1f0bf8c2_objectSpread2({}, eventInit), {}, {
  18489. bubbles: true
  18490. });
  18491. element.dispatchEvent(createFocusEvent(element, "focusout", bubbleInit));
  18492. return defaultAllowed;
  18493. }
  18494. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/fireKeyboardEvent.js
  18495. function createKeyboardEvent(element, type, eventInit) {
  18496. if (eventInit === void 0) {
  18497. eventInit = {};
  18498. }
  18499. if (typeof KeyboardEvent === "function") {
  18500. return new KeyboardEvent(type, eventInit);
  18501. } // IE 11 doesn't support Event constructors
  18502. var event = getDocument(element).createEvent("KeyboardEvent");
  18503. event.initKeyboardEvent(type, eventInit.bubbles, eventInit.cancelable, getWindow(element), eventInit.key, eventInit.location, eventInit.ctrlKey, eventInit.altKey, eventInit.shiftKey, eventInit.metaKey);
  18504. return event;
  18505. }
  18506. /**
  18507. * Creates and dispatches `KeyboardEvent` in a way that also works on IE 11.
  18508. *
  18509. * @example
  18510. * import { fireKeyboardEvent } from "reakit-utils";
  18511. *
  18512. * fireKeyboardEvent(document.getElementById("id"), "keydown", {
  18513. * key: "ArrowDown",
  18514. * shiftKey: true,
  18515. * });
  18516. */
  18517. function fireKeyboardEvent(element, type, eventInit) {
  18518. return element.dispatchEvent(createKeyboardEvent(element, type, eventInit));
  18519. }
  18520. ;// CONCATENATED MODULE: ./node_modules/reakit-utils/es/getNextActiveElementOnBlur.js
  18521. var isIE11 = canUseDOM && "msCrypto" in window;
  18522. /**
  18523. * Cross-browser method that returns the next active element (the element that
  18524. * is receiving focus) after a blur event is dispatched. It receives the blur
  18525. * event object as the argument.
  18526. *
  18527. * @example
  18528. * import { getNextActiveElementOnBlur } from "reakit-utils";
  18529. *
  18530. * const element = document.getElementById("id");
  18531. * element.addEventListener("blur", (event) => {
  18532. * const nextActiveElement = getNextActiveElementOnBlur(event);
  18533. * });
  18534. */
  18535. function getNextActiveElementOnBlur(event) {
  18536. // IE 11 doesn't support event.relatedTarget on blur.
  18537. // document.activeElement points the the next active element.
  18538. // On modern browsers, document.activeElement points to the current target.
  18539. if (isIE11) {
  18540. var activeElement = getActiveElement_getActiveElement(event.currentTarget);
  18541. return activeElement;
  18542. }
  18543. return event.relatedTarget;
  18544. }
  18545. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Composite/Composite.js
  18546. var Composite_isIE11 = canUseDOM && "msCrypto" in window;
  18547. function canProxyKeyboardEvent(event) {
  18548. if (!isSelfTarget(event)) return false;
  18549. if (event.metaKey) return false;
  18550. if (event.key === "Tab") return false;
  18551. return true;
  18552. }
  18553. function useKeyboardEventProxy(virtual, currentItem, htmlEventHandler) {
  18554. var eventHandlerRef = useLiveRef(htmlEventHandler);
  18555. return (0,external_React_namespaceObject.useCallback)(function (event) {
  18556. var _eventHandlerRef$curr;
  18557. (_eventHandlerRef$curr = eventHandlerRef.current) === null || _eventHandlerRef$curr === void 0 ? void 0 : _eventHandlerRef$curr.call(eventHandlerRef, event);
  18558. if (event.defaultPrevented) return;
  18559. if (virtual && canProxyKeyboardEvent(event)) {
  18560. var currentElement = currentItem === null || currentItem === void 0 ? void 0 : currentItem.ref.current;
  18561. if (currentElement) {
  18562. if (!fireKeyboardEvent(currentElement, event.type, event)) {
  18563. event.preventDefault();
  18564. } // The event will be triggered on the composite item and then
  18565. // propagated up to this composite element again, so we can pretend
  18566. // that it wasn't called on this component in the first place.
  18567. if (event.currentTarget.contains(currentElement)) {
  18568. event.stopPropagation();
  18569. }
  18570. }
  18571. }
  18572. }, [virtual, currentItem]);
  18573. } // istanbul ignore next
  18574. function useActiveElementRef(elementRef) {
  18575. var activeElementRef = (0,external_React_namespaceObject.useRef)(null);
  18576. (0,external_React_namespaceObject.useEffect)(function () {
  18577. var document = getDocument(elementRef.current);
  18578. var onFocus = function onFocus(event) {
  18579. var target = event.target;
  18580. activeElementRef.current = target;
  18581. };
  18582. document.addEventListener("focus", onFocus, true);
  18583. return function () {
  18584. document.removeEventListener("focus", onFocus, true);
  18585. };
  18586. }, []);
  18587. return activeElementRef;
  18588. }
  18589. function findFirstEnabledItemInTheLastRow(items) {
  18590. return findFirstEnabledItem(flatten(reverse(groupItems(items))));
  18591. }
  18592. function isItem(items, element) {
  18593. return items === null || items === void 0 ? void 0 : items.some(function (item) {
  18594. return !!element && item.ref.current === element;
  18595. });
  18596. }
  18597. function useScheduleUserFocus(currentItem) {
  18598. var currentItemRef = useLiveRef(currentItem);
  18599. var _React$useReducer = (0,external_React_namespaceObject.useReducer)(function (n) {
  18600. return n + 1;
  18601. }, 0),
  18602. scheduled = _React$useReducer[0],
  18603. schedule = _React$useReducer[1];
  18604. (0,external_React_namespaceObject.useEffect)(function () {
  18605. var _currentItemRef$curre;
  18606. var currentElement = (_currentItemRef$curre = currentItemRef.current) === null || _currentItemRef$curre === void 0 ? void 0 : _currentItemRef$curre.ref.current;
  18607. if (scheduled && currentElement) {
  18608. userFocus(currentElement);
  18609. }
  18610. }, [scheduled]);
  18611. return schedule;
  18612. }
  18613. var useComposite = createHook({
  18614. name: "Composite",
  18615. compose: [useTabbable],
  18616. keys: COMPOSITE_KEYS,
  18617. useOptions: function useOptions(options) {
  18618. return _objectSpread2(_objectSpread2({}, options), {}, {
  18619. currentId: getCurrentId(options)
  18620. });
  18621. },
  18622. useProps: function useProps(options, _ref) {
  18623. var htmlRef = _ref.ref,
  18624. htmlOnFocusCapture = _ref.onFocusCapture,
  18625. htmlOnFocus = _ref.onFocus,
  18626. htmlOnBlurCapture = _ref.onBlurCapture,
  18627. htmlOnKeyDown = _ref.onKeyDown,
  18628. htmlOnKeyDownCapture = _ref.onKeyDownCapture,
  18629. htmlOnKeyUpCapture = _ref.onKeyUpCapture,
  18630. htmlProps = _objectWithoutPropertiesLoose(_ref, ["ref", "onFocusCapture", "onFocus", "onBlurCapture", "onKeyDown", "onKeyDownCapture", "onKeyUpCapture"]);
  18631. var ref = (0,external_React_namespaceObject.useRef)(null);
  18632. var currentItem = findEnabledItemById(options.items, options.currentId);
  18633. var previousElementRef = (0,external_React_namespaceObject.useRef)(null);
  18634. var onFocusCaptureRef = useLiveRef(htmlOnFocusCapture);
  18635. var onFocusRef = useLiveRef(htmlOnFocus);
  18636. var onBlurCaptureRef = useLiveRef(htmlOnBlurCapture);
  18637. var onKeyDownRef = useLiveRef(htmlOnKeyDown);
  18638. var scheduleUserFocus = useScheduleUserFocus(currentItem); // IE 11 doesn't support event.relatedTarget, so we use the active element
  18639. // ref instead.
  18640. var activeElementRef = Composite_isIE11 ? useActiveElementRef(ref) : undefined;
  18641. (0,external_React_namespaceObject.useEffect)(function () {
  18642. var element = ref.current;
  18643. if (options.unstable_moves && !currentItem) {
  18644. false ? 0 : void 0; // If composite.move(null) has been called, the composite container
  18645. // will receive focus.
  18646. element === null || element === void 0 ? void 0 : element.focus();
  18647. }
  18648. }, [options.unstable_moves, currentItem]);
  18649. var onKeyDownCapture = useKeyboardEventProxy(options.unstable_virtual, currentItem, htmlOnKeyDownCapture);
  18650. var onKeyUpCapture = useKeyboardEventProxy(options.unstable_virtual, currentItem, htmlOnKeyUpCapture);
  18651. var onFocusCapture = (0,external_React_namespaceObject.useCallback)(function (event) {
  18652. var _onFocusCaptureRef$cu;
  18653. (_onFocusCaptureRef$cu = onFocusCaptureRef.current) === null || _onFocusCaptureRef$cu === void 0 ? void 0 : _onFocusCaptureRef$cu.call(onFocusCaptureRef, event);
  18654. if (event.defaultPrevented) return;
  18655. if (!options.unstable_virtual) return; // IE11 doesn't support event.relatedTarget, so we use the active
  18656. // element ref instead.
  18657. var previousActiveElement = (activeElementRef === null || activeElementRef === void 0 ? void 0 : activeElementRef.current) || event.relatedTarget;
  18658. var previousActiveElementWasItem = isItem(options.items, previousActiveElement);
  18659. if (isSelfTarget(event) && previousActiveElementWasItem) {
  18660. // Composite has been focused as a result of an item receiving focus.
  18661. // The composite item will move focus back to the composite
  18662. // container. In this case, we don't want to propagate this
  18663. // additional event nor call the onFocus handler passed to
  18664. // <Composite onFocus={...} />.
  18665. event.stopPropagation(); // We keep track of the previous active item element so we can
  18666. // manually fire a blur event on it later when the focus is moved to
  18667. // another item on the onBlurCapture event below.
  18668. previousElementRef.current = previousActiveElement;
  18669. }
  18670. }, [options.unstable_virtual, options.items]);
  18671. var onFocus = (0,external_React_namespaceObject.useCallback)(function (event) {
  18672. var _onFocusRef$current;
  18673. (_onFocusRef$current = onFocusRef.current) === null || _onFocusRef$current === void 0 ? void 0 : _onFocusRef$current.call(onFocusRef, event);
  18674. if (event.defaultPrevented) return;
  18675. if (options.unstable_virtual) {
  18676. if (isSelfTarget(event)) {
  18677. // This means that the composite element has been focused while the
  18678. // composite item has not. For example, by clicking on the
  18679. // composite element without touching any item, or by tabbing into
  18680. // the composite element. In this case, we want to trigger focus on
  18681. // the item, just like it would happen with roving tabindex.
  18682. // When it receives focus, the composite item will put focus back
  18683. // on the composite element, in which case hasItemWithFocus will be
  18684. // true.
  18685. scheduleUserFocus();
  18686. }
  18687. } else if (isSelfTarget(event)) {
  18688. var _options$setCurrentId;
  18689. // When the roving tabindex composite gets intentionally focused (for
  18690. // example, by clicking directly on it, and not on an item), we make
  18691. // sure to set the current id to null (which means the composite
  18692. // itself is focused).
  18693. (_options$setCurrentId = options.setCurrentId) === null || _options$setCurrentId === void 0 ? void 0 : _options$setCurrentId.call(options, null);
  18694. }
  18695. }, [options.unstable_virtual, options.setCurrentId]);
  18696. var onBlurCapture = (0,external_React_namespaceObject.useCallback)(function (event) {
  18697. var _onBlurCaptureRef$cur;
  18698. (_onBlurCaptureRef$cur = onBlurCaptureRef.current) === null || _onBlurCaptureRef$cur === void 0 ? void 0 : _onBlurCaptureRef$cur.call(onBlurCaptureRef, event);
  18699. if (event.defaultPrevented) return;
  18700. if (!options.unstable_virtual) return; // When virtual is set to true, we move focus from the composite
  18701. // container (this component) to the composite item that is being
  18702. // selected. Then we move focus back to the composite container. This
  18703. // is so we can provide the same API as the roving tabindex method,
  18704. // which means people can attach onFocus/onBlur handlers on the
  18705. // CompositeItem component regardless of whether it's virtual or not.
  18706. // This sequence of blurring and focusing items and composite may be
  18707. // confusing, so we ignore intermediate focus and blurs by stopping its
  18708. // propagation and not calling the passed onBlur handler (htmlOnBlur).
  18709. var currentElement = (currentItem === null || currentItem === void 0 ? void 0 : currentItem.ref.current) || null;
  18710. var nextActiveElement = getNextActiveElementOnBlur(event);
  18711. var nextActiveElementIsItem = isItem(options.items, nextActiveElement);
  18712. if (isSelfTarget(event) && nextActiveElementIsItem) {
  18713. // This is an intermediate blur event: blurring the composite
  18714. // container to focus an item (nextActiveElement).
  18715. if (nextActiveElement === currentElement) {
  18716. // The next active element will be the same as the current item in
  18717. // the state in two scenarios:
  18718. // - Moving focus with keyboard: the state is updated before the
  18719. // blur event is triggered, so here the current item is already
  18720. // pointing to the next active element.
  18721. // - Clicking on the current active item with a pointer: this
  18722. // will trigger blur on the composite element and then the next
  18723. // active element will be the same as the current item. Clicking on
  18724. // an item other than the current one doesn't end up here as the
  18725. // currentItem state will be updated only after it.
  18726. if (previousElementRef.current && previousElementRef.current !== nextActiveElement) {
  18727. // If there's a previous active item and it's not a click action,
  18728. // then we fire a blur event on it so it will work just like if
  18729. // it had DOM focus before (like when using roving tabindex).
  18730. fireBlurEvent(previousElementRef.current, event);
  18731. }
  18732. } else if (currentElement) {
  18733. // This will be true when the next active element is not the
  18734. // current element, but there's a current item. This will only
  18735. // happen when clicking with a pointer on a different item, when
  18736. // there's already an item selected, in which case currentElement
  18737. // is the item that is getting blurred, and nextActiveElement is
  18738. // the item that is being clicked.
  18739. fireBlurEvent(currentElement, event);
  18740. } // We want to ignore intermediate blur events, so we stop its
  18741. // propagation and return early so onFocus will not be called.
  18742. event.stopPropagation();
  18743. } else {
  18744. var targetIsItem = isItem(options.items, event.target);
  18745. if (!targetIsItem && currentElement) {
  18746. // If target is not a composite item, it may be the composite
  18747. // element itself (isSelfTarget) or a tabbable element inside the
  18748. // composite widget. This may be triggered by clicking outside the
  18749. // composite widget or by tabbing out of it. In either cases we
  18750. // want to fire a blur event on the current item.
  18751. fireBlurEvent(currentElement, event);
  18752. }
  18753. }
  18754. }, [options.unstable_virtual, options.items, currentItem]);
  18755. var onKeyDown = (0,external_React_namespaceObject.useCallback)(function (event) {
  18756. var _onKeyDownRef$current, _options$groups;
  18757. (_onKeyDownRef$current = onKeyDownRef.current) === null || _onKeyDownRef$current === void 0 ? void 0 : _onKeyDownRef$current.call(onKeyDownRef, event);
  18758. if (event.defaultPrevented) return;
  18759. if (options.currentId !== null) return;
  18760. if (!isSelfTarget(event)) return;
  18761. var isVertical = options.orientation !== "horizontal";
  18762. var isHorizontal = options.orientation !== "vertical";
  18763. var isGrid = !!((_options$groups = options.groups) !== null && _options$groups !== void 0 && _options$groups.length);
  18764. var up = function up() {
  18765. if (isGrid) {
  18766. var item = findFirstEnabledItemInTheLastRow(options.items);
  18767. if (item !== null && item !== void 0 && item.id) {
  18768. var _options$move;
  18769. (_options$move = options.move) === null || _options$move === void 0 ? void 0 : _options$move.call(options, item.id);
  18770. }
  18771. } else {
  18772. var _options$last;
  18773. (_options$last = options.last) === null || _options$last === void 0 ? void 0 : _options$last.call(options);
  18774. }
  18775. };
  18776. var keyMap = {
  18777. ArrowUp: (isGrid || isVertical) && up,
  18778. ArrowRight: (isGrid || isHorizontal) && options.first,
  18779. ArrowDown: (isGrid || isVertical) && options.first,
  18780. ArrowLeft: (isGrid || isHorizontal) && options.last,
  18781. Home: options.first,
  18782. End: options.last,
  18783. PageUp: options.first,
  18784. PageDown: options.last
  18785. };
  18786. var action = keyMap[event.key];
  18787. if (action) {
  18788. event.preventDefault();
  18789. action();
  18790. }
  18791. }, [options.currentId, options.orientation, options.groups, options.items, options.move, options.last, options.first]);
  18792. return _objectSpread2({
  18793. ref: useForkRef(ref, htmlRef),
  18794. id: options.baseId,
  18795. onFocus: onFocus,
  18796. onFocusCapture: onFocusCapture,
  18797. onBlurCapture: onBlurCapture,
  18798. onKeyDownCapture: onKeyDownCapture,
  18799. onKeyDown: onKeyDown,
  18800. onKeyUpCapture: onKeyUpCapture,
  18801. "aria-activedescendant": options.unstable_virtual ? (currentItem === null || currentItem === void 0 ? void 0 : currentItem.id) || undefined : undefined
  18802. }, htmlProps);
  18803. },
  18804. useComposeProps: function useComposeProps(options, htmlProps) {
  18805. htmlProps = useRole(options, htmlProps, true);
  18806. var tabbableHTMLProps = useTabbable(options, htmlProps, true);
  18807. if (options.unstable_virtual || options.currentId === null) {
  18808. // Composite will only be tabbable by default if the focus is managed
  18809. // using aria-activedescendant, which requires DOM focus on the container
  18810. // element (the composite)
  18811. return _objectSpread2({
  18812. tabIndex: 0
  18813. }, tabbableHTMLProps);
  18814. }
  18815. return _objectSpread2(_objectSpread2({}, htmlProps), {}, {
  18816. ref: tabbableHTMLProps.ref
  18817. });
  18818. }
  18819. });
  18820. var Composite = createComponent({
  18821. as: "div",
  18822. useHook: useComposite,
  18823. useCreateElement: function useCreateElement$1(type, props, children) {
  18824. false ? 0 : void 0;
  18825. return useCreateElement(type, props, children);
  18826. }
  18827. });
  18828. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Group/Group.js
  18829. // Automatically generated
  18830. var GROUP_KEYS = [];
  18831. var useGroup = createHook({
  18832. name: "Group",
  18833. compose: useRole,
  18834. keys: GROUP_KEYS,
  18835. useProps: function useProps(_, htmlProps) {
  18836. return _objectSpread2({
  18837. role: "group"
  18838. }, htmlProps);
  18839. }
  18840. });
  18841. var Group = createComponent({
  18842. as: "div",
  18843. useHook: useGroup
  18844. });
  18845. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Composite/CompositeGroup.js
  18846. var useCompositeGroup = createHook({
  18847. name: "CompositeGroup",
  18848. compose: [useGroup, unstable_useId],
  18849. keys: COMPOSITE_GROUP_KEYS,
  18850. propsAreEqual: function propsAreEqual(prev, next) {
  18851. if (!next.id || prev.id !== next.id) {
  18852. return useGroup.unstable_propsAreEqual(prev, next);
  18853. }
  18854. var prevCurrentId = prev.currentId,
  18855. prevMoves = prev.unstable_moves,
  18856. prevProps = _objectWithoutPropertiesLoose(prev, ["currentId", "unstable_moves"]);
  18857. var nextCurrentId = next.currentId,
  18858. nextMoves = next.unstable_moves,
  18859. nextProps = _objectWithoutPropertiesLoose(next, ["currentId", "unstable_moves"]);
  18860. if (prev.items && next.items) {
  18861. var prevCurrentItem = findEnabledItemById(prev.items, prevCurrentId);
  18862. var nextCurrentItem = findEnabledItemById(next.items, nextCurrentId);
  18863. var prevGroupId = prevCurrentItem === null || prevCurrentItem === void 0 ? void 0 : prevCurrentItem.groupId;
  18864. var nextGroupId = nextCurrentItem === null || nextCurrentItem === void 0 ? void 0 : nextCurrentItem.groupId;
  18865. if (next.id === nextGroupId || next.id === prevGroupId) {
  18866. return false;
  18867. }
  18868. }
  18869. return useGroup.unstable_propsAreEqual(prevProps, nextProps);
  18870. },
  18871. useProps: function useProps(options, _ref) {
  18872. var htmlRef = _ref.ref,
  18873. htmlProps = _objectWithoutPropertiesLoose(_ref, ["ref"]);
  18874. var ref = (0,external_React_namespaceObject.useRef)(null);
  18875. var id = options.id; // We need this to be called before CompositeItems' register
  18876. useIsomorphicEffect(function () {
  18877. var _options$registerGrou;
  18878. if (!id) return undefined;
  18879. (_options$registerGrou = options.registerGroup) === null || _options$registerGrou === void 0 ? void 0 : _options$registerGrou.call(options, {
  18880. id: id,
  18881. ref: ref
  18882. });
  18883. return function () {
  18884. var _options$unregisterGr;
  18885. (_options$unregisterGr = options.unregisterGroup) === null || _options$unregisterGr === void 0 ? void 0 : _options$unregisterGr.call(options, id);
  18886. };
  18887. }, [id, options.registerGroup, options.unregisterGroup]);
  18888. return _objectSpread2({
  18889. ref: useForkRef(ref, htmlRef)
  18890. }, htmlProps);
  18891. }
  18892. });
  18893. var CompositeGroup = createComponent({
  18894. as: "div",
  18895. useHook: useCompositeGroup
  18896. });
  18897. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.js
  18898. 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)."; }
  18899. /**
  18900. * External dependencies
  18901. */
  18902. /**
  18903. * Internal dependencies
  18904. */
  18905. const alignment_matrix_control_icon_styles_rootSize = () => {
  18906. const padding = 1.5;
  18907. const size = 24;
  18908. return /*#__PURE__*/emotion_react_browser_esm_css({
  18909. gridTemplateRows: `repeat( 3, calc( ${size - padding * 2}px / 3))`,
  18910. padding,
  18911. maxHeight: size,
  18912. maxWidth: size
  18913. }, true ? "" : 0, true ? "" : 0);
  18914. };
  18915. const rootPointerEvents = _ref => {
  18916. let {
  18917. disablePointerEvents
  18918. } = _ref;
  18919. return /*#__PURE__*/emotion_react_browser_esm_css({
  18920. pointerEvents: disablePointerEvents ? 'none' : null
  18921. }, true ? "" : 0, true ? "" : 0);
  18922. };
  18923. const Wrapper = emotion_styled_base_browser_esm("div", true ? {
  18924. target: "elqsdmc2"
  18925. } : 0)( true ? {
  18926. name: "ogl07i",
  18927. styles: "box-sizing:border-box;padding:2px"
  18928. } : 0);
  18929. const alignment_matrix_control_icon_styles_Root = emotion_styled_base_browser_esm("div", true ? {
  18930. target: "elqsdmc1"
  18931. } : 0)("transform-origin:top left;height:100%;width:100%;", rootBase, ";", alignment_matrix_control_icon_styles_rootSize, ";", rootPointerEvents, ";" + ( true ? "" : 0));
  18932. const alignment_matrix_control_icon_styles_pointActive = _ref2 => {
  18933. let {
  18934. isActive
  18935. } = _ref2;
  18936. const boxShadow = isActive ? `0 0 0 1px currentColor` : null;
  18937. return /*#__PURE__*/emotion_react_browser_esm_css("box-shadow:", boxShadow, ";color:currentColor;*:hover>&{color:currentColor;}" + ( true ? "" : 0), true ? "" : 0);
  18938. };
  18939. const alignment_matrix_control_icon_styles_Point = emotion_styled_base_browser_esm("span", true ? {
  18940. target: "elqsdmc0"
  18941. } : 0)("height:2px;width:2px;", pointBase, ";", alignment_matrix_control_icon_styles_pointActive, ";" + ( true ? "" : 0));
  18942. const alignment_matrix_control_icon_styles_Cell = Cell;
  18943. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/alignment-matrix-control/icon.js
  18944. /**
  18945. * External dependencies
  18946. */
  18947. /**
  18948. * Internal dependencies
  18949. */
  18950. const BASE_SIZE = 24;
  18951. function AlignmentMatrixControlIcon(_ref) {
  18952. let {
  18953. className,
  18954. disablePointerEvents = true,
  18955. size = BASE_SIZE,
  18956. style = {},
  18957. value = 'center',
  18958. ...props
  18959. } = _ref;
  18960. const alignIndex = getAlignmentIndex(value);
  18961. const scale = (size / BASE_SIZE).toFixed(2);
  18962. const classes = classnames_default()('component-alignment-matrix-control-icon', className);
  18963. const styles = { ...style,
  18964. transform: `scale(${scale})`
  18965. };
  18966. return (0,external_wp_element_namespaceObject.createElement)(alignment_matrix_control_icon_styles_Root, extends_extends({}, props, {
  18967. className: classes,
  18968. disablePointerEvents: disablePointerEvents,
  18969. role: "presentation",
  18970. size: size,
  18971. style: styles
  18972. }), ALIGNMENTS.map((align, index) => {
  18973. const isActive = alignIndex === index;
  18974. return (0,external_wp_element_namespaceObject.createElement)(alignment_matrix_control_icon_styles_Cell, {
  18975. key: align
  18976. }, (0,external_wp_element_namespaceObject.createElement)(alignment_matrix_control_icon_styles_Point, {
  18977. isActive: isActive
  18978. }));
  18979. }));
  18980. }
  18981. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/alignment-matrix-control/index.js
  18982. /**
  18983. * External dependencies
  18984. */
  18985. /**
  18986. * WordPress dependencies
  18987. */
  18988. /**
  18989. * Internal dependencies
  18990. */
  18991. const noop = () => {};
  18992. function useBaseId(id) {
  18993. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(AlignmentMatrixControl, 'alignment-matrix-control');
  18994. return id || instanceId;
  18995. }
  18996. function AlignmentMatrixControl(_ref) {
  18997. let {
  18998. className,
  18999. id,
  19000. label = (0,external_wp_i18n_namespaceObject.__)('Alignment Matrix Control'),
  19001. defaultValue = 'center center',
  19002. value,
  19003. onChange = noop,
  19004. width = 92,
  19005. ...props
  19006. } = _ref;
  19007. const [immutableDefaultValue] = (0,external_wp_element_namespaceObject.useState)(value !== null && value !== void 0 ? value : defaultValue);
  19008. const baseId = useBaseId(id);
  19009. const initialCurrentId = getItemId(baseId, immutableDefaultValue);
  19010. const composite = useCompositeState({
  19011. baseId,
  19012. currentId: initialCurrentId,
  19013. rtl: (0,external_wp_i18n_namespaceObject.isRTL)()
  19014. });
  19015. const handleOnChange = nextValue => {
  19016. onChange(nextValue);
  19017. };
  19018. const {
  19019. setCurrentId
  19020. } = composite;
  19021. (0,external_wp_element_namespaceObject.useEffect)(() => {
  19022. if (typeof value !== 'undefined') {
  19023. setCurrentId(getItemId(baseId, value));
  19024. }
  19025. }, [value, setCurrentId, baseId]);
  19026. const classes = classnames_default()('component-alignment-matrix-control', className);
  19027. return (0,external_wp_element_namespaceObject.createElement)(Composite, extends_extends({}, props, composite, {
  19028. "aria-label": label,
  19029. as: Root,
  19030. className: classes,
  19031. role: "grid",
  19032. size: width
  19033. }), GRID.map((cells, index) => (0,external_wp_element_namespaceObject.createElement)(CompositeGroup, extends_extends({}, composite, {
  19034. as: Row,
  19035. role: "row",
  19036. key: index
  19037. }), cells.map(cell => {
  19038. const cellId = getItemId(baseId, cell);
  19039. const isActive = composite.currentId === cellId;
  19040. return (0,external_wp_element_namespaceObject.createElement)(cell_Cell, extends_extends({}, composite, {
  19041. id: cellId,
  19042. isActive: isActive,
  19043. key: cell,
  19044. value: cell,
  19045. onFocus: () => handleOnChange(cell),
  19046. tabIndex: isActive ? 0 : -1
  19047. }));
  19048. }))));
  19049. }
  19050. AlignmentMatrixControl.Icon = AlignmentMatrixControlIcon;
  19051. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/animate/index.js
  19052. /**
  19053. * External dependencies
  19054. */
  19055. /**
  19056. * @typedef {'top' | 'top left' | 'top right' | 'middle' | 'middle left' | 'middle right' | 'bottom' | 'bottom left' | 'bottom right'} AppearOrigin
  19057. * @typedef {'left' | 'right'} SlideInOrigin
  19058. * @typedef {{ type: 'appear'; origin?: AppearOrigin }} AppearOptions
  19059. * @typedef {{ type: 'slide-in'; origin?: SlideInOrigin }} SlideInOptions
  19060. * @typedef {{ type: 'loading' }} LoadingOptions
  19061. * @typedef {AppearOptions | SlideInOptions | LoadingOptions} GetAnimateOptions
  19062. */
  19063. /* eslint-disable jsdoc/valid-types */
  19064. /**
  19065. * @param {GetAnimateOptions['type']} type The animation type
  19066. * @return {'top' | 'left'} Default origin
  19067. */
  19068. function getDefaultOrigin(type) {
  19069. return type === 'appear' ? 'top' : 'left';
  19070. }
  19071. /* eslint-enable jsdoc/valid-types */
  19072. /**
  19073. * @param {GetAnimateOptions} options
  19074. *
  19075. * @return {string | void} ClassName that applies the animations
  19076. */
  19077. function getAnimateClassName(options) {
  19078. if (options.type === 'loading') {
  19079. return classnames_default()('components-animate__loading');
  19080. }
  19081. const {
  19082. type,
  19083. origin = getDefaultOrigin(type)
  19084. } = options;
  19085. if (type === 'appear') {
  19086. const [yAxis, xAxis = 'center'] = origin.split(' ');
  19087. return classnames_default()('components-animate__appear', {
  19088. ['is-from-' + xAxis]: xAxis !== 'center',
  19089. ['is-from-' + yAxis]: yAxis !== 'middle'
  19090. });
  19091. }
  19092. if (type === 'slide-in') {
  19093. return classnames_default()('components-animate__slide-in', 'is-from-' + origin);
  19094. }
  19095. } // @ts-ignore Reason: Planned for deprecation
  19096. function Animate(_ref) {
  19097. let {
  19098. type,
  19099. options = {},
  19100. children
  19101. } = _ref;
  19102. return children({
  19103. className: getAnimateClassName({
  19104. type,
  19105. ...options
  19106. })
  19107. });
  19108. }
  19109. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/context.js
  19110. /**
  19111. * WordPress dependencies
  19112. */
  19113. const FlexContext = (0,external_wp_element_namespaceObject.createContext)({
  19114. flexItemDisplay: undefined
  19115. });
  19116. const useFlexContext = () => (0,external_wp_element_namespaceObject.useContext)(FlexContext);
  19117. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/styles.js
  19118. 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)."; }
  19119. /**
  19120. * External dependencies
  19121. */
  19122. const Flex = true ? {
  19123. name: "zjik7",
  19124. styles: "display:flex"
  19125. } : 0;
  19126. const Item = true ? {
  19127. name: "qgaee5",
  19128. styles: "display:block;max-height:100%;max-width:100%;min-height:0;min-width:0"
  19129. } : 0;
  19130. const block = true ? {
  19131. name: "82a6rk",
  19132. styles: "flex:1"
  19133. } : 0;
  19134. /**
  19135. * Workaround to optimize DOM rendering.
  19136. * We'll enhance alignment with naive parent flex assumptions.
  19137. *
  19138. * Trade-off:
  19139. * Far less DOM less. However, UI rendering is not as reliable.
  19140. */
  19141. /**
  19142. * Improves stability of width/height rendering.
  19143. * https://github.com/ItsJonQ/g2/pull/149
  19144. */
  19145. const ItemsColumn = true ? {
  19146. name: "13nosa1",
  19147. styles: ">*{min-height:0;}"
  19148. } : 0;
  19149. const ItemsRow = true ? {
  19150. name: "1pwxzk4",
  19151. styles: ">*{min-width:0;}"
  19152. } : 0;
  19153. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/flex-item/hook.js
  19154. /**
  19155. * External dependencies
  19156. */
  19157. /**
  19158. * Internal dependencies
  19159. */
  19160. function useFlexItem(props) {
  19161. const {
  19162. className,
  19163. display: displayProp,
  19164. isBlock = false,
  19165. ...otherProps
  19166. } = useContextSystem(props, 'FlexItem');
  19167. const sx = {};
  19168. const contextDisplay = useFlexContext().flexItemDisplay;
  19169. sx.Base = /*#__PURE__*/emotion_react_browser_esm_css({
  19170. display: displayProp || contextDisplay
  19171. }, true ? "" : 0, true ? "" : 0);
  19172. const cx = useCx();
  19173. const classes = cx(Item, sx.Base, isBlock && block, className);
  19174. return { ...otherProps,
  19175. className: classes
  19176. };
  19177. }
  19178. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/flex-block/hook.js
  19179. /**
  19180. * Internal dependencies
  19181. */
  19182. function useFlexBlock(props) {
  19183. const otherProps = useContextSystem(props, 'FlexBlock');
  19184. const flexItemProps = useFlexItem({
  19185. isBlock: true,
  19186. ...otherProps
  19187. });
  19188. return flexItemProps;
  19189. }
  19190. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/flex-block/component.js
  19191. /**
  19192. * External dependencies
  19193. */
  19194. /**
  19195. * Internal dependencies
  19196. */
  19197. function UnconnectedFlexBlock(props, forwardedRef) {
  19198. const flexBlockProps = useFlexBlock(props);
  19199. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, flexBlockProps, {
  19200. ref: forwardedRef
  19201. }));
  19202. }
  19203. /**
  19204. * `FlexBlock` is a primitive layout component that adaptively resizes content
  19205. * within layout containers like `Flex`.
  19206. *
  19207. * ```jsx
  19208. * import { Flex, FlexBlock } from '@wordpress/components';
  19209. *
  19210. * function Example() {
  19211. * return (
  19212. * <Flex>
  19213. * <FlexBlock>...</FlexBlock>
  19214. * </Flex>
  19215. * );
  19216. * }
  19217. * ```
  19218. */
  19219. const FlexBlock = contextConnect(UnconnectedFlexBlock, 'FlexBlock');
  19220. /* harmony default export */ var flex_block_component = (FlexBlock);
  19221. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/flex-item/component.js
  19222. /**
  19223. * External dependencies
  19224. */
  19225. /**
  19226. * Internal dependencies
  19227. */
  19228. function UnconnectedFlexItem(props, forwardedRef) {
  19229. const flexItemProps = useFlexItem(props);
  19230. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, flexItemProps, {
  19231. ref: forwardedRef
  19232. }));
  19233. }
  19234. /**
  19235. * `FlexItem` is a primitive layout component that aligns content within layout
  19236. * containers like `Flex`.
  19237. *
  19238. * ```jsx
  19239. * import { Flex, FlexItem } from '@wordpress/components';
  19240. *
  19241. * function Example() {
  19242. * return (
  19243. * <Flex>
  19244. * <FlexItem>...</FlexItem>
  19245. * </Flex>
  19246. * );
  19247. * }
  19248. * ```
  19249. */
  19250. const FlexItem = contextConnect(UnconnectedFlexItem, 'FlexItem');
  19251. /* harmony default export */ var flex_item_component = (FlexItem);
  19252. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/utils/use-responsive-value.js
  19253. /**
  19254. * WordPress dependencies
  19255. */
  19256. const breakpoints = ['40em', '52em', '64em'];
  19257. const useBreakpointIndex = function () {
  19258. let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  19259. const {
  19260. defaultIndex = 0
  19261. } = options;
  19262. if (typeof defaultIndex !== 'number') {
  19263. throw new TypeError(`Default breakpoint index should be a number. Got: ${defaultIndex}, ${typeof defaultIndex}`);
  19264. } else if (defaultIndex < 0 || defaultIndex > breakpoints.length - 1) {
  19265. throw new RangeError(`Default breakpoint index out of range. Theme has ${breakpoints.length} breakpoints, got index ${defaultIndex}`);
  19266. }
  19267. const [value, setValue] = (0,external_wp_element_namespaceObject.useState)(defaultIndex);
  19268. (0,external_wp_element_namespaceObject.useEffect)(() => {
  19269. const getIndex = () => breakpoints.filter(bp => {
  19270. return typeof window !== 'undefined' ? window.matchMedia(`screen and (min-width: ${bp})`).matches : false;
  19271. }).length;
  19272. const onResize = () => {
  19273. const newValue = getIndex();
  19274. if (value !== newValue) {
  19275. setValue(newValue);
  19276. }
  19277. };
  19278. onResize();
  19279. if (typeof window !== 'undefined') {
  19280. window.addEventListener('resize', onResize);
  19281. }
  19282. return () => {
  19283. if (typeof window !== 'undefined') {
  19284. window.removeEventListener('resize', onResize);
  19285. }
  19286. };
  19287. }, [value]);
  19288. return value;
  19289. };
  19290. function useResponsiveValue(values) {
  19291. let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  19292. const index = useBreakpointIndex(options); // Allow calling the function with a "normal" value without having to check on the outside.
  19293. if (!Array.isArray(values) && typeof values !== 'function') return values;
  19294. const array = values || [];
  19295. /* eslint-disable jsdoc/no-undefined-types */
  19296. return (
  19297. /** @type {T[]} */
  19298. array[
  19299. /* eslint-enable jsdoc/no-undefined-types */
  19300. index >= array.length ? array.length - 1 : index]
  19301. );
  19302. }
  19303. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/utils/space.js
  19304. /**
  19305. * The argument value for the `space()` utility function.
  19306. *
  19307. * When this is a number or a numeric string, it will be interpreted as a
  19308. * multiplier for the grid base value (4px). For example, `space( 2 )` will be 8px.
  19309. *
  19310. * Otherwise, it will be interpreted as a literal CSS length value. For example,
  19311. * `space( 'auto' )` will be 'auto', and `space( '2px' )` will be 2px.
  19312. */
  19313. const GRID_BASE = '4px';
  19314. /**
  19315. * A function that handles numbers, numeric strings, and unit values.
  19316. *
  19317. * When given a number or a numeric string, it will return the grid-based
  19318. * value as a factor of GRID_BASE, defined above.
  19319. *
  19320. * When given a unit value or one of the named CSS values like `auto`,
  19321. * it will simply return the value back.
  19322. *
  19323. * @param value A number, numeric string, or a unit value.
  19324. */
  19325. function space(value) {
  19326. var _window$CSS, _window$CSS$supports;
  19327. if (typeof value === 'undefined') {
  19328. return undefined;
  19329. } // Handle empty strings, if it's the number 0 this still works.
  19330. if (!value) {
  19331. return '0';
  19332. }
  19333. 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.
  19334. 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)) {
  19335. return value.toString();
  19336. }
  19337. return `calc(${GRID_BASE} * ${value})`;
  19338. }
  19339. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/flex/hook.js
  19340. /**
  19341. * External dependencies
  19342. */
  19343. /**
  19344. * WordPress dependencies
  19345. */
  19346. /**
  19347. * Internal dependencies
  19348. */
  19349. function hook_useDeprecatedProps(props) {
  19350. const {
  19351. isReversed,
  19352. ...otherProps
  19353. } = props;
  19354. if (typeof isReversed !== 'undefined') {
  19355. external_wp_deprecated_default()('Flex isReversed', {
  19356. alternative: 'Flex direction="row-reverse" or "column-reverse"',
  19357. since: '5.9'
  19358. });
  19359. return { ...otherProps,
  19360. direction: isReversed ? 'row-reverse' : 'row'
  19361. };
  19362. }
  19363. return otherProps;
  19364. }
  19365. function useFlex(props) {
  19366. const {
  19367. align = 'center',
  19368. className,
  19369. direction: directionProp = 'row',
  19370. expanded = true,
  19371. gap = 2,
  19372. justify = 'space-between',
  19373. wrap = false,
  19374. ...otherProps
  19375. } = useContextSystem(hook_useDeprecatedProps(props), 'Flex');
  19376. const directionAsArray = Array.isArray(directionProp) ? directionProp : [directionProp];
  19377. const direction = useResponsiveValue(directionAsArray);
  19378. const isColumn = typeof direction === 'string' && !!direction.includes('column');
  19379. const isReverse = typeof direction === 'string' && direction.includes('reverse');
  19380. const cx = useCx();
  19381. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  19382. const base = /*#__PURE__*/emotion_react_browser_esm_css({
  19383. alignItems: isColumn ? 'normal' : align,
  19384. flexDirection: direction,
  19385. flexWrap: wrap ? 'wrap' : undefined,
  19386. gap: space(gap),
  19387. justifyContent: justify,
  19388. height: isColumn && expanded ? '100%' : undefined,
  19389. width: !isColumn && expanded ? '100%' : undefined
  19390. }, true ? "" : 0, true ? "" : 0);
  19391. return cx(Flex, base, isColumn ? ItemsColumn : ItemsRow, className);
  19392. }, [align, className, cx, direction, expanded, gap, isColumn, isReverse, justify, wrap]);
  19393. return { ...otherProps,
  19394. className: classes,
  19395. isColumn
  19396. };
  19397. }
  19398. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/flex/component.js
  19399. /**
  19400. * External dependencies
  19401. */
  19402. /**
  19403. * Internal dependencies
  19404. */
  19405. function UnconnectedFlex(props, forwardedRef) {
  19406. const {
  19407. children,
  19408. isColumn,
  19409. ...otherProps
  19410. } = useFlex(props);
  19411. return (0,external_wp_element_namespaceObject.createElement)(FlexContext.Provider, {
  19412. value: {
  19413. flexItemDisplay: isColumn ? 'block' : undefined
  19414. }
  19415. }, (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, otherProps, {
  19416. ref: forwardedRef
  19417. }), children));
  19418. }
  19419. /**
  19420. * `Flex` is a primitive layout component that adaptively aligns child content
  19421. * horizontally or vertically. `Flex` powers components like `HStack` and
  19422. * `VStack`.
  19423. *
  19424. * `Flex` is used with any of its two sub-components, `FlexItem` and
  19425. * `FlexBlock`.
  19426. *
  19427. * ```jsx
  19428. * import { Flex, FlexBlock, FlexItem } from '@wordpress/components';
  19429. *
  19430. * function Example() {
  19431. * return (
  19432. * <Flex>
  19433. * <FlexItem>
  19434. * <p>Code</p>
  19435. * </FlexItem>
  19436. * <FlexBlock>
  19437. * <p>Poetry</p>
  19438. * </FlexBlock>
  19439. * </Flex>
  19440. * );
  19441. * }
  19442. * ```
  19443. */
  19444. const component_Flex = contextConnect(UnconnectedFlex, 'Flex');
  19445. /* harmony default export */ var flex_component = (component_Flex);
  19446. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/truncate/styles.js
  19447. 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)."; }
  19448. /**
  19449. * External dependencies
  19450. */
  19451. const Truncate = true ? {
  19452. name: "hdknak",
  19453. styles: "display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap"
  19454. } : 0;
  19455. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/values.js
  19456. /* eslint-disable jsdoc/valid-types */
  19457. /**
  19458. * Determines if a value is null or undefined.
  19459. *
  19460. * @template T
  19461. *
  19462. * @param {T} value The value to check.
  19463. * @return {value is Exclude<T, null | undefined>} Whether value is not null or undefined.
  19464. */
  19465. function isValueDefined(value) {
  19466. return value !== undefined && value !== null;
  19467. }
  19468. /* eslint-enable jsdoc/valid-types */
  19469. /* eslint-disable jsdoc/valid-types */
  19470. /**
  19471. * Determines if a value is empty, null, or undefined.
  19472. *
  19473. * @param {string | number | null | undefined} value The value to check.
  19474. * @return {value is ("" | null | undefined)} Whether value is empty.
  19475. */
  19476. function isValueEmpty(value) {
  19477. const isEmptyString = value === '';
  19478. return !isValueDefined(value) || isEmptyString;
  19479. }
  19480. /* eslint-enable jsdoc/valid-types */
  19481. /**
  19482. * Get the first defined/non-null value from an array.
  19483. *
  19484. * @template T
  19485. *
  19486. * @param {Array<T | null | undefined>} values Values to derive from.
  19487. * @param {T} fallbackValue Fallback value if there are no defined values.
  19488. * @return {T} A defined value or the fallback value.
  19489. */
  19490. function getDefinedValue() {
  19491. var _values$find;
  19492. let values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  19493. let fallbackValue = arguments.length > 1 ? arguments[1] : undefined;
  19494. return (_values$find = values.find(isValueDefined)) !== null && _values$find !== void 0 ? _values$find : fallbackValue;
  19495. }
  19496. /**
  19497. * @param {string} [locale]
  19498. * @return {[RegExp, RegExp]} The delimiter and decimal regexp
  19499. */
  19500. const getDelimiterAndDecimalRegex = locale => {
  19501. const formatted = Intl.NumberFormat(locale).format(1000.1);
  19502. const delimiter = formatted[1];
  19503. const decimal = formatted[formatted.length - 2];
  19504. return [new RegExp(`\\${delimiter}`, 'g'), new RegExp(`\\${decimal}`, 'g')];
  19505. }; // https://en.wikipedia.org/wiki/Decimal_separator#Current_standards
  19506. const INTERNATIONAL_THOUSANDS_DELIMITER = / /g;
  19507. const ARABIC_NUMERAL_LOCALES = (/* unused pure expression or super */ null && (['ar', 'fa', 'ur', 'ckb', 'ps']));
  19508. const EASTERN_ARABIC_NUMBERS = /([۰-۹]|[٠-٩])/g;
  19509. /**
  19510. * Checks to see if a value is a numeric value (`number` or `string`).
  19511. *
  19512. * Intentionally ignores whether the thousands delimiters are only
  19513. * in the thousands marks.
  19514. *
  19515. * @param {any} value
  19516. * @param {string} [locale]
  19517. * @return {boolean} Whether value is numeric.
  19518. */
  19519. function isValueNumeric(value) {
  19520. let locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window.navigator.language;
  19521. if (ARABIC_NUMERAL_LOCALES.some(l => locale.startsWith(l))) {
  19522. locale = 'en-GB';
  19523. if (EASTERN_ARABIC_NUMBERS.test(value)) {
  19524. value = value.replace(/[٠-٩]/g, (
  19525. /** @type {string} */
  19526. d) => '٠١٢٣٤٥٦٧٨٩'.indexOf(d)).replace(/[۰-۹]/g, (
  19527. /** @type {string} */
  19528. d) => '۰۱۲۳۴۵۶۷۸۹'.indexOf(d)).replace(/٬/g, ',').replace(/٫/g, '.');
  19529. }
  19530. }
  19531. const [delimiterRegexp, decimalRegexp] = getDelimiterAndDecimalRegex(locale);
  19532. const valueToCheck = typeof value === 'string' ? value.replace(delimiterRegexp, '').replace(decimalRegexp, '.').replace(INTERNATIONAL_THOUSANDS_DELIMITER, '') : value;
  19533. return !isNaN(parseFloat(valueToCheck)) && isFinite(valueToCheck);
  19534. }
  19535. /**
  19536. * Converts a string to a number.
  19537. *
  19538. * @param {string} value
  19539. * @return {number} String as a number.
  19540. */
  19541. const stringToNumber = value => {
  19542. return parseFloat(value);
  19543. };
  19544. /**
  19545. * Converts a number to a string.
  19546. *
  19547. * @param {number} value
  19548. * @return {string} Number as a string.
  19549. */
  19550. const numberToString = value => {
  19551. return `${value}`;
  19552. };
  19553. /**
  19554. * Regardless of the input being a string or a number, returns a number.
  19555. *
  19556. * Returns `undefined` in case the string is `undefined` or not a valid numeric value.
  19557. *
  19558. * @param {string | number} value
  19559. * @return {number} The parsed number.
  19560. */
  19561. const ensureNumber = value => {
  19562. return typeof value === 'string' ? stringToNumber(value) : value;
  19563. };
  19564. /**
  19565. * Regardless of the input being a string or a number, returns a number.
  19566. *
  19567. * Returns `undefined` in case the string is `undefined` or not a valid numeric value.
  19568. *
  19569. * @param {string | number} value
  19570. * @return {string} The converted string, or `undefined` in case the input is `undefined` or `NaN`.
  19571. */
  19572. const ensureString = value => {
  19573. return typeof value === 'string' ? value : numberToString(value);
  19574. };
  19575. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/truncate/utils.js
  19576. /**
  19577. * Internal dependencies
  19578. */
  19579. const TRUNCATE_ELLIPSIS = '…';
  19580. const TRUNCATE_TYPE = {
  19581. auto: 'auto',
  19582. head: 'head',
  19583. middle: 'middle',
  19584. tail: 'tail',
  19585. none: 'none'
  19586. };
  19587. const TRUNCATE_DEFAULT_PROPS = {
  19588. ellipsis: TRUNCATE_ELLIPSIS,
  19589. ellipsizeMode: TRUNCATE_TYPE.auto,
  19590. limit: 0,
  19591. numberOfLines: 0
  19592. }; // Source
  19593. // https://github.com/kahwee/truncate-middle
  19594. function truncateMiddle(word, headLength, tailLength, ellipsis) {
  19595. if (typeof word !== 'string') {
  19596. return '';
  19597. }
  19598. const wordLength = word.length; // Setting default values
  19599. // eslint-disable-next-line no-bitwise
  19600. const frontLength = ~~headLength; // Will cast to integer
  19601. // eslint-disable-next-line no-bitwise
  19602. const backLength = ~~tailLength;
  19603. /* istanbul ignore next */
  19604. const truncateStr = isValueDefined(ellipsis) ? ellipsis : TRUNCATE_ELLIPSIS;
  19605. if (frontLength === 0 && backLength === 0 || frontLength >= wordLength || backLength >= wordLength || frontLength + backLength >= wordLength) {
  19606. return word;
  19607. } else if (backLength === 0) {
  19608. return word.slice(0, frontLength) + truncateStr;
  19609. }
  19610. return word.slice(0, frontLength) + truncateStr + word.slice(wordLength - backLength);
  19611. }
  19612. function truncateContent() {
  19613. let words = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  19614. let props = arguments.length > 1 ? arguments[1] : undefined;
  19615. const mergedProps = { ...TRUNCATE_DEFAULT_PROPS,
  19616. ...props
  19617. };
  19618. const {
  19619. ellipsis,
  19620. ellipsizeMode,
  19621. limit
  19622. } = mergedProps;
  19623. if (ellipsizeMode === TRUNCATE_TYPE.none) {
  19624. return words;
  19625. }
  19626. let truncateHead;
  19627. let truncateTail;
  19628. switch (ellipsizeMode) {
  19629. case TRUNCATE_TYPE.head:
  19630. truncateHead = 0;
  19631. truncateTail = limit;
  19632. break;
  19633. case TRUNCATE_TYPE.middle:
  19634. truncateHead = Math.floor(limit / 2);
  19635. truncateTail = Math.floor(limit / 2);
  19636. break;
  19637. default:
  19638. truncateHead = limit;
  19639. truncateTail = 0;
  19640. }
  19641. const truncatedContent = ellipsizeMode !== TRUNCATE_TYPE.auto ? truncateMiddle(words, truncateHead, truncateTail, ellipsis) : words;
  19642. return truncatedContent;
  19643. }
  19644. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/truncate/hook.js
  19645. /**
  19646. * External dependencies
  19647. */
  19648. /**
  19649. * WordPress dependencies
  19650. */
  19651. /**
  19652. * Internal dependencies
  19653. */
  19654. function useTruncate(props) {
  19655. const {
  19656. className,
  19657. children,
  19658. ellipsis = TRUNCATE_ELLIPSIS,
  19659. ellipsizeMode = TRUNCATE_TYPE.auto,
  19660. limit = 0,
  19661. numberOfLines = 0,
  19662. ...otherProps
  19663. } = useContextSystem(props, 'Truncate');
  19664. const cx = useCx();
  19665. const truncatedContent = truncateContent(typeof children === 'string' ? children : '', {
  19666. ellipsis,
  19667. ellipsizeMode,
  19668. limit,
  19669. numberOfLines
  19670. });
  19671. const shouldTruncate = ellipsizeMode === TRUNCATE_TYPE.auto;
  19672. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  19673. const truncateLines = /*#__PURE__*/emotion_react_browser_esm_css("-webkit-box-orient:vertical;-webkit-line-clamp:", numberOfLines, ";display:-webkit-box;overflow:hidden;" + ( true ? "" : 0), true ? "" : 0);
  19674. return cx(shouldTruncate && !numberOfLines && Truncate, shouldTruncate && !!numberOfLines && truncateLines, className);
  19675. }, [className, cx, numberOfLines, shouldTruncate]);
  19676. return { ...otherProps,
  19677. className: classes,
  19678. children: truncatedContent
  19679. };
  19680. }
  19681. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/utils/colors.js
  19682. /**
  19683. * External dependencies
  19684. */
  19685. /** @type {HTMLDivElement} */
  19686. let colorComputationNode;
  19687. colord_k([plugins_names]);
  19688. /**
  19689. * @return {HTMLDivElement | undefined} The HTML element for color computation.
  19690. */
  19691. function getColorComputationNode() {
  19692. if (typeof document === 'undefined') return;
  19693. if (!colorComputationNode) {
  19694. // Create a temporary element for style computation.
  19695. const el = document.createElement('div');
  19696. el.setAttribute('data-g2-color-computation-node', ''); // Inject for window computed style.
  19697. document.body.appendChild(el);
  19698. colorComputationNode = el;
  19699. }
  19700. return colorComputationNode;
  19701. }
  19702. /**
  19703. * @param {string | unknown} value
  19704. *
  19705. * @return {boolean} Whether the value is a valid color.
  19706. */
  19707. function isColor(value) {
  19708. if (typeof value !== 'string') return false;
  19709. const test = colord_w(value);
  19710. return test.isValid();
  19711. }
  19712. /**
  19713. * Retrieves the computed background color. This is useful for getting the
  19714. * value of a CSS variable color.
  19715. *
  19716. * @param {string | unknown} backgroundColor The background color to compute.
  19717. *
  19718. * @return {string} The computed background color.
  19719. */
  19720. function _getComputedBackgroundColor(backgroundColor) {
  19721. var _window;
  19722. if (typeof backgroundColor !== 'string') return '';
  19723. if (isColor(backgroundColor)) return backgroundColor;
  19724. if (!backgroundColor.includes('var(')) return '';
  19725. if (typeof document === 'undefined') return ''; // Attempts to gracefully handle CSS variables color values.
  19726. const el = getColorComputationNode();
  19727. if (!el) return '';
  19728. el.style.background = backgroundColor; // Grab the style.
  19729. const computedColor = (_window = window) === null || _window === void 0 ? void 0 : _window.getComputedStyle(el).background; // Reset.
  19730. el.style.background = '';
  19731. return computedColor || '';
  19732. }
  19733. const getComputedBackgroundColor = memize_default()(_getComputedBackgroundColor);
  19734. /**
  19735. * Get the text shade optimized for readability, based on a background color.
  19736. *
  19737. * @param {string | unknown} backgroundColor The background color.
  19738. *
  19739. * @return {string} The optimized text color (black or white).
  19740. */
  19741. function getOptimalTextColor(backgroundColor) {
  19742. const background = getComputedBackgroundColor(backgroundColor);
  19743. return colord_w(background).isLight() ? '#000000' : '#ffffff';
  19744. }
  19745. /**
  19746. * Get the text shade optimized for readability, based on a background color.
  19747. *
  19748. * @param {string | unknown} backgroundColor The background color.
  19749. *
  19750. * @return {string} The optimized text shade (dark or light).
  19751. */
  19752. function getOptimalTextShade(backgroundColor) {
  19753. const result = getOptimalTextColor(backgroundColor);
  19754. return result === '#000000' ? 'dark' : 'light';
  19755. }
  19756. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/config-values.js
  19757. /**
  19758. * Internal dependencies
  19759. */
  19760. const CONTROL_HEIGHT = '36px';
  19761. const CONTROL_PADDING_X = '12px';
  19762. const CONTROL_PROPS = {
  19763. controlSurfaceColor: COLORS.white,
  19764. controlTextActiveColor: COLORS.ui.theme,
  19765. controlPaddingX: CONTROL_PADDING_X,
  19766. controlPaddingXLarge: `calc(${CONTROL_PADDING_X} * 1.3334)`,
  19767. controlPaddingXSmall: `calc(${CONTROL_PADDING_X} / 1.3334)`,
  19768. controlBackgroundColor: COLORS.white,
  19769. controlBorderRadius: '2px',
  19770. controlBorderColor: COLORS.gray[700],
  19771. controlBoxShadow: 'transparent',
  19772. controlBorderColorHover: COLORS.gray[700],
  19773. controlBoxShadowFocus: `0 0 0 0.5px ${COLORS.ui.theme}`,
  19774. controlDestructiveBorderColor: COLORS.alert.red,
  19775. controlHeight: CONTROL_HEIGHT,
  19776. controlHeightXSmall: `calc( ${CONTROL_HEIGHT} * 0.6 )`,
  19777. controlHeightSmall: `calc( ${CONTROL_HEIGHT} * 0.8 )`,
  19778. controlHeightLarge: `calc( ${CONTROL_HEIGHT} * 1.2 )`,
  19779. controlHeightXLarge: `calc( ${CONTROL_HEIGHT} * 1.4 )`
  19780. };
  19781. const TOGGLE_GROUP_CONTROL_PROPS = {
  19782. toggleGroupControlBackgroundColor: CONTROL_PROPS.controlBackgroundColor,
  19783. toggleGroupControlBorderColor: COLORS.ui.border,
  19784. toggleGroupControlBackdropBackgroundColor: CONTROL_PROPS.controlSurfaceColor,
  19785. toggleGroupControlBackdropBorderColor: COLORS.ui.border,
  19786. toggleGroupControlBackdropBoxShadow: 'transparent',
  19787. toggleGroupControlButtonColorActive: CONTROL_PROPS.controlBackgroundColor
  19788. }; // Using Object.assign to avoid creating circular references when emitting
  19789. // TypeScript type declarations.
  19790. /* harmony default export */ var config_values = (Object.assign({}, CONTROL_PROPS, TOGGLE_GROUP_CONTROL_PROPS, {
  19791. colorDivider: 'rgba(0, 0, 0, 0.1)',
  19792. colorScrollbarThumb: 'rgba(0, 0, 0, 0.2)',
  19793. colorScrollbarThumbHover: 'rgba(0, 0, 0, 0.5)',
  19794. colorScrollbarTrack: 'rgba(0, 0, 0, 0.04)',
  19795. elevationIntensity: 1,
  19796. radiusBlockUi: '2px',
  19797. borderWidth: '1px',
  19798. borderWidthFocus: '1.5px',
  19799. borderWidthTab: '4px',
  19800. spinnerSize: 16,
  19801. fontSize: '13px',
  19802. fontSizeH1: 'calc(2.44 * 13px)',
  19803. fontSizeH2: 'calc(1.95 * 13px)',
  19804. fontSizeH3: 'calc(1.56 * 13px)',
  19805. fontSizeH4: 'calc(1.25 * 13px)',
  19806. fontSizeH5: '13px',
  19807. fontSizeH6: 'calc(0.8 * 13px)',
  19808. fontSizeInputMobile: '16px',
  19809. fontSizeMobile: '15px',
  19810. fontSizeSmall: 'calc(0.92 * 13px)',
  19811. fontSizeXSmall: 'calc(0.75 * 13px)',
  19812. fontLineHeightBase: '1.2',
  19813. fontWeight: 'normal',
  19814. fontWeightHeading: '600',
  19815. gridBase: '4px',
  19816. cardBorderRadius: '2px',
  19817. cardPaddingXSmall: `${space(2)}`,
  19818. cardPaddingSmall: `${space(4)}`,
  19819. cardPaddingMedium: `${space(4)} ${space(6)}`,
  19820. cardPaddingLarge: `${space(6)} ${space(8)}`,
  19821. surfaceBackgroundColor: COLORS.white,
  19822. surfaceBackgroundSubtleColor: '#F3F3F3',
  19823. surfaceBackgroundTintColor: '#F5F5F5',
  19824. surfaceBorderColor: 'rgba(0, 0, 0, 0.1)',
  19825. surfaceBorderBoldColor: 'rgba(0, 0, 0, 0.15)',
  19826. surfaceBorderSubtleColor: 'rgba(0, 0, 0, 0.05)',
  19827. surfaceBackgroundTertiaryColor: COLORS.white,
  19828. surfaceColor: COLORS.white,
  19829. transitionDuration: '200ms',
  19830. transitionDurationFast: '160ms',
  19831. transitionDurationFaster: '120ms',
  19832. transitionDurationFastest: '100ms',
  19833. transitionTimingFunction: 'cubic-bezier(0.08, 0.52, 0.52, 1)',
  19834. transitionTimingFunctionControl: 'cubic-bezier(0.12, 0.8, 0.32, 1)'
  19835. }));
  19836. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/text/styles.js
  19837. 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)."; }
  19838. /**
  19839. * External dependencies
  19840. */
  19841. /**
  19842. * Internal dependencies
  19843. */
  19844. const Text = /*#__PURE__*/emotion_react_browser_esm_css("color:", COLORS.gray[900], ";line-height:", config_values.fontLineHeightBase, ";margin:0;" + ( true ? "" : 0), true ? "" : 0);
  19845. const styles_block = true ? {
  19846. name: "4zleql",
  19847. styles: "display:block"
  19848. } : 0;
  19849. const positive = /*#__PURE__*/emotion_react_browser_esm_css("color:", COLORS.alert.green, ";" + ( true ? "" : 0), true ? "" : 0);
  19850. const destructive = /*#__PURE__*/emotion_react_browser_esm_css("color:", COLORS.alert.red, ";" + ( true ? "" : 0), true ? "" : 0);
  19851. const muted = /*#__PURE__*/emotion_react_browser_esm_css("color:", COLORS.gray[700], ";" + ( true ? "" : 0), true ? "" : 0);
  19852. 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);
  19853. const upperCase = true ? {
  19854. name: "50zrmy",
  19855. styles: "text-transform:uppercase"
  19856. } : 0;
  19857. // EXTERNAL MODULE: ./node_modules/highlight-words-core/dist/index.js
  19858. var dist = __webpack_require__(3138);
  19859. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/text/utils.js
  19860. /**
  19861. * External dependencies
  19862. */
  19863. /**
  19864. * WordPress dependencies
  19865. */
  19866. /**
  19867. * Source:
  19868. * https://github.com/bvaughn/react-highlight-words/blob/HEAD/src/Highlighter.js
  19869. */
  19870. /* eslint-disable jsdoc/valid-types */
  19871. /**
  19872. * @typedef Options
  19873. * @property {string} [activeClassName=''] Classname for active highlighted areas.
  19874. * @property {number} [activeIndex=-1] The index of the active highlighted area.
  19875. * @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [activeStyle] Styles to apply to the active highlighted area.
  19876. * @property {boolean} [autoEscape] Whether to automatically escape text.
  19877. * @property {boolean} [caseSensitive=false] Whether to highlight in a case-sensitive manner.
  19878. * @property {string} children Children to highlight.
  19879. * @property {import('highlight-words-core').FindAllArgs['findChunks']} [findChunks] Custom `findChunks` function to pass to `highlight-words-core`.
  19880. * @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).
  19881. * @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [highlightStyle={}] Styles to apply to highlighted text.
  19882. * @property {keyof JSX.IntrinsicElements} [highlightTag='mark'] Tag to use for the highlighted text.
  19883. * @property {import('highlight-words-core').FindAllArgs['sanitize']} [sanitize] Custom `santize` function to pass to `highlight-words-core`.
  19884. * @property {string[]} [searchWords=[]] Words to search for and highlight.
  19885. * @property {string} [unhighlightClassName=''] Classname to apply to unhighlighted text.
  19886. * @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [unhighlightStyle] Style to apply to unhighlighted text.
  19887. */
  19888. /**
  19889. * Maps props to lowercase names.
  19890. *
  19891. * @template {Record<string, unknown>} T
  19892. * @param {T} object Props to map.
  19893. * @return {{[K in keyof T as Lowercase<string & K>]: T[K]}} The mapped props.
  19894. */
  19895. /* eslint-enable jsdoc/valid-types */
  19896. const lowercaseProps = object => {
  19897. /** @type {any} */
  19898. const mapped = {};
  19899. for (const key in object) {
  19900. mapped[key.toLowerCase()] = object[key];
  19901. }
  19902. return mapped;
  19903. };
  19904. const memoizedLowercaseProps = memize_default()(lowercaseProps);
  19905. /**
  19906. *
  19907. * @param {Options} options
  19908. */
  19909. function createHighlighterText(_ref) {
  19910. let {
  19911. activeClassName = '',
  19912. activeIndex = -1,
  19913. activeStyle,
  19914. autoEscape,
  19915. caseSensitive = false,
  19916. children,
  19917. findChunks,
  19918. highlightClassName = '',
  19919. highlightStyle = {},
  19920. highlightTag = 'mark',
  19921. sanitize,
  19922. searchWords = [],
  19923. unhighlightClassName = '',
  19924. unhighlightStyle
  19925. } = _ref;
  19926. if (!children) return null;
  19927. if (typeof children !== 'string') return children;
  19928. const textToHighlight = children;
  19929. const chunks = (0,dist.findAll)({
  19930. autoEscape,
  19931. caseSensitive,
  19932. findChunks,
  19933. sanitize,
  19934. searchWords,
  19935. textToHighlight
  19936. });
  19937. const HighlightTag = highlightTag;
  19938. let highlightIndex = -1;
  19939. let highlightClassNames = '';
  19940. let highlightStyles;
  19941. const textContent = chunks.map((chunk, index) => {
  19942. const text = textToHighlight.substr(chunk.start, chunk.end - chunk.start);
  19943. if (chunk.highlight) {
  19944. highlightIndex++;
  19945. let highlightClass;
  19946. if (typeof highlightClassName === 'object') {
  19947. if (!caseSensitive) {
  19948. highlightClassName = memoizedLowercaseProps(highlightClassName);
  19949. highlightClass = highlightClassName[text.toLowerCase()];
  19950. } else {
  19951. highlightClass = highlightClassName[text];
  19952. }
  19953. } else {
  19954. highlightClass = highlightClassName;
  19955. }
  19956. const isActive = highlightIndex === +activeIndex;
  19957. highlightClassNames = `${highlightClass} ${isActive ? activeClassName : ''}`;
  19958. highlightStyles = isActive === true && activeStyle !== null ? Object.assign({}, highlightStyle, activeStyle) : highlightStyle;
  19959. /** @type {Record<string, any>} */
  19960. const props = {
  19961. children: text,
  19962. className: highlightClassNames,
  19963. key: index,
  19964. style: highlightStyles
  19965. }; // Don't attach arbitrary props to DOM elements; this triggers React DEV warnings (https://fb.me/react-unknown-prop)
  19966. // Only pass through the highlightIndex attribute for custom components.
  19967. if (typeof HighlightTag !== 'string') {
  19968. props.highlightIndex = highlightIndex;
  19969. }
  19970. return (0,external_wp_element_namespaceObject.createElement)(HighlightTag, props);
  19971. }
  19972. return (0,external_wp_element_namespaceObject.createElement)('span', {
  19973. children: text,
  19974. className: unhighlightClassName,
  19975. key: index,
  19976. style: unhighlightStyle
  19977. });
  19978. });
  19979. return textContent;
  19980. }
  19981. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/utils/font-size.js
  19982. /**
  19983. * External dependencies
  19984. */
  19985. /**
  19986. * Internal dependencies
  19987. */
  19988. const BASE_FONT_SIZE = 13;
  19989. const PRESET_FONT_SIZES = {
  19990. body: BASE_FONT_SIZE,
  19991. caption: 10,
  19992. footnote: 11,
  19993. largeTitle: 28,
  19994. subheadline: 12,
  19995. title: 20
  19996. };
  19997. const HEADING_FONT_SIZES = [1, 2, 3, 4, 5, 6].flatMap(n => [n, n.toString()]);
  19998. function getFontSize() {
  19999. let size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : BASE_FONT_SIZE;
  20000. if (size in PRESET_FONT_SIZES) {
  20001. return getFontSize(PRESET_FONT_SIZES[size]);
  20002. }
  20003. if (typeof size !== 'number') {
  20004. const parsed = parseFloat(size);
  20005. if (Number.isNaN(parsed)) return size;
  20006. size = parsed;
  20007. }
  20008. const ratio = `(${size} / ${BASE_FONT_SIZE})`;
  20009. return `calc(${ratio} * ${config_values.fontSize})`;
  20010. }
  20011. function getHeadingFontSize() {
  20012. let size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 3;
  20013. if (!HEADING_FONT_SIZES.includes(size)) {
  20014. return getFontSize(size);
  20015. }
  20016. const headingSize = `fontSizeH${size}`;
  20017. return config_values[headingSize];
  20018. }
  20019. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/text/get-line-height.js
  20020. /**
  20021. * External dependencies
  20022. */
  20023. /**
  20024. * Internal dependencies
  20025. */
  20026. function getLineHeight(adjustLineHeightForInnerControls, lineHeight) {
  20027. if (lineHeight) return lineHeight;
  20028. if (!adjustLineHeightForInnerControls) return;
  20029. let value = `calc(${config_values.controlHeight} + ${space(2)})`;
  20030. switch (adjustLineHeightForInnerControls) {
  20031. case 'large':
  20032. value = `calc(${config_values.controlHeightLarge} + ${space(2)})`;
  20033. break;
  20034. case 'small':
  20035. value = `calc(${config_values.controlHeightSmall} + ${space(2)})`;
  20036. break;
  20037. case 'xSmall':
  20038. value = `calc(${config_values.controlHeightXSmall} + ${space(2)})`;
  20039. break;
  20040. default:
  20041. break;
  20042. }
  20043. return value;
  20044. }
  20045. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/text/hook.js
  20046. 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)."; }
  20047. /**
  20048. * External dependencies
  20049. */
  20050. /**
  20051. * WordPress dependencies
  20052. */
  20053. /**
  20054. * Internal dependencies
  20055. */
  20056. /**
  20057. * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'span'>} props
  20058. */
  20059. var hook_ref = true ? {
  20060. name: "50zrmy",
  20061. styles: "text-transform:uppercase"
  20062. } : 0;
  20063. function useText(props) {
  20064. const {
  20065. adjustLineHeightForInnerControls,
  20066. align,
  20067. children,
  20068. className,
  20069. color,
  20070. ellipsizeMode,
  20071. isDestructive = false,
  20072. display,
  20073. highlightEscape = false,
  20074. highlightCaseSensitive = false,
  20075. highlightWords,
  20076. highlightSanitize,
  20077. isBlock = false,
  20078. letterSpacing,
  20079. lineHeight: lineHeightProp,
  20080. optimizeReadabilityFor,
  20081. size,
  20082. truncate = false,
  20083. upperCase = false,
  20084. variant,
  20085. weight = config_values.fontWeight,
  20086. ...otherProps
  20087. } = useContextSystem(props, 'Text');
  20088. /** @type {import('react').ReactNode} */
  20089. let content = children;
  20090. const isHighlighter = Array.isArray(highlightWords);
  20091. const isCaption = size === 'caption';
  20092. if (isHighlighter) {
  20093. if (typeof children !== 'string') {
  20094. throw new TypeError('`children` of `Text` must only be `string` types when `highlightWords` is defined');
  20095. }
  20096. content = createHighlighterText({
  20097. autoEscape: highlightEscape,
  20098. // Disable reason: We need to disable this otherwise it erases the cast
  20099. // eslint-disable-next-line object-shorthand
  20100. children:
  20101. /** @type {string} */
  20102. children,
  20103. caseSensitive: highlightCaseSensitive,
  20104. searchWords: highlightWords,
  20105. sanitize: highlightSanitize
  20106. });
  20107. }
  20108. const cx = useCx();
  20109. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  20110. const sx = {};
  20111. const lineHeight = getLineHeight(adjustLineHeightForInnerControls, lineHeightProp);
  20112. sx.Base = /*#__PURE__*/emotion_react_browser_esm_css({
  20113. color,
  20114. display,
  20115. fontSize: getFontSize(size),
  20116. /* eslint-disable jsdoc/valid-types */
  20117. fontWeight:
  20118. /** @type {import('react').CSSProperties['fontWeight']} */
  20119. weight,
  20120. /* eslint-enable jsdoc/valid-types */
  20121. lineHeight,
  20122. letterSpacing,
  20123. textAlign: align
  20124. }, true ? "" : 0, true ? "" : 0);
  20125. sx.upperCase = hook_ref;
  20126. sx.optimalTextColor = null;
  20127. if (optimizeReadabilityFor) {
  20128. const isOptimalTextColorDark = getOptimalTextShade(optimizeReadabilityFor) === 'dark';
  20129. sx.optimalTextColor = isOptimalTextColorDark ? /*#__PURE__*/emotion_react_browser_esm_css({
  20130. color: COLORS.gray[900]
  20131. }, true ? "" : 0, true ? "" : 0) : /*#__PURE__*/emotion_react_browser_esm_css({
  20132. color: COLORS.white
  20133. }, true ? "" : 0, true ? "" : 0);
  20134. }
  20135. 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);
  20136. }, [adjustLineHeightForInnerControls, align, className, color, cx, display, isBlock, isCaption, isDestructive, isHighlighter, letterSpacing, lineHeightProp, optimizeReadabilityFor, size, upperCase, variant, weight]);
  20137. /** @type {undefined | 'auto' | 'none'} */
  20138. let finalEllipsizeMode;
  20139. if (truncate === true) {
  20140. finalEllipsizeMode = 'auto';
  20141. }
  20142. if (truncate === false) {
  20143. finalEllipsizeMode = 'none';
  20144. }
  20145. const finalComponentProps = { ...otherProps,
  20146. className: classes,
  20147. children,
  20148. ellipsizeMode: ellipsizeMode || finalEllipsizeMode
  20149. };
  20150. const truncateProps = useTruncate(finalComponentProps);
  20151. /**
  20152. * Enhance child `<Link />` components to inherit font size.
  20153. */
  20154. if (!truncate && Array.isArray(children)) {
  20155. content = external_wp_element_namespaceObject.Children.map(children, child => {
  20156. if (typeof child !== 'object' || child === null || !('props' in child)) {
  20157. return child;
  20158. }
  20159. const isLink = hasConnectNamespace(child, ['Link']);
  20160. if (isLink) {
  20161. return (0,external_wp_element_namespaceObject.cloneElement)(child, {
  20162. size: child.props.size || 'inherit'
  20163. });
  20164. }
  20165. return child;
  20166. });
  20167. }
  20168. return { ...truncateProps,
  20169. children: truncate ? truncateProps.children : content
  20170. };
  20171. }
  20172. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/text/component.js
  20173. /**
  20174. * Internal dependencies
  20175. */
  20176. /**
  20177. * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'span'>} props
  20178. * @param {import('react').ForwardedRef<any>} forwardedRef
  20179. */
  20180. function component_Text(props, forwardedRef) {
  20181. const textProps = useText(props);
  20182. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({
  20183. as: "span"
  20184. }, textProps, {
  20185. ref: forwardedRef
  20186. }));
  20187. }
  20188. /**
  20189. * `Text` is a core component that renders text in the library, using the
  20190. * library's typography system.
  20191. *
  20192. * `Text` can be used to render any text-content, like an HTML `p` or `span`.
  20193. *
  20194. * @example
  20195. *
  20196. * ```jsx
  20197. * import { __experimentalText as Text } from `@wordpress/components`;
  20198. *
  20199. * function Example() {
  20200. * return <Text>Code is Poetry</Text>;
  20201. * }
  20202. * ```
  20203. */
  20204. const ConnectedText = contextConnect(component_Text, 'Text');
  20205. /* harmony default export */ var text_component = (ConnectedText);
  20206. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/base-label.js
  20207. function base_label_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)."; }
  20208. /**
  20209. * External dependencies
  20210. */
  20211. // This is a very low-level mixin which you shouldn't have to use directly.
  20212. // Try to use BaseControl's StyledLabel or BaseControl.VisualLabel if you can.
  20213. const baseLabelTypography = true ? {
  20214. name: "9amh4a",
  20215. styles: "font-size:11px;font-weight:500;line-height:1.4;text-transform:uppercase"
  20216. } : 0;
  20217. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/rtl.js
  20218. /**
  20219. * External dependencies
  20220. */
  20221. /**
  20222. * WordPress dependencies
  20223. */
  20224. const LOWER_LEFT_REGEXP = new RegExp(/-left/g);
  20225. const LOWER_RIGHT_REGEXP = new RegExp(/-right/g);
  20226. const UPPER_LEFT_REGEXP = new RegExp(/Left/g);
  20227. const UPPER_RIGHT_REGEXP = new RegExp(/Right/g);
  20228. /**
  20229. * Flips a CSS property from left <-> right.
  20230. *
  20231. * @param {string} key The CSS property name.
  20232. *
  20233. * @return {string} The flipped CSS property name, if applicable.
  20234. */
  20235. function getConvertedKey(key) {
  20236. if (key === 'left') {
  20237. return 'right';
  20238. }
  20239. if (key === 'right') {
  20240. return 'left';
  20241. }
  20242. if (LOWER_LEFT_REGEXP.test(key)) {
  20243. return key.replace(LOWER_LEFT_REGEXP, '-right');
  20244. }
  20245. if (LOWER_RIGHT_REGEXP.test(key)) {
  20246. return key.replace(LOWER_RIGHT_REGEXP, '-left');
  20247. }
  20248. if (UPPER_LEFT_REGEXP.test(key)) {
  20249. return key.replace(UPPER_LEFT_REGEXP, 'Right');
  20250. }
  20251. if (UPPER_RIGHT_REGEXP.test(key)) {
  20252. return key.replace(UPPER_RIGHT_REGEXP, 'Left');
  20253. }
  20254. return key;
  20255. }
  20256. /**
  20257. * An incredibly basic ltr -> rtl converter for style properties
  20258. *
  20259. * @param {import('react').CSSProperties} ltrStyles
  20260. *
  20261. * @return {import('react').CSSProperties} Converted ltr -> rtl styles
  20262. */
  20263. const convertLTRToRTL = function () {
  20264. let ltrStyles = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  20265. return Object.fromEntries(Object.entries(ltrStyles).map(_ref => {
  20266. let [key, value] = _ref;
  20267. return [getConvertedKey(key), value];
  20268. }));
  20269. };
  20270. /**
  20271. * A higher-order function that create an incredibly basic ltr -> rtl style converter for CSS objects.
  20272. *
  20273. * @param {import('react').CSSProperties} ltrStyles Ltr styles. Converts and renders from ltr -> rtl styles, if applicable.
  20274. * @param {import('react').CSSProperties} [rtlStyles] Rtl styles. Renders if provided.
  20275. *
  20276. * @return {() => import('@emotion/react').SerializedStyles} A function to output CSS styles for Emotion's renderer
  20277. */
  20278. function rtl() {
  20279. let ltrStyles = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  20280. let rtlStyles = arguments.length > 1 ? arguments[1] : undefined;
  20281. return () => {
  20282. if (rtlStyles) {
  20283. // @ts-ignore: `css` types are wrong, it can accept an object: https://emotion.sh/docs/object-styles#with-css
  20284. 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);
  20285. } // @ts-ignore: `css` types are wrong, it can accept an object: https://emotion.sh/docs/object-styles#with-css
  20286. 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);
  20287. };
  20288. }
  20289. /**
  20290. * Call this in the `useMemo` dependency array to ensure that subsequent renders will
  20291. * cause rtl styles to update based on the `isRTL` return value even if all other dependencies
  20292. * remain the same.
  20293. *
  20294. * @example
  20295. * const styles = useMemo( () => {
  20296. * return css`
  20297. * ${ rtl( { marginRight: '10px' } ) }
  20298. * `;
  20299. * }, [ rtl.watch() ] );
  20300. */
  20301. rtl.watch = () => (0,external_wp_i18n_namespaceObject.isRTL)();
  20302. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/styles/input-control-styles.js
  20303. 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)."; }
  20304. /**
  20305. * External dependencies
  20306. */
  20307. var _ref2 = true ? {
  20308. name: "1739oy8",
  20309. styles: "z-index:1"
  20310. } : 0;
  20311. const rootFocusedStyles = _ref3 => {
  20312. let {
  20313. isFocused
  20314. } = _ref3;
  20315. if (!isFocused) return '';
  20316. return _ref2;
  20317. };
  20318. const input_control_styles_Root = /*#__PURE__*/emotion_styled_base_browser_esm(flex_component, true ? {
  20319. target: "em5sgkm7"
  20320. } : 0)("position:relative;border-radius:2px;padding-top:0;", rootFocusedStyles, ";" + ( true ? "" : 0));
  20321. const containerDisabledStyles = _ref4 => {
  20322. let {
  20323. disabled
  20324. } = _ref4;
  20325. const backgroundColor = disabled ? COLORS.ui.backgroundDisabled : COLORS.ui.background;
  20326. return /*#__PURE__*/emotion_react_browser_esm_css({
  20327. backgroundColor
  20328. }, true ? "" : 0, true ? "" : 0);
  20329. };
  20330. var input_control_styles_ref = true ? {
  20331. name: "1d3w5wq",
  20332. styles: "width:100%"
  20333. } : 0;
  20334. const containerWidthStyles = _ref5 => {
  20335. let {
  20336. __unstableInputWidth,
  20337. labelPosition
  20338. } = _ref5;
  20339. if (!__unstableInputWidth) return input_control_styles_ref;
  20340. if (labelPosition === 'side') return '';
  20341. if (labelPosition === 'edge') {
  20342. return /*#__PURE__*/emotion_react_browser_esm_css({
  20343. flex: `0 0 ${__unstableInputWidth}`
  20344. }, true ? "" : 0, true ? "" : 0);
  20345. }
  20346. return /*#__PURE__*/emotion_react_browser_esm_css({
  20347. width: __unstableInputWidth
  20348. }, true ? "" : 0, true ? "" : 0);
  20349. };
  20350. const Container = emotion_styled_base_browser_esm("div", true ? {
  20351. target: "em5sgkm6"
  20352. } : 0)("align-items:center;box-sizing:border-box;border-radius:inherit;display:flex;flex:1;position:relative;", containerDisabledStyles, " ", containerWidthStyles, ";" + ( true ? "" : 0));
  20353. const disabledStyles = _ref6 => {
  20354. let {
  20355. disabled
  20356. } = _ref6;
  20357. if (!disabled) return '';
  20358. return /*#__PURE__*/emotion_react_browser_esm_css({
  20359. color: COLORS.ui.textDisabled
  20360. }, true ? "" : 0, true ? "" : 0);
  20361. };
  20362. const fontSizeStyles = _ref7 => {
  20363. let {
  20364. inputSize: size
  20365. } = _ref7;
  20366. const sizes = {
  20367. default: '13px',
  20368. small: '11px',
  20369. '__unstable-large': '13px'
  20370. };
  20371. const fontSize = sizes[size] || sizes.default;
  20372. const fontSizeMobile = '16px';
  20373. if (!fontSize) return '';
  20374. return /*#__PURE__*/emotion_react_browser_esm_css("font-size:", fontSizeMobile, ";@media ( min-width: 600px ){font-size:", fontSize, ";}" + ( true ? "" : 0), true ? "" : 0);
  20375. };
  20376. const getSizeConfig = _ref8 => {
  20377. let {
  20378. inputSize: size,
  20379. __next36pxDefaultSize
  20380. } = _ref8;
  20381. // Paddings may be overridden by the custom paddings props.
  20382. const sizes = {
  20383. default: {
  20384. height: 36,
  20385. lineHeight: 1,
  20386. minHeight: 36,
  20387. paddingLeft: space(4),
  20388. paddingRight: space(4)
  20389. },
  20390. small: {
  20391. height: 24,
  20392. lineHeight: 1,
  20393. minHeight: 24,
  20394. paddingLeft: space(2),
  20395. paddingRight: space(2)
  20396. },
  20397. '__unstable-large': {
  20398. height: 40,
  20399. lineHeight: 1,
  20400. minHeight: 40,
  20401. paddingLeft: space(4),
  20402. paddingRight: space(4)
  20403. }
  20404. };
  20405. if (!__next36pxDefaultSize) {
  20406. sizes.default = {
  20407. height: 30,
  20408. lineHeight: 1,
  20409. minHeight: 30,
  20410. paddingLeft: space(2),
  20411. paddingRight: space(2)
  20412. };
  20413. }
  20414. return sizes[size] || sizes.default;
  20415. };
  20416. const sizeStyles = props => {
  20417. return /*#__PURE__*/emotion_react_browser_esm_css(getSizeConfig(props), true ? "" : 0, true ? "" : 0);
  20418. };
  20419. const customPaddings = _ref9 => {
  20420. let {
  20421. paddingInlineStart,
  20422. paddingInlineEnd
  20423. } = _ref9;
  20424. return /*#__PURE__*/emotion_react_browser_esm_css({
  20425. paddingInlineStart,
  20426. paddingInlineEnd
  20427. }, true ? "" : 0, true ? "" : 0);
  20428. };
  20429. const dragStyles = _ref10 => {
  20430. let {
  20431. isDragging,
  20432. dragCursor
  20433. } = _ref10;
  20434. let defaultArrowStyles;
  20435. let activeDragCursorStyles;
  20436. if (isDragging) {
  20437. 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);
  20438. }
  20439. if (isDragging && dragCursor) {
  20440. activeDragCursorStyles = /*#__PURE__*/emotion_react_browser_esm_css("&:active{cursor:", dragCursor, ";}" + ( true ? "" : 0), true ? "" : 0);
  20441. }
  20442. return /*#__PURE__*/emotion_react_browser_esm_css(defaultArrowStyles, " ", activeDragCursorStyles, ";" + ( true ? "" : 0), true ? "" : 0);
  20443. }; // TODO: Resolve need to use &&& to increase specificity
  20444. // https://github.com/WordPress/gutenberg/issues/18483
  20445. const Input = emotion_styled_base_browser_esm("input", true ? {
  20446. target: "em5sgkm5"
  20447. } : 0)("&&&{background-color:transparent;box-sizing:border-box;border:none;box-shadow:none!important;color:", COLORS.gray[900], ";display:block;font-family:inherit;margin:0;outline:none;width:100%;", dragStyles, " ", disabledStyles, " ", fontSizeStyles, " ", sizeStyles, " ", customPaddings, " &::-webkit-input-placeholder{line-height:normal;}}" + ( true ? "" : 0));
  20448. const BaseLabel = /*#__PURE__*/emotion_styled_base_browser_esm(text_component, true ? {
  20449. target: "em5sgkm4"
  20450. } : 0)("&&&{", baseLabelTypography, ";box-sizing:border-box;display:block;padding-top:0;padding-bottom:0;max-width:100%;z-index:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}" + ( true ? "" : 0));
  20451. const Label = props => (0,external_wp_element_namespaceObject.createElement)(BaseLabel, extends_extends({}, props, {
  20452. as: "label"
  20453. }));
  20454. const LabelWrapper = /*#__PURE__*/emotion_styled_base_browser_esm(flex_item_component, true ? {
  20455. target: "em5sgkm3"
  20456. } : 0)( true ? {
  20457. name: "1b6uupn",
  20458. styles: "max-width:calc( 100% - 10px )"
  20459. } : 0);
  20460. const backdropFocusedStyles = _ref11 => {
  20461. let {
  20462. disabled,
  20463. isFocused
  20464. } = _ref11;
  20465. let borderColor = isFocused ? COLORS.ui.borderFocus : COLORS.ui.border;
  20466. let boxShadow;
  20467. if (isFocused) {
  20468. boxShadow = `0 0 0 1px ${COLORS.ui.borderFocus} inset`;
  20469. }
  20470. if (disabled) {
  20471. borderColor = COLORS.ui.borderDisabled;
  20472. }
  20473. return /*#__PURE__*/emotion_react_browser_esm_css({
  20474. boxShadow,
  20475. borderColor,
  20476. borderStyle: 'solid',
  20477. borderWidth: 1
  20478. }, true ? "" : 0, true ? "" : 0);
  20479. };
  20480. const BackdropUI = emotion_styled_base_browser_esm("div", true ? {
  20481. target: "em5sgkm2"
  20482. } : 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({
  20483. paddingLeft: 2
  20484. }), ";}" + ( true ? "" : 0));
  20485. const Prefix = emotion_styled_base_browser_esm("span", true ? {
  20486. target: "em5sgkm1"
  20487. } : 0)( true ? {
  20488. name: "pvvbxf",
  20489. styles: "box-sizing:border-box;display:block"
  20490. } : 0);
  20491. const Suffix = emotion_styled_base_browser_esm("span", true ? {
  20492. target: "em5sgkm0"
  20493. } : 0)( true ? {
  20494. name: "jgf79h",
  20495. styles: "align-items:center;align-self:stretch;box-sizing:border-box;display:flex"
  20496. } : 0);
  20497. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/backdrop.js
  20498. /**
  20499. * WordPress dependencies
  20500. */
  20501. /**
  20502. * Internal dependencies
  20503. */
  20504. function Backdrop(_ref) {
  20505. let {
  20506. disabled = false,
  20507. isFocused = false
  20508. } = _ref;
  20509. return (0,external_wp_element_namespaceObject.createElement)(BackdropUI, {
  20510. "aria-hidden": "true",
  20511. className: "components-input-control__backdrop",
  20512. disabled: disabled,
  20513. isFocused: isFocused
  20514. });
  20515. }
  20516. const MemoizedBackdrop = (0,external_wp_element_namespaceObject.memo)(Backdrop);
  20517. /* harmony default export */ var backdrop = (MemoizedBackdrop);
  20518. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/label.js
  20519. /**
  20520. * Internal dependencies
  20521. */
  20522. function label_Label(_ref) {
  20523. let {
  20524. children,
  20525. hideLabelFromVision,
  20526. htmlFor,
  20527. ...props
  20528. } = _ref;
  20529. if (!children) return null;
  20530. if (hideLabelFromVision) {
  20531. return (0,external_wp_element_namespaceObject.createElement)(visually_hidden_component, {
  20532. as: "label",
  20533. htmlFor: htmlFor
  20534. }, children);
  20535. }
  20536. return (0,external_wp_element_namespaceObject.createElement)(LabelWrapper, null, (0,external_wp_element_namespaceObject.createElement)(Label, extends_extends({
  20537. htmlFor: htmlFor
  20538. }, props), children));
  20539. }
  20540. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/input-base.js
  20541. /**
  20542. * External dependencies
  20543. */
  20544. /**
  20545. * WordPress dependencies
  20546. */
  20547. /**
  20548. * Internal dependencies
  20549. */
  20550. function useUniqueId(idProp) {
  20551. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(InputBase);
  20552. const id = `input-base-control-${instanceId}`;
  20553. return idProp || id;
  20554. } // Adapter to map props for the new ui/flex compopnent.
  20555. function getUIFlexProps(labelPosition) {
  20556. const props = {};
  20557. switch (labelPosition) {
  20558. case 'top':
  20559. props.direction = 'column';
  20560. props.gap = 0;
  20561. break;
  20562. case 'bottom':
  20563. props.direction = 'column-reverse';
  20564. props.gap = 0;
  20565. break;
  20566. case 'edge':
  20567. props.justify = 'space-between';
  20568. break;
  20569. }
  20570. return props;
  20571. }
  20572. function InputBase(_ref, ref) {
  20573. let {
  20574. __next36pxDefaultSize,
  20575. __unstableInputWidth,
  20576. children,
  20577. className,
  20578. disabled = false,
  20579. hideLabelFromVision = false,
  20580. labelPosition,
  20581. id: idProp,
  20582. isFocused = false,
  20583. label,
  20584. prefix,
  20585. size = 'default',
  20586. suffix,
  20587. ...props
  20588. } = _ref;
  20589. const id = useUniqueId(idProp);
  20590. const hideLabel = hideLabelFromVision || !label;
  20591. const {
  20592. paddingLeft,
  20593. paddingRight
  20594. } = getSizeConfig({
  20595. inputSize: size,
  20596. __next36pxDefaultSize
  20597. });
  20598. const prefixSuffixContextValue = (0,external_wp_element_namespaceObject.useMemo)(() => {
  20599. return {
  20600. InputControlPrefixWrapper: {
  20601. paddingLeft
  20602. },
  20603. InputControlSuffixWrapper: {
  20604. paddingRight
  20605. }
  20606. };
  20607. }, [paddingLeft, paddingRight]);
  20608. return (// @ts-expect-error The `direction` prop from Flex (FlexDirection) conflicts with legacy SVGAttributes `direction` (string) that come from React intrinsic prop definitions.
  20609. (0,external_wp_element_namespaceObject.createElement)(input_control_styles_Root, extends_extends({}, props, getUIFlexProps(labelPosition), {
  20610. className: className,
  20611. gap: 2,
  20612. isFocused: isFocused,
  20613. labelPosition: labelPosition,
  20614. ref: ref
  20615. }), (0,external_wp_element_namespaceObject.createElement)(label_Label, {
  20616. className: "components-input-control__label",
  20617. hideLabelFromVision: hideLabelFromVision,
  20618. labelPosition: labelPosition,
  20619. htmlFor: id
  20620. }, label), (0,external_wp_element_namespaceObject.createElement)(Container, {
  20621. __unstableInputWidth: __unstableInputWidth,
  20622. className: "components-input-control__container",
  20623. disabled: disabled,
  20624. hideLabel: hideLabel,
  20625. labelPosition: labelPosition
  20626. }, (0,external_wp_element_namespaceObject.createElement)(ContextSystemProvider, {
  20627. value: prefixSuffixContextValue
  20628. }, prefix && (0,external_wp_element_namespaceObject.createElement)(Prefix, {
  20629. className: "components-input-control__prefix"
  20630. }, prefix), children, suffix && (0,external_wp_element_namespaceObject.createElement)(Suffix, {
  20631. className: "components-input-control__suffix"
  20632. }, suffix)), (0,external_wp_element_namespaceObject.createElement)(backdrop, {
  20633. disabled: disabled,
  20634. isFocused: isFocused
  20635. })))
  20636. );
  20637. }
  20638. /* harmony default export */ var input_base = ((0,external_wp_element_namespaceObject.forwardRef)(InputBase));
  20639. ;// CONCATENATED MODULE: ./node_modules/@use-gesture/core/dist/maths-b28d9b98.esm.js
  20640. function maths_b28d9b98_esm_clamp(v, min, max) {
  20641. return Math.max(min, Math.min(v, max));
  20642. }
  20643. const V = {
  20644. toVector(v, fallback) {
  20645. if (v === undefined) v = fallback;
  20646. return Array.isArray(v) ? v : [v, v];
  20647. },
  20648. add(v1, v2) {
  20649. return [v1[0] + v2[0], v1[1] + v2[1]];
  20650. },
  20651. sub(v1, v2) {
  20652. return [v1[0] - v2[0], v1[1] - v2[1]];
  20653. },
  20654. addTo(v1, v2) {
  20655. v1[0] += v2[0];
  20656. v1[1] += v2[1];
  20657. },
  20658. subTo(v1, v2) {
  20659. v1[0] -= v2[0];
  20660. v1[1] -= v2[1];
  20661. }
  20662. };
  20663. function rubberband(distance, dimension, constant) {
  20664. if (dimension === 0 || Math.abs(dimension) === Infinity) return Math.pow(distance, constant * 5);
  20665. return distance * dimension * constant / (dimension + constant * distance);
  20666. }
  20667. function rubberbandIfOutOfBounds(position, min, max, constant = 0.15) {
  20668. if (constant === 0) return maths_b28d9b98_esm_clamp(position, min, max);
  20669. if (position < min) return -rubberband(min - position, max - min, constant) + min;
  20670. if (position > max) return +rubberband(position - max, max - min, constant) + max;
  20671. return position;
  20672. }
  20673. function computeRubberband(bounds, [Vx, Vy], [Rx, Ry]) {
  20674. const [[X0, X1], [Y0, Y1]] = bounds;
  20675. return [rubberbandIfOutOfBounds(Vx, X0, X1, Rx), rubberbandIfOutOfBounds(Vy, Y0, Y1, Ry)];
  20676. }
  20677. ;// CONCATENATED MODULE: ./node_modules/@use-gesture/core/dist/actions-e3d93fde.esm.js
  20678. function actions_e3d93fde_esm_defineProperty(obj, key, value) {
  20679. if (key in obj) {
  20680. Object.defineProperty(obj, key, {
  20681. value: value,
  20682. enumerable: true,
  20683. configurable: true,
  20684. writable: true
  20685. });
  20686. } else {
  20687. obj[key] = value;
  20688. }
  20689. return obj;
  20690. }
  20691. function actions_e3d93fde_esm_ownKeys(object, enumerableOnly) {
  20692. var keys = Object.keys(object);
  20693. if (Object.getOwnPropertySymbols) {
  20694. var symbols = Object.getOwnPropertySymbols(object);
  20695. enumerableOnly && (symbols = symbols.filter(function (sym) {
  20696. return Object.getOwnPropertyDescriptor(object, sym).enumerable;
  20697. })), keys.push.apply(keys, symbols);
  20698. }
  20699. return keys;
  20700. }
  20701. function actions_e3d93fde_esm_objectSpread2(target) {
  20702. for (var i = 1; i < arguments.length; i++) {
  20703. var source = null != arguments[i] ? arguments[i] : {};
  20704. i % 2 ? actions_e3d93fde_esm_ownKeys(Object(source), !0).forEach(function (key) {
  20705. actions_e3d93fde_esm_defineProperty(target, key, source[key]);
  20706. }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : actions_e3d93fde_esm_ownKeys(Object(source)).forEach(function (key) {
  20707. Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
  20708. });
  20709. }
  20710. return target;
  20711. }
  20712. const EVENT_TYPE_MAP = {
  20713. pointer: {
  20714. start: 'down',
  20715. change: 'move',
  20716. end: 'up'
  20717. },
  20718. mouse: {
  20719. start: 'down',
  20720. change: 'move',
  20721. end: 'up'
  20722. },
  20723. touch: {
  20724. start: 'start',
  20725. change: 'move',
  20726. end: 'end'
  20727. },
  20728. gesture: {
  20729. start: 'start',
  20730. change: 'change',
  20731. end: 'end'
  20732. }
  20733. };
  20734. function capitalize(string) {
  20735. if (!string) return '';
  20736. return string[0].toUpperCase() + string.slice(1);
  20737. }
  20738. const actionsWithoutCaptureSupported = ['enter', 'leave'];
  20739. function hasCapture(capture = false, actionKey) {
  20740. return capture && !actionsWithoutCaptureSupported.includes(actionKey);
  20741. }
  20742. function toHandlerProp(device, action = '', capture = false) {
  20743. const deviceProps = EVENT_TYPE_MAP[device];
  20744. const actionKey = deviceProps ? deviceProps[action] || action : action;
  20745. return 'on' + capitalize(device) + capitalize(actionKey) + (hasCapture(capture, actionKey) ? 'Capture' : '');
  20746. }
  20747. const pointerCaptureEvents = ['gotpointercapture', 'lostpointercapture'];
  20748. function parseProp(prop) {
  20749. let eventKey = prop.substring(2).toLowerCase();
  20750. const passive = !!~eventKey.indexOf('passive');
  20751. if (passive) eventKey = eventKey.replace('passive', '');
  20752. const captureKey = pointerCaptureEvents.includes(eventKey) ? 'capturecapture' : 'capture';
  20753. const capture = !!~eventKey.indexOf(captureKey);
  20754. if (capture) eventKey = eventKey.replace('capture', '');
  20755. return {
  20756. device: eventKey,
  20757. capture,
  20758. passive
  20759. };
  20760. }
  20761. function toDomEventType(device, action = '') {
  20762. const deviceProps = EVENT_TYPE_MAP[device];
  20763. const actionKey = deviceProps ? deviceProps[action] || action : action;
  20764. return device + actionKey;
  20765. }
  20766. function isTouch(event) {
  20767. return 'touches' in event;
  20768. }
  20769. function getPointerType(event) {
  20770. if (isTouch(event)) return 'touch';
  20771. if ('pointerType' in event) return event.pointerType;
  20772. return 'mouse';
  20773. }
  20774. function getCurrentTargetTouchList(event) {
  20775. return Array.from(event.touches).filter(e => {
  20776. var _event$currentTarget, _event$currentTarget$;
  20777. 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));
  20778. });
  20779. }
  20780. function getTouchList(event) {
  20781. return event.type === 'touchend' || event.type === 'touchcancel' ? event.changedTouches : event.targetTouches;
  20782. }
  20783. function getValueEvent(event) {
  20784. return isTouch(event) ? getTouchList(event)[0] : event;
  20785. }
  20786. function distanceAngle(P1, P2) {
  20787. const dx = P2.clientX - P1.clientX;
  20788. const dy = P2.clientY - P1.clientY;
  20789. const cx = (P2.clientX + P1.clientX) / 2;
  20790. const cy = (P2.clientY + P1.clientY) / 2;
  20791. const distance = Math.hypot(dx, dy);
  20792. const angle = -(Math.atan2(dx, dy) * 180) / Math.PI;
  20793. const origin = [cx, cy];
  20794. return {
  20795. angle,
  20796. distance,
  20797. origin
  20798. };
  20799. }
  20800. function touchIds(event) {
  20801. return getCurrentTargetTouchList(event).map(touch => touch.identifier);
  20802. }
  20803. function touchDistanceAngle(event, ids) {
  20804. const [P1, P2] = Array.from(event.touches).filter(touch => ids.includes(touch.identifier));
  20805. return distanceAngle(P1, P2);
  20806. }
  20807. function pointerId(event) {
  20808. const valueEvent = getValueEvent(event);
  20809. return isTouch(event) ? valueEvent.identifier : valueEvent.pointerId;
  20810. }
  20811. function pointerValues(event) {
  20812. const valueEvent = getValueEvent(event);
  20813. return [valueEvent.clientX, valueEvent.clientY];
  20814. }
  20815. const LINE_HEIGHT = 40;
  20816. const PAGE_HEIGHT = 800;
  20817. function wheelValues(event) {
  20818. let {
  20819. deltaX,
  20820. deltaY,
  20821. deltaMode
  20822. } = event;
  20823. if (deltaMode === 1) {
  20824. deltaX *= LINE_HEIGHT;
  20825. deltaY *= LINE_HEIGHT;
  20826. } else if (deltaMode === 2) {
  20827. deltaX *= PAGE_HEIGHT;
  20828. deltaY *= PAGE_HEIGHT;
  20829. }
  20830. return [deltaX, deltaY];
  20831. }
  20832. function scrollValues(event) {
  20833. var _ref, _ref2;
  20834. const {
  20835. scrollX,
  20836. scrollY,
  20837. scrollLeft,
  20838. scrollTop
  20839. } = event.currentTarget;
  20840. 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];
  20841. }
  20842. function getEventDetails(event) {
  20843. const payload = {};
  20844. if ('buttons' in event) payload.buttons = event.buttons;
  20845. if ('shiftKey' in event) {
  20846. const {
  20847. shiftKey,
  20848. altKey,
  20849. metaKey,
  20850. ctrlKey
  20851. } = event;
  20852. Object.assign(payload, {
  20853. shiftKey,
  20854. altKey,
  20855. metaKey,
  20856. ctrlKey
  20857. });
  20858. }
  20859. return payload;
  20860. }
  20861. function call(v, ...args) {
  20862. if (typeof v === 'function') {
  20863. return v(...args);
  20864. } else {
  20865. return v;
  20866. }
  20867. }
  20868. function actions_e3d93fde_esm_noop() {}
  20869. function chain(...fns) {
  20870. if (fns.length === 0) return actions_e3d93fde_esm_noop;
  20871. if (fns.length === 1) return fns[0];
  20872. return function () {
  20873. let result;
  20874. for (const fn of fns) {
  20875. result = fn.apply(this, arguments) || result;
  20876. }
  20877. return result;
  20878. };
  20879. }
  20880. function assignDefault(value, fallback) {
  20881. return Object.assign({}, fallback, value || {});
  20882. }
  20883. const BEFORE_LAST_KINEMATICS_DELAY = 32;
  20884. class Engine {
  20885. constructor(ctrl, args, key) {
  20886. this.ctrl = ctrl;
  20887. this.args = args;
  20888. this.key = key;
  20889. if (!this.state) {
  20890. this.state = {};
  20891. this.computeValues([0, 0]);
  20892. this.computeInitial();
  20893. if (this.init) this.init();
  20894. this.reset();
  20895. }
  20896. }
  20897. get state() {
  20898. return this.ctrl.state[this.key];
  20899. }
  20900. set state(state) {
  20901. this.ctrl.state[this.key] = state;
  20902. }
  20903. get shared() {
  20904. return this.ctrl.state.shared;
  20905. }
  20906. get eventStore() {
  20907. return this.ctrl.gestureEventStores[this.key];
  20908. }
  20909. get timeoutStore() {
  20910. return this.ctrl.gestureTimeoutStores[this.key];
  20911. }
  20912. get config() {
  20913. return this.ctrl.config[this.key];
  20914. }
  20915. get sharedConfig() {
  20916. return this.ctrl.config.shared;
  20917. }
  20918. get handler() {
  20919. return this.ctrl.handlers[this.key];
  20920. }
  20921. reset() {
  20922. const {
  20923. state,
  20924. shared,
  20925. ingKey,
  20926. args
  20927. } = this;
  20928. shared[ingKey] = state._active = state.active = state._blocked = state._force = false;
  20929. state._step = [false, false];
  20930. state.intentional = false;
  20931. state._movement = [0, 0];
  20932. state._distance = [0, 0];
  20933. state._direction = [0, 0];
  20934. state._delta = [0, 0];
  20935. state._bounds = [[-Infinity, Infinity], [-Infinity, Infinity]];
  20936. state.args = args;
  20937. state.axis = undefined;
  20938. state.memo = undefined;
  20939. state.elapsedTime = 0;
  20940. state.direction = [0, 0];
  20941. state.distance = [0, 0];
  20942. state.overflow = [0, 0];
  20943. state._movementBound = [false, false];
  20944. state.velocity = [0, 0];
  20945. state.movement = [0, 0];
  20946. state.delta = [0, 0];
  20947. state.timeStamp = 0;
  20948. }
  20949. start(event) {
  20950. const state = this.state;
  20951. const config = this.config;
  20952. if (!state._active) {
  20953. this.reset();
  20954. this.computeInitial();
  20955. state._active = true;
  20956. state.target = event.target;
  20957. state.currentTarget = event.currentTarget;
  20958. state.lastOffset = config.from ? call(config.from, state) : state.offset;
  20959. state.offset = state.lastOffset;
  20960. }
  20961. state.startTime = state.timeStamp = event.timeStamp;
  20962. }
  20963. computeValues(values) {
  20964. const state = this.state;
  20965. state._values = values;
  20966. state.values = this.config.transform(values);
  20967. }
  20968. computeInitial() {
  20969. const state = this.state;
  20970. state._initial = state._values;
  20971. state.initial = state.values;
  20972. }
  20973. compute(event) {
  20974. const {
  20975. state,
  20976. config,
  20977. shared
  20978. } = this;
  20979. state.args = this.args;
  20980. let dt = 0;
  20981. if (event) {
  20982. state.event = event;
  20983. if (config.preventDefault && event.cancelable) state.event.preventDefault();
  20984. state.type = event.type;
  20985. shared.touches = this.ctrl.pointerIds.size || this.ctrl.touchIds.size;
  20986. shared.locked = !!document.pointerLockElement;
  20987. Object.assign(shared, getEventDetails(event));
  20988. shared.down = shared.pressed = shared.buttons % 2 === 1 || shared.touches > 0;
  20989. dt = event.timeStamp - state.timeStamp;
  20990. state.timeStamp = event.timeStamp;
  20991. state.elapsedTime = state.timeStamp - state.startTime;
  20992. }
  20993. if (state._active) {
  20994. const _absoluteDelta = state._delta.map(Math.abs);
  20995. V.addTo(state._distance, _absoluteDelta);
  20996. }
  20997. if (this.axisIntent) this.axisIntent(event);
  20998. const [_m0, _m1] = state._movement;
  20999. const [t0, t1] = config.threshold;
  21000. const {
  21001. _step,
  21002. values
  21003. } = state;
  21004. if (config.hasCustomTransform) {
  21005. if (_step[0] === false) _step[0] = Math.abs(_m0) >= t0 && values[0];
  21006. if (_step[1] === false) _step[1] = Math.abs(_m1) >= t1 && values[1];
  21007. } else {
  21008. if (_step[0] === false) _step[0] = Math.abs(_m0) >= t0 && Math.sign(_m0) * t0;
  21009. if (_step[1] === false) _step[1] = Math.abs(_m1) >= t1 && Math.sign(_m1) * t1;
  21010. }
  21011. state.intentional = _step[0] !== false || _step[1] !== false;
  21012. if (!state.intentional) return;
  21013. const movement = [0, 0];
  21014. if (config.hasCustomTransform) {
  21015. const [v0, v1] = values;
  21016. movement[0] = _step[0] !== false ? v0 - _step[0] : 0;
  21017. movement[1] = _step[1] !== false ? v1 - _step[1] : 0;
  21018. } else {
  21019. movement[0] = _step[0] !== false ? _m0 - _step[0] : 0;
  21020. movement[1] = _step[1] !== false ? _m1 - _step[1] : 0;
  21021. }
  21022. if (this.restrictToAxis && !state._blocked) this.restrictToAxis(movement);
  21023. const previousOffset = state.offset;
  21024. const gestureIsActive = state._active && !state._blocked || state.active;
  21025. if (gestureIsActive) {
  21026. state.first = state._active && !state.active;
  21027. state.last = !state._active && state.active;
  21028. state.active = shared[this.ingKey] = state._active;
  21029. if (event) {
  21030. if (state.first) {
  21031. if ('bounds' in config) state._bounds = call(config.bounds, state);
  21032. if (this.setup) this.setup();
  21033. }
  21034. state.movement = movement;
  21035. this.computeOffset();
  21036. }
  21037. }
  21038. const [ox, oy] = state.offset;
  21039. const [[x0, x1], [y0, y1]] = state._bounds;
  21040. state.overflow = [ox < x0 ? -1 : ox > x1 ? 1 : 0, oy < y0 ? -1 : oy > y1 ? 1 : 0];
  21041. state._movementBound[0] = state.overflow[0] ? state._movementBound[0] === false ? state._movement[0] : state._movementBound[0] : false;
  21042. state._movementBound[1] = state.overflow[1] ? state._movementBound[1] === false ? state._movement[1] : state._movementBound[1] : false;
  21043. const rubberband = state._active ? config.rubberband || [0, 0] : [0, 0];
  21044. state.offset = computeRubberband(state._bounds, state.offset, rubberband);
  21045. state.delta = V.sub(state.offset, previousOffset);
  21046. this.computeMovement();
  21047. if (gestureIsActive && (!state.last || dt > BEFORE_LAST_KINEMATICS_DELAY)) {
  21048. state.delta = V.sub(state.offset, previousOffset);
  21049. const absoluteDelta = state.delta.map(Math.abs);
  21050. V.addTo(state.distance, absoluteDelta);
  21051. state.direction = state.delta.map(Math.sign);
  21052. state._direction = state._delta.map(Math.sign);
  21053. if (!state.first && dt > 0) {
  21054. state.velocity = [absoluteDelta[0] / dt, absoluteDelta[1] / dt];
  21055. }
  21056. }
  21057. }
  21058. emit() {
  21059. const state = this.state;
  21060. const shared = this.shared;
  21061. const config = this.config;
  21062. if (!state._active) this.clean();
  21063. if ((state._blocked || !state.intentional) && !state._force && !config.triggerAllEvents) return;
  21064. const memo = this.handler(actions_e3d93fde_esm_objectSpread2(actions_e3d93fde_esm_objectSpread2(actions_e3d93fde_esm_objectSpread2({}, shared), state), {}, {
  21065. [this.aliasKey]: state.values
  21066. }));
  21067. if (memo !== undefined) state.memo = memo;
  21068. }
  21069. clean() {
  21070. this.eventStore.clean();
  21071. this.timeoutStore.clean();
  21072. }
  21073. }
  21074. function selectAxis([dx, dy], threshold) {
  21075. const absDx = Math.abs(dx);
  21076. const absDy = Math.abs(dy);
  21077. if (absDx > absDy && absDx > threshold) {
  21078. return 'x';
  21079. }
  21080. if (absDy > absDx && absDy > threshold) {
  21081. return 'y';
  21082. }
  21083. return undefined;
  21084. }
  21085. class CoordinatesEngine extends Engine {
  21086. constructor(...args) {
  21087. super(...args);
  21088. actions_e3d93fde_esm_defineProperty(this, "aliasKey", 'xy');
  21089. }
  21090. reset() {
  21091. super.reset();
  21092. this.state.axis = undefined;
  21093. }
  21094. init() {
  21095. this.state.offset = [0, 0];
  21096. this.state.lastOffset = [0, 0];
  21097. }
  21098. computeOffset() {
  21099. this.state.offset = V.add(this.state.lastOffset, this.state.movement);
  21100. }
  21101. computeMovement() {
  21102. this.state.movement = V.sub(this.state.offset, this.state.lastOffset);
  21103. }
  21104. axisIntent(event) {
  21105. const state = this.state;
  21106. const config = this.config;
  21107. if (!state.axis && event) {
  21108. const threshold = typeof config.axisThreshold === 'object' ? config.axisThreshold[getPointerType(event)] : config.axisThreshold;
  21109. state.axis = selectAxis(state._movement, threshold);
  21110. }
  21111. state._blocked = (config.lockDirection || !!config.axis) && !state.axis || !!config.axis && config.axis !== state.axis;
  21112. }
  21113. restrictToAxis(v) {
  21114. if (this.config.axis || this.config.lockDirection) {
  21115. switch (this.state.axis) {
  21116. case 'x':
  21117. v[1] = 0;
  21118. break;
  21119. case 'y':
  21120. v[0] = 0;
  21121. break;
  21122. }
  21123. }
  21124. }
  21125. }
  21126. const identity = v => v;
  21127. const DEFAULT_RUBBERBAND = 0.15;
  21128. const commonConfigResolver = {
  21129. enabled(value = true) {
  21130. return value;
  21131. },
  21132. eventOptions(value, _k, config) {
  21133. return actions_e3d93fde_esm_objectSpread2(actions_e3d93fde_esm_objectSpread2({}, config.shared.eventOptions), value);
  21134. },
  21135. preventDefault(value = false) {
  21136. return value;
  21137. },
  21138. triggerAllEvents(value = false) {
  21139. return value;
  21140. },
  21141. rubberband(value = 0) {
  21142. switch (value) {
  21143. case true:
  21144. return [DEFAULT_RUBBERBAND, DEFAULT_RUBBERBAND];
  21145. case false:
  21146. return [0, 0];
  21147. default:
  21148. return V.toVector(value);
  21149. }
  21150. },
  21151. from(value) {
  21152. if (typeof value === 'function') return value;
  21153. if (value != null) return V.toVector(value);
  21154. },
  21155. transform(value, _k, config) {
  21156. const transform = value || config.shared.transform;
  21157. this.hasCustomTransform = !!transform;
  21158. if (false) {}
  21159. return transform || identity;
  21160. },
  21161. threshold(value) {
  21162. return V.toVector(value, 0);
  21163. }
  21164. };
  21165. if (false) {}
  21166. const DEFAULT_AXIS_THRESHOLD = 0;
  21167. const coordinatesConfigResolver = actions_e3d93fde_esm_objectSpread2(actions_e3d93fde_esm_objectSpread2({}, commonConfigResolver), {}, {
  21168. axis(_v, _k, {
  21169. axis
  21170. }) {
  21171. this.lockDirection = axis === 'lock';
  21172. if (!this.lockDirection) return axis;
  21173. },
  21174. axisThreshold(value = DEFAULT_AXIS_THRESHOLD) {
  21175. return value;
  21176. },
  21177. bounds(value = {}) {
  21178. if (typeof value === 'function') {
  21179. return state => coordinatesConfigResolver.bounds(value(state));
  21180. }
  21181. if ('current' in value) {
  21182. return () => value.current;
  21183. }
  21184. if (typeof HTMLElement === 'function' && value instanceof HTMLElement) {
  21185. return value;
  21186. }
  21187. const {
  21188. left = -Infinity,
  21189. right = Infinity,
  21190. top = -Infinity,
  21191. bottom = Infinity
  21192. } = value;
  21193. return [[left, right], [top, bottom]];
  21194. }
  21195. });
  21196. const DISPLACEMENT = 10;
  21197. const KEYS_DELTA_MAP = {
  21198. ArrowRight: (factor = 1) => [DISPLACEMENT * factor, 0],
  21199. ArrowLeft: (factor = 1) => [-DISPLACEMENT * factor, 0],
  21200. ArrowUp: (factor = 1) => [0, -DISPLACEMENT * factor],
  21201. ArrowDown: (factor = 1) => [0, DISPLACEMENT * factor]
  21202. };
  21203. class DragEngine extends CoordinatesEngine {
  21204. constructor(...args) {
  21205. super(...args);
  21206. actions_e3d93fde_esm_defineProperty(this, "ingKey", 'dragging');
  21207. }
  21208. reset() {
  21209. super.reset();
  21210. const state = this.state;
  21211. state._pointerId = undefined;
  21212. state._pointerActive = false;
  21213. state._keyboardActive = false;
  21214. state._preventScroll = false;
  21215. state._delayed = false;
  21216. state.swipe = [0, 0];
  21217. state.tap = false;
  21218. state.canceled = false;
  21219. state.cancel = this.cancel.bind(this);
  21220. }
  21221. setup() {
  21222. const state = this.state;
  21223. if (state._bounds instanceof HTMLElement) {
  21224. const boundRect = state._bounds.getBoundingClientRect();
  21225. const targetRect = state.currentTarget.getBoundingClientRect();
  21226. const _bounds = {
  21227. left: boundRect.left - targetRect.left + state.offset[0],
  21228. right: boundRect.right - targetRect.right + state.offset[0],
  21229. top: boundRect.top - targetRect.top + state.offset[1],
  21230. bottom: boundRect.bottom - targetRect.bottom + state.offset[1]
  21231. };
  21232. state._bounds = coordinatesConfigResolver.bounds(_bounds);
  21233. }
  21234. }
  21235. cancel() {
  21236. const state = this.state;
  21237. if (state.canceled) return;
  21238. state.canceled = true;
  21239. state._active = false;
  21240. setTimeout(() => {
  21241. this.compute();
  21242. this.emit();
  21243. }, 0);
  21244. }
  21245. setActive() {
  21246. this.state._active = this.state._pointerActive || this.state._keyboardActive;
  21247. }
  21248. clean() {
  21249. this.pointerClean();
  21250. this.state._pointerActive = false;
  21251. this.state._keyboardActive = false;
  21252. super.clean();
  21253. }
  21254. pointerDown(event) {
  21255. const config = this.config;
  21256. const state = this.state;
  21257. if (event.buttons != null && (
  21258. Array.isArray(config.pointerButtons) ? !config.pointerButtons.includes(event.buttons) :
  21259. config.pointerButtons !== -1 && config.pointerButtons !== event.buttons)) return;
  21260. const ctrlIds = this.ctrl.setEventIds(event);
  21261. if (config.pointerCapture) {
  21262. event.target.setPointerCapture(event.pointerId);
  21263. }
  21264. if (
  21265. ctrlIds && ctrlIds.size > 1 && state._pointerActive) return;
  21266. this.start(event);
  21267. this.setupPointer(event);
  21268. state._pointerId = pointerId(event);
  21269. state._pointerActive = true;
  21270. this.computeValues(pointerValues(event));
  21271. this.computeInitial();
  21272. if (config.preventScrollAxis && getPointerType(event) !== 'mouse') {
  21273. state._active = false;
  21274. this.setupScrollPrevention(event);
  21275. } else if (config.delay > 0) {
  21276. this.setupDelayTrigger(event);
  21277. if (config.triggerAllEvents) {
  21278. this.compute(event);
  21279. this.emit();
  21280. }
  21281. } else {
  21282. this.startPointerDrag(event);
  21283. }
  21284. }
  21285. startPointerDrag(event) {
  21286. const state = this.state;
  21287. state._active = true;
  21288. state._preventScroll = true;
  21289. state._delayed = false;
  21290. this.compute(event);
  21291. this.emit();
  21292. }
  21293. pointerMove(event) {
  21294. const state = this.state;
  21295. const config = this.config;
  21296. if (!state._pointerActive) return;
  21297. if (state.type === event.type && event.timeStamp === state.timeStamp) return;
  21298. const id = pointerId(event);
  21299. if (state._pointerId !== undefined && id !== state._pointerId) return;
  21300. const _values = pointerValues(event);
  21301. if (document.pointerLockElement === event.target) {
  21302. state._delta = [event.movementX, event.movementY];
  21303. } else {
  21304. state._delta = V.sub(_values, state._values);
  21305. this.computeValues(_values);
  21306. }
  21307. V.addTo(state._movement, state._delta);
  21308. this.compute(event);
  21309. if (state._delayed && state.intentional) {
  21310. this.timeoutStore.remove('dragDelay');
  21311. state.active = false;
  21312. this.startPointerDrag(event);
  21313. return;
  21314. }
  21315. if (config.preventScrollAxis && !state._preventScroll) {
  21316. if (state.axis) {
  21317. if (state.axis === config.preventScrollAxis || config.preventScrollAxis === 'xy') {
  21318. state._active = false;
  21319. this.clean();
  21320. return;
  21321. } else {
  21322. this.timeoutStore.remove('startPointerDrag');
  21323. this.startPointerDrag(event);
  21324. return;
  21325. }
  21326. } else {
  21327. return;
  21328. }
  21329. }
  21330. this.emit();
  21331. }
  21332. pointerUp(event) {
  21333. this.ctrl.setEventIds(event);
  21334. try {
  21335. if (this.config.pointerCapture && event.target.hasPointerCapture(event.pointerId)) {
  21336. ;
  21337. event.target.releasePointerCapture(event.pointerId);
  21338. }
  21339. } catch (_unused) {
  21340. if (false) {}
  21341. }
  21342. const state = this.state;
  21343. const config = this.config;
  21344. if (!state._active || !state._pointerActive) return;
  21345. const id = pointerId(event);
  21346. if (state._pointerId !== undefined && id !== state._pointerId) return;
  21347. this.state._pointerActive = false;
  21348. this.setActive();
  21349. this.compute(event);
  21350. const [dx, dy] = state._distance;
  21351. state.tap = dx <= config.tapsThreshold && dy <= config.tapsThreshold;
  21352. if (state.tap && config.filterTaps) {
  21353. state._force = true;
  21354. } else {
  21355. const [dirx, diry] = state.direction;
  21356. const [vx, vy] = state.velocity;
  21357. const [mx, my] = state.movement;
  21358. const [svx, svy] = config.swipe.velocity;
  21359. const [sx, sy] = config.swipe.distance;
  21360. const sdt = config.swipe.duration;
  21361. if (state.elapsedTime < sdt) {
  21362. if (Math.abs(vx) > svx && Math.abs(mx) > sx) state.swipe[0] = dirx;
  21363. if (Math.abs(vy) > svy && Math.abs(my) > sy) state.swipe[1] = diry;
  21364. }
  21365. }
  21366. this.emit();
  21367. }
  21368. pointerClick(event) {
  21369. if (!this.state.tap && event.detail > 0) {
  21370. event.preventDefault();
  21371. event.stopPropagation();
  21372. }
  21373. }
  21374. setupPointer(event) {
  21375. const config = this.config;
  21376. const device = config.device;
  21377. if (false) {}
  21378. if (config.pointerLock) {
  21379. event.currentTarget.requestPointerLock();
  21380. }
  21381. if (!config.pointerCapture) {
  21382. this.eventStore.add(this.sharedConfig.window, device, 'change', this.pointerMove.bind(this));
  21383. this.eventStore.add(this.sharedConfig.window, device, 'end', this.pointerUp.bind(this));
  21384. this.eventStore.add(this.sharedConfig.window, device, 'cancel', this.pointerUp.bind(this));
  21385. }
  21386. }
  21387. pointerClean() {
  21388. if (this.config.pointerLock && document.pointerLockElement === this.state.currentTarget) {
  21389. document.exitPointerLock();
  21390. }
  21391. }
  21392. preventScroll(event) {
  21393. if (this.state._preventScroll && event.cancelable) {
  21394. event.preventDefault();
  21395. }
  21396. }
  21397. setupScrollPrevention(event) {
  21398. this.state._preventScroll = false;
  21399. persistEvent(event);
  21400. const remove = this.eventStore.add(this.sharedConfig.window, 'touch', 'change', this.preventScroll.bind(this), {
  21401. passive: false
  21402. });
  21403. this.eventStore.add(this.sharedConfig.window, 'touch', 'end', remove);
  21404. this.eventStore.add(this.sharedConfig.window, 'touch', 'cancel', remove);
  21405. this.timeoutStore.add('startPointerDrag', this.startPointerDrag.bind(this), this.config.preventScrollDelay, event);
  21406. }
  21407. setupDelayTrigger(event) {
  21408. this.state._delayed = true;
  21409. this.timeoutStore.add('dragDelay', () => {
  21410. this.state._step = [0, 0];
  21411. this.startPointerDrag(event);
  21412. }, this.config.delay);
  21413. }
  21414. keyDown(event) {
  21415. const deltaFn = KEYS_DELTA_MAP[event.key];
  21416. if (deltaFn) {
  21417. const state = this.state;
  21418. const factor = event.shiftKey ? 10 : event.altKey ? 0.1 : 1;
  21419. this.start(event);
  21420. state._delta = deltaFn(factor);
  21421. state._keyboardActive = true;
  21422. V.addTo(state._movement, state._delta);
  21423. this.compute(event);
  21424. this.emit();
  21425. }
  21426. }
  21427. keyUp(event) {
  21428. if (!(event.key in KEYS_DELTA_MAP)) return;
  21429. this.state._keyboardActive = false;
  21430. this.setActive();
  21431. this.compute(event);
  21432. this.emit();
  21433. }
  21434. bind(bindFunction) {
  21435. const device = this.config.device;
  21436. bindFunction(device, 'start', this.pointerDown.bind(this));
  21437. if (this.config.pointerCapture) {
  21438. bindFunction(device, 'change', this.pointerMove.bind(this));
  21439. bindFunction(device, 'end', this.pointerUp.bind(this));
  21440. bindFunction(device, 'cancel', this.pointerUp.bind(this));
  21441. bindFunction('lostPointerCapture', '', this.pointerUp.bind(this));
  21442. }
  21443. if (this.config.keys) {
  21444. bindFunction('key', 'down', this.keyDown.bind(this));
  21445. bindFunction('key', 'up', this.keyUp.bind(this));
  21446. }
  21447. if (this.config.filterTaps) {
  21448. bindFunction('click', '', this.pointerClick.bind(this), {
  21449. capture: true,
  21450. passive: false
  21451. });
  21452. }
  21453. }
  21454. }
  21455. function persistEvent(event) {
  21456. 'persist' in event && typeof event.persist === 'function' && event.persist();
  21457. }
  21458. const actions_e3d93fde_esm_isBrowser = typeof window !== 'undefined' && window.document && window.document.createElement;
  21459. function actions_e3d93fde_esm_supportsTouchEvents() {
  21460. return actions_e3d93fde_esm_isBrowser && 'ontouchstart' in window;
  21461. }
  21462. function isTouchScreen() {
  21463. return actions_e3d93fde_esm_supportsTouchEvents() || actions_e3d93fde_esm_isBrowser && window.navigator.maxTouchPoints > 1;
  21464. }
  21465. function actions_e3d93fde_esm_supportsPointerEvents() {
  21466. return actions_e3d93fde_esm_isBrowser && 'onpointerdown' in window;
  21467. }
  21468. function supportsPointerLock() {
  21469. return actions_e3d93fde_esm_isBrowser && 'exitPointerLock' in window.document;
  21470. }
  21471. function supportsGestureEvents() {
  21472. try {
  21473. return 'constructor' in GestureEvent;
  21474. } catch (e) {
  21475. return false;
  21476. }
  21477. }
  21478. const SUPPORT = {
  21479. isBrowser: actions_e3d93fde_esm_isBrowser,
  21480. gesture: supportsGestureEvents(),
  21481. touch: isTouchScreen(),
  21482. touchscreen: isTouchScreen(),
  21483. pointer: actions_e3d93fde_esm_supportsPointerEvents(),
  21484. pointerLock: supportsPointerLock()
  21485. };
  21486. const DEFAULT_PREVENT_SCROLL_DELAY = 250;
  21487. const DEFAULT_DRAG_DELAY = 180;
  21488. const DEFAULT_SWIPE_VELOCITY = 0.5;
  21489. const DEFAULT_SWIPE_DISTANCE = 50;
  21490. const DEFAULT_SWIPE_DURATION = 250;
  21491. const DEFAULT_DRAG_AXIS_THRESHOLD = {
  21492. mouse: 0,
  21493. touch: 0,
  21494. pen: 8
  21495. };
  21496. const dragConfigResolver = actions_e3d93fde_esm_objectSpread2(actions_e3d93fde_esm_objectSpread2({}, coordinatesConfigResolver), {}, {
  21497. device(_v, _k, {
  21498. pointer: {
  21499. touch = false,
  21500. lock = false,
  21501. mouse = false
  21502. } = {}
  21503. }) {
  21504. this.pointerLock = lock && SUPPORT.pointerLock;
  21505. if (SUPPORT.touch && touch) return 'touch';
  21506. if (this.pointerLock) return 'mouse';
  21507. if (SUPPORT.pointer && !mouse) return 'pointer';
  21508. if (SUPPORT.touch) return 'touch';
  21509. return 'mouse';
  21510. },
  21511. preventScrollAxis(value, _k, {
  21512. preventScroll
  21513. }) {
  21514. this.preventScrollDelay = typeof preventScroll === 'number' ? preventScroll : preventScroll || preventScroll === undefined && value ? DEFAULT_PREVENT_SCROLL_DELAY : undefined;
  21515. if (!SUPPORT.touchscreen || preventScroll === false) return undefined;
  21516. return value ? value : preventScroll !== undefined ? 'y' : undefined;
  21517. },
  21518. pointerCapture(_v, _k, {
  21519. pointer: {
  21520. capture = true,
  21521. buttons = 1,
  21522. keys = true
  21523. } = {}
  21524. }) {
  21525. this.pointerButtons = buttons;
  21526. this.keys = keys;
  21527. return !this.pointerLock && this.device === 'pointer' && capture;
  21528. },
  21529. threshold(value, _k, {
  21530. filterTaps = false,
  21531. tapsThreshold = 3,
  21532. axis = undefined
  21533. }) {
  21534. const threshold = V.toVector(value, filterTaps ? tapsThreshold : axis ? 1 : 0);
  21535. this.filterTaps = filterTaps;
  21536. this.tapsThreshold = tapsThreshold;
  21537. return threshold;
  21538. },
  21539. swipe({
  21540. velocity = DEFAULT_SWIPE_VELOCITY,
  21541. distance = DEFAULT_SWIPE_DISTANCE,
  21542. duration = DEFAULT_SWIPE_DURATION
  21543. } = {}) {
  21544. return {
  21545. velocity: this.transform(V.toVector(velocity)),
  21546. distance: this.transform(V.toVector(distance)),
  21547. duration
  21548. };
  21549. },
  21550. delay(value = 0) {
  21551. switch (value) {
  21552. case true:
  21553. return DEFAULT_DRAG_DELAY;
  21554. case false:
  21555. return 0;
  21556. default:
  21557. return value;
  21558. }
  21559. },
  21560. axisThreshold(value) {
  21561. if (!value) return DEFAULT_DRAG_AXIS_THRESHOLD;
  21562. return actions_e3d93fde_esm_objectSpread2(actions_e3d93fde_esm_objectSpread2({}, DEFAULT_DRAG_AXIS_THRESHOLD), value);
  21563. }
  21564. });
  21565. if (false) {}
  21566. function clampStateInternalMovementToBounds(state) {
  21567. const [ox, oy] = state.overflow;
  21568. const [dx, dy] = state._delta;
  21569. const [dirx, diry] = state._direction;
  21570. if (ox < 0 && dx > 0 && dirx < 0 || ox > 0 && dx < 0 && dirx > 0) {
  21571. state._movement[0] = state._movementBound[0];
  21572. }
  21573. if (oy < 0 && dy > 0 && diry < 0 || oy > 0 && dy < 0 && diry > 0) {
  21574. state._movement[1] = state._movementBound[1];
  21575. }
  21576. }
  21577. const SCALE_ANGLE_RATIO_INTENT_DEG = 30;
  21578. const PINCH_WHEEL_RATIO = 100;
  21579. class PinchEngine extends Engine {
  21580. constructor(...args) {
  21581. super(...args);
  21582. actions_e3d93fde_esm_defineProperty(this, "ingKey", 'pinching');
  21583. actions_e3d93fde_esm_defineProperty(this, "aliasKey", 'da');
  21584. }
  21585. init() {
  21586. this.state.offset = [1, 0];
  21587. this.state.lastOffset = [1, 0];
  21588. this.state._pointerEvents = new Map();
  21589. }
  21590. reset() {
  21591. super.reset();
  21592. const state = this.state;
  21593. state._touchIds = [];
  21594. state.canceled = false;
  21595. state.cancel = this.cancel.bind(this);
  21596. state.turns = 0;
  21597. }
  21598. computeOffset() {
  21599. const {
  21600. type,
  21601. movement,
  21602. lastOffset
  21603. } = this.state;
  21604. if (type === 'wheel') {
  21605. this.state.offset = V.add(movement, lastOffset);
  21606. } else {
  21607. this.state.offset = [(1 + movement[0]) * lastOffset[0], movement[1] + lastOffset[1]];
  21608. }
  21609. }
  21610. computeMovement() {
  21611. const {
  21612. offset,
  21613. lastOffset
  21614. } = this.state;
  21615. this.state.movement = [offset[0] / lastOffset[0], offset[1] - lastOffset[1]];
  21616. }
  21617. axisIntent() {
  21618. const state = this.state;
  21619. const [_m0, _m1] = state._movement;
  21620. if (!state.axis) {
  21621. const axisMovementDifference = Math.abs(_m0) * SCALE_ANGLE_RATIO_INTENT_DEG - Math.abs(_m1);
  21622. if (axisMovementDifference < 0) state.axis = 'angle';else if (axisMovementDifference > 0) state.axis = 'scale';
  21623. }
  21624. }
  21625. restrictToAxis(v) {
  21626. if (this.config.lockDirection) {
  21627. if (this.state.axis === 'scale') v[1] = 0;else if (this.state.axis === 'angle') v[0] = 0;
  21628. }
  21629. }
  21630. cancel() {
  21631. const state = this.state;
  21632. if (state.canceled) return;
  21633. setTimeout(() => {
  21634. state.canceled = true;
  21635. state._active = false;
  21636. this.compute();
  21637. this.emit();
  21638. }, 0);
  21639. }
  21640. touchStart(event) {
  21641. this.ctrl.setEventIds(event);
  21642. const state = this.state;
  21643. const ctrlTouchIds = this.ctrl.touchIds;
  21644. if (state._active) {
  21645. if (state._touchIds.every(id => ctrlTouchIds.has(id))) return;
  21646. }
  21647. if (ctrlTouchIds.size < 2) return;
  21648. this.start(event);
  21649. state._touchIds = Array.from(ctrlTouchIds).slice(0, 2);
  21650. const payload = touchDistanceAngle(event, state._touchIds);
  21651. this.pinchStart(event, payload);
  21652. }
  21653. pointerStart(event) {
  21654. if (event.buttons != null && event.buttons % 2 !== 1) return;
  21655. this.ctrl.setEventIds(event);
  21656. event.target.setPointerCapture(event.pointerId);
  21657. const state = this.state;
  21658. const _pointerEvents = state._pointerEvents;
  21659. const ctrlPointerIds = this.ctrl.pointerIds;
  21660. if (state._active) {
  21661. if (Array.from(_pointerEvents.keys()).every(id => ctrlPointerIds.has(id))) return;
  21662. }
  21663. if (_pointerEvents.size < 2) {
  21664. _pointerEvents.set(event.pointerId, event);
  21665. }
  21666. if (state._pointerEvents.size < 2) return;
  21667. this.start(event);
  21668. const payload = distanceAngle(...Array.from(_pointerEvents.values()));
  21669. this.pinchStart(event, payload);
  21670. }
  21671. pinchStart(event, payload) {
  21672. const state = this.state;
  21673. state.origin = payload.origin;
  21674. this.computeValues([payload.distance, payload.angle]);
  21675. this.computeInitial();
  21676. this.compute(event);
  21677. this.emit();
  21678. }
  21679. touchMove(event) {
  21680. if (!this.state._active) return;
  21681. const payload = touchDistanceAngle(event, this.state._touchIds);
  21682. this.pinchMove(event, payload);
  21683. }
  21684. pointerMove(event) {
  21685. const _pointerEvents = this.state._pointerEvents;
  21686. if (_pointerEvents.has(event.pointerId)) {
  21687. _pointerEvents.set(event.pointerId, event);
  21688. }
  21689. if (!this.state._active) return;
  21690. const payload = distanceAngle(...Array.from(_pointerEvents.values()));
  21691. this.pinchMove(event, payload);
  21692. }
  21693. pinchMove(event, payload) {
  21694. const state = this.state;
  21695. const prev_a = state._values[1];
  21696. const delta_a = payload.angle - prev_a;
  21697. let delta_turns = 0;
  21698. if (Math.abs(delta_a) > 270) delta_turns += Math.sign(delta_a);
  21699. this.computeValues([payload.distance, payload.angle - 360 * delta_turns]);
  21700. state.origin = payload.origin;
  21701. state.turns = delta_turns;
  21702. state._movement = [state._values[0] / state._initial[0] - 1, state._values[1] - state._initial[1]];
  21703. this.compute(event);
  21704. this.emit();
  21705. }
  21706. touchEnd(event) {
  21707. this.ctrl.setEventIds(event);
  21708. if (!this.state._active) return;
  21709. if (this.state._touchIds.some(id => !this.ctrl.touchIds.has(id))) {
  21710. this.state._active = false;
  21711. this.compute(event);
  21712. this.emit();
  21713. }
  21714. }
  21715. pointerEnd(event) {
  21716. const state = this.state;
  21717. this.ctrl.setEventIds(event);
  21718. try {
  21719. event.target.releasePointerCapture(event.pointerId);
  21720. } catch (_unused) {}
  21721. if (state._pointerEvents.has(event.pointerId)) {
  21722. state._pointerEvents.delete(event.pointerId);
  21723. }
  21724. if (!state._active) return;
  21725. if (state._pointerEvents.size < 2) {
  21726. state._active = false;
  21727. this.compute(event);
  21728. this.emit();
  21729. }
  21730. }
  21731. gestureStart(event) {
  21732. if (event.cancelable) event.preventDefault();
  21733. const state = this.state;
  21734. if (state._active) return;
  21735. this.start(event);
  21736. this.computeValues([event.scale, event.rotation]);
  21737. state.origin = [event.clientX, event.clientY];
  21738. this.compute(event);
  21739. this.emit();
  21740. }
  21741. gestureMove(event) {
  21742. if (event.cancelable) event.preventDefault();
  21743. if (!this.state._active) return;
  21744. const state = this.state;
  21745. this.computeValues([event.scale, event.rotation]);
  21746. state.origin = [event.clientX, event.clientY];
  21747. const _previousMovement = state._movement;
  21748. state._movement = [event.scale - 1, event.rotation];
  21749. state._delta = V.sub(state._movement, _previousMovement);
  21750. this.compute(event);
  21751. this.emit();
  21752. }
  21753. gestureEnd(event) {
  21754. if (!this.state._active) return;
  21755. this.state._active = false;
  21756. this.compute(event);
  21757. this.emit();
  21758. }
  21759. wheel(event) {
  21760. const modifierKey = this.config.modifierKey;
  21761. if (modifierKey && !event[modifierKey]) return;
  21762. if (!this.state._active) this.wheelStart(event);else this.wheelChange(event);
  21763. this.timeoutStore.add('wheelEnd', this.wheelEnd.bind(this));
  21764. }
  21765. wheelStart(event) {
  21766. this.start(event);
  21767. this.wheelChange(event);
  21768. }
  21769. wheelChange(event) {
  21770. const isR3f = ('uv' in event);
  21771. if (!isR3f) {
  21772. if (event.cancelable) {
  21773. event.preventDefault();
  21774. }
  21775. if (false) {}
  21776. }
  21777. const state = this.state;
  21778. state._delta = [-wheelValues(event)[1] / PINCH_WHEEL_RATIO * state.offset[0], 0];
  21779. V.addTo(state._movement, state._delta);
  21780. clampStateInternalMovementToBounds(state);
  21781. this.state.origin = [event.clientX, event.clientY];
  21782. this.compute(event);
  21783. this.emit();
  21784. }
  21785. wheelEnd() {
  21786. if (!this.state._active) return;
  21787. this.state._active = false;
  21788. this.compute();
  21789. this.emit();
  21790. }
  21791. bind(bindFunction) {
  21792. const device = this.config.device;
  21793. if (!!device) {
  21794. bindFunction(device, 'start', this[device + 'Start'].bind(this));
  21795. bindFunction(device, 'change', this[device + 'Move'].bind(this));
  21796. bindFunction(device, 'end', this[device + 'End'].bind(this));
  21797. bindFunction(device, 'cancel', this[device + 'End'].bind(this));
  21798. }
  21799. if (this.config.pinchOnWheel) {
  21800. bindFunction('wheel', '', this.wheel.bind(this), {
  21801. passive: false
  21802. });
  21803. }
  21804. }
  21805. }
  21806. const pinchConfigResolver = actions_e3d93fde_esm_objectSpread2(actions_e3d93fde_esm_objectSpread2({}, commonConfigResolver), {}, {
  21807. device(_v, _k, {
  21808. shared,
  21809. pointer: {
  21810. touch = false
  21811. } = {}
  21812. }) {
  21813. const sharedConfig = shared;
  21814. if (sharedConfig.target && !SUPPORT.touch && SUPPORT.gesture) return 'gesture';
  21815. if (SUPPORT.touch && touch) return 'touch';
  21816. if (SUPPORT.touchscreen) {
  21817. if (SUPPORT.pointer) return 'pointer';
  21818. if (SUPPORT.touch) return 'touch';
  21819. }
  21820. },
  21821. bounds(_v, _k, {
  21822. scaleBounds = {},
  21823. angleBounds = {}
  21824. }) {
  21825. const _scaleBounds = state => {
  21826. const D = assignDefault(call(scaleBounds, state), {
  21827. min: -Infinity,
  21828. max: Infinity
  21829. });
  21830. return [D.min, D.max];
  21831. };
  21832. const _angleBounds = state => {
  21833. const A = assignDefault(call(angleBounds, state), {
  21834. min: -Infinity,
  21835. max: Infinity
  21836. });
  21837. return [A.min, A.max];
  21838. };
  21839. if (typeof scaleBounds !== 'function' && typeof angleBounds !== 'function') return [_scaleBounds(), _angleBounds()];
  21840. return state => [_scaleBounds(state), _angleBounds(state)];
  21841. },
  21842. threshold(value, _k, config) {
  21843. this.lockDirection = config.axis === 'lock';
  21844. const threshold = V.toVector(value, this.lockDirection ? [0.1, 3] : 0);
  21845. return threshold;
  21846. },
  21847. modifierKey(value) {
  21848. if (value === undefined) return 'ctrlKey';
  21849. return value;
  21850. },
  21851. pinchOnWheel(value = true) {
  21852. return value;
  21853. }
  21854. });
  21855. class MoveEngine extends CoordinatesEngine {
  21856. constructor(...args) {
  21857. super(...args);
  21858. actions_e3d93fde_esm_defineProperty(this, "ingKey", 'moving');
  21859. }
  21860. move(event) {
  21861. if (this.config.mouseOnly && event.pointerType !== 'mouse') return;
  21862. if (!this.state._active) this.moveStart(event);else this.moveChange(event);
  21863. this.timeoutStore.add('moveEnd', this.moveEnd.bind(this));
  21864. }
  21865. moveStart(event) {
  21866. this.start(event);
  21867. this.computeValues(pointerValues(event));
  21868. this.compute(event);
  21869. this.computeInitial();
  21870. this.emit();
  21871. }
  21872. moveChange(event) {
  21873. if (!this.state._active) return;
  21874. const values = pointerValues(event);
  21875. const state = this.state;
  21876. state._delta = V.sub(values, state._values);
  21877. V.addTo(state._movement, state._delta);
  21878. this.computeValues(values);
  21879. this.compute(event);
  21880. this.emit();
  21881. }
  21882. moveEnd(event) {
  21883. if (!this.state._active) return;
  21884. this.state._active = false;
  21885. this.compute(event);
  21886. this.emit();
  21887. }
  21888. bind(bindFunction) {
  21889. bindFunction('pointer', 'change', this.move.bind(this));
  21890. bindFunction('pointer', 'leave', this.moveEnd.bind(this));
  21891. }
  21892. }
  21893. const moveConfigResolver = actions_e3d93fde_esm_objectSpread2(actions_e3d93fde_esm_objectSpread2({}, coordinatesConfigResolver), {}, {
  21894. mouseOnly: (value = true) => value
  21895. });
  21896. class ScrollEngine extends CoordinatesEngine {
  21897. constructor(...args) {
  21898. super(...args);
  21899. actions_e3d93fde_esm_defineProperty(this, "ingKey", 'scrolling');
  21900. }
  21901. scroll(event) {
  21902. if (!this.state._active) this.start(event);
  21903. this.scrollChange(event);
  21904. this.timeoutStore.add('scrollEnd', this.scrollEnd.bind(this));
  21905. }
  21906. scrollChange(event) {
  21907. if (event.cancelable) event.preventDefault();
  21908. const state = this.state;
  21909. const values = scrollValues(event);
  21910. state._delta = V.sub(values, state._values);
  21911. V.addTo(state._movement, state._delta);
  21912. this.computeValues(values);
  21913. this.compute(event);
  21914. this.emit();
  21915. }
  21916. scrollEnd() {
  21917. if (!this.state._active) return;
  21918. this.state._active = false;
  21919. this.compute();
  21920. this.emit();
  21921. }
  21922. bind(bindFunction) {
  21923. bindFunction('scroll', '', this.scroll.bind(this));
  21924. }
  21925. }
  21926. const scrollConfigResolver = coordinatesConfigResolver;
  21927. class WheelEngine extends CoordinatesEngine {
  21928. constructor(...args) {
  21929. super(...args);
  21930. actions_e3d93fde_esm_defineProperty(this, "ingKey", 'wheeling');
  21931. }
  21932. wheel(event) {
  21933. if (!this.state._active) this.start(event);
  21934. this.wheelChange(event);
  21935. this.timeoutStore.add('wheelEnd', this.wheelEnd.bind(this));
  21936. }
  21937. wheelChange(event) {
  21938. const state = this.state;
  21939. state._delta = wheelValues(event);
  21940. V.addTo(state._movement, state._delta);
  21941. clampStateInternalMovementToBounds(state);
  21942. this.compute(event);
  21943. this.emit();
  21944. }
  21945. wheelEnd() {
  21946. if (!this.state._active) return;
  21947. this.state._active = false;
  21948. this.compute();
  21949. this.emit();
  21950. }
  21951. bind(bindFunction) {
  21952. bindFunction('wheel', '', this.wheel.bind(this));
  21953. }
  21954. }
  21955. const wheelConfigResolver = coordinatesConfigResolver;
  21956. class HoverEngine extends CoordinatesEngine {
  21957. constructor(...args) {
  21958. super(...args);
  21959. actions_e3d93fde_esm_defineProperty(this, "ingKey", 'hovering');
  21960. }
  21961. enter(event) {
  21962. if (this.config.mouseOnly && event.pointerType !== 'mouse') return;
  21963. this.start(event);
  21964. this.computeValues(pointerValues(event));
  21965. this.compute(event);
  21966. this.emit();
  21967. }
  21968. leave(event) {
  21969. if (this.config.mouseOnly && event.pointerType !== 'mouse') return;
  21970. const state = this.state;
  21971. if (!state._active) return;
  21972. state._active = false;
  21973. const values = pointerValues(event);
  21974. state._movement = state._delta = V.sub(values, state._values);
  21975. this.computeValues(values);
  21976. this.compute(event);
  21977. state.delta = state.movement;
  21978. this.emit();
  21979. }
  21980. bind(bindFunction) {
  21981. bindFunction('pointer', 'enter', this.enter.bind(this));
  21982. bindFunction('pointer', 'leave', this.leave.bind(this));
  21983. }
  21984. }
  21985. const hoverConfigResolver = actions_e3d93fde_esm_objectSpread2(actions_e3d93fde_esm_objectSpread2({}, coordinatesConfigResolver), {}, {
  21986. mouseOnly: (value = true) => value
  21987. });
  21988. const actions_e3d93fde_esm_EngineMap = new Map();
  21989. const ConfigResolverMap = new Map();
  21990. function actions_e3d93fde_esm_registerAction(action) {
  21991. actions_e3d93fde_esm_EngineMap.set(action.key, action.engine);
  21992. ConfigResolverMap.set(action.key, action.resolver);
  21993. }
  21994. const actions_e3d93fde_esm_dragAction = {
  21995. key: 'drag',
  21996. engine: DragEngine,
  21997. resolver: dragConfigResolver
  21998. };
  21999. const actions_e3d93fde_esm_hoverAction = {
  22000. key: 'hover',
  22001. engine: HoverEngine,
  22002. resolver: hoverConfigResolver
  22003. };
  22004. const actions_e3d93fde_esm_moveAction = {
  22005. key: 'move',
  22006. engine: MoveEngine,
  22007. resolver: moveConfigResolver
  22008. };
  22009. const actions_e3d93fde_esm_pinchAction = {
  22010. key: 'pinch',
  22011. engine: PinchEngine,
  22012. resolver: pinchConfigResolver
  22013. };
  22014. const actions_e3d93fde_esm_scrollAction = {
  22015. key: 'scroll',
  22016. engine: ScrollEngine,
  22017. resolver: scrollConfigResolver
  22018. };
  22019. const actions_e3d93fde_esm_wheelAction = {
  22020. key: 'wheel',
  22021. engine: WheelEngine,
  22022. resolver: wheelConfigResolver
  22023. };
  22024. ;// CONCATENATED MODULE: ./node_modules/@use-gesture/core/dist/use-gesture-core.esm.js
  22025. function use_gesture_core_esm_objectWithoutPropertiesLoose(source, excluded) {
  22026. if (source == null) return {};
  22027. var target = {};
  22028. var sourceKeys = Object.keys(source);
  22029. var key, i;
  22030. for (i = 0; i < sourceKeys.length; i++) {
  22031. key = sourceKeys[i];
  22032. if (excluded.indexOf(key) >= 0) continue;
  22033. target[key] = source[key];
  22034. }
  22035. return target;
  22036. }
  22037. function _objectWithoutProperties(source, excluded) {
  22038. if (source == null) return {};
  22039. var target = use_gesture_core_esm_objectWithoutPropertiesLoose(source, excluded);
  22040. var key, i;
  22041. if (Object.getOwnPropertySymbols) {
  22042. var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
  22043. for (i = 0; i < sourceSymbolKeys.length; i++) {
  22044. key = sourceSymbolKeys[i];
  22045. if (excluded.indexOf(key) >= 0) continue;
  22046. if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
  22047. target[key] = source[key];
  22048. }
  22049. }
  22050. return target;
  22051. }
  22052. const sharedConfigResolver = {
  22053. target(value) {
  22054. if (value) {
  22055. return () => 'current' in value ? value.current : value;
  22056. }
  22057. return undefined;
  22058. },
  22059. enabled(value = true) {
  22060. return value;
  22061. },
  22062. window(value = SUPPORT.isBrowser ? window : undefined) {
  22063. return value;
  22064. },
  22065. eventOptions({
  22066. passive = true,
  22067. capture = false
  22068. } = {}) {
  22069. return {
  22070. passive,
  22071. capture
  22072. };
  22073. },
  22074. transform(value) {
  22075. return value;
  22076. }
  22077. };
  22078. const _excluded = ["target", "eventOptions", "window", "enabled", "transform"];
  22079. function resolveWith(config = {}, resolvers) {
  22080. const result = {};
  22081. for (const [key, resolver] of Object.entries(resolvers)) {
  22082. switch (typeof resolver) {
  22083. case 'function':
  22084. if (false) {} else {
  22085. result[key] = resolver.call(result, config[key], key, config);
  22086. }
  22087. break;
  22088. case 'object':
  22089. result[key] = resolveWith(config[key], resolver);
  22090. break;
  22091. case 'boolean':
  22092. if (resolver) result[key] = config[key];
  22093. break;
  22094. }
  22095. }
  22096. return result;
  22097. }
  22098. function use_gesture_core_esm_parse(newConfig, gestureKey, _config = {}) {
  22099. const _ref = newConfig,
  22100. {
  22101. target,
  22102. eventOptions,
  22103. window,
  22104. enabled,
  22105. transform
  22106. } = _ref,
  22107. rest = _objectWithoutProperties(_ref, _excluded);
  22108. _config.shared = resolveWith({
  22109. target,
  22110. eventOptions,
  22111. window,
  22112. enabled,
  22113. transform
  22114. }, sharedConfigResolver);
  22115. if (gestureKey) {
  22116. const resolver = ConfigResolverMap.get(gestureKey);
  22117. _config[gestureKey] = resolveWith(actions_e3d93fde_esm_objectSpread2({
  22118. shared: _config.shared
  22119. }, rest), resolver);
  22120. } else {
  22121. for (const key in rest) {
  22122. const resolver = ConfigResolverMap.get(key);
  22123. if (resolver) {
  22124. _config[key] = resolveWith(actions_e3d93fde_esm_objectSpread2({
  22125. shared: _config.shared
  22126. }, rest[key]), resolver);
  22127. } else if (false) {}
  22128. }
  22129. }
  22130. return _config;
  22131. }
  22132. class EventStore {
  22133. constructor(ctrl, gestureKey) {
  22134. actions_e3d93fde_esm_defineProperty(this, "_listeners", new Set());
  22135. this._ctrl = ctrl;
  22136. this._gestureKey = gestureKey;
  22137. }
  22138. add(element, device, action, handler, options) {
  22139. const listeners = this._listeners;
  22140. const type = toDomEventType(device, action);
  22141. const _options = this._gestureKey ? this._ctrl.config[this._gestureKey].eventOptions : {};
  22142. const eventOptions = actions_e3d93fde_esm_objectSpread2(actions_e3d93fde_esm_objectSpread2({}, _options), options);
  22143. element.addEventListener(type, handler, eventOptions);
  22144. const remove = () => {
  22145. element.removeEventListener(type, handler, eventOptions);
  22146. listeners.delete(remove);
  22147. };
  22148. listeners.add(remove);
  22149. return remove;
  22150. }
  22151. clean() {
  22152. this._listeners.forEach(remove => remove());
  22153. this._listeners.clear();
  22154. }
  22155. }
  22156. class TimeoutStore {
  22157. constructor() {
  22158. actions_e3d93fde_esm_defineProperty(this, "_timeouts", new Map());
  22159. }
  22160. add(key, callback, ms = 140, ...args) {
  22161. this.remove(key);
  22162. this._timeouts.set(key, window.setTimeout(callback, ms, ...args));
  22163. }
  22164. remove(key) {
  22165. const timeout = this._timeouts.get(key);
  22166. if (timeout) window.clearTimeout(timeout);
  22167. }
  22168. clean() {
  22169. this._timeouts.forEach(timeout => void window.clearTimeout(timeout));
  22170. this._timeouts.clear();
  22171. }
  22172. }
  22173. class Controller {
  22174. constructor(handlers) {
  22175. actions_e3d93fde_esm_defineProperty(this, "gestures", new Set());
  22176. actions_e3d93fde_esm_defineProperty(this, "_targetEventStore", new EventStore(this));
  22177. actions_e3d93fde_esm_defineProperty(this, "gestureEventStores", {});
  22178. actions_e3d93fde_esm_defineProperty(this, "gestureTimeoutStores", {});
  22179. actions_e3d93fde_esm_defineProperty(this, "handlers", {});
  22180. actions_e3d93fde_esm_defineProperty(this, "config", {});
  22181. actions_e3d93fde_esm_defineProperty(this, "pointerIds", new Set());
  22182. actions_e3d93fde_esm_defineProperty(this, "touchIds", new Set());
  22183. actions_e3d93fde_esm_defineProperty(this, "state", {
  22184. shared: {
  22185. shiftKey: false,
  22186. metaKey: false,
  22187. ctrlKey: false,
  22188. altKey: false
  22189. }
  22190. });
  22191. resolveGestures(this, handlers);
  22192. }
  22193. setEventIds(event) {
  22194. if (isTouch(event)) {
  22195. this.touchIds = new Set(touchIds(event));
  22196. return this.touchIds;
  22197. } else if ('pointerId' in event) {
  22198. if (event.type === 'pointerup' || event.type === 'pointercancel') this.pointerIds.delete(event.pointerId);else if (event.type === 'pointerdown') this.pointerIds.add(event.pointerId);
  22199. return this.pointerIds;
  22200. }
  22201. }
  22202. applyHandlers(handlers, nativeHandlers) {
  22203. this.handlers = handlers;
  22204. this.nativeHandlers = nativeHandlers;
  22205. }
  22206. applyConfig(config, gestureKey) {
  22207. this.config = use_gesture_core_esm_parse(config, gestureKey, this.config);
  22208. }
  22209. clean() {
  22210. this._targetEventStore.clean();
  22211. for (const key of this.gestures) {
  22212. this.gestureEventStores[key].clean();
  22213. this.gestureTimeoutStores[key].clean();
  22214. }
  22215. }
  22216. effect() {
  22217. if (this.config.shared.target) this.bind();
  22218. return () => this._targetEventStore.clean();
  22219. }
  22220. bind(...args) {
  22221. const sharedConfig = this.config.shared;
  22222. const props = {};
  22223. let target;
  22224. if (sharedConfig.target) {
  22225. target = sharedConfig.target();
  22226. if (!target) return;
  22227. }
  22228. if (sharedConfig.enabled) {
  22229. for (const gestureKey of this.gestures) {
  22230. const gestureConfig = this.config[gestureKey];
  22231. const bindFunction = bindToProps(props, gestureConfig.eventOptions, !!target);
  22232. if (gestureConfig.enabled) {
  22233. const Engine = actions_e3d93fde_esm_EngineMap.get(gestureKey);
  22234. new Engine(this, args, gestureKey).bind(bindFunction);
  22235. }
  22236. }
  22237. const nativeBindFunction = bindToProps(props, sharedConfig.eventOptions, !!target);
  22238. for (const eventKey in this.nativeHandlers) {
  22239. nativeBindFunction(eventKey, '',
  22240. event => this.nativeHandlers[eventKey](actions_e3d93fde_esm_objectSpread2(actions_e3d93fde_esm_objectSpread2({}, this.state.shared), {}, {
  22241. event,
  22242. args
  22243. })), undefined, true);
  22244. }
  22245. }
  22246. for (const handlerProp in props) {
  22247. props[handlerProp] = chain(...props[handlerProp]);
  22248. }
  22249. if (!target) return props;
  22250. for (const handlerProp in props) {
  22251. const {
  22252. device,
  22253. capture,
  22254. passive
  22255. } = parseProp(handlerProp);
  22256. this._targetEventStore.add(target, device, '', props[handlerProp], {
  22257. capture,
  22258. passive
  22259. });
  22260. }
  22261. }
  22262. }
  22263. function setupGesture(ctrl, gestureKey) {
  22264. ctrl.gestures.add(gestureKey);
  22265. ctrl.gestureEventStores[gestureKey] = new EventStore(ctrl, gestureKey);
  22266. ctrl.gestureTimeoutStores[gestureKey] = new TimeoutStore();
  22267. }
  22268. function resolveGestures(ctrl, internalHandlers) {
  22269. if (internalHandlers.drag) setupGesture(ctrl, 'drag');
  22270. if (internalHandlers.wheel) setupGesture(ctrl, 'wheel');
  22271. if (internalHandlers.scroll) setupGesture(ctrl, 'scroll');
  22272. if (internalHandlers.move) setupGesture(ctrl, 'move');
  22273. if (internalHandlers.pinch) setupGesture(ctrl, 'pinch');
  22274. if (internalHandlers.hover) setupGesture(ctrl, 'hover');
  22275. }
  22276. const bindToProps = (props, eventOptions, withPassiveOption) => (device, action, handler, options = {}, isNative = false) => {
  22277. var _options$capture, _options$passive;
  22278. const capture = (_options$capture = options.capture) !== null && _options$capture !== void 0 ? _options$capture : eventOptions.capture;
  22279. const passive = (_options$passive = options.passive) !== null && _options$passive !== void 0 ? _options$passive : eventOptions.passive;
  22280. let handlerProp = isNative ? device : toHandlerProp(device, action, capture);
  22281. if (withPassiveOption && passive) handlerProp += 'Passive';
  22282. props[handlerProp] = props[handlerProp] || [];
  22283. props[handlerProp].push(handler);
  22284. };
  22285. const RE_NOT_NATIVE = /^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;
  22286. function sortHandlers(_handlers) {
  22287. const native = {};
  22288. const handlers = {};
  22289. const actions = new Set();
  22290. for (let key in _handlers) {
  22291. if (RE_NOT_NATIVE.test(key)) {
  22292. actions.add(RegExp.lastMatch);
  22293. handlers[key] = _handlers[key];
  22294. } else {
  22295. native[key] = _handlers[key];
  22296. }
  22297. }
  22298. return [handlers, native, actions];
  22299. }
  22300. function registerGesture(actions, handlers, handlerKey, key, internalHandlers, config) {
  22301. if (!actions.has(handlerKey)) return;
  22302. if (!EngineMap.has(key)) {
  22303. if (false) {}
  22304. return;
  22305. }
  22306. const startKey = handlerKey + 'Start';
  22307. const endKey = handlerKey + 'End';
  22308. const fn = state => {
  22309. let memo = undefined;
  22310. if (state.first && startKey in handlers) handlers[startKey](state);
  22311. if (handlerKey in handlers) memo = handlers[handlerKey](state);
  22312. if (state.last && endKey in handlers) handlers[endKey](state);
  22313. return memo;
  22314. };
  22315. internalHandlers[key] = fn;
  22316. config[key] = config[key] || {};
  22317. }
  22318. function use_gesture_core_esm_parseMergedHandlers(mergedHandlers, mergedConfig) {
  22319. const [handlers, nativeHandlers, actions] = sortHandlers(mergedHandlers);
  22320. const internalHandlers = {};
  22321. registerGesture(actions, handlers, 'onDrag', 'drag', internalHandlers, mergedConfig);
  22322. registerGesture(actions, handlers, 'onWheel', 'wheel', internalHandlers, mergedConfig);
  22323. registerGesture(actions, handlers, 'onScroll', 'scroll', internalHandlers, mergedConfig);
  22324. registerGesture(actions, handlers, 'onPinch', 'pinch', internalHandlers, mergedConfig);
  22325. registerGesture(actions, handlers, 'onMove', 'move', internalHandlers, mergedConfig);
  22326. registerGesture(actions, handlers, 'onHover', 'hover', internalHandlers, mergedConfig);
  22327. return {
  22328. handlers: internalHandlers,
  22329. config: mergedConfig,
  22330. nativeHandlers
  22331. };
  22332. }
  22333. ;// CONCATENATED MODULE: ./node_modules/@use-gesture/react/dist/use-gesture-react.esm.js
  22334. function useRecognizers(handlers, config = {}, gestureKey, nativeHandlers) {
  22335. const ctrl = external_React_default().useMemo(() => new Controller(handlers), []);
  22336. ctrl.applyHandlers(handlers, nativeHandlers);
  22337. ctrl.applyConfig(config, gestureKey);
  22338. external_React_default().useEffect(ctrl.effect.bind(ctrl));
  22339. external_React_default().useEffect(() => {
  22340. return ctrl.clean.bind(ctrl);
  22341. }, []);
  22342. if (config.target === undefined) {
  22343. return ctrl.bind.bind(ctrl);
  22344. }
  22345. return undefined;
  22346. }
  22347. function use_gesture_react_esm_useDrag(handler, config) {
  22348. actions_e3d93fde_esm_registerAction(actions_e3d93fde_esm_dragAction);
  22349. return useRecognizers({
  22350. drag: handler
  22351. }, config || {}, 'drag');
  22352. }
  22353. function usePinch(handler, config) {
  22354. registerAction(pinchAction);
  22355. return useRecognizers({
  22356. pinch: handler
  22357. }, config || {}, 'pinch');
  22358. }
  22359. function useWheel(handler, config) {
  22360. registerAction(wheelAction);
  22361. return useRecognizers({
  22362. wheel: handler
  22363. }, config || {}, 'wheel');
  22364. }
  22365. function useScroll(handler, config) {
  22366. registerAction(scrollAction);
  22367. return useRecognizers({
  22368. scroll: handler
  22369. }, config || {}, 'scroll');
  22370. }
  22371. function useMove(handler, config) {
  22372. registerAction(moveAction);
  22373. return useRecognizers({
  22374. move: handler
  22375. }, config || {}, 'move');
  22376. }
  22377. function useHover(handler, config) {
  22378. actions_e3d93fde_esm_registerAction(actions_e3d93fde_esm_hoverAction);
  22379. return useRecognizers({
  22380. hover: handler
  22381. }, config || {}, 'hover');
  22382. }
  22383. function createUseGesture(actions) {
  22384. actions.forEach(registerAction);
  22385. return function useGesture(_handlers, _config) {
  22386. const {
  22387. handlers,
  22388. nativeHandlers,
  22389. config
  22390. } = parseMergedHandlers(_handlers, _config || {});
  22391. return useRecognizers(handlers, config, undefined, nativeHandlers);
  22392. };
  22393. }
  22394. function useGesture(handlers, config) {
  22395. const hook = createUseGesture([dragAction, pinchAction, scrollAction, wheelAction, moveAction, hoverAction]);
  22396. return hook(handlers, config || {});
  22397. }
  22398. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/utils.js
  22399. /**
  22400. * External dependencies
  22401. */
  22402. /**
  22403. * WordPress dependencies
  22404. */
  22405. /**
  22406. * Internal dependencies
  22407. */
  22408. /**
  22409. * Gets a CSS cursor value based on a drag direction.
  22410. *
  22411. * @param dragDirection The drag direction.
  22412. * @return The CSS cursor value.
  22413. */
  22414. function getDragCursor(dragDirection) {
  22415. let dragCursor = 'ns-resize';
  22416. switch (dragDirection) {
  22417. case 'n':
  22418. case 's':
  22419. dragCursor = 'ns-resize';
  22420. break;
  22421. case 'e':
  22422. case 'w':
  22423. dragCursor = 'ew-resize';
  22424. break;
  22425. }
  22426. return dragCursor;
  22427. }
  22428. /**
  22429. * Custom hook that renders a drag cursor when dragging.
  22430. *
  22431. * @param {boolean} isDragging The dragging state.
  22432. * @param {string} dragDirection The drag direction.
  22433. *
  22434. * @return {string} The CSS cursor value.
  22435. */
  22436. function useDragCursor(isDragging, dragDirection) {
  22437. const dragCursor = getDragCursor(dragDirection);
  22438. (0,external_wp_element_namespaceObject.useEffect)(() => {
  22439. if (isDragging) {
  22440. document.documentElement.style.cursor = dragCursor;
  22441. } else {
  22442. // @ts-expect-error
  22443. document.documentElement.style.cursor = null;
  22444. }
  22445. }, [isDragging, dragCursor]);
  22446. return dragCursor;
  22447. }
  22448. function useDraft(props) {
  22449. const refPreviousValue = (0,external_wp_element_namespaceObject.useRef)(props.value);
  22450. const [draft, setDraft] = (0,external_wp_element_namespaceObject.useState)({});
  22451. const value = draft.value !== undefined ? draft.value : props.value; // Determines when to discard the draft value to restore controlled status.
  22452. // To do so, it tracks the previous value and marks the draft value as stale
  22453. // after each render.
  22454. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
  22455. const {
  22456. current: previousValue
  22457. } = refPreviousValue;
  22458. refPreviousValue.current = props.value;
  22459. if (draft.value !== undefined && !draft.isStale) setDraft({ ...draft,
  22460. isStale: true
  22461. });else if (draft.isStale && props.value !== previousValue) setDraft({});
  22462. }, [props.value, draft]);
  22463. const onChange = (nextValue, extra) => {
  22464. // Mutates the draft value to avoid an extra effect run.
  22465. setDraft(current => Object.assign(current, {
  22466. value: nextValue,
  22467. isStale: false
  22468. }));
  22469. props.onChange(nextValue, extra);
  22470. };
  22471. const onBlur = event => {
  22472. var _props$onBlur;
  22473. setDraft({});
  22474. (_props$onBlur = props.onBlur) === null || _props$onBlur === void 0 ? void 0 : _props$onBlur.call(props, event);
  22475. };
  22476. return {
  22477. value,
  22478. onBlur,
  22479. onChange
  22480. };
  22481. }
  22482. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/reducer/state.js
  22483. /**
  22484. * External dependencies
  22485. */
  22486. /**
  22487. * Internal dependencies
  22488. */
  22489. const initialStateReducer = state => state;
  22490. const initialInputControlState = {
  22491. error: null,
  22492. initialValue: '',
  22493. isDirty: false,
  22494. isDragEnabled: false,
  22495. isDragging: false,
  22496. isPressEnterToChange: false,
  22497. value: ''
  22498. };
  22499. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/reducer/actions.js
  22500. /**
  22501. * External dependencies
  22502. */
  22503. /**
  22504. * Internal dependencies
  22505. */
  22506. const CHANGE = 'CHANGE';
  22507. const COMMIT = 'COMMIT';
  22508. const CONTROL = 'CONTROL';
  22509. const DRAG_END = 'DRAG_END';
  22510. const DRAG_START = 'DRAG_START';
  22511. const DRAG = 'DRAG';
  22512. const INVALIDATE = 'INVALIDATE';
  22513. const PRESS_DOWN = 'PRESS_DOWN';
  22514. const PRESS_ENTER = 'PRESS_ENTER';
  22515. const PRESS_UP = 'PRESS_UP';
  22516. const RESET = 'RESET';
  22517. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/reducer/reducer.js
  22518. /**
  22519. * External dependencies
  22520. */
  22521. /**
  22522. * WordPress dependencies
  22523. */
  22524. /**
  22525. * Internal dependencies
  22526. */
  22527. /**
  22528. * Prepares initialState for the reducer.
  22529. *
  22530. * @param initialState The initial state.
  22531. * @return Prepared initialState for the reducer
  22532. */
  22533. function mergeInitialState() {
  22534. let initialState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialInputControlState;
  22535. const {
  22536. value
  22537. } = initialState;
  22538. return { ...initialInputControlState,
  22539. ...initialState,
  22540. initialValue: value
  22541. };
  22542. }
  22543. /**
  22544. * Creates the base reducer which may be coupled to a specializing reducer.
  22545. * As its final step, for all actions other than CONTROL, the base reducer
  22546. * passes the state and action on through the specializing reducer. The
  22547. * exception for CONTROL actions is because they represent controlled updates
  22548. * from props and no case has yet presented for their specialization.
  22549. *
  22550. * @param composedStateReducers A reducer to specialize state changes.
  22551. * @return The reducer.
  22552. */
  22553. function inputControlStateReducer(composedStateReducers) {
  22554. return (state, action) => {
  22555. const nextState = { ...state
  22556. };
  22557. switch (action.type) {
  22558. /*
  22559. * Controlled updates
  22560. */
  22561. case CONTROL:
  22562. nextState.value = action.payload.value;
  22563. nextState.isDirty = false;
  22564. nextState._event = undefined; // Returns immediately to avoid invoking additional reducers.
  22565. return nextState;
  22566. /**
  22567. * Keyboard events
  22568. */
  22569. case PRESS_UP:
  22570. nextState.isDirty = false;
  22571. break;
  22572. case PRESS_DOWN:
  22573. nextState.isDirty = false;
  22574. break;
  22575. /**
  22576. * Drag events
  22577. */
  22578. case DRAG_START:
  22579. nextState.isDragging = true;
  22580. break;
  22581. case DRAG_END:
  22582. nextState.isDragging = false;
  22583. break;
  22584. /**
  22585. * Input events
  22586. */
  22587. case CHANGE:
  22588. nextState.error = null;
  22589. nextState.value = action.payload.value;
  22590. if (state.isPressEnterToChange) {
  22591. nextState.isDirty = true;
  22592. }
  22593. break;
  22594. case COMMIT:
  22595. nextState.value = action.payload.value;
  22596. nextState.isDirty = false;
  22597. break;
  22598. case RESET:
  22599. nextState.error = null;
  22600. nextState.isDirty = false;
  22601. nextState.value = action.payload.value || state.initialValue;
  22602. break;
  22603. /**
  22604. * Validation
  22605. */
  22606. case INVALIDATE:
  22607. nextState.error = action.payload.error;
  22608. break;
  22609. }
  22610. nextState._event = action.payload.event;
  22611. /**
  22612. * Send the nextState + action to the composedReducers via
  22613. * this "bridge" mechanism. This allows external stateReducers
  22614. * to hook into actions, and modify state if needed.
  22615. */
  22616. return composedStateReducers(nextState, action);
  22617. };
  22618. }
  22619. /**
  22620. * A custom hook that connects and external stateReducer with an internal
  22621. * reducer. This hook manages the internal state of InputControl.
  22622. * However, by connecting an external stateReducer function, other
  22623. * components can react to actions as well as modify state before it is
  22624. * applied.
  22625. *
  22626. * This technique uses the "stateReducer" design pattern:
  22627. * https://kentcdodds.com/blog/the-state-reducer-pattern/
  22628. *
  22629. * @param stateReducer An external state reducer.
  22630. * @param initialState The initial state for the reducer.
  22631. * @param onChangeHandler A handler for the onChange event.
  22632. * @return State, dispatch, and a collection of actions.
  22633. */
  22634. function useInputControlStateReducer() {
  22635. let stateReducer = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialStateReducer;
  22636. let initialState = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : initialInputControlState;
  22637. let onChangeHandler = arguments.length > 2 ? arguments[2] : undefined;
  22638. const [state, dispatch] = (0,external_wp_element_namespaceObject.useReducer)(inputControlStateReducer(stateReducer), mergeInitialState(initialState));
  22639. const createChangeEvent = type => (nextValue, event) => {
  22640. dispatch({
  22641. type,
  22642. payload: {
  22643. value: nextValue,
  22644. event
  22645. }
  22646. });
  22647. };
  22648. const createKeyEvent = type => event => {
  22649. dispatch({
  22650. type,
  22651. payload: {
  22652. event
  22653. }
  22654. });
  22655. };
  22656. const createDragEvent = type => payload => {
  22657. dispatch({
  22658. type,
  22659. payload
  22660. });
  22661. };
  22662. /**
  22663. * Actions for the reducer
  22664. */
  22665. const change = createChangeEvent(CHANGE);
  22666. const invalidate = (error, event) => dispatch({
  22667. type: INVALIDATE,
  22668. payload: {
  22669. error,
  22670. event
  22671. }
  22672. });
  22673. const reset = createChangeEvent(RESET);
  22674. const commit = createChangeEvent(COMMIT);
  22675. const dragStart = createDragEvent(DRAG_START);
  22676. const drag = createDragEvent(DRAG);
  22677. const dragEnd = createDragEvent(DRAG_END);
  22678. const pressUp = createKeyEvent(PRESS_UP);
  22679. const pressDown = createKeyEvent(PRESS_DOWN);
  22680. const pressEnter = createKeyEvent(PRESS_ENTER);
  22681. const currentState = (0,external_wp_element_namespaceObject.useRef)(state);
  22682. const refProps = (0,external_wp_element_namespaceObject.useRef)({
  22683. value: initialState.value,
  22684. onChangeHandler
  22685. }); // Freshens refs to props and state so that subsequent effects have access
  22686. // to their latest values without their changes causing effect runs.
  22687. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
  22688. currentState.current = state;
  22689. refProps.current = {
  22690. value: initialState.value,
  22691. onChangeHandler
  22692. };
  22693. }); // Propagates the latest state through onChange.
  22694. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
  22695. if (currentState.current._event !== undefined && state.value !== refProps.current.value && !state.isDirty) {
  22696. var _state$value;
  22697. refProps.current.onChangeHandler((_state$value = state.value) !== null && _state$value !== void 0 ? _state$value : '', {
  22698. event: currentState.current._event
  22699. });
  22700. }
  22701. }, [state.value, state.isDirty]); // Updates the state from props.
  22702. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
  22703. if (initialState.value !== currentState.current.value && !currentState.current.isDirty) {
  22704. var _initialState$value;
  22705. dispatch({
  22706. type: CONTROL,
  22707. payload: {
  22708. value: (_initialState$value = initialState.value) !== null && _initialState$value !== void 0 ? _initialState$value : ''
  22709. }
  22710. });
  22711. }
  22712. }, [initialState.value]);
  22713. return {
  22714. change,
  22715. commit,
  22716. dispatch,
  22717. drag,
  22718. dragEnd,
  22719. dragStart,
  22720. invalidate,
  22721. pressDown,
  22722. pressEnter,
  22723. pressUp,
  22724. reset,
  22725. state
  22726. };
  22727. }
  22728. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/input-field.js
  22729. /**
  22730. * External dependencies
  22731. */
  22732. /**
  22733. * WordPress dependencies
  22734. */
  22735. /**
  22736. * Internal dependencies
  22737. */
  22738. const input_field_noop = () => {};
  22739. function InputField(_ref, ref) {
  22740. let {
  22741. disabled = false,
  22742. dragDirection = 'n',
  22743. dragThreshold = 10,
  22744. id,
  22745. isDragEnabled = false,
  22746. isFocused,
  22747. isPressEnterToChange = false,
  22748. onBlur = input_field_noop,
  22749. onChange = input_field_noop,
  22750. onDrag = input_field_noop,
  22751. onDragEnd = input_field_noop,
  22752. onDragStart = input_field_noop,
  22753. onFocus = input_field_noop,
  22754. onKeyDown = input_field_noop,
  22755. onValidate = input_field_noop,
  22756. size = 'default',
  22757. setIsFocused,
  22758. stateReducer = state => state,
  22759. value: valueProp,
  22760. type,
  22761. ...props
  22762. } = _ref;
  22763. const {
  22764. // State.
  22765. state,
  22766. // Actions.
  22767. change,
  22768. commit,
  22769. drag,
  22770. dragEnd,
  22771. dragStart,
  22772. invalidate,
  22773. pressDown,
  22774. pressEnter,
  22775. pressUp,
  22776. reset
  22777. } = useInputControlStateReducer(stateReducer, {
  22778. isDragEnabled,
  22779. value: valueProp,
  22780. isPressEnterToChange
  22781. }, onChange);
  22782. const {
  22783. value,
  22784. isDragging,
  22785. isDirty
  22786. } = state;
  22787. const wasDirtyOnBlur = (0,external_wp_element_namespaceObject.useRef)(false);
  22788. const dragCursor = useDragCursor(isDragging, dragDirection);
  22789. const handleOnBlur = event => {
  22790. onBlur(event);
  22791. setIsFocused === null || setIsFocused === void 0 ? void 0 : setIsFocused(false);
  22792. /**
  22793. * If isPressEnterToChange is set, this commits the value to
  22794. * the onChange callback.
  22795. */
  22796. if (isDirty || !event.target.validity.valid) {
  22797. wasDirtyOnBlur.current = true;
  22798. handleOnCommit(event);
  22799. }
  22800. };
  22801. const handleOnFocus = event => {
  22802. onFocus(event);
  22803. setIsFocused === null || setIsFocused === void 0 ? void 0 : setIsFocused(true);
  22804. };
  22805. const handleOnChange = event => {
  22806. const nextValue = event.target.value;
  22807. change(nextValue, event);
  22808. };
  22809. const handleOnCommit = event => {
  22810. const nextValue = event.currentTarget.value;
  22811. try {
  22812. onValidate(nextValue);
  22813. commit(nextValue, event);
  22814. } catch (err) {
  22815. invalidate(err, event);
  22816. }
  22817. };
  22818. const handleOnKeyDown = event => {
  22819. const {
  22820. key
  22821. } = event;
  22822. onKeyDown(event);
  22823. switch (key) {
  22824. case 'ArrowUp':
  22825. pressUp(event);
  22826. break;
  22827. case 'ArrowDown':
  22828. pressDown(event);
  22829. break;
  22830. case 'Enter':
  22831. pressEnter(event);
  22832. if (isPressEnterToChange) {
  22833. event.preventDefault();
  22834. handleOnCommit(event);
  22835. }
  22836. break;
  22837. case 'Escape':
  22838. if (isPressEnterToChange && isDirty) {
  22839. event.preventDefault();
  22840. reset(valueProp, event);
  22841. }
  22842. break;
  22843. }
  22844. };
  22845. const dragGestureProps = use_gesture_react_esm_useDrag(dragProps => {
  22846. const {
  22847. distance,
  22848. dragging,
  22849. event,
  22850. target
  22851. } = dragProps; // The `target` prop always references the `input` element while, by
  22852. // default, the `dragProps.event.target` property would reference the real
  22853. // event target (i.e. any DOM element that the pointer is hovering while
  22854. // dragging). Ensuring that the `target` is always the `input` element
  22855. // allows consumers of `InputControl` (or any higher-level control) to
  22856. // check the input's validity by accessing `event.target.validity.valid`.
  22857. dragProps.event = { ...dragProps.event,
  22858. target
  22859. };
  22860. if (!distance) return;
  22861. event.stopPropagation();
  22862. /**
  22863. * Quick return if no longer dragging.
  22864. * This prevents unnecessary value calculations.
  22865. */
  22866. if (!dragging) {
  22867. onDragEnd(dragProps);
  22868. dragEnd(dragProps);
  22869. return;
  22870. }
  22871. onDrag(dragProps);
  22872. drag(dragProps);
  22873. if (!isDragging) {
  22874. onDragStart(dragProps);
  22875. dragStart(dragProps);
  22876. }
  22877. }, {
  22878. axis: dragDirection === 'e' || dragDirection === 'w' ? 'x' : 'y',
  22879. threshold: dragThreshold,
  22880. enabled: isDragEnabled,
  22881. pointer: {
  22882. capture: false
  22883. }
  22884. });
  22885. const dragProps = isDragEnabled ? dragGestureProps() : {};
  22886. /*
  22887. * Works around the odd UA (e.g. Firefox) that does not focus inputs of
  22888. * type=number when their spinner arrows are pressed.
  22889. */
  22890. let handleOnMouseDown;
  22891. if (type === 'number') {
  22892. handleOnMouseDown = event => {
  22893. var _props$onMouseDown;
  22894. (_props$onMouseDown = props.onMouseDown) === null || _props$onMouseDown === void 0 ? void 0 : _props$onMouseDown.call(props, event);
  22895. if (event.currentTarget !== event.currentTarget.ownerDocument.activeElement) {
  22896. event.currentTarget.focus();
  22897. }
  22898. };
  22899. }
  22900. return (0,external_wp_element_namespaceObject.createElement)(Input, extends_extends({}, props, dragProps, {
  22901. className: "components-input-control__input",
  22902. disabled: disabled,
  22903. dragCursor: dragCursor,
  22904. isDragging: isDragging,
  22905. id: id,
  22906. onBlur: handleOnBlur,
  22907. onChange: handleOnChange,
  22908. onFocus: handleOnFocus,
  22909. onKeyDown: handleOnKeyDown,
  22910. onMouseDown: handleOnMouseDown,
  22911. ref: ref,
  22912. inputSize: size,
  22913. value: value,
  22914. type: type
  22915. }));
  22916. }
  22917. const ForwardedComponent = (0,external_wp_element_namespaceObject.forwardRef)(InputField);
  22918. /* harmony default export */ var input_field = (ForwardedComponent);
  22919. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/index.js
  22920. /**
  22921. * External dependencies
  22922. */
  22923. /**
  22924. * WordPress dependencies
  22925. */
  22926. /**
  22927. * Internal dependencies
  22928. */
  22929. const input_control_noop = () => {};
  22930. function input_control_useUniqueId(idProp) {
  22931. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(InputControl);
  22932. const id = `inspector-input-control-${instanceId}`;
  22933. return idProp || id;
  22934. }
  22935. function UnforwardedInputControl(_ref, ref) {
  22936. let {
  22937. __next36pxDefaultSize,
  22938. __unstableStateReducer: stateReducer = state => state,
  22939. __unstableInputWidth,
  22940. className,
  22941. disabled = false,
  22942. hideLabelFromVision = false,
  22943. id: idProp,
  22944. isPressEnterToChange = false,
  22945. label,
  22946. labelPosition = 'top',
  22947. onChange = input_control_noop,
  22948. onValidate = input_control_noop,
  22949. onKeyDown = input_control_noop,
  22950. prefix,
  22951. size = 'default',
  22952. suffix,
  22953. value,
  22954. ...props
  22955. } = _ref;
  22956. const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false);
  22957. const id = input_control_useUniqueId(idProp);
  22958. const classes = classnames_default()('components-input-control', className);
  22959. const draftHookProps = useDraft({
  22960. value,
  22961. onBlur: props.onBlur,
  22962. onChange
  22963. });
  22964. return (0,external_wp_element_namespaceObject.createElement)(input_base, {
  22965. __next36pxDefaultSize: __next36pxDefaultSize,
  22966. __unstableInputWidth: __unstableInputWidth,
  22967. className: classes,
  22968. disabled: disabled,
  22969. gap: 3,
  22970. hideLabelFromVision: hideLabelFromVision,
  22971. id: id,
  22972. isFocused: isFocused,
  22973. justify: "left",
  22974. label: label,
  22975. labelPosition: labelPosition,
  22976. prefix: prefix,
  22977. size: size,
  22978. suffix: suffix
  22979. }, (0,external_wp_element_namespaceObject.createElement)(input_field, extends_extends({}, props, {
  22980. __next36pxDefaultSize: __next36pxDefaultSize,
  22981. className: "components-input-control__input",
  22982. disabled: disabled,
  22983. id: id,
  22984. isFocused: isFocused,
  22985. isPressEnterToChange: isPressEnterToChange,
  22986. onKeyDown: onKeyDown,
  22987. onValidate: onValidate,
  22988. paddingInlineStart: prefix ? space(2) : undefined,
  22989. paddingInlineEnd: suffix ? space(2) : undefined,
  22990. ref: ref,
  22991. setIsFocused: setIsFocused,
  22992. size: size,
  22993. stateReducer: stateReducer
  22994. }, draftHookProps)));
  22995. }
  22996. /**
  22997. * InputControl components let users enter and edit text. This is an experimental component
  22998. * intended to (in time) merge with or replace `TextControl`.
  22999. *
  23000. * ```jsx
  23001. * import { __experimentalInputControl as InputControl } from '@wordpress/components';
  23002. * import { useState } from '@wordpress/compose';
  23003. *
  23004. * const Example = () => {
  23005. * const [ value, setValue ] = useState( '' );
  23006. *
  23007. * return (
  23008. * <InputControl
  23009. * value={ value }
  23010. * onChange={ ( nextValue ) => setValue( nextValue ?? '' ) }
  23011. * />
  23012. * );
  23013. * };
  23014. * ```
  23015. */
  23016. const InputControl = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedInputControl);
  23017. /* harmony default export */ var input_control = (InputControl);
  23018. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/number-control/styles/number-control-styles.js
  23019. 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)."; }
  23020. // @ts-nocheck
  23021. /**
  23022. * External dependencies
  23023. */
  23024. /**
  23025. * Internal dependencies
  23026. */
  23027. var number_control_styles_ref = true ? {
  23028. name: "euqsgg",
  23029. 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;}"
  23030. } : 0;
  23031. const htmlArrowStyles = _ref2 => {
  23032. let {
  23033. hideHTMLArrows
  23034. } = _ref2;
  23035. if (!hideHTMLArrows) return ``;
  23036. return number_control_styles_ref;
  23037. };
  23038. const number_control_styles_Input = /*#__PURE__*/emotion_styled_base_browser_esm(input_control, true ? {
  23039. target: "ep48uk90"
  23040. } : 0)(htmlArrowStyles, ";" + ( true ? "" : 0));
  23041. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/math.js
  23042. /**
  23043. * Parses and retrieves a number value.
  23044. *
  23045. * @param {unknown} value The incoming value.
  23046. *
  23047. * @return {number} The parsed number value.
  23048. */
  23049. function getNumber(value) {
  23050. const number = Number(value);
  23051. return isNaN(number) ? 0 : number;
  23052. }
  23053. /**
  23054. * Safely adds 2 values.
  23055. *
  23056. * @param {Array<number|string>} args Values to add together.
  23057. *
  23058. * @return {number} The sum of values.
  23059. */
  23060. function add() {
  23061. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  23062. args[_key] = arguments[_key];
  23063. }
  23064. return args.reduce(
  23065. /** @type {(sum:number, arg: number|string) => number} */
  23066. (sum, arg) => sum + getNumber(arg), 0);
  23067. }
  23068. /**
  23069. * Safely subtracts 2 values.
  23070. *
  23071. * @param {Array<number|string>} args Values to subtract together.
  23072. *
  23073. * @return {number} The difference of the values.
  23074. */
  23075. function subtract() {
  23076. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  23077. args[_key2] = arguments[_key2];
  23078. }
  23079. return args.reduce(
  23080. /** @type {(diff:number, arg: number|string, index:number) => number} */
  23081. (diff, arg, index) => {
  23082. const value = getNumber(arg);
  23083. return index === 0 ? value : diff - value;
  23084. }, 0);
  23085. }
  23086. /**
  23087. * Determines the decimal position of a number value.
  23088. *
  23089. * @param {number} value The number to evaluate.
  23090. *
  23091. * @return {number} The number of decimal places.
  23092. */
  23093. function getPrecision(value) {
  23094. const split = (value + '').split('.');
  23095. return split[1] !== undefined ? split[1].length : 0;
  23096. }
  23097. /**
  23098. * Clamps a value based on a min/max range.
  23099. *
  23100. * @param {number} value The value.
  23101. * @param {number} min The minimum range.
  23102. * @param {number} max The maximum range.
  23103. *
  23104. * @return {number} The clamped value.
  23105. */
  23106. function math_clamp(value, min, max) {
  23107. const baseValue = getNumber(value);
  23108. return Math.max(min, Math.min(baseValue, max));
  23109. }
  23110. /**
  23111. * Clamps a value based on a min/max range with rounding
  23112. *
  23113. * @param {number | string} value The value.
  23114. * @param {number} min The minimum range.
  23115. * @param {number} max The maximum range.
  23116. * @param {number} step A multiplier for the value.
  23117. *
  23118. * @return {number} The rounded and clamped value.
  23119. */
  23120. function roundClamp() {
  23121. let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  23122. let min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Infinity;
  23123. let max = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Infinity;
  23124. let step = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
  23125. const baseValue = getNumber(value);
  23126. const stepValue = getNumber(step);
  23127. const precision = getPrecision(step);
  23128. const rounded = Math.round(baseValue / stepValue) * stepValue;
  23129. const clampedValue = math_clamp(rounded, min, max);
  23130. return precision ? getNumber(clampedValue.toFixed(precision)) : clampedValue;
  23131. }
  23132. /**
  23133. * Clamps a value based on a min/max range with rounding.
  23134. * Returns a string.
  23135. *
  23136. * @param {Parameters<typeof roundClamp>} args Arguments for roundClamp().
  23137. * @return {string} The rounded and clamped value.
  23138. */
  23139. function roundClampString() {
  23140. return roundClamp(...arguments).toString();
  23141. }
  23142. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/number-control/index.js
  23143. /**
  23144. * External dependencies
  23145. */
  23146. /**
  23147. * WordPress dependencies
  23148. */
  23149. /**
  23150. * Internal dependencies
  23151. */
  23152. function UnforwardedNumberControl(_ref, ref) {
  23153. let {
  23154. __unstableStateReducer: stateReducerProp,
  23155. className,
  23156. dragDirection = 'n',
  23157. hideHTMLArrows = false,
  23158. isDragEnabled = true,
  23159. isShiftStepEnabled = true,
  23160. label,
  23161. max = Infinity,
  23162. min = -Infinity,
  23163. required = false,
  23164. shiftStep = 10,
  23165. step = 1,
  23166. type: typeProp = 'number',
  23167. value: valueProp,
  23168. ...props
  23169. } = _ref;
  23170. const isStepAny = step === 'any';
  23171. const baseStep = isStepAny ? 1 : ensureNumber(step);
  23172. const baseValue = roundClamp(0, min, max, baseStep);
  23173. const constrainValue = (value, stepOverride) => {
  23174. // When step is "any" clamp the value, otherwise round and clamp it.
  23175. return isStepAny ? Math.min(max, Math.max(min, ensureNumber(value))) : roundClamp(value, min, max, stepOverride !== null && stepOverride !== void 0 ? stepOverride : baseStep);
  23176. };
  23177. const autoComplete = typeProp === 'number' ? 'off' : undefined;
  23178. const classes = classnames_default()('components-number-control', className);
  23179. /**
  23180. * "Middleware" function that intercepts updates from InputControl.
  23181. * This allows us to tap into actions to transform the (next) state for
  23182. * InputControl.
  23183. *
  23184. * @return The updated state to apply to InputControl
  23185. */
  23186. const numberControlStateReducer = (state, action) => {
  23187. const nextState = { ...state
  23188. };
  23189. const {
  23190. type,
  23191. payload
  23192. } = action;
  23193. const event = payload.event;
  23194. const currentValue = nextState.value;
  23195. /**
  23196. * Handles custom UP and DOWN Keyboard events
  23197. */
  23198. if (type === PRESS_UP || type === PRESS_DOWN) {
  23199. const enableShift = (event === null || event === void 0 ? void 0 : event.shiftKey) && isShiftStepEnabled;
  23200. const incrementalValue = enableShift ? ensureNumber(shiftStep) * baseStep : baseStep;
  23201. let nextValue = isValueEmpty(currentValue) ? baseValue : currentValue;
  23202. if (event !== null && event !== void 0 && event.preventDefault) {
  23203. event.preventDefault();
  23204. }
  23205. if (type === PRESS_UP) {
  23206. nextValue = add(nextValue, incrementalValue);
  23207. }
  23208. if (type === PRESS_DOWN) {
  23209. nextValue = subtract(nextValue, incrementalValue);
  23210. } // @ts-expect-error TODO: Resolve discrepancy between `value` types in InputControl based components
  23211. nextState.value = constrainValue(nextValue, enableShift ? incrementalValue : undefined);
  23212. }
  23213. /**
  23214. * Handles drag to update events
  23215. */
  23216. if (type === DRAG && isDragEnabled) {
  23217. // @ts-expect-error TODO: See if reducer actions can be typed better
  23218. const [x, y] = payload.delta; // @ts-expect-error TODO: See if reducer actions can be typed better
  23219. const enableShift = payload.shiftKey && isShiftStepEnabled;
  23220. const modifier = enableShift ? ensureNumber(shiftStep) * baseStep : baseStep;
  23221. let directionModifier;
  23222. let delta;
  23223. switch (dragDirection) {
  23224. case 'n':
  23225. delta = y;
  23226. directionModifier = -1;
  23227. break;
  23228. case 'e':
  23229. delta = x;
  23230. directionModifier = (0,external_wp_i18n_namespaceObject.isRTL)() ? -1 : 1;
  23231. break;
  23232. case 's':
  23233. delta = y;
  23234. directionModifier = 1;
  23235. break;
  23236. case 'w':
  23237. delta = x;
  23238. directionModifier = (0,external_wp_i18n_namespaceObject.isRTL)() ? 1 : -1;
  23239. break;
  23240. }
  23241. if (delta !== 0) {
  23242. delta = Math.ceil(Math.abs(delta)) * Math.sign(delta);
  23243. const distance = delta * modifier * directionModifier; // @ts-expect-error TODO: Resolve discrepancy between `value` types in InputControl based components
  23244. nextState.value = constrainValue( // @ts-expect-error TODO: Investigate if it's ok for currentValue to be undefined
  23245. add(currentValue, distance), enableShift ? modifier : undefined);
  23246. }
  23247. }
  23248. /**
  23249. * Handles commit (ENTER key press or blur)
  23250. */
  23251. if (type === PRESS_ENTER || type === COMMIT) {
  23252. const applyEmptyValue = required === false && currentValue === ''; // @ts-expect-error TODO: Resolve discrepancy between `value` types in InputControl based components
  23253. nextState.value = applyEmptyValue ? currentValue : // @ts-expect-error TODO: Investigate if it's ok for currentValue to be undefined
  23254. constrainValue(currentValue);
  23255. }
  23256. return nextState;
  23257. };
  23258. return (0,external_wp_element_namespaceObject.createElement)(number_control_styles_Input, extends_extends({
  23259. autoComplete: autoComplete,
  23260. inputMode: "numeric"
  23261. }, props, {
  23262. className: classes,
  23263. dragDirection: dragDirection,
  23264. hideHTMLArrows: hideHTMLArrows,
  23265. isDragEnabled: isDragEnabled,
  23266. label: label,
  23267. max: max,
  23268. min: min,
  23269. ref: ref,
  23270. required: required,
  23271. step: step,
  23272. type: typeProp // @ts-expect-error TODO: Resolve discrepancy between `value` types in InputControl based components
  23273. ,
  23274. value: valueProp,
  23275. __unstableStateReducer: (state, action) => {
  23276. var _stateReducerProp;
  23277. const baseState = numberControlStateReducer(state, action);
  23278. return (_stateReducerProp = stateReducerProp === null || stateReducerProp === void 0 ? void 0 : stateReducerProp(baseState, action)) !== null && _stateReducerProp !== void 0 ? _stateReducerProp : baseState;
  23279. }
  23280. }));
  23281. }
  23282. const NumberControl = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedNumberControl);
  23283. /* harmony default export */ var number_control = (NumberControl);
  23284. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/angle-picker-control/styles/angle-picker-control-styles.js
  23285. 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)."; }
  23286. /**
  23287. * External dependencies
  23288. */
  23289. /**
  23290. * Internal dependencies
  23291. */
  23292. const CIRCLE_SIZE = 32;
  23293. const INNER_CIRCLE_SIZE = 3;
  23294. const deprecatedBottomMargin = _ref => {
  23295. let {
  23296. __nextHasNoMarginBottom
  23297. } = _ref;
  23298. return !__nextHasNoMarginBottom ? /*#__PURE__*/emotion_react_browser_esm_css("margin-bottom:", space(2), ";" + ( true ? "" : 0), true ? "" : 0) : '';
  23299. };
  23300. const angle_picker_control_styles_Root = /*#__PURE__*/emotion_styled_base_browser_esm(flex_component, true ? {
  23301. target: "e65ony43"
  23302. } : 0)(deprecatedBottomMargin, ";" + ( true ? "" : 0));
  23303. const CircleRoot = emotion_styled_base_browser_esm("div", true ? {
  23304. target: "e65ony42"
  23305. } : 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));
  23306. const CircleIndicatorWrapper = emotion_styled_base_browser_esm("div", true ? {
  23307. target: "e65ony41"
  23308. } : 0)( true ? {
  23309. name: "1bhd2sw",
  23310. styles: "box-sizing:border-box;position:relative;width:100%;height:100%"
  23311. } : 0);
  23312. const CircleIndicator = emotion_styled_base_browser_esm("div", true ? {
  23313. target: "e65ony40"
  23314. } : 0)("background:", COLORS.ui.theme, ";border-radius:50%;border:", INNER_CIRCLE_SIZE, "px solid ", COLORS.ui.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));
  23315. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/angle-picker-control/angle-circle.js
  23316. /**
  23317. * WordPress dependencies
  23318. */
  23319. /**
  23320. * Internal dependencies
  23321. */
  23322. function AngleCircle(_ref) {
  23323. let {
  23324. value,
  23325. onChange,
  23326. ...props
  23327. } = _ref;
  23328. const angleCircleRef = (0,external_wp_element_namespaceObject.useRef)();
  23329. const angleCircleCenter = (0,external_wp_element_namespaceObject.useRef)();
  23330. const previousCursorValue = (0,external_wp_element_namespaceObject.useRef)();
  23331. const setAngleCircleCenter = () => {
  23332. const rect = angleCircleRef.current.getBoundingClientRect();
  23333. angleCircleCenter.current = {
  23334. x: rect.x + rect.width / 2,
  23335. y: rect.y + rect.height / 2
  23336. };
  23337. };
  23338. const changeAngleToPosition = event => {
  23339. const {
  23340. x: centerX,
  23341. y: centerY
  23342. } = angleCircleCenter.current; // Prevent (drag) mouse events from selecting and accidentally
  23343. // triggering actions from other elements.
  23344. event.preventDefault(); // Input control needs to lose focus and by preventDefault above, it doesn't.
  23345. event.target.focus();
  23346. onChange(getAngle(centerX, centerY, event.clientX, event.clientY));
  23347. };
  23348. const {
  23349. startDrag,
  23350. isDragging
  23351. } = (0,external_wp_compose_namespaceObject.__experimentalUseDragging)({
  23352. onDragStart: event => {
  23353. setAngleCircleCenter();
  23354. changeAngleToPosition(event);
  23355. },
  23356. onDragMove: changeAngleToPosition,
  23357. onDragEnd: changeAngleToPosition
  23358. });
  23359. (0,external_wp_element_namespaceObject.useEffect)(() => {
  23360. if (isDragging) {
  23361. if (previousCursorValue.current === undefined) {
  23362. previousCursorValue.current = document.body.style.cursor;
  23363. }
  23364. document.body.style.cursor = 'grabbing';
  23365. } else {
  23366. document.body.style.cursor = previousCursorValue.current || null;
  23367. previousCursorValue.current = undefined;
  23368. }
  23369. }, [isDragging]);
  23370. return (
  23371. /* eslint-disable jsx-a11y/no-static-element-interactions */
  23372. (0,external_wp_element_namespaceObject.createElement)(CircleRoot, extends_extends({
  23373. ref: angleCircleRef,
  23374. onMouseDown: startDrag,
  23375. className: "components-angle-picker-control__angle-circle",
  23376. style: isDragging ? {
  23377. cursor: 'grabbing'
  23378. } : undefined
  23379. }, props), (0,external_wp_element_namespaceObject.createElement)(CircleIndicatorWrapper, {
  23380. style: value ? {
  23381. transform: `rotate(${value}deg)`
  23382. } : undefined,
  23383. className: "components-angle-picker-control__angle-circle-indicator-wrapper",
  23384. tabIndex: -1
  23385. }, (0,external_wp_element_namespaceObject.createElement)(CircleIndicator, {
  23386. className: "components-angle-picker-control__angle-circle-indicator"
  23387. })))
  23388. /* eslint-enable jsx-a11y/no-static-element-interactions */
  23389. );
  23390. }
  23391. function getAngle(centerX, centerY, pointX, pointY) {
  23392. const y = pointY - centerY;
  23393. const x = pointX - centerX;
  23394. const angleInRadians = Math.atan2(y, x);
  23395. const angleInDeg = Math.round(angleInRadians * (180 / Math.PI)) + 90;
  23396. if (angleInDeg < 0) {
  23397. return 360 + angleInDeg;
  23398. }
  23399. return angleInDeg;
  23400. }
  23401. /* harmony default export */ var angle_circle = (AngleCircle);
  23402. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/spacer/hook.js
  23403. /**
  23404. * External dependencies
  23405. */
  23406. /**
  23407. * Internal dependencies
  23408. */
  23409. const isDefined = o => typeof o !== 'undefined' && o !== null;
  23410. function useSpacer(props) {
  23411. const {
  23412. className,
  23413. margin,
  23414. marginBottom = 2,
  23415. marginLeft,
  23416. marginRight,
  23417. marginTop,
  23418. marginX,
  23419. marginY,
  23420. padding,
  23421. paddingBottom,
  23422. paddingLeft,
  23423. paddingRight,
  23424. paddingTop,
  23425. paddingX,
  23426. paddingY,
  23427. ...otherProps
  23428. } = useContextSystem(props, 'Spacer');
  23429. const cx = useCx();
  23430. 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) && rtl({
  23431. marginLeft: space(marginLeft)
  23432. })(), isDefined(marginRight) && rtl({
  23433. marginRight: space(marginRight)
  23434. })(), 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) && rtl({
  23435. paddingLeft: space(paddingLeft)
  23436. })(), isDefined(paddingRight) && rtl({
  23437. paddingRight: space(paddingRight)
  23438. })(), className);
  23439. return { ...otherProps,
  23440. className: classes
  23441. };
  23442. }
  23443. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/spacer/component.js
  23444. /**
  23445. * External dependencies
  23446. */
  23447. /**
  23448. * Internal dependencies
  23449. */
  23450. function UnconnectedSpacer(props, forwardedRef) {
  23451. const spacerProps = useSpacer(props);
  23452. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, spacerProps, {
  23453. ref: forwardedRef
  23454. }));
  23455. }
  23456. /**
  23457. * `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`.
  23458. *
  23459. * `Spacer` comes with a bunch of shorthand props to adjust `margin` and `padding`. The values of these props
  23460. * can either be a number (which will act as a multiplier to the library's grid system base of 4px),
  23461. * or a literal CSS value string.
  23462. *
  23463. * ```jsx
  23464. * import { Spacer } from `@wordpress/components`
  23465. *
  23466. * function Example() {
  23467. * return (
  23468. * <View>
  23469. * <Spacer>
  23470. * <Heading>WordPress.org</Heading>
  23471. * </Spacer>
  23472. * <Text>
  23473. * Code is Poetry
  23474. * </Text>
  23475. * </View>
  23476. * );
  23477. * }
  23478. * ```
  23479. */
  23480. const Spacer = contextConnect(UnconnectedSpacer, 'Spacer');
  23481. /* harmony default export */ var spacer_component = (Spacer);
  23482. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/angle-picker-control/index.js
  23483. /**
  23484. * External dependencies
  23485. */
  23486. /**
  23487. * WordPress dependencies
  23488. */
  23489. /**
  23490. * Internal dependencies
  23491. */
  23492. function AnglePickerControl(_ref) {
  23493. let {
  23494. /** Start opting into the new margin-free styles that will become the default in a future version. */
  23495. __nextHasNoMarginBottom = false,
  23496. className,
  23497. label = (0,external_wp_i18n_namespaceObject.__)('Angle'),
  23498. onChange,
  23499. value
  23500. } = _ref;
  23501. if (!__nextHasNoMarginBottom) {
  23502. external_wp_deprecated_default()('Bottom margin styles for wp.components.AnglePickerControl', {
  23503. since: '6.1',
  23504. version: '6.4',
  23505. hint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version.'
  23506. });
  23507. }
  23508. const handleOnNumberChange = unprocessedValue => {
  23509. const inputValue = unprocessedValue !== '' ? parseInt(unprocessedValue, 10) : 0;
  23510. onChange(inputValue);
  23511. };
  23512. const classes = classnames_default()('components-angle-picker-control', className);
  23513. return (0,external_wp_element_namespaceObject.createElement)(angle_picker_control_styles_Root, {
  23514. __nextHasNoMarginBottom: __nextHasNoMarginBottom,
  23515. className: classes,
  23516. gap: 4
  23517. }, (0,external_wp_element_namespaceObject.createElement)(flex_block_component, null, (0,external_wp_element_namespaceObject.createElement)(number_control, {
  23518. label: label,
  23519. className: "components-angle-picker-control__input-field",
  23520. max: 360,
  23521. min: 0,
  23522. onChange: handleOnNumberChange,
  23523. size: "__unstable-large",
  23524. step: "1",
  23525. value: value,
  23526. hideHTMLArrows: true,
  23527. suffix: (0,external_wp_element_namespaceObject.createElement)(spacer_component, {
  23528. as: text_component,
  23529. marginBottom: 0,
  23530. marginRight: space(3),
  23531. style: {
  23532. color: 'var( --wp-admin-theme-color )'
  23533. }
  23534. }, "\xB0")
  23535. })), (0,external_wp_element_namespaceObject.createElement)(flex_item_component, {
  23536. style: {
  23537. marginBottom: space(1),
  23538. marginTop: 'auto'
  23539. }
  23540. }, (0,external_wp_element_namespaceObject.createElement)(angle_circle, {
  23541. "aria-hidden": "true",
  23542. value: value,
  23543. onChange: onChange
  23544. })));
  23545. }
  23546. // EXTERNAL MODULE: ./node_modules/remove-accents/index.js
  23547. var remove_accents = __webpack_require__(4793);
  23548. var remove_accents_default = /*#__PURE__*/__webpack_require__.n(remove_accents);
  23549. ;// CONCATENATED MODULE: external ["wp","keycodes"]
  23550. var external_wp_keycodes_namespaceObject = window["wp"]["keycodes"];
  23551. ;// CONCATENATED MODULE: external ["wp","richText"]
  23552. var external_wp_richText_namespaceObject = window["wp"]["richText"];
  23553. ;// CONCATENATED MODULE: external ["wp","a11y"]
  23554. var external_wp_a11y_namespaceObject = window["wp"]["a11y"];
  23555. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/strings.js
  23556. /**
  23557. * External dependencies
  23558. */
  23559. const ALL_UNICODE_DASH_CHARACTERS = new RegExp(`[${[// - (hyphen-minus)
  23560. '\u002d', // ~ (tilde)
  23561. '\u007e', // ­ (soft hyphen)
  23562. '\u00ad', // ֊ (armenian hyphen)
  23563. '\u058a', // ־ (hebrew punctuation maqaf)
  23564. '\u05be', // ᐀ (canadian syllabics hyphen)
  23565. '\u1400', // ᠆ (mongolian todo soft hyphen)
  23566. '\u1806', // ‐ (hyphen)
  23567. '\u2010', // non-breaking hyphen)
  23568. '\u2011', // ‒ (figure dash)
  23569. '\u2012', // – (en dash)
  23570. '\u2013', // — (em dash)
  23571. '\u2014', // ― (horizontal bar)
  23572. '\u2015', // ⁓ (swung dash)
  23573. '\u2053', // superscript minus)
  23574. '\u207b', // subscript minus)
  23575. '\u208b', // − (minus sign)
  23576. '\u2212', // ⸗ (double oblique hyphen)
  23577. '\u2e17', // ⸺ (two-em dash)
  23578. '\u2e3a', // ⸻ (three-em dash)
  23579. '\u2e3b', // 〜 (wave dash)
  23580. '\u301c', // 〰 (wavy dash)
  23581. '\u3030', // ゠ (katakana-hiragana double hyphen)
  23582. '\u30a0', // ︱ (presentation form for vertical em dash)
  23583. '\ufe31', // ︲ (presentation form for vertical en dash)
  23584. '\ufe32', // ﹘ (small em dash)
  23585. '\ufe58', // ﹣ (small hyphen-minus)
  23586. '\ufe63', // - (fullwidth hyphen-minus)
  23587. '\uff0d'].join('')}]`, 'g');
  23588. const normalizeTextString = value => {
  23589. return remove_accents_default()(value).toLocaleLowerCase().replace(ALL_UNICODE_DASH_CHARACTERS, '-');
  23590. };
  23591. /**
  23592. * Escapes the RegExp special characters.
  23593. *
  23594. * @param {string} string Input string.
  23595. *
  23596. * @return {string} Regex-escaped string.
  23597. */
  23598. function escapeRegExp(string) {
  23599. return string.replace(/[\\^$.*+?()[\]{}|]/g, '\\$&');
  23600. }
  23601. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/autocomplete/get-default-use-items.js
  23602. /**
  23603. * External dependencies
  23604. */
  23605. /**
  23606. * WordPress dependencies
  23607. */
  23608. /**
  23609. * Internal dependencies
  23610. */
  23611. function filterOptions(search) {
  23612. let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  23613. let maxResults = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 10;
  23614. const filtered = [];
  23615. for (let i = 0; i < options.length; i++) {
  23616. const option = options[i]; // Merge label into keywords.
  23617. let {
  23618. keywords = []
  23619. } = option;
  23620. if ('string' === typeof option.label) {
  23621. keywords = [...keywords, option.label];
  23622. }
  23623. const isMatch = keywords.some(keyword => search.test(remove_accents_default()(keyword)));
  23624. if (!isMatch) {
  23625. continue;
  23626. }
  23627. filtered.push(option); // Abort early if max reached.
  23628. if (filtered.length === maxResults) {
  23629. break;
  23630. }
  23631. }
  23632. return filtered;
  23633. }
  23634. function getDefaultUseItems(autocompleter) {
  23635. return filterValue => {
  23636. const [items, setItems] = (0,external_wp_element_namespaceObject.useState)([]);
  23637. /*
  23638. * We support both synchronous and asynchronous retrieval of completer options
  23639. * but internally treat all as async so we maintain a single, consistent code path.
  23640. *
  23641. * Because networks can be slow, and the internet is wonderfully unpredictable,
  23642. * we don't want two promises updating the state at once. This ensures that only
  23643. * the most recent promise will act on `optionsData`. This doesn't use the state
  23644. * because `setState` is batched, and so there's no guarantee that setting
  23645. * `activePromise` in the state would result in it actually being in `this.state`
  23646. * before the promise resolves and we check to see if this is the active promise or not.
  23647. */
  23648. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
  23649. const {
  23650. options,
  23651. isDebounced
  23652. } = autocompleter;
  23653. const loadOptions = (0,external_lodash_namespaceObject.debounce)(() => {
  23654. const promise = Promise.resolve(typeof options === 'function' ? options(filterValue) : options).then(optionsData => {
  23655. if (promise.canceled) {
  23656. return;
  23657. }
  23658. const keyedOptions = optionsData.map((optionData, optionIndex) => ({
  23659. key: `${autocompleter.name}-${optionIndex}`,
  23660. value: optionData,
  23661. label: autocompleter.getOptionLabel(optionData),
  23662. keywords: autocompleter.getOptionKeywords ? autocompleter.getOptionKeywords(optionData) : [],
  23663. isDisabled: autocompleter.isOptionDisabled ? autocompleter.isOptionDisabled(optionData) : false
  23664. })); // Create a regular expression to filter the options.
  23665. const search = new RegExp('(?:\\b|\\s|^)' + escapeRegExp(filterValue), 'i');
  23666. setItems(filterOptions(search, keyedOptions));
  23667. });
  23668. return promise;
  23669. }, isDebounced ? 250 : 0);
  23670. const promise = loadOptions();
  23671. return () => {
  23672. loadOptions.cancel();
  23673. if (promise) {
  23674. promise.canceled = true;
  23675. }
  23676. };
  23677. }, [filterValue]);
  23678. return [items];
  23679. };
  23680. }
  23681. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/autocomplete/autocompleter-ui.js
  23682. /**
  23683. * External dependencies
  23684. */
  23685. /**
  23686. * WordPress dependencies
  23687. */
  23688. /**
  23689. * Internal dependencies
  23690. */
  23691. function getAutoCompleterUI(autocompleter) {
  23692. const useItems = autocompleter.useItems ? autocompleter.useItems : getDefaultUseItems(autocompleter);
  23693. function AutocompleterUI(_ref) {
  23694. let {
  23695. filterValue,
  23696. instanceId,
  23697. listBoxId,
  23698. className,
  23699. selectedIndex,
  23700. onChangeOptions,
  23701. onSelect,
  23702. onReset,
  23703. value,
  23704. contentRef
  23705. } = _ref;
  23706. const [items] = useItems(filterValue);
  23707. const popoverAnchor = (0,external_wp_richText_namespaceObject.useAnchor)({
  23708. editableContentElement: contentRef.current,
  23709. value
  23710. });
  23711. (0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
  23712. onChangeOptions(items); // Temporarily disabling exhaustive-deps to avoid introducing unexpected side effecst.
  23713. // See https://github.com/WordPress/gutenberg/pull/41820
  23714. // eslint-disable-next-line react-hooks/exhaustive-deps
  23715. }, [items]);
  23716. if (!items.length > 0) {
  23717. return null;
  23718. }
  23719. return (0,external_wp_element_namespaceObject.createElement)(popover, {
  23720. focusOnMount: false,
  23721. onClose: onReset,
  23722. position: "top right",
  23723. className: "components-autocomplete__popover",
  23724. anchor: popoverAnchor
  23725. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  23726. id: listBoxId,
  23727. role: "listbox",
  23728. className: "components-autocomplete__results"
  23729. }, (0,external_lodash_namespaceObject.map)(items, (option, index) => (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  23730. key: option.key,
  23731. id: `components-autocomplete-item-${instanceId}-${option.key}`,
  23732. role: "option",
  23733. "aria-selected": index === selectedIndex,
  23734. disabled: option.isDisabled,
  23735. className: classnames_default()('components-autocomplete__result', className, {
  23736. 'is-selected': index === selectedIndex
  23737. }),
  23738. onClick: () => onSelect(option)
  23739. }, option.label))));
  23740. }
  23741. return AutocompleterUI;
  23742. }
  23743. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/autocomplete/index.js
  23744. /**
  23745. * External dependencies
  23746. */
  23747. /**
  23748. * WordPress dependencies
  23749. */
  23750. /**
  23751. * Internal dependencies
  23752. */
  23753. /**
  23754. * A raw completer option.
  23755. *
  23756. * @typedef {*} CompleterOption
  23757. */
  23758. /**
  23759. * @callback FnGetOptions
  23760. *
  23761. * @return {(CompleterOption[]|Promise.<CompleterOption[]>)} The completer options or a promise for them.
  23762. */
  23763. /**
  23764. * @callback FnGetOptionKeywords
  23765. * @param {CompleterOption} option a completer option.
  23766. *
  23767. * @return {string[]} list of key words to search.
  23768. */
  23769. /**
  23770. * @callback FnIsOptionDisabled
  23771. * @param {CompleterOption} option a completer option.
  23772. *
  23773. * @return {string[]} whether or not the given option is disabled.
  23774. */
  23775. /**
  23776. * @callback FnGetOptionLabel
  23777. * @param {CompleterOption} option a completer option.
  23778. *
  23779. * @return {(string|Array.<(string|WPElement)>)} list of react components to render.
  23780. */
  23781. /**
  23782. * @callback FnAllowContext
  23783. * @param {string} before the string before the auto complete trigger and query.
  23784. * @param {string} after the string after the autocomplete trigger and query.
  23785. *
  23786. * @return {boolean} true if the completer can handle.
  23787. */
  23788. /**
  23789. * @typedef {Object} OptionCompletion
  23790. * @property {'insert-at-caret'|'replace'} action the intended placement of the completion.
  23791. * @property {OptionCompletionValue} value the completion value.
  23792. */
  23793. /**
  23794. * A completion value.
  23795. *
  23796. * @typedef {(string|WPElement|Object)} OptionCompletionValue
  23797. */
  23798. /**
  23799. * @callback FnGetOptionCompletion
  23800. * @param {CompleterOption} value the value of the completer option.
  23801. * @param {string} query the text value of the autocomplete query.
  23802. *
  23803. * @return {(OptionCompletion|OptionCompletionValue)} the completion for the given option. If an
  23804. * OptionCompletionValue is returned, the
  23805. * completion action defaults to `insert-at-caret`.
  23806. */
  23807. /**
  23808. * @typedef {Object} WPCompleter
  23809. * @property {string} name a way to identify a completer, useful for selective overriding.
  23810. * @property {?string} className A class to apply to the popup menu.
  23811. * @property {string} triggerPrefix the prefix that will display the menu.
  23812. * @property {(CompleterOption[]|FnGetOptions)} options the completer options or a function to get them.
  23813. * @property {?FnGetOptionKeywords} getOptionKeywords get the keywords for a given option.
  23814. * @property {?FnIsOptionDisabled} isOptionDisabled get whether or not the given option is disabled.
  23815. * @property {FnGetOptionLabel} getOptionLabel get the label for a given option.
  23816. * @property {?FnAllowContext} allowContext filter the context under which the autocomplete activates.
  23817. * @property {FnGetOptionCompletion} getOptionCompletion get the completion associated with a given option.
  23818. */
  23819. function useAutocomplete(_ref) {
  23820. let {
  23821. record,
  23822. onChange,
  23823. onReplace,
  23824. completers,
  23825. contentRef
  23826. } = _ref;
  23827. const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500);
  23828. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(useAutocomplete);
  23829. const [selectedIndex, setSelectedIndex] = (0,external_wp_element_namespaceObject.useState)(0);
  23830. const [filteredOptions, setFilteredOptions] = (0,external_wp_element_namespaceObject.useState)([]);
  23831. const [filterValue, setFilterValue] = (0,external_wp_element_namespaceObject.useState)('');
  23832. const [autocompleter, setAutocompleter] = (0,external_wp_element_namespaceObject.useState)(null);
  23833. const [AutocompleterUI, setAutocompleterUI] = (0,external_wp_element_namespaceObject.useState)(null);
  23834. const backspacing = (0,external_wp_element_namespaceObject.useRef)(false);
  23835. function insertCompletion(replacement) {
  23836. const end = record.start;
  23837. const start = end - autocompleter.triggerPrefix.length - filterValue.length;
  23838. const toInsert = (0,external_wp_richText_namespaceObject.create)({
  23839. html: (0,external_wp_element_namespaceObject.renderToString)(replacement)
  23840. });
  23841. onChange((0,external_wp_richText_namespaceObject.insert)(record, toInsert, start, end));
  23842. }
  23843. function select(option) {
  23844. const {
  23845. getOptionCompletion
  23846. } = autocompleter || {};
  23847. if (option.isDisabled) {
  23848. return;
  23849. }
  23850. if (getOptionCompletion) {
  23851. const completion = getOptionCompletion(option.value, filterValue);
  23852. const {
  23853. action,
  23854. value
  23855. } = undefined === completion.action || undefined === completion.value ? {
  23856. action: 'insert-at-caret',
  23857. value: completion
  23858. } : completion;
  23859. if ('replace' === action) {
  23860. onReplace([value]); // When replacing, the component will unmount, so don't reset
  23861. // state (below) on an unmounted component.
  23862. return;
  23863. } else if ('insert-at-caret' === action) {
  23864. insertCompletion(value);
  23865. }
  23866. } // Reset autocomplete state after insertion rather than before
  23867. // so insertion events don't cause the completion menu to redisplay.
  23868. reset();
  23869. }
  23870. function reset() {
  23871. setSelectedIndex(0);
  23872. setFilteredOptions([]);
  23873. setFilterValue('');
  23874. setAutocompleter(null);
  23875. setAutocompleterUI(null);
  23876. }
  23877. function announce(options) {
  23878. if (!debouncedSpeak) {
  23879. return;
  23880. }
  23881. if (!!options.length) {
  23882. debouncedSpeak((0,external_wp_i18n_namespaceObject.sprintf)(
  23883. /* translators: %d: number of results. */
  23884. (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');
  23885. } else {
  23886. debouncedSpeak((0,external_wp_i18n_namespaceObject.__)('No results.'), 'assertive');
  23887. }
  23888. }
  23889. /**
  23890. * Load options for an autocompleter.
  23891. *
  23892. * @param {Array} options
  23893. */
  23894. function onChangeOptions(options) {
  23895. setSelectedIndex(options.length === filteredOptions.length ? selectedIndex : 0);
  23896. setFilteredOptions(options);
  23897. announce(options);
  23898. }
  23899. function handleKeyDown(event) {
  23900. backspacing.current = event.keyCode === external_wp_keycodes_namespaceObject.BACKSPACE;
  23901. if (!autocompleter) {
  23902. return;
  23903. }
  23904. if (filteredOptions.length === 0) {
  23905. return;
  23906. }
  23907. if (event.defaultPrevented) {
  23908. return;
  23909. }
  23910. switch (event.keyCode) {
  23911. case external_wp_keycodes_namespaceObject.UP:
  23912. setSelectedIndex((selectedIndex === 0 ? filteredOptions.length : selectedIndex) - 1);
  23913. break;
  23914. case external_wp_keycodes_namespaceObject.DOWN:
  23915. setSelectedIndex((selectedIndex + 1) % filteredOptions.length);
  23916. break;
  23917. case external_wp_keycodes_namespaceObject.ESCAPE:
  23918. setAutocompleter(null);
  23919. setAutocompleterUI(null);
  23920. event.preventDefault();
  23921. break;
  23922. case external_wp_keycodes_namespaceObject.ENTER:
  23923. select(filteredOptions[selectedIndex]);
  23924. break;
  23925. case external_wp_keycodes_namespaceObject.LEFT:
  23926. case external_wp_keycodes_namespaceObject.RIGHT:
  23927. reset();
  23928. return;
  23929. default:
  23930. return;
  23931. } // Any handled keycode should prevent original behavior. This relies on
  23932. // the early return in the default case.
  23933. event.preventDefault();
  23934. } // textContent is a primitive (string), memoizing is not strictly necessary
  23935. // but this is a preemptive performance improvement, since the autocompleter
  23936. // is a potential bottleneck for the editor type metric.
  23937. const textContent = (0,external_wp_element_namespaceObject.useMemo)(() => {
  23938. if ((0,external_wp_richText_namespaceObject.isCollapsed)(record)) {
  23939. return (0,external_wp_richText_namespaceObject.getTextContent)((0,external_wp_richText_namespaceObject.slice)(record, 0));
  23940. }
  23941. }, [record]);
  23942. (0,external_wp_element_namespaceObject.useEffect)(() => {
  23943. if (!textContent) {
  23944. reset();
  23945. return;
  23946. }
  23947. const text = remove_accents_default()(textContent);
  23948. const textAfterSelection = (0,external_wp_richText_namespaceObject.getTextContent)((0,external_wp_richText_namespaceObject.slice)(record, undefined, (0,external_wp_richText_namespaceObject.getTextContent)(record).length));
  23949. const completer = (0,external_lodash_namespaceObject.find)(completers, _ref2 => {
  23950. let {
  23951. triggerPrefix,
  23952. allowContext
  23953. } = _ref2;
  23954. const index = text.lastIndexOf(triggerPrefix);
  23955. if (index === -1) {
  23956. return false;
  23957. }
  23958. const textWithoutTrigger = text.slice(index + triggerPrefix.length);
  23959. const tooDistantFromTrigger = textWithoutTrigger.length > 50; // 50 chars seems to be a good limit.
  23960. // This is a final barrier to prevent the effect from completing with
  23961. // an extremely long string, which causes the editor to slow-down
  23962. // significantly. This could happen, for example, if `matchingWhileBackspacing`
  23963. // is true and one of the "words" end up being too long. If that's the case,
  23964. // it will be caught by this guard.
  23965. if (tooDistantFromTrigger) return false;
  23966. const mismatch = filteredOptions.length === 0;
  23967. const wordsFromTrigger = textWithoutTrigger.split(/\s/); // We need to allow the effect to run when not backspacing and if there
  23968. // was a mismatch. i.e when typing a trigger + the match string or when
  23969. // clicking in an existing trigger word on the page. We do that if we
  23970. // detect that we have one word from trigger in the current textual context.
  23971. //
  23972. // Ex.: "Some text @a" <-- "@a" will be detected as the trigger word and
  23973. // allow the effect to run. It will run until there's a mismatch.
  23974. const hasOneTriggerWord = wordsFromTrigger.length === 1; // This is used to allow the effect to run when backspacing and if
  23975. // "touching" a word that "belongs" to a trigger. We consider a "trigger
  23976. // word" any word up to the limit of 3 from the trigger character.
  23977. // Anything beyond that is ignored if there's a mismatch. This allows
  23978. // us to "escape" a mismatch when backspacing, but still imposing some
  23979. // sane limits.
  23980. //
  23981. // Ex: "Some text @marcelo sekkkk" <--- "kkkk" caused a mismatch, but
  23982. // if the user presses backspace here, it will show the completion popup again.
  23983. const matchingWhileBackspacing = backspacing.current && textWithoutTrigger.split(/\s/).length <= 3;
  23984. if (mismatch && !(matchingWhileBackspacing || hasOneTriggerWord)) {
  23985. return false;
  23986. }
  23987. if (allowContext && !allowContext(text.slice(0, index), textAfterSelection)) {
  23988. return false;
  23989. }
  23990. if (/^\s/.test(textWithoutTrigger) || /\s\s+$/.test(textWithoutTrigger)) {
  23991. return false;
  23992. }
  23993. return /[\u0000-\uFFFF]*$/.test(textWithoutTrigger);
  23994. });
  23995. if (!completer) {
  23996. reset();
  23997. return;
  23998. }
  23999. const safeTrigger = escapeRegExp(completer.triggerPrefix);
  24000. const match = text.slice(text.lastIndexOf(completer.triggerPrefix)).match(new RegExp(`${safeTrigger}([\u0000-\uFFFF]*)$`));
  24001. const query = match && match[1];
  24002. setAutocompleter(completer);
  24003. setAutocompleterUI(() => completer !== autocompleter ? getAutoCompleterUI(completer) : AutocompleterUI);
  24004. setFilterValue(query); // Temporarily disabling exhaustive-deps to avoid introducing unexpected side effecst.
  24005. // See https://github.com/WordPress/gutenberg/pull/41820
  24006. // eslint-disable-next-line react-hooks/exhaustive-deps
  24007. }, [textContent]);
  24008. const {
  24009. key: selectedKey = ''
  24010. } = filteredOptions[selectedIndex] || {};
  24011. const {
  24012. className
  24013. } = autocompleter || {};
  24014. const isExpanded = !!autocompleter && filteredOptions.length > 0;
  24015. const listBoxId = isExpanded ? `components-autocomplete-listbox-${instanceId}` : null;
  24016. const activeId = isExpanded ? `components-autocomplete-item-${instanceId}-${selectedKey}` : null;
  24017. const hasSelection = record.start !== undefined;
  24018. return {
  24019. listBoxId,
  24020. activeId,
  24021. onKeyDown: handleKeyDown,
  24022. popover: hasSelection && AutocompleterUI && (0,external_wp_element_namespaceObject.createElement)(AutocompleterUI, {
  24023. className: className,
  24024. filterValue: filterValue,
  24025. instanceId: instanceId,
  24026. listBoxId: listBoxId,
  24027. selectedIndex: selectedIndex,
  24028. onChangeOptions: onChangeOptions,
  24029. onSelect: select,
  24030. value: record,
  24031. contentRef: contentRef,
  24032. reset: reset
  24033. })
  24034. };
  24035. }
  24036. function useAutocompleteProps(options) {
  24037. const ref = (0,external_wp_element_namespaceObject.useRef)();
  24038. const onKeyDownRef = (0,external_wp_element_namespaceObject.useRef)();
  24039. const {
  24040. popover,
  24041. listBoxId,
  24042. activeId,
  24043. onKeyDown
  24044. } = useAutocomplete({ ...options,
  24045. contentRef: ref
  24046. });
  24047. onKeyDownRef.current = onKeyDown;
  24048. return {
  24049. ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, (0,external_wp_compose_namespaceObject.useRefEffect)(element => {
  24050. function _onKeyDown(event) {
  24051. onKeyDownRef.current(event);
  24052. }
  24053. element.addEventListener('keydown', _onKeyDown);
  24054. return () => {
  24055. element.removeEventListener('keydown', _onKeyDown);
  24056. };
  24057. }, [])]),
  24058. children: popover,
  24059. 'aria-autocomplete': listBoxId ? 'list' : undefined,
  24060. 'aria-owns': listBoxId,
  24061. 'aria-activedescendant': activeId
  24062. };
  24063. }
  24064. function Autocomplete(_ref3) {
  24065. let {
  24066. children,
  24067. isSelected,
  24068. ...options
  24069. } = _ref3;
  24070. const {
  24071. popover,
  24072. ...props
  24073. } = useAutocomplete(options);
  24074. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, children(props), isSelected && popover);
  24075. }
  24076. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/font-values.js
  24077. /* harmony default export */ var font_values = ({
  24078. 'default.fontFamily': "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif",
  24079. 'default.fontSize': '13px',
  24080. 'helpText.fontSize': '12px',
  24081. mobileTextMinFontSize: '16px'
  24082. });
  24083. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/font.js
  24084. /**
  24085. * External dependencies
  24086. */
  24087. /**
  24088. * Internal dependencies
  24089. */
  24090. /**
  24091. *
  24092. * @param {keyof FONT} value Path of value from `FONT`
  24093. * @return {string} Font rule value
  24094. */
  24095. function font(value) {
  24096. return (0,external_lodash_namespaceObject.get)(font_values, value, '');
  24097. }
  24098. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/box-sizing.js
  24099. function box_sizing_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)."; }
  24100. /**
  24101. * External dependencies
  24102. */
  24103. const boxSizingReset = true ? {
  24104. name: "kv6lnz",
  24105. styles: "box-sizing:border-box;*,*::before,*::after{box-sizing:inherit;}"
  24106. } : 0;
  24107. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/base-control/styles/base-control-styles.js
  24108. 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)."; }
  24109. /**
  24110. * External dependencies
  24111. */
  24112. /**
  24113. * Internal dependencies
  24114. */
  24115. const base_control_styles_Wrapper = emotion_styled_base_browser_esm("div", true ? {
  24116. target: "ej5x27r4"
  24117. } : 0)("font-family:", font('default.fontFamily'), ";font-size:", font('default.fontSize'), ";", boxSizingReset, ";" + ( true ? "" : 0));
  24118. const deprecatedMarginField = _ref2 => {
  24119. let {
  24120. __nextHasNoMarginBottom = false
  24121. } = _ref2;
  24122. return !__nextHasNoMarginBottom && /*#__PURE__*/emotion_react_browser_esm_css("margin-bottom:", space(2), ";" + ( true ? "" : 0), true ? "" : 0);
  24123. };
  24124. const StyledField = emotion_styled_base_browser_esm("div", true ? {
  24125. target: "ej5x27r3"
  24126. } : 0)(deprecatedMarginField, " .components-panel__row &{margin-bottom:inherit;}" + ( true ? "" : 0));
  24127. const labelStyles = /*#__PURE__*/emotion_react_browser_esm_css(baseLabelTypography, ";display:inline-block;margin-bottom:", space(2), ";padding:0;" + ( true ? "" : 0), true ? "" : 0);
  24128. const StyledLabel = emotion_styled_base_browser_esm("label", true ? {
  24129. target: "ej5x27r2"
  24130. } : 0)(labelStyles, ";" + ( true ? "" : 0));
  24131. var base_control_styles_ref = true ? {
  24132. name: "11yad0w",
  24133. styles: "margin-bottom:revert"
  24134. } : 0;
  24135. const deprecatedMarginHelp = _ref3 => {
  24136. let {
  24137. __nextHasNoMarginBottom = false
  24138. } = _ref3;
  24139. return !__nextHasNoMarginBottom && base_control_styles_ref;
  24140. };
  24141. const StyledHelp = emotion_styled_base_browser_esm("p", true ? {
  24142. target: "ej5x27r1"
  24143. } : 0)("margin-top:", space(2), ";margin-bottom:0;font-size:", font('helpText.fontSize'), ";font-style:normal;color:", COLORS.gray[700], ";", deprecatedMarginHelp, ";" + ( true ? "" : 0));
  24144. const StyledVisualLabel = emotion_styled_base_browser_esm("span", true ? {
  24145. target: "ej5x27r0"
  24146. } : 0)(labelStyles, ";" + ( true ? "" : 0));
  24147. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/base-control/index.js
  24148. /**
  24149. * External dependencies
  24150. */
  24151. /**
  24152. * Internal dependencies
  24153. */
  24154. /**
  24155. * `BaseControl` is a component used to generate labels and help text for components handling user inputs.
  24156. *
  24157. * @example
  24158. * // Render a `BaseControl` for a textarea input
  24159. * import { BaseControl } from '@wordpress/components';
  24160. *
  24161. * // The `id` prop is necessary to accessibly associate the label with the textarea
  24162. * const MyBaseControl = () => (
  24163. * <BaseControl id="textarea-1" label="Text" help="Enter some text" __nextHasNoMarginBottom={ true }>
  24164. * <textarea id="textarea-1" />
  24165. * </BaseControl>
  24166. * );
  24167. */
  24168. const BaseControl = _ref => {
  24169. let {
  24170. __nextHasNoMarginBottom = false,
  24171. id,
  24172. label,
  24173. hideLabelFromVision = false,
  24174. help,
  24175. className,
  24176. children
  24177. } = _ref;
  24178. return (0,external_wp_element_namespaceObject.createElement)(base_control_styles_Wrapper, {
  24179. className: classnames_default()('components-base-control', className)
  24180. }, (0,external_wp_element_namespaceObject.createElement)(StyledField, {
  24181. className: "components-base-control__field" // TODO: Official deprecation for this should start after all internal usages have been migrated
  24182. ,
  24183. __nextHasNoMarginBottom: __nextHasNoMarginBottom
  24184. }, label && id && (hideLabelFromVision ? (0,external_wp_element_namespaceObject.createElement)(visually_hidden_component, {
  24185. as: "label",
  24186. htmlFor: id
  24187. }, label) : (0,external_wp_element_namespaceObject.createElement)(StyledLabel, {
  24188. className: "components-base-control__label",
  24189. htmlFor: id
  24190. }, label)), label && !id && (hideLabelFromVision ? (0,external_wp_element_namespaceObject.createElement)(visually_hidden_component, {
  24191. as: "label"
  24192. }, label) : (0,external_wp_element_namespaceObject.createElement)(BaseControl.VisualLabel, null, label)), children), !!help && (0,external_wp_element_namespaceObject.createElement)(StyledHelp, {
  24193. id: id ? id + '__help' : undefined,
  24194. className: "components-base-control__help",
  24195. __nextHasNoMarginBottom: __nextHasNoMarginBottom
  24196. }, help));
  24197. };
  24198. /**
  24199. * `BaseControl.VisualLabel` is used to render a purely visual label inside a `BaseControl` component.
  24200. *
  24201. * It should only be used in cases where the children being rendered inside `BaseControl` are already accessibly labeled,
  24202. * e.g., a button, but we want an additional visual label for that section equivalent to the labels `BaseControl` would
  24203. * otherwise use if the `label` prop was passed.
  24204. *
  24205. * @example
  24206. * import { BaseControl } from '@wordpress/components';
  24207. *
  24208. * const MyBaseControl = () => (
  24209. * <BaseControl help="This button is already accessibly labeled.">
  24210. * <BaseControl.VisualLabel>Author</BaseControl.VisualLabel>
  24211. * <Button>Select an author</Button>
  24212. * </BaseControl>
  24213. * );
  24214. */
  24215. const VisualLabel = _ref2 => {
  24216. let {
  24217. className,
  24218. children,
  24219. ...props
  24220. } = _ref2;
  24221. return (0,external_wp_element_namespaceObject.createElement)(StyledVisualLabel, extends_extends({}, props, {
  24222. className: classnames_default()('components-base-control__label', className)
  24223. }), children);
  24224. };
  24225. BaseControl.VisualLabel = VisualLabel;
  24226. /* harmony default export */ var base_control = (BaseControl);
  24227. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/link.js
  24228. /**
  24229. * WordPress dependencies
  24230. */
  24231. const link_link = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  24232. xmlns: "http://www.w3.org/2000/svg",
  24233. viewBox: "0 0 24 24"
  24234. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  24235. 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"
  24236. }));
  24237. /* harmony default export */ var library_link = (link_link);
  24238. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/link-off.js
  24239. /**
  24240. * WordPress dependencies
  24241. */
  24242. const linkOff = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  24243. xmlns: "http://www.w3.org/2000/svg",
  24244. viewBox: "0 0 24 24"
  24245. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  24246. 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"
  24247. }));
  24248. /* harmony default export */ var link_off = (linkOff);
  24249. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-box-control/styles.js
  24250. 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)."; }
  24251. /**
  24252. * External dependencies
  24253. */
  24254. /**
  24255. * Internal dependencies
  24256. */
  24257. const BorderBoxControl = /*#__PURE__*/emotion_react_browser_esm_css( true ? "" : 0, true ? "" : 0);
  24258. const LinkedBorderControl = true ? {
  24259. name: "82a6rk",
  24260. styles: "flex:1"
  24261. } : 0;
  24262. const BorderBoxControlLinkedButton = __next36pxDefaultSize => {
  24263. return /*#__PURE__*/emotion_react_browser_esm_css("flex:0;flex-basis:24px;line-height:0;margin-top:", __next36pxDefaultSize ? '6px' : '3px', ";" + ( true ? "" : 0), true ? "" : 0);
  24264. };
  24265. const BorderBoxStyleWithFallback = border => {
  24266. const {
  24267. color = COLORS.gray[200],
  24268. style = 'solid',
  24269. width = config_values.borderWidth
  24270. } = border || {};
  24271. const clampedWidth = width !== config_values.borderWidth ? `clamp(1px, ${width}, 10px)` : width;
  24272. const hasVisibleBorder = !!width && width !== '0' || !!color;
  24273. const borderStyle = hasVisibleBorder ? style || 'solid' : style;
  24274. return `${color} ${borderStyle} ${clampedWidth}`;
  24275. };
  24276. const borderBoxControlVisualizer = (borders, __next36pxDefaultSize) => {
  24277. return /*#__PURE__*/emotion_react_browser_esm_css("position:absolute;top:", __next36pxDefaultSize ? '18px' : '15px', ";right:30px;bottom:", __next36pxDefaultSize ? '18px' : '15px', ";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({
  24278. borderLeft: BorderBoxStyleWithFallback(borders === null || borders === void 0 ? void 0 : borders.left)
  24279. })(), " ", rtl({
  24280. borderRight: BorderBoxStyleWithFallback(borders === null || borders === void 0 ? void 0 : borders.right)
  24281. })(), ";" + ( true ? "" : 0), true ? "" : 0);
  24282. };
  24283. const borderBoxControlSplitControls = () => /*#__PURE__*/emotion_react_browser_esm_css("position:relative;flex:1;", rtl({
  24284. marginRight: space(3)
  24285. }, {
  24286. marginLeft: space(3)
  24287. })(), ";" + ( true ? "" : 0), true ? "" : 0);
  24288. const CenteredBorderControl = true ? {
  24289. name: "1nwbfnf",
  24290. styles: "grid-column:span 2;margin:0 auto"
  24291. } : 0;
  24292. const rightBorderControl = () => /*#__PURE__*/emotion_react_browser_esm_css(rtl({
  24293. marginLeft: 'auto'
  24294. }, {
  24295. marginRight: 'auto'
  24296. })(), ";" + ( true ? "" : 0), true ? "" : 0);
  24297. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control-linked-button/hook.js
  24298. /**
  24299. * WordPress dependencies
  24300. */
  24301. /**
  24302. * Internal dependencies
  24303. */
  24304. function useBorderBoxControlLinkedButton(props) {
  24305. const {
  24306. className,
  24307. __next36pxDefaultSize = false,
  24308. ...otherProps
  24309. } = useContextSystem(props, 'BorderBoxControlLinkedButton'); // Generate class names.
  24310. const cx = useCx();
  24311. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  24312. return cx(BorderBoxControlLinkedButton(__next36pxDefaultSize), className);
  24313. }, [className, cx, __next36pxDefaultSize]);
  24314. return { ...otherProps,
  24315. className: classes
  24316. };
  24317. }
  24318. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control-linked-button/component.js
  24319. /**
  24320. * WordPress dependencies
  24321. */
  24322. /**
  24323. * Internal dependencies
  24324. */
  24325. const component_BorderBoxControlLinkedButton = (props, forwardedRef) => {
  24326. const {
  24327. className,
  24328. isLinked,
  24329. ...buttonProps
  24330. } = useBorderBoxControlLinkedButton(props);
  24331. const label = isLinked ? (0,external_wp_i18n_namespaceObject.__)('Unlink sides') : (0,external_wp_i18n_namespaceObject.__)('Link sides');
  24332. return (0,external_wp_element_namespaceObject.createElement)(tooltip, {
  24333. text: label
  24334. }, (0,external_wp_element_namespaceObject.createElement)(component, {
  24335. className: className
  24336. }, (0,external_wp_element_namespaceObject.createElement)(build_module_button, extends_extends({}, buttonProps, {
  24337. isSmall: true,
  24338. icon: isLinked ? library_link : link_off,
  24339. iconSize: 24,
  24340. "aria-label": label,
  24341. ref: forwardedRef
  24342. }))));
  24343. };
  24344. const ConnectedBorderBoxControlLinkedButton = contextConnect(component_BorderBoxControlLinkedButton, 'BorderBoxControlLinkedButton');
  24345. /* harmony default export */ var border_box_control_linked_button_component = (ConnectedBorderBoxControlLinkedButton);
  24346. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control-visualizer/hook.js
  24347. /**
  24348. * WordPress dependencies
  24349. */
  24350. /**
  24351. * Internal dependencies
  24352. */
  24353. function useBorderBoxControlVisualizer(props) {
  24354. const {
  24355. className,
  24356. value,
  24357. __next36pxDefaultSize = false,
  24358. ...otherProps
  24359. } = useContextSystem(props, 'BorderBoxControlVisualizer'); // Generate class names.
  24360. const cx = useCx();
  24361. const rtlWatchResult = rtl.watch();
  24362. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  24363. return cx(borderBoxControlVisualizer(value, __next36pxDefaultSize), className); // rtlWatchResult is needed to refresh styles when the writing direction changes
  24364. // eslint-disable-next-line react-hooks/exhaustive-deps
  24365. }, [cx, className, value, __next36pxDefaultSize, rtlWatchResult]);
  24366. return { ...otherProps,
  24367. className: classes,
  24368. value
  24369. };
  24370. }
  24371. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control-visualizer/component.js
  24372. /**
  24373. * WordPress dependencies
  24374. */
  24375. /**
  24376. * Internal dependencies
  24377. */
  24378. const BorderBoxControlVisualizer = (props, forwardedRef) => {
  24379. const {
  24380. value,
  24381. ...otherProps
  24382. } = useBorderBoxControlVisualizer(props);
  24383. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, otherProps, {
  24384. ref: forwardedRef
  24385. }));
  24386. };
  24387. const ConnectedBorderBoxControlVisualizer = contextConnect(BorderBoxControlVisualizer, 'BorderBoxControlVisualizer');
  24388. /* harmony default export */ var border_box_control_visualizer_component = (ConnectedBorderBoxControlVisualizer);
  24389. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js
  24390. /**
  24391. * WordPress dependencies
  24392. */
  24393. const closeSmall = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  24394. xmlns: "http://www.w3.org/2000/svg",
  24395. viewBox: "0 0 24 24"
  24396. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  24397. 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"
  24398. }));
  24399. /* harmony default export */ var close_small = (closeSmall);
  24400. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/line-solid.js
  24401. /**
  24402. * WordPress dependencies
  24403. */
  24404. const lineSolid = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  24405. xmlns: "http://www.w3.org/2000/svg",
  24406. viewBox: "0 0 24 24"
  24407. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  24408. d: "M5 11.25h14v1.5H5z"
  24409. }));
  24410. /* harmony default export */ var line_solid = (lineSolid);
  24411. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/line-dashed.js
  24412. /**
  24413. * WordPress dependencies
  24414. */
  24415. const lineDashed = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  24416. xmlns: "http://www.w3.org/2000/svg",
  24417. viewBox: "0 0 24 24"
  24418. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  24419. fillRule: "evenodd",
  24420. d: "M5 11.25h3v1.5H5v-1.5zm5.5 0h3v1.5h-3v-1.5zm8.5 0h-3v1.5h3v-1.5z",
  24421. clipRule: "evenodd"
  24422. }));
  24423. /* harmony default export */ var line_dashed = (lineDashed);
  24424. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/line-dotted.js
  24425. /**
  24426. * WordPress dependencies
  24427. */
  24428. const lineDotted = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  24429. xmlns: "http://www.w3.org/2000/svg",
  24430. viewBox: "0 0 24 24"
  24431. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  24432. fillRule: "evenodd",
  24433. 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",
  24434. clipRule: "evenodd"
  24435. }));
  24436. /* harmony default export */ var line_dotted = (lineDotted);
  24437. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/unit-control/styles/unit-control-styles.js
  24438. 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)."; }
  24439. /**
  24440. * External dependencies
  24441. */
  24442. /**
  24443. * Internal dependencies
  24444. */
  24445. // Using `selectSize` instead of `size` to avoid a type conflict with the
  24446. // `size` HTML attribute of the `select` element.
  24447. const unit_control_styles_Root = emotion_styled_base_browser_esm("div", true ? {
  24448. target: "e1bagdl33"
  24449. } : 0)("box-sizing:border-box;position:relative;&&& ", BackdropUI, "{transition:box-shadow 0.1s linear;}" + ( true ? "" : 0));
  24450. var unit_control_styles_ref = true ? {
  24451. name: "1y65o8",
  24452. styles: "&::-webkit-outer-spin-button,&::-webkit-inner-spin-button{-webkit-appearance:none;margin:0;}"
  24453. } : 0;
  24454. const arrowStyles = _ref2 => {
  24455. let {
  24456. disableUnits
  24457. } = _ref2;
  24458. if (disableUnits) return '';
  24459. return unit_control_styles_ref;
  24460. }; // TODO: Resolve need to use &&& to increase specificity
  24461. // https://github.com/WordPress/gutenberg/issues/18483
  24462. const ValueInput = /*#__PURE__*/emotion_styled_base_browser_esm(number_control, true ? {
  24463. target: "e1bagdl32"
  24464. } : 0)("&&&{input{appearance:none;-moz-appearance:textfield;display:block;width:100%;", arrowStyles, ";}}" + ( true ? "" : 0));
  24465. const baseUnitLabelStyles = _ref3 => {
  24466. let {
  24467. selectSize
  24468. } = _ref3;
  24469. const sizes = {
  24470. default: /*#__PURE__*/emotion_react_browser_esm_css("box-sizing:border-box;padding:2px 1px;width:20px;color:", COLORS.gray[800], ";font-size:8px;line-height:1;letter-spacing:-0.5px;text-transform:uppercase;text-align-last:center;" + ( true ? "" : 0), true ? "" : 0),
  24471. large: /*#__PURE__*/emotion_react_browser_esm_css("box-sizing:border-box;min-width:24px;max-width:48px;height:24px;margin-inline-end:", space(2), ";padding:", space(1), ";color:", COLORS.ui.theme, ";font-size:13px;line-height:1;text-align-last:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" + ( true ? "" : 0), true ? "" : 0)
  24472. };
  24473. return selectSize === '__unstable-large' ? sizes.large : sizes.default;
  24474. };
  24475. const UnitLabel = emotion_styled_base_browser_esm("div", true ? {
  24476. target: "e1bagdl31"
  24477. } : 0)("&&&{pointer-events:none;", baseUnitLabelStyles, ";color:", COLORS.gray[900], ";}" + ( true ? "" : 0));
  24478. const unitSelectSizes = _ref4 => {
  24479. let {
  24480. selectSize = 'default'
  24481. } = _ref4;
  24482. const sizes = {
  24483. default: /*#__PURE__*/emotion_react_browser_esm_css("height:100%;border:1px solid transparent;transition:box-shadow 0.1s linear,border 0.1s linear;", rtl({
  24484. borderTopLeftRadius: 0,
  24485. borderBottomLeftRadius: 0
  24486. })(), " &:not(:disabled):hover{background-color:", COLORS.gray[100], ";}&:focus{border:1px solid ", COLORS.ui.borderFocus, ";box-shadow:inset 0 0 0 ", config_values.borderWidth + ' ' + COLORS.ui.borderFocus, ";outline-offset:0;outline:2px solid transparent;z-index:1;}" + ( true ? "" : 0), true ? "" : 0),
  24487. large: /*#__PURE__*/emotion_react_browser_esm_css("display:flex;justify-content:center;align-items:center;&:hover{color:", COLORS.ui.borderFocus, ";box-shadow:inset 0 0 0 ", config_values.borderWidth + ' ' + COLORS.ui.borderFocus, ";outline:", config_values.borderWidth, " solid transparent;}&:focus{box-shadow:0 0 0 ", config_values.borderWidthFocus + ' ' + COLORS.ui.borderFocus, ";outline:", config_values.borderWidthFocus, " solid transparent;}" + ( true ? "" : 0), true ? "" : 0)
  24488. };
  24489. return selectSize === '__unstable-large' ? sizes.large : sizes.default;
  24490. };
  24491. const UnitSelect = emotion_styled_base_browser_esm("select", true ? {
  24492. target: "e1bagdl30"
  24493. } : 0)("&&{appearance:none;background:transparent;border-radius:2px;border:none;display:block;outline:none;margin:0;min-height:auto;font-family:inherit;", baseUnitLabelStyles, ";", unitSelectSizes, ";&:not( :disabled ){cursor:pointer;}}" + ( true ? "" : 0));
  24494. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-control/styles.js
  24495. 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)."; }
  24496. /**
  24497. * External dependencies
  24498. */
  24499. /**
  24500. * Internal dependencies
  24501. */
  24502. const styles_labelStyles = true ? {
  24503. name: "f3vz0n",
  24504. styles: "font-weight:500"
  24505. } : 0;
  24506. const focusBoxShadow = /*#__PURE__*/emotion_react_browser_esm_css("box-shadow:inset 0 0 0 ", config_values.borderWidth, " ", COLORS.ui.borderFocus, ";" + ( true ? "" : 0), true ? "" : 0);
  24507. const borderControl = /*#__PURE__*/emotion_react_browser_esm_css("border:0;padding:0;margin:0;", boxSizingReset, ";" + ( true ? "" : 0), true ? "" : 0);
  24508. const innerWrapper = () => /*#__PURE__*/emotion_react_browser_esm_css(unit_control_styles_Root, "{flex:1 1 40%;}&& ", UnitSelect, "{min-height:0;}" + ( true ? "" : 0), true ? "" : 0);
  24509. /*
  24510. * This style is only applied to the UnitControl wrapper when the border width
  24511. * field should be a set width. Omitting this allows the UnitControl &
  24512. * RangeControl to share the available width in a 40/60 split respectively.
  24513. */
  24514. const styles_wrapperWidth = /*#__PURE__*/emotion_react_browser_esm_css(unit_control_styles_Root, "{flex:0 0 auto;}" + ( true ? "" : 0), true ? "" : 0);
  24515. /*
  24516. * When default control height is 36px the following should be removed.
  24517. * See: InputControl and __next36pxDefaultSize.
  24518. */
  24519. const wrapperHeight = __next36pxDefaultSize => {
  24520. return /*#__PURE__*/emotion_react_browser_esm_css("height:", __next36pxDefaultSize ? '36px' : '30px', ";" + ( true ? "" : 0), true ? "" : 0);
  24521. };
  24522. const borderControlDropdown = () => /*#__PURE__*/emotion_react_browser_esm_css("background:#fff;&&>button{height:100%;padding:", space(0.75), ";", rtl({
  24523. borderRadius: `2px 0 0 2px`
  24524. }, {
  24525. borderRadius: `0 2px 2px 0`
  24526. })(), " border:", config_values.borderWidth, " solid ", COLORS.ui.border, ";&:focus,&:hover:not( :disabled ){", focusBoxShadow, " border-color:", COLORS.ui.borderFocus, ";z-index:1;position:relative;}}" + ( true ? "" : 0), true ? "" : 0);
  24527. const colorIndicatorBorder = border => {
  24528. const {
  24529. color,
  24530. style
  24531. } = border || {};
  24532. const fallbackColor = !!style && style !== 'none' ? COLORS.gray[300] : undefined;
  24533. return /*#__PURE__*/emotion_react_browser_esm_css("border-style:", style === 'none' ? 'solid' : style, ";border-color:", color || fallbackColor, ";" + ( true ? "" : 0), true ? "" : 0);
  24534. };
  24535. var styles_ref = true ? {
  24536. name: "6g24ce",
  24537. styles: "height:16px;width:16px"
  24538. } : 0;
  24539. const colorIndicatorWrapper = (border, __next36pxDefaultSize) => {
  24540. const {
  24541. style
  24542. } = border || {};
  24543. return /*#__PURE__*/emotion_react_browser_esm_css("border-radius:9999px;border:2px solid transparent;", style ? colorIndicatorBorder(border) : undefined, " width:", __next36pxDefaultSize ? '28px' : '22px', ";height:", __next36pxDefaultSize ? '28px' : '22px', ";padding:", __next36pxDefaultSize ? '2px' : '1px', ";&>span{", !__next36pxDefaultSize ? styles_ref : '', " 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);
  24544. }; // Must equal $color-palette-circle-size from:
  24545. // @wordpress/components/src/circular-option-picker/style.scss
  24546. const swatchSize = 28;
  24547. const swatchGap = 12;
  24548. const borderControlPopoverControls = /*#__PURE__*/emotion_react_browser_esm_css("width:", swatchSize * 6 + swatchGap * 5, "px;>div:first-of-type>", StyledLabel, "{margin-bottom:0;", styles_labelStyles, ";}&& ", StyledLabel, "+button:not( .has-text ){min-width:24px;padding:0;}" + ( true ? "" : 0), true ? "" : 0);
  24549. const borderControlPopoverContent = /*#__PURE__*/emotion_react_browser_esm_css( true ? "" : 0, true ? "" : 0);
  24550. const borderColorIndicator = /*#__PURE__*/emotion_react_browser_esm_css( true ? "" : 0, true ? "" : 0);
  24551. const resetButton = /*#__PURE__*/emotion_react_browser_esm_css("justify-content:center;width:100%;&&{border-top:", config_values.borderWidth, " solid ", COLORS.gray[200], ";border-top-left-radius:0;border-top-right-radius:0;height:46px;}" + ( true ? "" : 0), true ? "" : 0);
  24552. const borderControlStylePicker = /*#__PURE__*/emotion_react_browser_esm_css(StyledLabel, "{", styles_labelStyles, ";}" + ( true ? "" : 0), true ? "" : 0);
  24553. const borderStyleButton = true ? {
  24554. name: "1486260",
  24555. styles: "&&&&&{min-width:30px;width:30px;height:30px;padding:3px;}"
  24556. } : 0;
  24557. const borderSlider = () => /*#__PURE__*/emotion_react_browser_esm_css("flex:1 1 60%;", rtl({
  24558. marginRight: space(3)
  24559. })(), " ", StyledField, "{margin-bottom:0;font-size:0;display:flex;}" + ( true ? "" : 0), true ? "" : 0);
  24560. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-control/border-control-style-picker/hook.js
  24561. /**
  24562. * WordPress dependencies
  24563. */
  24564. /**
  24565. * Internal dependencies
  24566. */
  24567. function useBorderControlStylePicker(props) {
  24568. const {
  24569. className,
  24570. ...otherProps
  24571. } = useContextSystem(props, 'BorderControlStylePicker'); // Generate class names.
  24572. const cx = useCx();
  24573. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  24574. return cx(borderControlStylePicker, className);
  24575. }, [className, cx]);
  24576. const buttonClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
  24577. return cx(borderStyleButton);
  24578. }, [cx]);
  24579. return { ...otherProps,
  24580. className: classes,
  24581. buttonClassName
  24582. };
  24583. }
  24584. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-control/border-control-style-picker/component.js
  24585. /**
  24586. * WordPress dependencies
  24587. */
  24588. /**
  24589. * Internal dependencies
  24590. */
  24591. const BORDER_STYLES = [{
  24592. label: (0,external_wp_i18n_namespaceObject.__)('Solid'),
  24593. icon: line_solid,
  24594. value: 'solid'
  24595. }, {
  24596. label: (0,external_wp_i18n_namespaceObject.__)('Dashed'),
  24597. icon: line_dashed,
  24598. value: 'dashed'
  24599. }, {
  24600. label: (0,external_wp_i18n_namespaceObject.__)('Dotted'),
  24601. icon: line_dotted,
  24602. value: 'dotted'
  24603. }];
  24604. const component_Label = props => {
  24605. const {
  24606. label,
  24607. hideLabelFromVision
  24608. } = props;
  24609. if (!label) {
  24610. return null;
  24611. }
  24612. return hideLabelFromVision ? (0,external_wp_element_namespaceObject.createElement)(visually_hidden_component, {
  24613. as: "label"
  24614. }, label) : (0,external_wp_element_namespaceObject.createElement)(StyledLabel, null, label);
  24615. };
  24616. const BorderControlStylePicker = (props, forwardedRef) => {
  24617. const {
  24618. buttonClassName,
  24619. hideLabelFromVision,
  24620. label,
  24621. onChange,
  24622. value,
  24623. ...otherProps
  24624. } = useBorderControlStylePicker(props);
  24625. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, otherProps, {
  24626. ref: forwardedRef
  24627. }), (0,external_wp_element_namespaceObject.createElement)(component_Label, {
  24628. label: label,
  24629. hideLabelFromVision: hideLabelFromVision
  24630. }), (0,external_wp_element_namespaceObject.createElement)(flex_component, {
  24631. justify: "flex-start",
  24632. gap: 1
  24633. }, BORDER_STYLES.map(borderStyle => (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  24634. key: borderStyle.value,
  24635. className: buttonClassName,
  24636. icon: borderStyle.icon,
  24637. isSmall: true,
  24638. isPressed: borderStyle.value === value,
  24639. onClick: () => onChange(borderStyle.value === value ? undefined : borderStyle.value),
  24640. "aria-label": borderStyle.label,
  24641. label: borderStyle.label,
  24642. showTooltip: true
  24643. }))));
  24644. };
  24645. const ConnectedBorderControlStylePicker = contextConnect(BorderControlStylePicker, 'BorderControlStylePicker');
  24646. /* harmony default export */ var border_control_style_picker_component = (ConnectedBorderControlStylePicker);
  24647. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-indicator/index.js
  24648. /**
  24649. * External dependencies
  24650. */
  24651. /**
  24652. * WordPress dependencies
  24653. */
  24654. /**
  24655. * Internal dependencies
  24656. */
  24657. function UnforwardedColorIndicator(props, forwardedRef) {
  24658. const {
  24659. className,
  24660. colorValue,
  24661. ...additionalProps
  24662. } = props;
  24663. return (0,external_wp_element_namespaceObject.createElement)("span", extends_extends({
  24664. className: classnames_default()('component-color-indicator', className),
  24665. style: {
  24666. background: colorValue
  24667. },
  24668. ref: forwardedRef
  24669. }, additionalProps));
  24670. }
  24671. /**
  24672. * ColorIndicator is a React component that renders a specific color in a
  24673. * circle. It's often used to summarize a collection of used colors in a child
  24674. * component.
  24675. *
  24676. * ```jsx
  24677. * import { ColorIndicator } from '@wordpress/components';
  24678. *
  24679. * const MyColorIndicator = () => <ColorIndicator colorValue="#0073aa" />;
  24680. * ```
  24681. */
  24682. const ColorIndicator = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedColorIndicator);
  24683. /* harmony default export */ var color_indicator = (ColorIndicator);
  24684. ;// CONCATENATED MODULE: ./node_modules/colord/plugins/a11y.mjs
  24685. 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}}
  24686. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/dropdown/index.js
  24687. // @ts-nocheck
  24688. /**
  24689. * External dependencies
  24690. */
  24691. /**
  24692. * WordPress dependencies
  24693. */
  24694. /**
  24695. * Internal dependencies
  24696. */
  24697. function useObservableState(initialState, onStateChange) {
  24698. const [state, setState] = (0,external_wp_element_namespaceObject.useState)(initialState);
  24699. return [state, value => {
  24700. setState(value);
  24701. if (onStateChange) {
  24702. onStateChange(value);
  24703. }
  24704. }];
  24705. }
  24706. function Dropdown(props) {
  24707. const {
  24708. renderContent,
  24709. renderToggle,
  24710. className,
  24711. contentClassName,
  24712. expandOnMobile,
  24713. headerTitle,
  24714. focusOnMount,
  24715. position,
  24716. popoverProps,
  24717. onClose,
  24718. onToggle,
  24719. style
  24720. } = props; // Use internal state instead of a ref to make sure that the component
  24721. // re-renders when the popover's anchor updates.
  24722. const [fallbackPopoverAnchor, setFallbackPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null);
  24723. const containerRef = (0,external_wp_element_namespaceObject.useRef)();
  24724. const [isOpen, setIsOpen] = useObservableState(false, onToggle);
  24725. (0,external_wp_element_namespaceObject.useEffect)(() => () => {
  24726. if (onToggle && isOpen) {
  24727. onToggle(false);
  24728. }
  24729. }, [onToggle, isOpen]);
  24730. function toggle() {
  24731. setIsOpen(!isOpen);
  24732. }
  24733. /**
  24734. * Closes the popover when focus leaves it unless the toggle was pressed or
  24735. * focus has moved to a separate dialog. The former is to let the toggle
  24736. * handle closing the popover and the latter is to preserve presence in
  24737. * case a dialog has opened, allowing focus to return when it's dismissed.
  24738. */
  24739. function closeIfFocusOutside() {
  24740. const {
  24741. ownerDocument
  24742. } = containerRef.current;
  24743. const dialog = ownerDocument.activeElement.closest('[role="dialog"]');
  24744. if (!containerRef.current.contains(ownerDocument.activeElement) && (!dialog || dialog.contains(containerRef.current))) {
  24745. close();
  24746. }
  24747. }
  24748. function close() {
  24749. if (onClose) {
  24750. onClose();
  24751. }
  24752. setIsOpen(false);
  24753. }
  24754. const args = {
  24755. isOpen,
  24756. onToggle: toggle,
  24757. onClose: close
  24758. };
  24759. const popoverPropsHaveAnchor = !!(popoverProps !== null && popoverProps !== void 0 && popoverProps.anchor) || // Note: `anchorRef`, `getAnchorRect` and `anchorRect` are deprecated and
  24760. // be removed from `Popover` from WordPress 6.3
  24761. !!(popoverProps !== null && popoverProps !== void 0 && popoverProps.anchorRef) || !!(popoverProps !== null && popoverProps !== void 0 && popoverProps.getAnchorRect) || !!(popoverProps !== null && popoverProps !== void 0 && popoverProps.anchorRect);
  24762. return (0,external_wp_element_namespaceObject.createElement)("div", {
  24763. className: classnames_default()('components-dropdown', className),
  24764. ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([setFallbackPopoverAnchor, containerRef]) // Some UAs focus the closest focusable parent when the toggle is
  24765. // clicked. Making this div focusable ensures such UAs will focus
  24766. // it and `closeIfFocusOutside` can tell if the toggle was clicked.
  24767. ,
  24768. tabIndex: "-1",
  24769. style: style
  24770. }, renderToggle(args), isOpen && (0,external_wp_element_namespaceObject.createElement)(popover, extends_extends({
  24771. position: position,
  24772. onClose: close,
  24773. onFocusOutside: closeIfFocusOutside,
  24774. expandOnMobile: expandOnMobile,
  24775. headerTitle: headerTitle,
  24776. focusOnMount: focusOnMount // This value is used to ensure that the dropdowns
  24777. // align with the editor header by default.
  24778. ,
  24779. offset: 13,
  24780. anchor: !popoverPropsHaveAnchor ? fallbackPopoverAnchor : undefined
  24781. }, popoverProps, {
  24782. className: classnames_default()('components-dropdown__content', popoverProps ? popoverProps.className : undefined, contentClassName)
  24783. }), renderContent(args)));
  24784. }
  24785. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/input-suffix-wrapper.js
  24786. /**
  24787. * External dependencies
  24788. */
  24789. /**
  24790. * Internal dependencies
  24791. */
  24792. function UnconnectedInputControlSuffixWrapper(props, forwardedRef) {
  24793. const derivedProps = useContextSystem(props, 'InputControlSuffixWrapper');
  24794. return (0,external_wp_element_namespaceObject.createElement)(spacer_component, extends_extends({
  24795. marginBottom: 0
  24796. }, derivedProps, {
  24797. ref: forwardedRef
  24798. }));
  24799. }
  24800. /**
  24801. * A convenience wrapper for the `suffix` when you want to apply
  24802. * standard padding in accordance with the size variant.
  24803. *
  24804. * ```jsx
  24805. * import {
  24806. * __experimentalInputControl as InputControl,
  24807. * __experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,
  24808. * } from '@wordpress/components';
  24809. *
  24810. * <InputControl
  24811. * suffix={<InputControlSuffixWrapper>%</InputControlSuffixWrapper>}
  24812. * />
  24813. * ```
  24814. */
  24815. const InputControlSuffixWrapper = contextConnect(UnconnectedInputControlSuffixWrapper, 'InputControlSuffixWrapper');
  24816. /* harmony default export */ var input_suffix_wrapper = (InputControlSuffixWrapper);
  24817. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/select-control/styles/select-control-styles.js
  24818. /**
  24819. * External dependencies
  24820. */
  24821. /**
  24822. * Internal dependencies
  24823. */
  24824. const select_control_styles_disabledStyles = _ref => {
  24825. let {
  24826. disabled
  24827. } = _ref;
  24828. if (!disabled) return '';
  24829. return /*#__PURE__*/emotion_react_browser_esm_css({
  24830. color: COLORS.ui.textDisabled
  24831. }, true ? "" : 0, true ? "" : 0);
  24832. };
  24833. const select_control_styles_fontSizeStyles = _ref2 => {
  24834. let {
  24835. selectSize = 'default'
  24836. } = _ref2;
  24837. const sizes = {
  24838. default: '13px',
  24839. small: '11px',
  24840. '__unstable-large': '13px'
  24841. };
  24842. const fontSize = sizes[selectSize];
  24843. const fontSizeMobile = '16px';
  24844. if (!fontSize) return '';
  24845. return /*#__PURE__*/emotion_react_browser_esm_css("font-size:", fontSizeMobile, ";@media ( min-width: 600px ){font-size:", fontSize, ";}" + ( true ? "" : 0), true ? "" : 0);
  24846. };
  24847. const select_control_styles_sizeStyles = _ref3 => {
  24848. let {
  24849. __next36pxDefaultSize,
  24850. selectSize = 'default'
  24851. } = _ref3;
  24852. const sizes = {
  24853. default: {
  24854. height: 36,
  24855. minHeight: 36,
  24856. paddingTop: 0,
  24857. paddingBottom: 0
  24858. },
  24859. small: {
  24860. height: 24,
  24861. minHeight: 24,
  24862. paddingTop: 0,
  24863. paddingBottom: 0
  24864. },
  24865. '__unstable-large': {
  24866. height: 40,
  24867. minHeight: 40,
  24868. paddingTop: 0,
  24869. paddingBottom: 0
  24870. }
  24871. };
  24872. if (!__next36pxDefaultSize) {
  24873. sizes.default = {
  24874. height: 30,
  24875. minHeight: 30,
  24876. paddingTop: 0,
  24877. paddingBottom: 0
  24878. };
  24879. }
  24880. const style = sizes[selectSize] || sizes.default;
  24881. return /*#__PURE__*/emotion_react_browser_esm_css(style, true ? "" : 0, true ? "" : 0);
  24882. };
  24883. const chevronIconSize = 18;
  24884. const sizePaddings = _ref4 => {
  24885. let {
  24886. __next36pxDefaultSize,
  24887. selectSize = 'default'
  24888. } = _ref4;
  24889. const iconWidth = chevronIconSize;
  24890. const sizes = {
  24891. default: {
  24892. paddingLeft: 16,
  24893. paddingRight: 16 + iconWidth
  24894. },
  24895. small: {
  24896. paddingLeft: 8,
  24897. paddingRight: 8 + iconWidth
  24898. },
  24899. '__unstable-large': {
  24900. paddingLeft: 16,
  24901. paddingRight: 16 + iconWidth
  24902. }
  24903. };
  24904. if (!__next36pxDefaultSize) {
  24905. sizes.default = {
  24906. paddingLeft: 8,
  24907. paddingRight: 8 + iconWidth
  24908. };
  24909. }
  24910. return rtl(sizes[selectSize] || sizes.default);
  24911. }; // TODO: Resolve need to use &&& to increase specificity
  24912. // https://github.com/WordPress/gutenberg/issues/18483
  24913. const Select = emotion_styled_base_browser_esm("select", true ? {
  24914. target: "e1mv6sxx2"
  24915. } : 0)("&&&{appearance:none;background:transparent;box-sizing:border-box;border:none;box-shadow:none!important;color:", COLORS.gray[900], ";display:block;font-family:inherit;margin:0;width:100%;max-width:none;cursor:pointer;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;", select_control_styles_disabledStyles, ";", select_control_styles_fontSizeStyles, ";", select_control_styles_sizeStyles, ";", sizePaddings, ";}" + ( true ? "" : 0));
  24916. const DownArrowWrapper = emotion_styled_base_browser_esm("div", true ? {
  24917. target: "e1mv6sxx1"
  24918. } : 0)("margin-inline-end:", space(-1), ";line-height:0;" + ( true ? "" : 0));
  24919. const InputControlSuffixWrapperWithClickThrough = /*#__PURE__*/emotion_styled_base_browser_esm(input_suffix_wrapper, true ? {
  24920. target: "e1mv6sxx0"
  24921. } : 0)("position:absolute;pointer-events:none;", rtl({
  24922. right: 0
  24923. }), ";" + ( true ? "" : 0));
  24924. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js
  24925. /**
  24926. * WordPress dependencies
  24927. */
  24928. /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */
  24929. /**
  24930. * Return an SVG icon.
  24931. *
  24932. * @param {IconProps} props icon is the SVG component to render
  24933. * size is a number specifiying the icon size in pixels
  24934. * Other props will be passed to wrapped SVG component
  24935. *
  24936. * @return {JSX.Element} Icon component
  24937. */
  24938. function icon_Icon(_ref) {
  24939. let {
  24940. icon,
  24941. size = 24,
  24942. ...props
  24943. } = _ref;
  24944. return (0,external_wp_element_namespaceObject.cloneElement)(icon, {
  24945. width: size,
  24946. height: size,
  24947. ...props
  24948. });
  24949. }
  24950. /* harmony default export */ var icons_build_module_icon = (icon_Icon);
  24951. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-down.js
  24952. /**
  24953. * WordPress dependencies
  24954. */
  24955. const chevronDown = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  24956. viewBox: "0 0 24 24",
  24957. xmlns: "http://www.w3.org/2000/svg"
  24958. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  24959. d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"
  24960. }));
  24961. /* harmony default export */ var chevron_down = (chevronDown);
  24962. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/select-control/chevron-down.js
  24963. /**
  24964. * WordPress dependencies
  24965. */
  24966. /**
  24967. * Internal dependencies
  24968. */
  24969. const SelectControlChevronDown = () => {
  24970. return (0,external_wp_element_namespaceObject.createElement)(InputControlSuffixWrapperWithClickThrough, null, (0,external_wp_element_namespaceObject.createElement)(DownArrowWrapper, null, (0,external_wp_element_namespaceObject.createElement)(icons_build_module_icon, {
  24971. icon: chevron_down,
  24972. size: chevronIconSize
  24973. })));
  24974. };
  24975. /* harmony default export */ var select_control_chevron_down = (SelectControlChevronDown);
  24976. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/select-control/index.js
  24977. /**
  24978. * External dependencies
  24979. */
  24980. /**
  24981. * WordPress dependencies
  24982. */
  24983. /**
  24984. * Internal dependencies
  24985. */
  24986. const select_control_noop = () => {};
  24987. function select_control_useUniqueId(idProp) {
  24988. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(SelectControl);
  24989. const id = `inspector-select-control-${instanceId}`;
  24990. return idProp || id;
  24991. }
  24992. function UnforwardedSelectControl(_ref, ref) {
  24993. let {
  24994. className,
  24995. disabled = false,
  24996. help,
  24997. hideLabelFromVision,
  24998. id: idProp,
  24999. label,
  25000. multiple = false,
  25001. onBlur = select_control_noop,
  25002. onChange = select_control_noop,
  25003. onFocus = select_control_noop,
  25004. options = [],
  25005. size = 'default',
  25006. value: valueProp,
  25007. labelPosition = 'top',
  25008. children,
  25009. prefix,
  25010. suffix,
  25011. __next36pxDefaultSize = false,
  25012. __nextHasNoMarginBottom = false,
  25013. ...props
  25014. } = _ref;
  25015. const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false);
  25016. const id = select_control_useUniqueId(idProp);
  25017. const helpId = help ? `${id}__help` : undefined; // Disable reason: A select with an onchange throws a warning.
  25018. if (!(options !== null && options !== void 0 && options.length) && !children) return null;
  25019. const handleOnBlur = event => {
  25020. onBlur(event);
  25021. setIsFocused(false);
  25022. };
  25023. const handleOnFocus = event => {
  25024. onFocus(event);
  25025. setIsFocused(true);
  25026. };
  25027. const handleOnChange = event => {
  25028. if (multiple) {
  25029. const selectedOptions = Array.from(event.target.options).filter(_ref2 => {
  25030. let {
  25031. selected
  25032. } = _ref2;
  25033. return selected;
  25034. });
  25035. const newValues = selectedOptions.map(_ref3 => {
  25036. let {
  25037. value
  25038. } = _ref3;
  25039. return value;
  25040. });
  25041. onChange(newValues);
  25042. return;
  25043. }
  25044. onChange(event.target.value, {
  25045. event
  25046. });
  25047. };
  25048. const classes = classnames_default()('components-select-control', className);
  25049. /* eslint-disable jsx-a11y/no-onchange */
  25050. return (0,external_wp_element_namespaceObject.createElement)(base_control, {
  25051. help: help,
  25052. id: id,
  25053. __nextHasNoMarginBottom: __nextHasNoMarginBottom
  25054. }, (0,external_wp_element_namespaceObject.createElement)(input_base, {
  25055. className: classes,
  25056. disabled: disabled,
  25057. hideLabelFromVision: hideLabelFromVision,
  25058. id: id,
  25059. isFocused: isFocused,
  25060. label: label,
  25061. size: size,
  25062. suffix: suffix || (0,external_wp_element_namespaceObject.createElement)(select_control_chevron_down, null),
  25063. prefix: prefix,
  25064. labelPosition: labelPosition,
  25065. __next36pxDefaultSize: __next36pxDefaultSize
  25066. }, (0,external_wp_element_namespaceObject.createElement)(Select, extends_extends({}, props, {
  25067. __next36pxDefaultSize: __next36pxDefaultSize,
  25068. "aria-describedby": helpId,
  25069. className: "components-select-control__input",
  25070. disabled: disabled,
  25071. id: id,
  25072. multiple: multiple,
  25073. onBlur: handleOnBlur,
  25074. onChange: handleOnChange,
  25075. onFocus: handleOnFocus,
  25076. ref: ref,
  25077. selectSize: size,
  25078. value: valueProp
  25079. }), children || options.map((option, index) => {
  25080. const key = option.id || `${option.label}-${option.value}-${index}`;
  25081. return (0,external_wp_element_namespaceObject.createElement)("option", {
  25082. key: key,
  25083. value: option.value,
  25084. disabled: option.disabled
  25085. }, option.label);
  25086. }))));
  25087. /* eslint-enable jsx-a11y/no-onchange */
  25088. }
  25089. /**
  25090. * `SelectControl` allows users to select from a single or multiple option menu.
  25091. * It functions as a wrapper around the browser's native `<select>` element.
  25092. *
  25093. * @example
  25094. * import { SelectControl } from '@wordpress/components';
  25095. * import { useState } from '@wordpress/element';
  25096. *
  25097. * const MySelectControl = () => {
  25098. * const [ size, setSize ] = useState( '50%' );
  25099. *
  25100. * return (
  25101. * <SelectControl
  25102. * label="Size"
  25103. * value={ size }
  25104. * options={ [
  25105. * { label: 'Big', value: '100%' },
  25106. * { label: 'Medium', value: '50%' },
  25107. * { label: 'Small', value: '25%' },
  25108. * ] }
  25109. * onChange={ setSize }
  25110. * />
  25111. * );
  25112. * };
  25113. */
  25114. const SelectControl = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedSelectControl);
  25115. /* harmony default export */ var select_control = (SelectControl);
  25116. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/hooks/use-controlled-state.js
  25117. /**
  25118. * WordPress dependencies
  25119. */
  25120. /**
  25121. * Internal dependencies
  25122. */
  25123. /**
  25124. * @template T
  25125. * @typedef Options
  25126. * @property {T | undefined} initial Initial value
  25127. * @property {T | ""} fallback Fallback value
  25128. */
  25129. /** @type {Readonly<{ initial: undefined, fallback: '' }>} */
  25130. const defaultOptions = {
  25131. initial: undefined,
  25132. /**
  25133. * Defaults to empty string, as that is preferred for usage with
  25134. * <input />, <textarea />, and <select /> form elements.
  25135. */
  25136. fallback: ''
  25137. };
  25138. /**
  25139. * Custom hooks for "controlled" components to track and consolidate internal
  25140. * state and incoming values. This is useful for components that render
  25141. * `input`, `textarea`, or `select` HTML elements.
  25142. *
  25143. * https://reactjs.org/docs/forms.html#controlled-components
  25144. *
  25145. * At first, a component using useControlledState receives an initial prop
  25146. * value, which is used as initial internal state.
  25147. *
  25148. * This internal state can be maintained and updated without
  25149. * relying on new incoming prop values.
  25150. *
  25151. * Unlike the basic useState hook, useControlledState's state can
  25152. * be updated if a new incoming prop value is changed.
  25153. *
  25154. * @template T
  25155. *
  25156. * @param {T | undefined} currentState The current value.
  25157. * @param {Options<T>} [options=defaultOptions] Additional options for the hook.
  25158. *
  25159. * @return {[T | "", (nextState: T) => void]} The controlled value and the value setter.
  25160. */
  25161. function useControlledState(currentState) {
  25162. let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultOptions;
  25163. const {
  25164. initial,
  25165. fallback
  25166. } = { ...defaultOptions,
  25167. ...options
  25168. };
  25169. const [internalState, setInternalState] = (0,external_wp_element_namespaceObject.useState)(currentState);
  25170. const hasCurrentState = isValueDefined(currentState);
  25171. /*
  25172. * Resets internal state if value every changes from uncontrolled <-> controlled.
  25173. */
  25174. (0,external_wp_element_namespaceObject.useEffect)(() => {
  25175. if (hasCurrentState && internalState) {
  25176. setInternalState(undefined);
  25177. }
  25178. }, [hasCurrentState, internalState]);
  25179. const state = getDefinedValue([currentState, internalState, initial], fallback);
  25180. /* eslint-disable jsdoc/no-undefined-types */
  25181. /** @type {(nextState: T) => void} */
  25182. const setState = nextState => {
  25183. if (!hasCurrentState) {
  25184. setInternalState(nextState);
  25185. }
  25186. };
  25187. /* eslint-enable jsdoc/no-undefined-types */
  25188. return [state, setState];
  25189. }
  25190. /* harmony default export */ var use_controlled_state = (useControlledState);
  25191. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/range-control/utils.js
  25192. /**
  25193. * External dependencies
  25194. */
  25195. /**
  25196. * WordPress dependencies
  25197. */
  25198. /**
  25199. * Internal dependencies
  25200. */
  25201. const utils_noop = () => {};
  25202. /**
  25203. * A float supported clamp function for a specific value.
  25204. *
  25205. * @param value The value to clamp.
  25206. * @param min The minimum value.
  25207. * @param max The maximum value.
  25208. *
  25209. * @return A (float) number
  25210. */
  25211. function floatClamp(value, min, max) {
  25212. if (typeof value !== 'number') {
  25213. return null;
  25214. }
  25215. return parseFloat(`${math_clamp(value, min, max)}`);
  25216. }
  25217. /**
  25218. * Hook to store a clamped value, derived from props.
  25219. *
  25220. * @param settings
  25221. * @return The controlled value and the value setter.
  25222. */
  25223. function useControlledRangeValue(settings) {
  25224. const {
  25225. min,
  25226. max,
  25227. value: valueProp,
  25228. initial
  25229. } = settings;
  25230. const [state, setInternalState] = use_controlled_state(floatClamp(valueProp, min, max), {
  25231. initial: floatClamp(initial !== null && initial !== void 0 ? initial : null, min, max),
  25232. fallback: null
  25233. });
  25234. const setState = (0,external_wp_element_namespaceObject.useCallback)(nextValue => {
  25235. if (nextValue === null) {
  25236. setInternalState(null);
  25237. } else {
  25238. setInternalState(floatClamp(nextValue, min, max));
  25239. }
  25240. }, [min, max]); // `state` can't be an empty string because we specified a fallback value of
  25241. // `null` in `useControlledState`
  25242. return [state, setState];
  25243. }
  25244. /**
  25245. * Hook to encapsulate the debouncing "hover" to better handle the showing
  25246. * and hiding of the Tooltip.
  25247. *
  25248. * @param settings
  25249. * @return Bound properties for use on a React.Node.
  25250. */
  25251. function useDebouncedHoverInteraction(settings) {
  25252. const {
  25253. onHide = utils_noop,
  25254. onMouseLeave = utils_noop,
  25255. onMouseMove = utils_noop,
  25256. onShow = utils_noop,
  25257. timeout = 300
  25258. } = settings;
  25259. const [show, setShow] = (0,external_wp_element_namespaceObject.useState)(false);
  25260. const timeoutRef = (0,external_wp_element_namespaceObject.useRef)();
  25261. const setDebouncedTimeout = (0,external_wp_element_namespaceObject.useCallback)(callback => {
  25262. window.clearTimeout(timeoutRef.current);
  25263. timeoutRef.current = window.setTimeout(callback, timeout);
  25264. }, [timeout]);
  25265. const handleOnMouseMove = (0,external_wp_element_namespaceObject.useCallback)(event => {
  25266. onMouseMove(event);
  25267. setDebouncedTimeout(() => {
  25268. if (!show) {
  25269. setShow(true);
  25270. onShow();
  25271. }
  25272. });
  25273. }, []);
  25274. const handleOnMouseLeave = (0,external_wp_element_namespaceObject.useCallback)(event => {
  25275. onMouseLeave(event);
  25276. setDebouncedTimeout(() => {
  25277. setShow(false);
  25278. onHide();
  25279. });
  25280. }, []);
  25281. (0,external_wp_element_namespaceObject.useEffect)(() => {
  25282. return () => {
  25283. window.clearTimeout(timeoutRef.current);
  25284. };
  25285. });
  25286. return {
  25287. onMouseMove: handleOnMouseMove,
  25288. onMouseLeave: handleOnMouseLeave
  25289. };
  25290. }
  25291. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/range-control/styles/range-control-styles.js
  25292. 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)."; }
  25293. /**
  25294. * External dependencies
  25295. */
  25296. /**
  25297. * Internal dependencies
  25298. */
  25299. const rangeHeightValue = 30;
  25300. const railHeight = 4;
  25301. const rangeHeight = () => /*#__PURE__*/emotion_react_browser_esm_css({
  25302. height: rangeHeightValue,
  25303. minHeight: rangeHeightValue
  25304. }, true ? "" : 0, true ? "" : 0);
  25305. const thumbSize = 12;
  25306. const range_control_styles_Root = emotion_styled_base_browser_esm("div", true ? {
  25307. target: "e1epgpqk14"
  25308. } : 0)( true ? {
  25309. name: "1se47kl",
  25310. styles: "-webkit-tap-highlight-color:transparent;align-items:flex-start;display:flex;justify-content:flex-start;padding:0;position:relative;touch-action:none;width:100%"
  25311. } : 0);
  25312. const wrapperColor = _ref4 => {
  25313. let {
  25314. color = COLORS.ui.borderFocus
  25315. } = _ref4;
  25316. return /*#__PURE__*/emotion_react_browser_esm_css({
  25317. color
  25318. }, true ? "" : 0, true ? "" : 0);
  25319. };
  25320. const wrapperMargin = _ref5 => {
  25321. let {
  25322. marks,
  25323. __nextHasNoMarginBottom
  25324. } = _ref5;
  25325. if (!__nextHasNoMarginBottom) {
  25326. return /*#__PURE__*/emotion_react_browser_esm_css({
  25327. marginBottom: marks ? 16 : undefined
  25328. }, true ? "" : 0, true ? "" : 0);
  25329. }
  25330. return '';
  25331. };
  25332. const range_control_styles_Wrapper = emotion_styled_base_browser_esm("div", true ? {
  25333. target: "e1epgpqk13"
  25334. } : 0)("display:block;flex:1;position:relative;width:100%;", wrapperColor, ";", rangeHeight, ";", wrapperMargin, ";" + ( true ? "" : 0));
  25335. const BeforeIconWrapper = emotion_styled_base_browser_esm("span", true ? {
  25336. target: "e1epgpqk12"
  25337. } : 0)("display:flex;margin-top:", railHeight, "px;", rtl({
  25338. marginRight: 6
  25339. }), ";" + ( true ? "" : 0));
  25340. const AfterIconWrapper = emotion_styled_base_browser_esm("span", true ? {
  25341. target: "e1epgpqk11"
  25342. } : 0)("display:flex;margin-top:", railHeight, "px;", rtl({
  25343. marginLeft: 6
  25344. }), ";" + ( true ? "" : 0));
  25345. const railBackgroundColor = _ref6 => {
  25346. let {
  25347. disabled,
  25348. railColor
  25349. } = _ref6;
  25350. let background = railColor || '';
  25351. if (disabled) {
  25352. background = COLORS.ui.backgroundDisabled;
  25353. }
  25354. return /*#__PURE__*/emotion_react_browser_esm_css({
  25355. background
  25356. }, true ? "" : 0, true ? "" : 0);
  25357. };
  25358. const Rail = emotion_styled_base_browser_esm("span", true ? {
  25359. target: "e1epgpqk10"
  25360. } : 0)("background-color:", COLORS.gray[300], ";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));
  25361. const trackBackgroundColor = _ref7 => {
  25362. let {
  25363. disabled,
  25364. trackColor
  25365. } = _ref7;
  25366. let background = trackColor || 'currentColor';
  25367. if (disabled) {
  25368. background = COLORS.gray[400];
  25369. }
  25370. return /*#__PURE__*/emotion_react_browser_esm_css({
  25371. background
  25372. }, true ? "" : 0, true ? "" : 0);
  25373. };
  25374. const Track = emotion_styled_base_browser_esm("span", true ? {
  25375. target: "e1epgpqk9"
  25376. } : 0)("background-color:currentColor;border-radius:", railHeight, "px;height:", railHeight, "px;pointer-events:none;display:block;position:absolute;margin-top:", (rangeHeightValue - railHeight) / 2, "px;top:0;", trackBackgroundColor, ";" + ( true ? "" : 0));
  25377. const MarksWrapper = emotion_styled_base_browser_esm("span", true ? {
  25378. target: "e1epgpqk8"
  25379. } : 0)( true ? {
  25380. name: "l7tjj5",
  25381. styles: "display:block;pointer-events:none;position:relative;width:100%;user-select:none"
  25382. } : 0);
  25383. const markFill = _ref8 => {
  25384. let {
  25385. disabled,
  25386. isFilled
  25387. } = _ref8;
  25388. let backgroundColor = isFilled ? 'currentColor' : COLORS.gray[300];
  25389. if (disabled) {
  25390. backgroundColor = COLORS.gray[400];
  25391. }
  25392. return /*#__PURE__*/emotion_react_browser_esm_css({
  25393. backgroundColor
  25394. }, true ? "" : 0, true ? "" : 0);
  25395. };
  25396. const Mark = emotion_styled_base_browser_esm("span", true ? {
  25397. target: "e1epgpqk7"
  25398. } : 0)("height:", thumbSize, "px;left:0;position:absolute;top:-4px;width:1px;", markFill, ";" + ( true ? "" : 0));
  25399. const markLabelFill = _ref9 => {
  25400. let {
  25401. isFilled
  25402. } = _ref9;
  25403. return /*#__PURE__*/emotion_react_browser_esm_css({
  25404. color: isFilled ? COLORS.gray[700] : COLORS.gray[300]
  25405. }, true ? "" : 0, true ? "" : 0);
  25406. };
  25407. const MarkLabel = emotion_styled_base_browser_esm("span", true ? {
  25408. target: "e1epgpqk6"
  25409. } : 0)("color:", COLORS.gray[300], ";left:0;font-size:11px;position:absolute;top:12px;transform:translateX( -50% );white-space:nowrap;", markLabelFill, ";" + ( true ? "" : 0));
  25410. var _ref3 = true ? {
  25411. name: "1sb75b3",
  25412. styles: "background-color:var( --wp-admin-theme-color )"
  25413. } : 0;
  25414. const thumbColor = _ref10 => {
  25415. let {
  25416. disabled
  25417. } = _ref10;
  25418. return disabled ? /*#__PURE__*/emotion_react_browser_esm_css("background-color:", COLORS.gray[400], ";" + ( true ? "" : 0), true ? "" : 0) : _ref3;
  25419. };
  25420. const ThumbWrapper = emotion_styled_base_browser_esm("span", true ? {
  25421. target: "e1epgpqk5"
  25422. } : 0)("align-items:center;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({
  25423. marginLeft: -10
  25424. }), ";", rtl({
  25425. transform: 'translateX( 4.5px )'
  25426. }, {
  25427. transform: 'translateX( -4.5px )'
  25428. }), ";" + ( true ? "" : 0));
  25429. const thumbFocus = _ref11 => {
  25430. let {
  25431. isFocused
  25432. } = _ref11;
  25433. 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) : '';
  25434. };
  25435. const Thumb = emotion_styled_base_browser_esm("span", true ? {
  25436. target: "e1epgpqk4"
  25437. } : 0)("align-items:center;border-radius:50%;height:100%;outline:0;position:absolute;user-select:none;width:100%;", thumbColor, ";", thumbFocus, ";" + ( true ? "" : 0));
  25438. const InputRange = emotion_styled_base_browser_esm("input", true ? {
  25439. target: "e1epgpqk3"
  25440. } : 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));
  25441. const tooltipShow = _ref12 => {
  25442. let {
  25443. show
  25444. } = _ref12;
  25445. return /*#__PURE__*/emotion_react_browser_esm_css({
  25446. opacity: show ? 1 : 0
  25447. }, true ? "" : 0, true ? "" : 0);
  25448. };
  25449. var range_control_styles_ref = true ? {
  25450. name: "1cypxip",
  25451. styles: "top:-80%"
  25452. } : 0;
  25453. var range_control_styles_ref2 = true ? {
  25454. name: "1lr98c4",
  25455. styles: "bottom:-80%"
  25456. } : 0;
  25457. const tooltipPosition = _ref13 => {
  25458. let {
  25459. position
  25460. } = _ref13;
  25461. const isBottom = position === 'bottom';
  25462. if (isBottom) {
  25463. return range_control_styles_ref2;
  25464. }
  25465. return range_control_styles_ref;
  25466. };
  25467. const range_control_styles_Tooltip = emotion_styled_base_browser_esm("span", true ? {
  25468. target: "e1epgpqk2"
  25469. } : 0)("background:rgba( 0, 0, 0, 0.8 );border-radius:2px;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({
  25470. transform: 'translateX(-50%)'
  25471. }, {
  25472. transform: 'translateX(50%)'
  25473. }), ";" + ( true ? "" : 0)); // @todo: Refactor RangeControl with latest HStack configuration
  25474. // @wordpress/components/ui/hstack.
  25475. const InputNumber = /*#__PURE__*/emotion_styled_base_browser_esm(number_control, true ? {
  25476. target: "e1epgpqk1"
  25477. } : 0)("display:inline-block;font-size:13px;margin-top:0;width:", space(16), "!important;input[type='number']&{", rangeHeight, ";}", rtl({
  25478. marginLeft: `${space(4)} !important`
  25479. }), ";" + ( true ? "" : 0));
  25480. const ActionRightWrapper = emotion_styled_base_browser_esm("span", true ? {
  25481. target: "e1epgpqk0"
  25482. } : 0)("display:block;margin-top:0;button,button.is-small{margin-left:0;", rangeHeight, ";}", rtl({
  25483. marginLeft: 8
  25484. }), ";" + ( true ? "" : 0));
  25485. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/range-control/input-range.js
  25486. /**
  25487. * WordPress dependencies
  25488. */
  25489. /**
  25490. * Internal dependencies
  25491. */
  25492. const input_range_noop = () => {};
  25493. function input_range_InputRange(props, ref) {
  25494. const {
  25495. describedBy,
  25496. label,
  25497. onHideTooltip = input_range_noop,
  25498. onMouseLeave = input_range_noop,
  25499. onMouseMove = input_range_noop,
  25500. onShowTooltip = input_range_noop,
  25501. value,
  25502. ...otherProps
  25503. } = props;
  25504. const hoverInteractions = useDebouncedHoverInteraction({
  25505. onHide: onHideTooltip,
  25506. onMouseLeave,
  25507. onMouseMove,
  25508. onShow: onShowTooltip
  25509. });
  25510. return (0,external_wp_element_namespaceObject.createElement)(InputRange, extends_extends({}, otherProps, hoverInteractions, {
  25511. "aria-describedby": describedBy,
  25512. "aria-label": label,
  25513. "aria-hidden": false,
  25514. ref: ref,
  25515. tabIndex: 0,
  25516. type: "range",
  25517. value: value
  25518. }));
  25519. }
  25520. const input_range_ForwardedComponent = (0,external_wp_element_namespaceObject.forwardRef)(input_range_InputRange);
  25521. /* harmony default export */ var input_range = (input_range_ForwardedComponent);
  25522. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/range-control/mark.js
  25523. /**
  25524. * External dependencies
  25525. */
  25526. /**
  25527. * Internal dependencies
  25528. */
  25529. function RangeMark(props) {
  25530. const {
  25531. className,
  25532. isFilled = false,
  25533. label,
  25534. style = {},
  25535. ...otherProps
  25536. } = props;
  25537. const classes = classnames_default()('components-range-control__mark', isFilled && 'is-filled', className);
  25538. const labelClasses = classnames_default()('components-range-control__mark-label', isFilled && 'is-filled');
  25539. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(Mark, extends_extends({}, otherProps, {
  25540. "aria-hidden": "true",
  25541. className: classes,
  25542. isFilled: isFilled,
  25543. style: style
  25544. })), label && (0,external_wp_element_namespaceObject.createElement)(MarkLabel, {
  25545. "aria-hidden": "true",
  25546. className: labelClasses,
  25547. isFilled: isFilled,
  25548. style: style
  25549. }, label));
  25550. }
  25551. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/range-control/rail.js
  25552. /**
  25553. * WordPress dependencies
  25554. */
  25555. /**
  25556. * Internal dependencies
  25557. */
  25558. function RangeRail(props) {
  25559. const {
  25560. disabled = false,
  25561. marks = false,
  25562. min = 0,
  25563. max = 100,
  25564. step = 1,
  25565. value = 0,
  25566. ...restProps
  25567. } = props;
  25568. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(Rail, extends_extends({
  25569. disabled: disabled
  25570. }, restProps)), marks && (0,external_wp_element_namespaceObject.createElement)(Marks, {
  25571. disabled: disabled,
  25572. marks: marks,
  25573. min: min,
  25574. max: max,
  25575. step: step,
  25576. value: value
  25577. }));
  25578. }
  25579. function Marks(props) {
  25580. const {
  25581. disabled = false,
  25582. marks = false,
  25583. min = 0,
  25584. max = 100,
  25585. step: stepProp = 1,
  25586. value = 0
  25587. } = props;
  25588. const step = stepProp === 'any' ? 1 : stepProp;
  25589. const marksData = useMarks({
  25590. marks,
  25591. min,
  25592. max,
  25593. step,
  25594. value
  25595. });
  25596. return (0,external_wp_element_namespaceObject.createElement)(MarksWrapper, {
  25597. "aria-hidden": "true",
  25598. className: "components-range-control__marks"
  25599. }, marksData.map(mark => (0,external_wp_element_namespaceObject.createElement)(RangeMark, extends_extends({}, mark, {
  25600. key: mark.key,
  25601. "aria-hidden": "true",
  25602. disabled: disabled
  25603. }))));
  25604. }
  25605. function useMarks(_ref) {
  25606. let {
  25607. marks,
  25608. min = 0,
  25609. max = 100,
  25610. step = 1,
  25611. value = 0
  25612. } = _ref;
  25613. if (!marks) {
  25614. return [];
  25615. }
  25616. const range = max - min;
  25617. if (!Array.isArray(marks)) {
  25618. marks = [];
  25619. const count = 1 + Math.round(range / step);
  25620. while (count > marks.push({
  25621. value: step * marks.length + min
  25622. }));
  25623. }
  25624. const placedMarks = [];
  25625. marks.forEach((mark, index) => {
  25626. if (mark.value < min || mark.value > max) {
  25627. return;
  25628. }
  25629. const key = `mark-${index}`;
  25630. const isFilled = mark.value <= value;
  25631. const offset = `${(mark.value - min) / range * 100}%`;
  25632. const offsetStyle = {
  25633. [(0,external_wp_i18n_namespaceObject.isRTL)() ? 'right' : 'left']: offset
  25634. };
  25635. placedMarks.push({ ...mark,
  25636. isFilled,
  25637. key,
  25638. style: offsetStyle
  25639. });
  25640. });
  25641. return placedMarks;
  25642. }
  25643. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/range-control/tooltip.js
  25644. /**
  25645. * External dependencies
  25646. */
  25647. /**
  25648. * WordPress dependencies
  25649. */
  25650. /**
  25651. * Internal dependencies
  25652. */
  25653. function SimpleTooltip(props) {
  25654. const {
  25655. className,
  25656. inputRef,
  25657. tooltipPosition,
  25658. show = false,
  25659. style = {},
  25660. value = 0,
  25661. renderTooltipContent = v => v,
  25662. zIndex = 100,
  25663. ...restProps
  25664. } = props;
  25665. const position = useTooltipPosition({
  25666. inputRef,
  25667. tooltipPosition
  25668. });
  25669. const classes = classnames_default()('components-simple-tooltip', className);
  25670. const styles = { ...style,
  25671. zIndex
  25672. };
  25673. return (0,external_wp_element_namespaceObject.createElement)(range_control_styles_Tooltip, extends_extends({}, restProps, {
  25674. "aria-hidden": show,
  25675. className: classes,
  25676. position: position,
  25677. show: show,
  25678. role: "tooltip",
  25679. style: styles
  25680. }), renderTooltipContent(value));
  25681. }
  25682. function useTooltipPosition(_ref) {
  25683. let {
  25684. inputRef,
  25685. tooltipPosition
  25686. } = _ref;
  25687. const [position, setPosition] = (0,external_wp_element_namespaceObject.useState)();
  25688. const setTooltipPosition = (0,external_wp_element_namespaceObject.useCallback)(() => {
  25689. if (inputRef && inputRef.current) {
  25690. setPosition(tooltipPosition);
  25691. }
  25692. }, [tooltipPosition]);
  25693. (0,external_wp_element_namespaceObject.useEffect)(() => {
  25694. setTooltipPosition();
  25695. }, [setTooltipPosition]);
  25696. (0,external_wp_element_namespaceObject.useEffect)(() => {
  25697. window.addEventListener('resize', setTooltipPosition);
  25698. return () => {
  25699. window.removeEventListener('resize', setTooltipPosition);
  25700. };
  25701. });
  25702. return position;
  25703. }
  25704. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/range-control/index.js
  25705. /**
  25706. * External dependencies
  25707. */
  25708. /**
  25709. * WordPress dependencies
  25710. */
  25711. /**
  25712. * Internal dependencies
  25713. */
  25714. const range_control_noop = () => {};
  25715. function UnforwardedRangeControl(props, forwardedRef) {
  25716. var _inputRef$current;
  25717. const {
  25718. __nextHasNoMarginBottom = false,
  25719. afterIcon,
  25720. allowReset = false,
  25721. beforeIcon,
  25722. className,
  25723. color: colorProp = COLORS.ui.theme,
  25724. currentInput,
  25725. disabled = false,
  25726. help,
  25727. hideLabelFromVision = false,
  25728. initialPosition,
  25729. isShiftStepEnabled = true,
  25730. label,
  25731. marks = false,
  25732. max = 100,
  25733. min = 0,
  25734. onBlur = range_control_noop,
  25735. onChange = range_control_noop,
  25736. onFocus = range_control_noop,
  25737. onMouseLeave = range_control_noop,
  25738. onMouseMove = range_control_noop,
  25739. railColor,
  25740. renderTooltipContent = v => v,
  25741. resetFallbackValue,
  25742. shiftStep = 10,
  25743. showTooltip: showTooltipProp,
  25744. step = 1,
  25745. trackColor,
  25746. value: valueProp,
  25747. withInputField = true,
  25748. ...otherProps
  25749. } = props;
  25750. const [value, setValue] = useControlledRangeValue({
  25751. min,
  25752. max,
  25753. value: valueProp !== null && valueProp !== void 0 ? valueProp : null,
  25754. initial: initialPosition
  25755. });
  25756. const isResetPendent = (0,external_wp_element_namespaceObject.useRef)(false);
  25757. let hasTooltip = showTooltipProp;
  25758. let hasInputField = withInputField;
  25759. if (step === 'any') {
  25760. // The tooltip and number input field are hidden when the step is "any"
  25761. // because the decimals get too lengthy to fit well.
  25762. hasTooltip = false;
  25763. hasInputField = false;
  25764. }
  25765. const [showTooltip, setShowTooltip] = (0,external_wp_element_namespaceObject.useState)(hasTooltip);
  25766. const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false);
  25767. const inputRef = (0,external_wp_element_namespaceObject.useRef)();
  25768. const isCurrentlyFocused = (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.matches(':focus');
  25769. const isThumbFocused = !disabled && isFocused;
  25770. const isValueReset = value === null;
  25771. const currentValue = value !== undefined ? value : currentInput;
  25772. const inputSliderValue = isValueReset ? '' : currentValue;
  25773. const rangeFillValue = isValueReset ? (max - min) / 2 + min : value;
  25774. const fillValue = isValueReset ? 50 : (value - min) / (max - min) * 100;
  25775. const fillValueOffset = `${math_clamp(fillValue, 0, 100)}%`;
  25776. const classes = classnames_default()('components-range-control', className);
  25777. const wrapperClasses = classnames_default()('components-range-control__wrapper', !!marks && 'is-marked');
  25778. const id = (0,external_wp_compose_namespaceObject.useInstanceId)(UnforwardedRangeControl, 'inspector-range-control');
  25779. const describedBy = !!help ? `${id}__help` : undefined;
  25780. const enableTooltip = hasTooltip !== false && Number.isFinite(value);
  25781. const handleOnRangeChange = event => {
  25782. const nextValue = parseFloat(event.target.value);
  25783. setValue(nextValue);
  25784. onChange(nextValue);
  25785. };
  25786. const handleOnChange = next => {
  25787. // @ts-expect-error TODO: Investigate if it's problematic for setValue() to
  25788. // potentially receive a NaN when next is undefined.
  25789. let nextValue = parseFloat(next);
  25790. setValue(nextValue);
  25791. /*
  25792. * Calls onChange only when nextValue is numeric
  25793. * otherwise may queue a reset for the blur event.
  25794. */
  25795. if (!isNaN(nextValue)) {
  25796. if (nextValue < min || nextValue > max) {
  25797. nextValue = floatClamp(nextValue, min, max);
  25798. }
  25799. onChange(nextValue);
  25800. isResetPendent.current = false;
  25801. } else if (allowReset) {
  25802. isResetPendent.current = true;
  25803. }
  25804. };
  25805. const handleOnInputNumberBlur = () => {
  25806. if (isResetPendent.current) {
  25807. handleOnReset();
  25808. isResetPendent.current = false;
  25809. }
  25810. };
  25811. const handleOnReset = () => {
  25812. let resetValue = parseFloat(`${resetFallbackValue}`);
  25813. let onChangeResetValue = resetValue;
  25814. if (isNaN(resetValue)) {
  25815. resetValue = null;
  25816. onChangeResetValue = undefined;
  25817. }
  25818. setValue(resetValue);
  25819. /**
  25820. * Previously, this callback would always receive undefined as
  25821. * an argument. This behavior is unexpected, specifically
  25822. * when resetFallbackValue is defined.
  25823. *
  25824. * The value of undefined is not ideal. Passing it through
  25825. * to internal <input /> elements would change it from a
  25826. * controlled component to an uncontrolled component.
  25827. *
  25828. * For now, to minimize unexpected regressions, we're going to
  25829. * preserve the undefined callback argument, except when a
  25830. * resetFallbackValue is defined.
  25831. */
  25832. onChange(onChangeResetValue);
  25833. };
  25834. const handleShowTooltip = () => setShowTooltip(true);
  25835. const handleHideTooltip = () => setShowTooltip(false);
  25836. const handleOnBlur = event => {
  25837. onBlur(event);
  25838. setIsFocused(false);
  25839. handleHideTooltip();
  25840. };
  25841. const handleOnFocus = event => {
  25842. onFocus(event);
  25843. setIsFocused(true);
  25844. handleShowTooltip();
  25845. };
  25846. const offsetStyle = {
  25847. [(0,external_wp_i18n_namespaceObject.isRTL)() ? 'right' : 'left']: fillValueOffset
  25848. };
  25849. return (0,external_wp_element_namespaceObject.createElement)(base_control, {
  25850. __nextHasNoMarginBottom: __nextHasNoMarginBottom,
  25851. className: classes,
  25852. label: label,
  25853. hideLabelFromVision: hideLabelFromVision,
  25854. id: `${id}`,
  25855. help: help
  25856. }, (0,external_wp_element_namespaceObject.createElement)(range_control_styles_Root, {
  25857. className: "components-range-control__root"
  25858. }, beforeIcon && (0,external_wp_element_namespaceObject.createElement)(BeforeIconWrapper, null, (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
  25859. icon: beforeIcon
  25860. })), (0,external_wp_element_namespaceObject.createElement)(range_control_styles_Wrapper, {
  25861. __nextHasNoMarginBottom: __nextHasNoMarginBottom,
  25862. className: wrapperClasses,
  25863. color: colorProp,
  25864. marks: !!marks
  25865. }, (0,external_wp_element_namespaceObject.createElement)(input_range, extends_extends({}, otherProps, {
  25866. className: "components-range-control__slider",
  25867. describedBy: describedBy,
  25868. disabled: disabled,
  25869. id: `${id}`,
  25870. label: label,
  25871. max: max,
  25872. min: min,
  25873. onBlur: handleOnBlur,
  25874. onChange: handleOnRangeChange,
  25875. onFocus: handleOnFocus,
  25876. onMouseMove: onMouseMove,
  25877. onMouseLeave: onMouseLeave,
  25878. ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([inputRef, forwardedRef]),
  25879. step: step,
  25880. value: inputSliderValue !== null && inputSliderValue !== void 0 ? inputSliderValue : undefined
  25881. })), (0,external_wp_element_namespaceObject.createElement)(RangeRail, {
  25882. "aria-hidden": true,
  25883. disabled: disabled,
  25884. marks: marks,
  25885. max: max,
  25886. min: min,
  25887. railColor: railColor,
  25888. step: step,
  25889. value: rangeFillValue
  25890. }), (0,external_wp_element_namespaceObject.createElement)(Track, {
  25891. "aria-hidden": true,
  25892. className: "components-range-control__track",
  25893. disabled: disabled,
  25894. style: {
  25895. width: fillValueOffset
  25896. },
  25897. trackColor: trackColor
  25898. }), (0,external_wp_element_namespaceObject.createElement)(ThumbWrapper, {
  25899. style: offsetStyle,
  25900. disabled: disabled
  25901. }, (0,external_wp_element_namespaceObject.createElement)(Thumb, {
  25902. "aria-hidden": true,
  25903. isFocused: isThumbFocused,
  25904. disabled: disabled
  25905. })), enableTooltip && (0,external_wp_element_namespaceObject.createElement)(SimpleTooltip, {
  25906. className: "components-range-control__tooltip",
  25907. inputRef: inputRef,
  25908. tooltipPosition: "bottom",
  25909. renderTooltipContent: renderTooltipContent,
  25910. show: isCurrentlyFocused || showTooltip,
  25911. style: offsetStyle,
  25912. value: value
  25913. })), afterIcon && (0,external_wp_element_namespaceObject.createElement)(AfterIconWrapper, null, (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
  25914. icon: afterIcon
  25915. })), hasInputField && (0,external_wp_element_namespaceObject.createElement)(InputNumber, {
  25916. "aria-label": label,
  25917. className: "components-range-control__number",
  25918. disabled: disabled,
  25919. inputMode: "decimal",
  25920. isShiftStepEnabled: isShiftStepEnabled,
  25921. max: max,
  25922. min: min,
  25923. onBlur: handleOnInputNumberBlur,
  25924. onChange: handleOnChange,
  25925. shiftStep: shiftStep,
  25926. step: step // @ts-expect-error TODO: Investigate if the `null` value is necessary
  25927. ,
  25928. value: inputSliderValue
  25929. }), allowReset && (0,external_wp_element_namespaceObject.createElement)(ActionRightWrapper, null, (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  25930. className: "components-range-control__reset",
  25931. disabled: disabled || value === undefined,
  25932. variant: "secondary",
  25933. isSmall: true,
  25934. onClick: handleOnReset
  25935. }, (0,external_wp_i18n_namespaceObject.__)('Reset')))));
  25936. }
  25937. /**
  25938. * RangeControls are used to make selections from a range of incremental values.
  25939. *
  25940. * ```jsx
  25941. * import { RangeControl } from '@wordpress/components';
  25942. * import { useState } from '@wordpress/element';
  25943. *
  25944. * const MyRangeControl = () => {
  25945. * const [ isChecked, setChecked ] = useState( true );
  25946. * return (
  25947. * <RangeControl
  25948. * help="Please select how transparent you would like this."
  25949. * initialPosition={50}
  25950. * label="Opacity"
  25951. * max={100}
  25952. * min={0}
  25953. * onChange={() => {}}
  25954. * />
  25955. * );
  25956. * };
  25957. * ```
  25958. */
  25959. const RangeControl = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedRangeControl);
  25960. /* harmony default export */ var range_control = (RangeControl);
  25961. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/h-stack/utils.js
  25962. /**
  25963. * External dependencies
  25964. */
  25965. /**
  25966. * Internal dependencies
  25967. */
  25968. const H_ALIGNMENTS = {
  25969. bottom: {
  25970. align: 'flex-end',
  25971. justify: 'center'
  25972. },
  25973. bottomLeft: {
  25974. align: 'flex-start',
  25975. justify: 'flex-end'
  25976. },
  25977. bottomRight: {
  25978. align: 'flex-end',
  25979. justify: 'flex-end'
  25980. },
  25981. center: {
  25982. align: 'center',
  25983. justify: 'center'
  25984. },
  25985. edge: {
  25986. align: 'center',
  25987. justify: 'space-between'
  25988. },
  25989. left: {
  25990. align: 'center',
  25991. justify: 'flex-start'
  25992. },
  25993. right: {
  25994. align: 'center',
  25995. justify: 'flex-end'
  25996. },
  25997. stretch: {
  25998. align: 'stretch'
  25999. },
  26000. top: {
  26001. align: 'flex-start',
  26002. justify: 'center'
  26003. },
  26004. topLeft: {
  26005. align: 'flex-start',
  26006. justify: 'flex-start'
  26007. },
  26008. topRight: {
  26009. align: 'flex-start',
  26010. justify: 'flex-end'
  26011. }
  26012. };
  26013. const V_ALIGNMENTS = {
  26014. bottom: {
  26015. justify: 'flex-end',
  26016. align: 'center'
  26017. },
  26018. bottomLeft: {
  26019. justify: 'flex-start',
  26020. align: 'flex-end'
  26021. },
  26022. bottomRight: {
  26023. justify: 'flex-end',
  26024. align: 'flex-end'
  26025. },
  26026. center: {
  26027. justify: 'center',
  26028. align: 'center'
  26029. },
  26030. edge: {
  26031. justify: 'space-between',
  26032. align: 'center'
  26033. },
  26034. left: {
  26035. justify: 'center',
  26036. align: 'flex-start'
  26037. },
  26038. right: {
  26039. justify: 'center',
  26040. align: 'flex-end'
  26041. },
  26042. stretch: {
  26043. justify: 'stretch'
  26044. },
  26045. top: {
  26046. justify: 'flex-start',
  26047. align: 'center'
  26048. },
  26049. topLeft: {
  26050. justify: 'flex-start',
  26051. align: 'flex-start'
  26052. },
  26053. topRight: {
  26054. justify: 'flex-start',
  26055. align: 'flex-end'
  26056. }
  26057. };
  26058. function getAlignmentProps(alignment) {
  26059. let direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'row';
  26060. if (!isValueDefined(alignment)) {
  26061. return {};
  26062. }
  26063. const isVertical = direction === 'column';
  26064. const props = isVertical ? V_ALIGNMENTS : H_ALIGNMENTS;
  26065. const alignmentProps = alignment in props ? props[alignment] : {
  26066. align: alignment
  26067. };
  26068. return alignmentProps;
  26069. }
  26070. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/utils/get-valid-children.js
  26071. /**
  26072. * External dependencies
  26073. */
  26074. /**
  26075. * WordPress dependencies
  26076. */
  26077. /**
  26078. * Gets a collection of available children elements from a React component's children prop.
  26079. *
  26080. * @param children
  26081. *
  26082. * @return An array of available children.
  26083. */
  26084. function getValidChildren(children) {
  26085. if (typeof children === 'string') return [children];
  26086. return external_wp_element_namespaceObject.Children.toArray(children).filter(child => (0,external_wp_element_namespaceObject.isValidElement)(child));
  26087. }
  26088. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/h-stack/hook.js
  26089. /**
  26090. * External dependencies
  26091. */
  26092. /**
  26093. * Internal dependencies
  26094. */
  26095. function useHStack(props) {
  26096. const {
  26097. alignment = 'edge',
  26098. children,
  26099. direction,
  26100. spacing = 2,
  26101. ...otherProps
  26102. } = useContextSystem(props, 'HStack');
  26103. const align = getAlignmentProps(alignment, direction);
  26104. const validChildren = getValidChildren(children);
  26105. const clonedChildren = validChildren.map((child, index) => {
  26106. const _isSpacer = hasConnectNamespace(child, ['Spacer']);
  26107. if (_isSpacer) {
  26108. const childElement = child;
  26109. const _key = childElement.key || `hstack-${index}`;
  26110. return (0,external_wp_element_namespaceObject.createElement)(flex_item_component, extends_extends({
  26111. isBlock: true,
  26112. key: _key
  26113. }, childElement.props));
  26114. }
  26115. return child;
  26116. });
  26117. const propsForFlex = {
  26118. children: clonedChildren,
  26119. direction,
  26120. justify: 'center',
  26121. ...align,
  26122. ...otherProps,
  26123. gap: spacing
  26124. };
  26125. const flexProps = useFlex(propsForFlex);
  26126. return flexProps;
  26127. }
  26128. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/h-stack/component.js
  26129. /**
  26130. * Internal dependencies
  26131. */
  26132. function UnconnectedHStack(props, forwardedRef) {
  26133. const hStackProps = useHStack(props);
  26134. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, hStackProps, {
  26135. ref: forwardedRef
  26136. }));
  26137. }
  26138. /**
  26139. * `HStack` (Horizontal Stack) arranges child elements in a horizontal line.
  26140. *
  26141. * `HStack` can render anything inside.
  26142. *
  26143. * @example
  26144. * ```jsx
  26145. * import {
  26146. * __experimentalHStack as HStack,
  26147. * __experimentalText as Text,
  26148. * } from `@wordpress/components`;
  26149. *
  26150. * function Example() {
  26151. * return (
  26152. * <HStack>
  26153. * <Text>Code</Text>
  26154. * <Text>is</Text>
  26155. * <Text>Poetry</Text>
  26156. * </HStack>
  26157. * );
  26158. * }
  26159. * ```
  26160. */
  26161. const HStack = contextConnect(UnconnectedHStack, 'HStack');
  26162. /* harmony default export */ var h_stack_component = (HStack);
  26163. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/styles.js
  26164. /**
  26165. * External dependencies
  26166. */
  26167. /**
  26168. * Internal dependencies
  26169. */
  26170. const NumberControlWrapper = /*#__PURE__*/emotion_styled_base_browser_esm(number_control, true ? {
  26171. target: "ez9hsf47"
  26172. } : 0)(Container, "{width:", space(24), ";}" + ( true ? "" : 0));
  26173. const styles_SelectControl = /*#__PURE__*/emotion_styled_base_browser_esm(select_control, true ? {
  26174. target: "ez9hsf46"
  26175. } : 0)("margin-left:", space(-2), ";width:5em;", BackdropUI, "{display:none;}" + ( true ? "" : 0));
  26176. const styles_RangeControl = /*#__PURE__*/emotion_styled_base_browser_esm(range_control, true ? {
  26177. target: "ez9hsf45"
  26178. } : 0)("flex:1;margin-right:", space(2), ";", StyledField, "{margin-bottom:0;}" + ( true ? "" : 0)); // Make the Hue circle picker not go out of the bar.
  26179. const interactiveHueStyles = `
  26180. .react-colorful__interactive {
  26181. width: calc( 100% - ${space(2)} );
  26182. margin-left: ${space(1)};
  26183. }`;
  26184. const AuxiliaryColorArtefactWrapper = emotion_styled_base_browser_esm("div", true ? {
  26185. target: "ez9hsf44"
  26186. } : 0)("padding-top:", space(2), ";padding-right:0;padding-left:0;padding-bottom:0;" + ( true ? "" : 0));
  26187. const AuxiliaryColorArtefactHStackHeader = /*#__PURE__*/emotion_styled_base_browser_esm(h_stack_component, true ? {
  26188. target: "ez9hsf43"
  26189. } : 0)("padding-left:", space(4), ";padding-right:", space(4), ";" + ( true ? "" : 0));
  26190. const ColorInputWrapper = /*#__PURE__*/emotion_styled_base_browser_esm(flex_component, true ? {
  26191. target: "ez9hsf42"
  26192. } : 0)("padding-top:", space(4), ";padding-left:", space(4), ";padding-right:", space(3), ";padding-bottom:", space(5), ";" + ( true ? "" : 0));
  26193. const ColorfulWrapper = emotion_styled_base_browser_esm("div", true ? {
  26194. target: "ez9hsf41"
  26195. } : 0)(boxSizingReset, ";width:216px;.react-colorful{display:flex;flex-direction:column;align-items:center;width:216px;height:auto;overflow:hidden;}.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;}" + ( true ? "" : 0));
  26196. const CopyButton = /*#__PURE__*/emotion_styled_base_browser_esm(build_module_button, true ? {
  26197. target: "ez9hsf40"
  26198. } : 0)("&&&&&{min-width:", space(6), ";padding:0;>svg{margin-right:0;}}" + ( true ? "" : 0));
  26199. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/copy.js
  26200. /**
  26201. * WordPress dependencies
  26202. */
  26203. const copy_copy = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  26204. xmlns: "http://www.w3.org/2000/svg",
  26205. viewBox: "0 0 24 24"
  26206. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  26207. d: "M20.2 8v11c0 .7-.6 1.2-1.2 1.2H6v1.5h13c1.5 0 2.7-1.2 2.7-2.8V8zM18 16.4V4.6c0-.9-.7-1.6-1.6-1.6H4.6C3.7 3 3 3.7 3 4.6v11.8c0 .9.7 1.6 1.6 1.6h11.8c.9 0 1.6-.7 1.6-1.6zm-13.5 0V4.6c0-.1.1-.1.1-.1h11.8c.1 0 .1.1.1.1v11.8c0 .1-.1.1-.1.1H4.6l-.1-.1z"
  26208. }));
  26209. /* harmony default export */ var library_copy = (copy_copy);
  26210. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getWindow.js
  26211. function getWindow_getWindow(node) {
  26212. if (node == null) {
  26213. return window;
  26214. }
  26215. if (node.toString() !== '[object Window]') {
  26216. var ownerDocument = node.ownerDocument;
  26217. return ownerDocument ? ownerDocument.defaultView || window : window;
  26218. }
  26219. return node;
  26220. }
  26221. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/instanceOf.js
  26222. function isElement(node) {
  26223. var OwnElement = getWindow_getWindow(node).Element;
  26224. return node instanceof OwnElement || node instanceof Element;
  26225. }
  26226. function isHTMLElement(node) {
  26227. var OwnElement = getWindow_getWindow(node).HTMLElement;
  26228. return node instanceof OwnElement || node instanceof HTMLElement;
  26229. }
  26230. function isShadowRoot(node) {
  26231. // IE 11 has no ShadowRoot
  26232. if (typeof ShadowRoot === 'undefined') {
  26233. return false;
  26234. }
  26235. var OwnElement = getWindow_getWindow(node).ShadowRoot;
  26236. return node instanceof OwnElement || node instanceof ShadowRoot;
  26237. }
  26238. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/math.js
  26239. var math_max = Math.max;
  26240. var math_min = Math.min;
  26241. var round = Math.round;
  26242. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/userAgent.js
  26243. function getUAString() {
  26244. var uaData = navigator.userAgentData;
  26245. if (uaData != null && uaData.brands) {
  26246. return uaData.brands.map(function (item) {
  26247. return item.brand + "/" + item.version;
  26248. }).join(' ');
  26249. }
  26250. return navigator.userAgent;
  26251. }
  26252. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js
  26253. function isLayoutViewport() {
  26254. return !/^((?!chrome|android).)*safari/i.test(getUAString());
  26255. }
  26256. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js
  26257. function getBoundingClientRect(element, includeScale, isFixedStrategy) {
  26258. if (includeScale === void 0) {
  26259. includeScale = false;
  26260. }
  26261. if (isFixedStrategy === void 0) {
  26262. isFixedStrategy = false;
  26263. }
  26264. var clientRect = element.getBoundingClientRect();
  26265. var scaleX = 1;
  26266. var scaleY = 1;
  26267. if (includeScale && isHTMLElement(element)) {
  26268. scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
  26269. scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
  26270. }
  26271. var _ref = isElement(element) ? getWindow_getWindow(element) : window,
  26272. visualViewport = _ref.visualViewport;
  26273. var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
  26274. var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
  26275. var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
  26276. var width = clientRect.width / scaleX;
  26277. var height = clientRect.height / scaleY;
  26278. return {
  26279. width: width,
  26280. height: height,
  26281. top: y,
  26282. right: x + width,
  26283. bottom: y + height,
  26284. left: x,
  26285. x: x,
  26286. y: y
  26287. };
  26288. }
  26289. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js
  26290. function getWindowScroll(node) {
  26291. var win = getWindow_getWindow(node);
  26292. var scrollLeft = win.pageXOffset;
  26293. var scrollTop = win.pageYOffset;
  26294. return {
  26295. scrollLeft: scrollLeft,
  26296. scrollTop: scrollTop
  26297. };
  26298. }
  26299. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js
  26300. function getHTMLElementScroll(element) {
  26301. return {
  26302. scrollLeft: element.scrollLeft,
  26303. scrollTop: element.scrollTop
  26304. };
  26305. }
  26306. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js
  26307. function getNodeScroll(node) {
  26308. if (node === getWindow_getWindow(node) || !isHTMLElement(node)) {
  26309. return getWindowScroll(node);
  26310. } else {
  26311. return getHTMLElementScroll(node);
  26312. }
  26313. }
  26314. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getNodeName.js
  26315. function getNodeName(element) {
  26316. return element ? (element.nodeName || '').toLowerCase() : null;
  26317. }
  26318. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js
  26319. function getDocumentElement(element) {
  26320. // $FlowFixMe[incompatible-return]: assume body is always available
  26321. return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
  26322. element.document) || window.document).documentElement;
  26323. }
  26324. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js
  26325. function getWindowScrollBarX(element) {
  26326. // If <html> has a CSS width greater than the viewport, then this will be
  26327. // incorrect for RTL.
  26328. // Popper 1 is broken in this case and never had a bug report so let's assume
  26329. // it's not an issue. I don't think anyone ever specifies width on <html>
  26330. // anyway.
  26331. // Browsers where the left scrollbar doesn't cause an issue report `0` for
  26332. // this (e.g. Edge 2019, IE11, Safari)
  26333. return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
  26334. }
  26335. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js
  26336. function getComputedStyle_getComputedStyle(element) {
  26337. return getWindow_getWindow(element).getComputedStyle(element);
  26338. }
  26339. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js
  26340. function isScrollParent(element) {
  26341. // Firefox wants us to check `-x` and `-y` variations as well
  26342. var _getComputedStyle = getComputedStyle_getComputedStyle(element),
  26343. overflow = _getComputedStyle.overflow,
  26344. overflowX = _getComputedStyle.overflowX,
  26345. overflowY = _getComputedStyle.overflowY;
  26346. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  26347. }
  26348. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js
  26349. function isElementScaled(element) {
  26350. var rect = element.getBoundingClientRect();
  26351. var scaleX = round(rect.width) / element.offsetWidth || 1;
  26352. var scaleY = round(rect.height) / element.offsetHeight || 1;
  26353. return scaleX !== 1 || scaleY !== 1;
  26354. } // Returns the composite rect of an element relative to its offsetParent.
  26355. // Composite means it takes into account transforms as well as layout.
  26356. function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
  26357. if (isFixed === void 0) {
  26358. isFixed = false;
  26359. }
  26360. var isOffsetParentAnElement = isHTMLElement(offsetParent);
  26361. var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
  26362. var documentElement = getDocumentElement(offsetParent);
  26363. var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
  26364. var scroll = {
  26365. scrollLeft: 0,
  26366. scrollTop: 0
  26367. };
  26368. var offsets = {
  26369. x: 0,
  26370. y: 0
  26371. };
  26372. if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
  26373. if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
  26374. isScrollParent(documentElement)) {
  26375. scroll = getNodeScroll(offsetParent);
  26376. }
  26377. if (isHTMLElement(offsetParent)) {
  26378. offsets = getBoundingClientRect(offsetParent, true);
  26379. offsets.x += offsetParent.clientLeft;
  26380. offsets.y += offsetParent.clientTop;
  26381. } else if (documentElement) {
  26382. offsets.x = getWindowScrollBarX(documentElement);
  26383. }
  26384. }
  26385. return {
  26386. x: rect.left + scroll.scrollLeft - offsets.x,
  26387. y: rect.top + scroll.scrollTop - offsets.y,
  26388. width: rect.width,
  26389. height: rect.height
  26390. };
  26391. }
  26392. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js
  26393. // Returns the layout rect of an element relative to its offsetParent. Layout
  26394. // means it doesn't take into account transforms.
  26395. function getLayoutRect(element) {
  26396. var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
  26397. // Fixes https://github.com/popperjs/popper-core/issues/1223
  26398. var width = element.offsetWidth;
  26399. var height = element.offsetHeight;
  26400. if (Math.abs(clientRect.width - width) <= 1) {
  26401. width = clientRect.width;
  26402. }
  26403. if (Math.abs(clientRect.height - height) <= 1) {
  26404. height = clientRect.height;
  26405. }
  26406. return {
  26407. x: element.offsetLeft,
  26408. y: element.offsetTop,
  26409. width: width,
  26410. height: height
  26411. };
  26412. }
  26413. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getParentNode.js
  26414. function getParentNode(element) {
  26415. if (getNodeName(element) === 'html') {
  26416. return element;
  26417. }
  26418. return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
  26419. // $FlowFixMe[incompatible-return]
  26420. // $FlowFixMe[prop-missing]
  26421. element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
  26422. element.parentNode || ( // DOM Element detected
  26423. isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
  26424. // $FlowFixMe[incompatible-call]: HTMLElement is a Node
  26425. getDocumentElement(element) // fallback
  26426. );
  26427. }
  26428. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js
  26429. function getScrollParent(node) {
  26430. if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
  26431. // $FlowFixMe[incompatible-return]: assume body is always available
  26432. return node.ownerDocument.body;
  26433. }
  26434. if (isHTMLElement(node) && isScrollParent(node)) {
  26435. return node;
  26436. }
  26437. return getScrollParent(getParentNode(node));
  26438. }
  26439. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js
  26440. /*
  26441. given a DOM element, return the list of all scroll parents, up the list of ancesors
  26442. until we get to the top window object. This list is what we attach scroll listeners
  26443. to, because if any of these parent elements scroll, we'll need to re-calculate the
  26444. reference element's position.
  26445. */
  26446. function listScrollParents(element, list) {
  26447. var _element$ownerDocumen;
  26448. if (list === void 0) {
  26449. list = [];
  26450. }
  26451. var scrollParent = getScrollParent(element);
  26452. var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
  26453. var win = getWindow_getWindow(scrollParent);
  26454. var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
  26455. var updatedList = list.concat(target);
  26456. return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
  26457. updatedList.concat(listScrollParents(getParentNode(target)));
  26458. }
  26459. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/isTableElement.js
  26460. function isTableElement(element) {
  26461. return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
  26462. }
  26463. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js
  26464. function getTrueOffsetParent(element) {
  26465. if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
  26466. getComputedStyle_getComputedStyle(element).position === 'fixed') {
  26467. return null;
  26468. }
  26469. return element.offsetParent;
  26470. } // `.offsetParent` reports `null` for fixed elements, while absolute elements
  26471. // return the containing block
  26472. function getContainingBlock(element) {
  26473. var isFirefox = /firefox/i.test(getUAString());
  26474. var isIE = /Trident/i.test(getUAString());
  26475. if (isIE && isHTMLElement(element)) {
  26476. // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
  26477. var elementCss = getComputedStyle_getComputedStyle(element);
  26478. if (elementCss.position === 'fixed') {
  26479. return null;
  26480. }
  26481. }
  26482. var currentNode = getParentNode(element);
  26483. if (isShadowRoot(currentNode)) {
  26484. currentNode = currentNode.host;
  26485. }
  26486. while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
  26487. var css = getComputedStyle_getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that
  26488. // create a containing block.
  26489. // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
  26490. 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') {
  26491. return currentNode;
  26492. } else {
  26493. currentNode = currentNode.parentNode;
  26494. }
  26495. }
  26496. return null;
  26497. } // Gets the closest ancestor positioned element. Handles some edge cases,
  26498. // such as table ancestors and cross browser bugs.
  26499. function getOffsetParent(element) {
  26500. var window = getWindow_getWindow(element);
  26501. var offsetParent = getTrueOffsetParent(element);
  26502. while (offsetParent && isTableElement(offsetParent) && getComputedStyle_getComputedStyle(offsetParent).position === 'static') {
  26503. offsetParent = getTrueOffsetParent(offsetParent);
  26504. }
  26505. if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle_getComputedStyle(offsetParent).position === 'static')) {
  26506. return window;
  26507. }
  26508. return offsetParent || getContainingBlock(element) || window;
  26509. }
  26510. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/enums.js
  26511. var enums_top = 'top';
  26512. var bottom = 'bottom';
  26513. var right = 'right';
  26514. var left = 'left';
  26515. var enums_auto = 'auto';
  26516. var basePlacements = [enums_top, bottom, right, left];
  26517. var start = 'start';
  26518. var end = 'end';
  26519. var clippingParents = 'clippingParents';
  26520. var viewport = 'viewport';
  26521. var popper = 'popper';
  26522. var reference = 'reference';
  26523. var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
  26524. return acc.concat([placement + "-" + start, placement + "-" + end]);
  26525. }, []);
  26526. var enums_placements = /*#__PURE__*/[].concat(basePlacements, [enums_auto]).reduce(function (acc, placement) {
  26527. return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
  26528. }, []); // modifiers that need to read the DOM
  26529. var beforeRead = 'beforeRead';
  26530. var read = 'read';
  26531. var afterRead = 'afterRead'; // pure-logic modifiers
  26532. var beforeMain = 'beforeMain';
  26533. var main = 'main';
  26534. var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
  26535. var beforeWrite = 'beforeWrite';
  26536. var write = 'write';
  26537. var afterWrite = 'afterWrite';
  26538. var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
  26539. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/orderModifiers.js
  26540. // source: https://stackoverflow.com/questions/49875255
  26541. function orderModifiers_order(modifiers) {
  26542. var map = new Map();
  26543. var visited = new Set();
  26544. var result = [];
  26545. modifiers.forEach(function (modifier) {
  26546. map.set(modifier.name, modifier);
  26547. }); // On visiting object, check for its dependencies and visit them recursively
  26548. function sort(modifier) {
  26549. visited.add(modifier.name);
  26550. var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
  26551. requires.forEach(function (dep) {
  26552. if (!visited.has(dep)) {
  26553. var depModifier = map.get(dep);
  26554. if (depModifier) {
  26555. sort(depModifier);
  26556. }
  26557. }
  26558. });
  26559. result.push(modifier);
  26560. }
  26561. modifiers.forEach(function (modifier) {
  26562. if (!visited.has(modifier.name)) {
  26563. // check for visited object
  26564. sort(modifier);
  26565. }
  26566. });
  26567. return result;
  26568. }
  26569. function orderModifiers(modifiers) {
  26570. // order based on dependencies
  26571. var orderedModifiers = orderModifiers_order(modifiers); // order based on phase
  26572. return modifierPhases.reduce(function (acc, phase) {
  26573. return acc.concat(orderedModifiers.filter(function (modifier) {
  26574. return modifier.phase === phase;
  26575. }));
  26576. }, []);
  26577. }
  26578. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/debounce.js
  26579. function debounce(fn) {
  26580. var pending;
  26581. return function () {
  26582. if (!pending) {
  26583. pending = new Promise(function (resolve) {
  26584. Promise.resolve().then(function () {
  26585. pending = undefined;
  26586. resolve(fn());
  26587. });
  26588. });
  26589. }
  26590. return pending;
  26591. };
  26592. }
  26593. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/mergeByName.js
  26594. function mergeByName(modifiers) {
  26595. var merged = modifiers.reduce(function (merged, current) {
  26596. var existing = merged[current.name];
  26597. merged[current.name] = existing ? Object.assign({}, existing, current, {
  26598. options: Object.assign({}, existing.options, current.options),
  26599. data: Object.assign({}, existing.data, current.data)
  26600. }) : current;
  26601. return merged;
  26602. }, {}); // IE11 does not support Object.values
  26603. return Object.keys(merged).map(function (key) {
  26604. return merged[key];
  26605. });
  26606. }
  26607. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/createPopper.js
  26608. var INVALID_ELEMENT_ERROR = 'Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.';
  26609. 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.';
  26610. var DEFAULT_OPTIONS = {
  26611. placement: 'bottom',
  26612. modifiers: [],
  26613. strategy: 'absolute'
  26614. };
  26615. function areValidElements() {
  26616. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  26617. args[_key] = arguments[_key];
  26618. }
  26619. return !args.some(function (element) {
  26620. return !(element && typeof element.getBoundingClientRect === 'function');
  26621. });
  26622. }
  26623. function popperGenerator(generatorOptions) {
  26624. if (generatorOptions === void 0) {
  26625. generatorOptions = {};
  26626. }
  26627. var _generatorOptions = generatorOptions,
  26628. _generatorOptions$def = _generatorOptions.defaultModifiers,
  26629. defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
  26630. _generatorOptions$def2 = _generatorOptions.defaultOptions,
  26631. defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
  26632. return function createPopper(reference, popper, options) {
  26633. if (options === void 0) {
  26634. options = defaultOptions;
  26635. }
  26636. var state = {
  26637. placement: 'bottom',
  26638. orderedModifiers: [],
  26639. options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
  26640. modifiersData: {},
  26641. elements: {
  26642. reference: reference,
  26643. popper: popper
  26644. },
  26645. attributes: {},
  26646. styles: {}
  26647. };
  26648. var effectCleanupFns = [];
  26649. var isDestroyed = false;
  26650. var instance = {
  26651. state: state,
  26652. setOptions: function setOptions(setOptionsAction) {
  26653. var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
  26654. cleanupModifierEffects();
  26655. state.options = Object.assign({}, defaultOptions, state.options, options);
  26656. state.scrollParents = {
  26657. reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
  26658. popper: listScrollParents(popper)
  26659. }; // Orders the modifiers based on their dependencies and `phase`
  26660. // properties
  26661. var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
  26662. state.orderedModifiers = orderedModifiers.filter(function (m) {
  26663. return m.enabled;
  26664. }); // Validate the provided modifiers so that the consumer will get warned
  26665. // if one of the modifiers is invalid for any reason
  26666. if (false) { var _getComputedStyle, marginTop, marginRight, marginBottom, marginLeft, flipModifier, modifiers; }
  26667. runModifierEffects();
  26668. return instance.update();
  26669. },
  26670. // Sync update – it will always be executed, even if not necessary. This
  26671. // is useful for low frequency updates where sync behavior simplifies the
  26672. // logic.
  26673. // For high frequency updates (e.g. `resize` and `scroll` events), always
  26674. // prefer the async Popper#update method
  26675. forceUpdate: function forceUpdate() {
  26676. if (isDestroyed) {
  26677. return;
  26678. }
  26679. var _state$elements = state.elements,
  26680. reference = _state$elements.reference,
  26681. popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
  26682. // anymore
  26683. if (!areValidElements(reference, popper)) {
  26684. if (false) {}
  26685. return;
  26686. } // Store the reference and popper rects to be read by modifiers
  26687. state.rects = {
  26688. reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
  26689. popper: getLayoutRect(popper)
  26690. }; // Modifiers have the ability to reset the current update cycle. The
  26691. // most common use case for this is the `flip` modifier changing the
  26692. // placement, which then needs to re-run all the modifiers, because the
  26693. // logic was previously ran for the previous placement and is therefore
  26694. // stale/incorrect
  26695. state.reset = false;
  26696. state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
  26697. // is filled with the initial data specified by the modifier. This means
  26698. // it doesn't persist and is fresh on each update.
  26699. // To ensure persistent data, use `${name}#persistent`
  26700. state.orderedModifiers.forEach(function (modifier) {
  26701. return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
  26702. });
  26703. var __debug_loops__ = 0;
  26704. for (var index = 0; index < state.orderedModifiers.length; index++) {
  26705. if (false) {}
  26706. if (state.reset === true) {
  26707. state.reset = false;
  26708. index = -1;
  26709. continue;
  26710. }
  26711. var _state$orderedModifie = state.orderedModifiers[index],
  26712. fn = _state$orderedModifie.fn,
  26713. _state$orderedModifie2 = _state$orderedModifie.options,
  26714. _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
  26715. name = _state$orderedModifie.name;
  26716. if (typeof fn === 'function') {
  26717. state = fn({
  26718. state: state,
  26719. options: _options,
  26720. name: name,
  26721. instance: instance
  26722. }) || state;
  26723. }
  26724. }
  26725. },
  26726. // Async and optimistically optimized update – it will not be executed if
  26727. // not necessary (debounced to run at most once-per-tick)
  26728. update: debounce(function () {
  26729. return new Promise(function (resolve) {
  26730. instance.forceUpdate();
  26731. resolve(state);
  26732. });
  26733. }),
  26734. destroy: function destroy() {
  26735. cleanupModifierEffects();
  26736. isDestroyed = true;
  26737. }
  26738. };
  26739. if (!areValidElements(reference, popper)) {
  26740. if (false) {}
  26741. return instance;
  26742. }
  26743. instance.setOptions(options).then(function (state) {
  26744. if (!isDestroyed && options.onFirstUpdate) {
  26745. options.onFirstUpdate(state);
  26746. }
  26747. }); // Modifiers have the ability to execute arbitrary code before the first
  26748. // update cycle runs. They will be executed in the same order as the update
  26749. // cycle. This is useful when a modifier adds some persistent data that
  26750. // other modifiers need to use, but the modifier is run after the dependent
  26751. // one.
  26752. function runModifierEffects() {
  26753. state.orderedModifiers.forEach(function (_ref3) {
  26754. var name = _ref3.name,
  26755. _ref3$options = _ref3.options,
  26756. options = _ref3$options === void 0 ? {} : _ref3$options,
  26757. effect = _ref3.effect;
  26758. if (typeof effect === 'function') {
  26759. var cleanupFn = effect({
  26760. state: state,
  26761. name: name,
  26762. instance: instance,
  26763. options: options
  26764. });
  26765. var noopFn = function noopFn() {};
  26766. effectCleanupFns.push(cleanupFn || noopFn);
  26767. }
  26768. });
  26769. }
  26770. function cleanupModifierEffects() {
  26771. effectCleanupFns.forEach(function (fn) {
  26772. return fn();
  26773. });
  26774. effectCleanupFns = [];
  26775. }
  26776. return instance;
  26777. };
  26778. }
  26779. var createPopper = /*#__PURE__*/(/* unused pure expression or super */ null && (popperGenerator())); // eslint-disable-next-line import/no-unused-modules
  26780. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/modifiers/eventListeners.js
  26781. // eslint-disable-next-line import/no-unused-modules
  26782. var passive = {
  26783. passive: true
  26784. };
  26785. function effect(_ref) {
  26786. var state = _ref.state,
  26787. instance = _ref.instance,
  26788. options = _ref.options;
  26789. var _options$scroll = options.scroll,
  26790. scroll = _options$scroll === void 0 ? true : _options$scroll,
  26791. _options$resize = options.resize,
  26792. resize = _options$resize === void 0 ? true : _options$resize;
  26793. var window = getWindow_getWindow(state.elements.popper);
  26794. var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
  26795. if (scroll) {
  26796. scrollParents.forEach(function (scrollParent) {
  26797. scrollParent.addEventListener('scroll', instance.update, passive);
  26798. });
  26799. }
  26800. if (resize) {
  26801. window.addEventListener('resize', instance.update, passive);
  26802. }
  26803. return function () {
  26804. if (scroll) {
  26805. scrollParents.forEach(function (scrollParent) {
  26806. scrollParent.removeEventListener('scroll', instance.update, passive);
  26807. });
  26808. }
  26809. if (resize) {
  26810. window.removeEventListener('resize', instance.update, passive);
  26811. }
  26812. };
  26813. } // eslint-disable-next-line import/no-unused-modules
  26814. /* harmony default export */ var eventListeners = ({
  26815. name: 'eventListeners',
  26816. enabled: true,
  26817. phase: 'write',
  26818. fn: function fn() {},
  26819. effect: effect,
  26820. data: {}
  26821. });
  26822. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/getBasePlacement.js
  26823. function getBasePlacement(placement) {
  26824. return placement.split('-')[0];
  26825. }
  26826. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/getVariation.js
  26827. function getVariation(placement) {
  26828. return placement.split('-')[1];
  26829. }
  26830. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js
  26831. function getMainAxisFromPlacement_getMainAxisFromPlacement(placement) {
  26832. return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
  26833. }
  26834. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/computeOffsets.js
  26835. function computeOffsets(_ref) {
  26836. var reference = _ref.reference,
  26837. element = _ref.element,
  26838. placement = _ref.placement;
  26839. var basePlacement = placement ? getBasePlacement(placement) : null;
  26840. var variation = placement ? getVariation(placement) : null;
  26841. var commonX = reference.x + reference.width / 2 - element.width / 2;
  26842. var commonY = reference.y + reference.height / 2 - element.height / 2;
  26843. var offsets;
  26844. switch (basePlacement) {
  26845. case enums_top:
  26846. offsets = {
  26847. x: commonX,
  26848. y: reference.y - element.height
  26849. };
  26850. break;
  26851. case bottom:
  26852. offsets = {
  26853. x: commonX,
  26854. y: reference.y + reference.height
  26855. };
  26856. break;
  26857. case right:
  26858. offsets = {
  26859. x: reference.x + reference.width,
  26860. y: commonY
  26861. };
  26862. break;
  26863. case left:
  26864. offsets = {
  26865. x: reference.x - element.width,
  26866. y: commonY
  26867. };
  26868. break;
  26869. default:
  26870. offsets = {
  26871. x: reference.x,
  26872. y: reference.y
  26873. };
  26874. }
  26875. var mainAxis = basePlacement ? getMainAxisFromPlacement_getMainAxisFromPlacement(basePlacement) : null;
  26876. if (mainAxis != null) {
  26877. var len = mainAxis === 'y' ? 'height' : 'width';
  26878. switch (variation) {
  26879. case start:
  26880. offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
  26881. break;
  26882. case end:
  26883. offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
  26884. break;
  26885. default:
  26886. }
  26887. }
  26888. return offsets;
  26889. }
  26890. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/modifiers/popperOffsets.js
  26891. function popperOffsets(_ref) {
  26892. var state = _ref.state,
  26893. name = _ref.name;
  26894. // Offsets are the actual position the popper needs to have to be
  26895. // properly positioned near its reference element
  26896. // This is the most basic placement, and will be adjusted by
  26897. // the modifiers in the next step
  26898. state.modifiersData[name] = computeOffsets({
  26899. reference: state.rects.reference,
  26900. element: state.rects.popper,
  26901. strategy: 'absolute',
  26902. placement: state.placement
  26903. });
  26904. } // eslint-disable-next-line import/no-unused-modules
  26905. /* harmony default export */ var modifiers_popperOffsets = ({
  26906. name: 'popperOffsets',
  26907. enabled: true,
  26908. phase: 'read',
  26909. fn: popperOffsets,
  26910. data: {}
  26911. });
  26912. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/modifiers/computeStyles.js
  26913. // eslint-disable-next-line import/no-unused-modules
  26914. var unsetSides = {
  26915. top: 'auto',
  26916. right: 'auto',
  26917. bottom: 'auto',
  26918. left: 'auto'
  26919. }; // Round the offsets to the nearest suitable subpixel based on the DPR.
  26920. // Zooming can change the DPR, but it seems to report a value that will
  26921. // cleanly divide the values into the appropriate subpixels.
  26922. function roundOffsetsByDPR(_ref) {
  26923. var x = _ref.x,
  26924. y = _ref.y;
  26925. var win = window;
  26926. var dpr = win.devicePixelRatio || 1;
  26927. return {
  26928. x: round(x * dpr) / dpr || 0,
  26929. y: round(y * dpr) / dpr || 0
  26930. };
  26931. }
  26932. function mapToStyles(_ref2) {
  26933. var _Object$assign2;
  26934. var popper = _ref2.popper,
  26935. popperRect = _ref2.popperRect,
  26936. placement = _ref2.placement,
  26937. variation = _ref2.variation,
  26938. offsets = _ref2.offsets,
  26939. position = _ref2.position,
  26940. gpuAcceleration = _ref2.gpuAcceleration,
  26941. adaptive = _ref2.adaptive,
  26942. roundOffsets = _ref2.roundOffsets,
  26943. isFixed = _ref2.isFixed;
  26944. var _offsets$x = offsets.x,
  26945. x = _offsets$x === void 0 ? 0 : _offsets$x,
  26946. _offsets$y = offsets.y,
  26947. y = _offsets$y === void 0 ? 0 : _offsets$y;
  26948. var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
  26949. x: x,
  26950. y: y
  26951. }) : {
  26952. x: x,
  26953. y: y
  26954. };
  26955. x = _ref3.x;
  26956. y = _ref3.y;
  26957. var hasX = offsets.hasOwnProperty('x');
  26958. var hasY = offsets.hasOwnProperty('y');
  26959. var sideX = left;
  26960. var sideY = enums_top;
  26961. var win = window;
  26962. if (adaptive) {
  26963. var offsetParent = getOffsetParent(popper);
  26964. var heightProp = 'clientHeight';
  26965. var widthProp = 'clientWidth';
  26966. if (offsetParent === getWindow_getWindow(popper)) {
  26967. offsetParent = getDocumentElement(popper);
  26968. if (getComputedStyle_getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {
  26969. heightProp = 'scrollHeight';
  26970. widthProp = 'scrollWidth';
  26971. }
  26972. } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
  26973. offsetParent = offsetParent;
  26974. if (placement === enums_top || (placement === left || placement === right) && variation === end) {
  26975. sideY = bottom;
  26976. var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
  26977. offsetParent[heightProp];
  26978. y -= offsetY - popperRect.height;
  26979. y *= gpuAcceleration ? 1 : -1;
  26980. }
  26981. if (placement === left || (placement === enums_top || placement === bottom) && variation === end) {
  26982. sideX = right;
  26983. var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
  26984. offsetParent[widthProp];
  26985. x -= offsetX - popperRect.width;
  26986. x *= gpuAcceleration ? 1 : -1;
  26987. }
  26988. }
  26989. var commonStyles = Object.assign({
  26990. position: position
  26991. }, adaptive && unsetSides);
  26992. var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
  26993. x: x,
  26994. y: y
  26995. }) : {
  26996. x: x,
  26997. y: y
  26998. };
  26999. x = _ref4.x;
  27000. y = _ref4.y;
  27001. if (gpuAcceleration) {
  27002. var _Object$assign;
  27003. 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));
  27004. }
  27005. return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
  27006. }
  27007. function computeStyles(_ref5) {
  27008. var state = _ref5.state,
  27009. options = _ref5.options;
  27010. var _options$gpuAccelerat = options.gpuAcceleration,
  27011. gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
  27012. _options$adaptive = options.adaptive,
  27013. adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
  27014. _options$roundOffsets = options.roundOffsets,
  27015. roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
  27016. if (false) { var transitionProperty; }
  27017. var commonStyles = {
  27018. placement: getBasePlacement(state.placement),
  27019. variation: getVariation(state.placement),
  27020. popper: state.elements.popper,
  27021. popperRect: state.rects.popper,
  27022. gpuAcceleration: gpuAcceleration,
  27023. isFixed: state.options.strategy === 'fixed'
  27024. };
  27025. if (state.modifiersData.popperOffsets != null) {
  27026. state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
  27027. offsets: state.modifiersData.popperOffsets,
  27028. position: state.options.strategy,
  27029. adaptive: adaptive,
  27030. roundOffsets: roundOffsets
  27031. })));
  27032. }
  27033. if (state.modifiersData.arrow != null) {
  27034. state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
  27035. offsets: state.modifiersData.arrow,
  27036. position: 'absolute',
  27037. adaptive: false,
  27038. roundOffsets: roundOffsets
  27039. })));
  27040. }
  27041. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  27042. 'data-popper-placement': state.placement
  27043. });
  27044. } // eslint-disable-next-line import/no-unused-modules
  27045. /* harmony default export */ var modifiers_computeStyles = ({
  27046. name: 'computeStyles',
  27047. enabled: true,
  27048. phase: 'beforeWrite',
  27049. fn: computeStyles,
  27050. data: {}
  27051. });
  27052. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/modifiers/applyStyles.js
  27053. // This modifier takes the styles prepared by the `computeStyles` modifier
  27054. // and applies them to the HTMLElements such as popper and arrow
  27055. function applyStyles(_ref) {
  27056. var state = _ref.state;
  27057. Object.keys(state.elements).forEach(function (name) {
  27058. var style = state.styles[name] || {};
  27059. var attributes = state.attributes[name] || {};
  27060. var element = state.elements[name]; // arrow is optional + virtual elements
  27061. if (!isHTMLElement(element) || !getNodeName(element)) {
  27062. return;
  27063. } // Flow doesn't support to extend this property, but it's the most
  27064. // effective way to apply styles to an HTMLElement
  27065. // $FlowFixMe[cannot-write]
  27066. Object.assign(element.style, style);
  27067. Object.keys(attributes).forEach(function (name) {
  27068. var value = attributes[name];
  27069. if (value === false) {
  27070. element.removeAttribute(name);
  27071. } else {
  27072. element.setAttribute(name, value === true ? '' : value);
  27073. }
  27074. });
  27075. });
  27076. }
  27077. function applyStyles_effect(_ref2) {
  27078. var state = _ref2.state;
  27079. var initialStyles = {
  27080. popper: {
  27081. position: state.options.strategy,
  27082. left: '0',
  27083. top: '0',
  27084. margin: '0'
  27085. },
  27086. arrow: {
  27087. position: 'absolute'
  27088. },
  27089. reference: {}
  27090. };
  27091. Object.assign(state.elements.popper.style, initialStyles.popper);
  27092. state.styles = initialStyles;
  27093. if (state.elements.arrow) {
  27094. Object.assign(state.elements.arrow.style, initialStyles.arrow);
  27095. }
  27096. return function () {
  27097. Object.keys(state.elements).forEach(function (name) {
  27098. var element = state.elements[name];
  27099. var attributes = state.attributes[name] || {};
  27100. var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
  27101. var style = styleProperties.reduce(function (style, property) {
  27102. style[property] = '';
  27103. return style;
  27104. }, {}); // arrow is optional + virtual elements
  27105. if (!isHTMLElement(element) || !getNodeName(element)) {
  27106. return;
  27107. }
  27108. Object.assign(element.style, style);
  27109. Object.keys(attributes).forEach(function (attribute) {
  27110. element.removeAttribute(attribute);
  27111. });
  27112. });
  27113. };
  27114. } // eslint-disable-next-line import/no-unused-modules
  27115. /* harmony default export */ var modifiers_applyStyles = ({
  27116. name: 'applyStyles',
  27117. enabled: true,
  27118. phase: 'write',
  27119. fn: applyStyles,
  27120. effect: applyStyles_effect,
  27121. requires: ['computeStyles']
  27122. });
  27123. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/modifiers/offset.js
  27124. // eslint-disable-next-line import/no-unused-modules
  27125. function distanceAndSkiddingToXY(placement, rects, offset) {
  27126. var basePlacement = getBasePlacement(placement);
  27127. var invertDistance = [left, enums_top].indexOf(basePlacement) >= 0 ? -1 : 1;
  27128. var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
  27129. placement: placement
  27130. })) : offset,
  27131. skidding = _ref[0],
  27132. distance = _ref[1];
  27133. skidding = skidding || 0;
  27134. distance = (distance || 0) * invertDistance;
  27135. return [left, right].indexOf(basePlacement) >= 0 ? {
  27136. x: distance,
  27137. y: skidding
  27138. } : {
  27139. x: skidding,
  27140. y: distance
  27141. };
  27142. }
  27143. function offset(_ref2) {
  27144. var state = _ref2.state,
  27145. options = _ref2.options,
  27146. name = _ref2.name;
  27147. var _options$offset = options.offset,
  27148. offset = _options$offset === void 0 ? [0, 0] : _options$offset;
  27149. var data = enums_placements.reduce(function (acc, placement) {
  27150. acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
  27151. return acc;
  27152. }, {});
  27153. var _data$state$placement = data[state.placement],
  27154. x = _data$state$placement.x,
  27155. y = _data$state$placement.y;
  27156. if (state.modifiersData.popperOffsets != null) {
  27157. state.modifiersData.popperOffsets.x += x;
  27158. state.modifiersData.popperOffsets.y += y;
  27159. }
  27160. state.modifiersData[name] = data;
  27161. } // eslint-disable-next-line import/no-unused-modules
  27162. /* harmony default export */ var modifiers_offset = ({
  27163. name: 'offset',
  27164. enabled: true,
  27165. phase: 'main',
  27166. requires: ['popperOffsets'],
  27167. fn: offset
  27168. });
  27169. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/getOppositePlacement.js
  27170. var getOppositePlacement_hash = {
  27171. left: 'right',
  27172. right: 'left',
  27173. bottom: 'top',
  27174. top: 'bottom'
  27175. };
  27176. function getOppositePlacement(placement) {
  27177. return placement.replace(/left|right|bottom|top/g, function (matched) {
  27178. return getOppositePlacement_hash[matched];
  27179. });
  27180. }
  27181. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js
  27182. var getOppositeVariationPlacement_hash = {
  27183. start: 'end',
  27184. end: 'start'
  27185. };
  27186. function getOppositeVariationPlacement(placement) {
  27187. return placement.replace(/start|end/g, function (matched) {
  27188. return getOppositeVariationPlacement_hash[matched];
  27189. });
  27190. }
  27191. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js
  27192. function getViewportRect(element, strategy) {
  27193. var win = getWindow_getWindow(element);
  27194. var html = getDocumentElement(element);
  27195. var visualViewport = win.visualViewport;
  27196. var width = html.clientWidth;
  27197. var height = html.clientHeight;
  27198. var x = 0;
  27199. var y = 0;
  27200. if (visualViewport) {
  27201. width = visualViewport.width;
  27202. height = visualViewport.height;
  27203. var layoutViewport = isLayoutViewport();
  27204. if (layoutViewport || !layoutViewport && strategy === 'fixed') {
  27205. x = visualViewport.offsetLeft;
  27206. y = visualViewport.offsetTop;
  27207. }
  27208. }
  27209. return {
  27210. width: width,
  27211. height: height,
  27212. x: x + getWindowScrollBarX(element),
  27213. y: y
  27214. };
  27215. }
  27216. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js
  27217. // Gets the entire size of the scrollable document area, even extending outside
  27218. // of the `<html>` and `<body>` rect bounds if horizontally scrollable
  27219. function getDocumentRect(element) {
  27220. var _element$ownerDocumen;
  27221. var html = getDocumentElement(element);
  27222. var winScroll = getWindowScroll(element);
  27223. var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
  27224. var width = math_max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
  27225. var height = math_max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
  27226. var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
  27227. var y = -winScroll.scrollTop;
  27228. if (getComputedStyle_getComputedStyle(body || html).direction === 'rtl') {
  27229. x += math_max(html.clientWidth, body ? body.clientWidth : 0) - width;
  27230. }
  27231. return {
  27232. width: width,
  27233. height: height,
  27234. x: x,
  27235. y: y
  27236. };
  27237. }
  27238. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/contains.js
  27239. function contains_contains(parent, child) {
  27240. var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
  27241. if (parent.contains(child)) {
  27242. return true;
  27243. } // then fallback to custom implementation with Shadow DOM support
  27244. else if (rootNode && isShadowRoot(rootNode)) {
  27245. var next = child;
  27246. do {
  27247. if (next && parent.isSameNode(next)) {
  27248. return true;
  27249. } // $FlowFixMe[prop-missing]: need a better way to handle this...
  27250. next = next.parentNode || next.host;
  27251. } while (next);
  27252. } // Give up, the result is false
  27253. return false;
  27254. }
  27255. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/rectToClientRect.js
  27256. function rectToClientRect(rect) {
  27257. return Object.assign({}, rect, {
  27258. left: rect.x,
  27259. top: rect.y,
  27260. right: rect.x + rect.width,
  27261. bottom: rect.y + rect.height
  27262. });
  27263. }
  27264. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js
  27265. function getInnerBoundingClientRect(element, strategy) {
  27266. var rect = getBoundingClientRect(element, false, strategy === 'fixed');
  27267. rect.top = rect.top + element.clientTop;
  27268. rect.left = rect.left + element.clientLeft;
  27269. rect.bottom = rect.top + element.clientHeight;
  27270. rect.right = rect.left + element.clientWidth;
  27271. rect.width = element.clientWidth;
  27272. rect.height = element.clientHeight;
  27273. rect.x = rect.left;
  27274. rect.y = rect.top;
  27275. return rect;
  27276. }
  27277. function getClientRectFromMixedType(element, clippingParent, strategy) {
  27278. return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
  27279. } // A "clipping parent" is an overflowable container with the characteristic of
  27280. // clipping (or hiding) overflowing elements with a position different from
  27281. // `initial`
  27282. function getClippingParents(element) {
  27283. var clippingParents = listScrollParents(getParentNode(element));
  27284. var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle_getComputedStyle(element).position) >= 0;
  27285. var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
  27286. if (!isElement(clipperElement)) {
  27287. return [];
  27288. } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
  27289. return clippingParents.filter(function (clippingParent) {
  27290. return isElement(clippingParent) && contains_contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
  27291. });
  27292. } // Gets the maximum area that the element is visible in due to any number of
  27293. // clipping parents
  27294. function getClippingRect(element, boundary, rootBoundary, strategy) {
  27295. var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
  27296. var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
  27297. var firstClippingParent = clippingParents[0];
  27298. var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
  27299. var rect = getClientRectFromMixedType(element, clippingParent, strategy);
  27300. accRect.top = math_max(rect.top, accRect.top);
  27301. accRect.right = math_min(rect.right, accRect.right);
  27302. accRect.bottom = math_min(rect.bottom, accRect.bottom);
  27303. accRect.left = math_max(rect.left, accRect.left);
  27304. return accRect;
  27305. }, getClientRectFromMixedType(element, firstClippingParent, strategy));
  27306. clippingRect.width = clippingRect.right - clippingRect.left;
  27307. clippingRect.height = clippingRect.bottom - clippingRect.top;
  27308. clippingRect.x = clippingRect.left;
  27309. clippingRect.y = clippingRect.top;
  27310. return clippingRect;
  27311. }
  27312. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/getFreshSideObject.js
  27313. function getFreshSideObject() {
  27314. return {
  27315. top: 0,
  27316. right: 0,
  27317. bottom: 0,
  27318. left: 0
  27319. };
  27320. }
  27321. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/mergePaddingObject.js
  27322. function mergePaddingObject(paddingObject) {
  27323. return Object.assign({}, getFreshSideObject(), paddingObject);
  27324. }
  27325. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/expandToHashMap.js
  27326. function expandToHashMap(value, keys) {
  27327. return keys.reduce(function (hashMap, key) {
  27328. hashMap[key] = value;
  27329. return hashMap;
  27330. }, {});
  27331. }
  27332. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/detectOverflow.js
  27333. // eslint-disable-next-line import/no-unused-modules
  27334. function detectOverflow(state, options) {
  27335. if (options === void 0) {
  27336. options = {};
  27337. }
  27338. var _options = options,
  27339. _options$placement = _options.placement,
  27340. placement = _options$placement === void 0 ? state.placement : _options$placement,
  27341. _options$strategy = _options.strategy,
  27342. strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,
  27343. _options$boundary = _options.boundary,
  27344. boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
  27345. _options$rootBoundary = _options.rootBoundary,
  27346. rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
  27347. _options$elementConte = _options.elementContext,
  27348. elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
  27349. _options$altBoundary = _options.altBoundary,
  27350. altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
  27351. _options$padding = _options.padding,
  27352. padding = _options$padding === void 0 ? 0 : _options$padding;
  27353. var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
  27354. var altContext = elementContext === popper ? reference : popper;
  27355. var popperRect = state.rects.popper;
  27356. var element = state.elements[altBoundary ? altContext : elementContext];
  27357. var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
  27358. var referenceClientRect = getBoundingClientRect(state.elements.reference);
  27359. var popperOffsets = computeOffsets({
  27360. reference: referenceClientRect,
  27361. element: popperRect,
  27362. strategy: 'absolute',
  27363. placement: placement
  27364. });
  27365. var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
  27366. var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
  27367. // 0 or negative = within the clipping rect
  27368. var overflowOffsets = {
  27369. top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
  27370. bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
  27371. left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
  27372. right: elementClientRect.right - clippingClientRect.right + paddingObject.right
  27373. };
  27374. var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element
  27375. if (elementContext === popper && offsetData) {
  27376. var offset = offsetData[placement];
  27377. Object.keys(overflowOffsets).forEach(function (key) {
  27378. var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
  27379. var axis = [enums_top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
  27380. overflowOffsets[key] += offset[axis] * multiply;
  27381. });
  27382. }
  27383. return overflowOffsets;
  27384. }
  27385. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js
  27386. function computeAutoPlacement(state, options) {
  27387. if (options === void 0) {
  27388. options = {};
  27389. }
  27390. var _options = options,
  27391. placement = _options.placement,
  27392. boundary = _options.boundary,
  27393. rootBoundary = _options.rootBoundary,
  27394. padding = _options.padding,
  27395. flipVariations = _options.flipVariations,
  27396. _options$allowedAutoP = _options.allowedAutoPlacements,
  27397. allowedAutoPlacements = _options$allowedAutoP === void 0 ? enums_placements : _options$allowedAutoP;
  27398. var variation = getVariation(placement);
  27399. var placements = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
  27400. return getVariation(placement) === variation;
  27401. }) : basePlacements;
  27402. var allowedPlacements = placements.filter(function (placement) {
  27403. return allowedAutoPlacements.indexOf(placement) >= 0;
  27404. });
  27405. if (allowedPlacements.length === 0) {
  27406. allowedPlacements = placements;
  27407. if (false) {}
  27408. } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
  27409. var overflows = allowedPlacements.reduce(function (acc, placement) {
  27410. acc[placement] = detectOverflow(state, {
  27411. placement: placement,
  27412. boundary: boundary,
  27413. rootBoundary: rootBoundary,
  27414. padding: padding
  27415. })[getBasePlacement(placement)];
  27416. return acc;
  27417. }, {});
  27418. return Object.keys(overflows).sort(function (a, b) {
  27419. return overflows[a] - overflows[b];
  27420. });
  27421. }
  27422. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/modifiers/flip.js
  27423. // eslint-disable-next-line import/no-unused-modules
  27424. function getExpandedFallbackPlacements(placement) {
  27425. if (getBasePlacement(placement) === enums_auto) {
  27426. return [];
  27427. }
  27428. var oppositePlacement = getOppositePlacement(placement);
  27429. return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
  27430. }
  27431. function flip(_ref) {
  27432. var state = _ref.state,
  27433. options = _ref.options,
  27434. name = _ref.name;
  27435. if (state.modifiersData[name]._skip) {
  27436. return;
  27437. }
  27438. var _options$mainAxis = options.mainAxis,
  27439. checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
  27440. _options$altAxis = options.altAxis,
  27441. checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,
  27442. specifiedFallbackPlacements = options.fallbackPlacements,
  27443. padding = options.padding,
  27444. boundary = options.boundary,
  27445. rootBoundary = options.rootBoundary,
  27446. altBoundary = options.altBoundary,
  27447. _options$flipVariatio = options.flipVariations,
  27448. flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,
  27449. allowedAutoPlacements = options.allowedAutoPlacements;
  27450. var preferredPlacement = state.options.placement;
  27451. var basePlacement = getBasePlacement(preferredPlacement);
  27452. var isBasePlacement = basePlacement === preferredPlacement;
  27453. var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
  27454. var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {
  27455. return acc.concat(getBasePlacement(placement) === enums_auto ? computeAutoPlacement(state, {
  27456. placement: placement,
  27457. boundary: boundary,
  27458. rootBoundary: rootBoundary,
  27459. padding: padding,
  27460. flipVariations: flipVariations,
  27461. allowedAutoPlacements: allowedAutoPlacements
  27462. }) : placement);
  27463. }, []);
  27464. var referenceRect = state.rects.reference;
  27465. var popperRect = state.rects.popper;
  27466. var checksMap = new Map();
  27467. var makeFallbackChecks = true;
  27468. var firstFittingPlacement = placements[0];
  27469. for (var i = 0; i < placements.length; i++) {
  27470. var placement = placements[i];
  27471. var _basePlacement = getBasePlacement(placement);
  27472. var isStartVariation = getVariation(placement) === start;
  27473. var isVertical = [enums_top, bottom].indexOf(_basePlacement) >= 0;
  27474. var len = isVertical ? 'width' : 'height';
  27475. var overflow = detectOverflow(state, {
  27476. placement: placement,
  27477. boundary: boundary,
  27478. rootBoundary: rootBoundary,
  27479. altBoundary: altBoundary,
  27480. padding: padding
  27481. });
  27482. var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : enums_top;
  27483. if (referenceRect[len] > popperRect[len]) {
  27484. mainVariationSide = getOppositePlacement(mainVariationSide);
  27485. }
  27486. var altVariationSide = getOppositePlacement(mainVariationSide);
  27487. var checks = [];
  27488. if (checkMainAxis) {
  27489. checks.push(overflow[_basePlacement] <= 0);
  27490. }
  27491. if (checkAltAxis) {
  27492. checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
  27493. }
  27494. if (checks.every(function (check) {
  27495. return check;
  27496. })) {
  27497. firstFittingPlacement = placement;
  27498. makeFallbackChecks = false;
  27499. break;
  27500. }
  27501. checksMap.set(placement, checks);
  27502. }
  27503. if (makeFallbackChecks) {
  27504. // `2` may be desired in some cases – research later
  27505. var numberOfChecks = flipVariations ? 3 : 1;
  27506. var _loop = function _loop(_i) {
  27507. var fittingPlacement = placements.find(function (placement) {
  27508. var checks = checksMap.get(placement);
  27509. if (checks) {
  27510. return checks.slice(0, _i).every(function (check) {
  27511. return check;
  27512. });
  27513. }
  27514. });
  27515. if (fittingPlacement) {
  27516. firstFittingPlacement = fittingPlacement;
  27517. return "break";
  27518. }
  27519. };
  27520. for (var _i = numberOfChecks; _i > 0; _i--) {
  27521. var _ret = _loop(_i);
  27522. if (_ret === "break") break;
  27523. }
  27524. }
  27525. if (state.placement !== firstFittingPlacement) {
  27526. state.modifiersData[name]._skip = true;
  27527. state.placement = firstFittingPlacement;
  27528. state.reset = true;
  27529. }
  27530. } // eslint-disable-next-line import/no-unused-modules
  27531. /* harmony default export */ var modifiers_flip = ({
  27532. name: 'flip',
  27533. enabled: true,
  27534. phase: 'main',
  27535. fn: flip,
  27536. requiresIfExists: ['offset'],
  27537. data: {
  27538. _skip: false
  27539. }
  27540. });
  27541. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/getAltAxis.js
  27542. function getAltAxis(axis) {
  27543. return axis === 'x' ? 'y' : 'x';
  27544. }
  27545. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/utils/within.js
  27546. function within(min, value, max) {
  27547. return math_max(min, math_min(value, max));
  27548. }
  27549. function withinMaxClamp(min, value, max) {
  27550. var v = within(min, value, max);
  27551. return v > max ? max : v;
  27552. }
  27553. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/modifiers/preventOverflow.js
  27554. function preventOverflow(_ref) {
  27555. var state = _ref.state,
  27556. options = _ref.options,
  27557. name = _ref.name;
  27558. var _options$mainAxis = options.mainAxis,
  27559. checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
  27560. _options$altAxis = options.altAxis,
  27561. checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
  27562. boundary = options.boundary,
  27563. rootBoundary = options.rootBoundary,
  27564. altBoundary = options.altBoundary,
  27565. padding = options.padding,
  27566. _options$tether = options.tether,
  27567. tether = _options$tether === void 0 ? true : _options$tether,
  27568. _options$tetherOffset = options.tetherOffset,
  27569. tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
  27570. var overflow = detectOverflow(state, {
  27571. boundary: boundary,
  27572. rootBoundary: rootBoundary,
  27573. padding: padding,
  27574. altBoundary: altBoundary
  27575. });
  27576. var basePlacement = getBasePlacement(state.placement);
  27577. var variation = getVariation(state.placement);
  27578. var isBasePlacement = !variation;
  27579. var mainAxis = getMainAxisFromPlacement_getMainAxisFromPlacement(basePlacement);
  27580. var altAxis = getAltAxis(mainAxis);
  27581. var popperOffsets = state.modifiersData.popperOffsets;
  27582. var referenceRect = state.rects.reference;
  27583. var popperRect = state.rects.popper;
  27584. var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
  27585. placement: state.placement
  27586. })) : tetherOffset;
  27587. var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
  27588. mainAxis: tetherOffsetValue,
  27589. altAxis: tetherOffsetValue
  27590. } : Object.assign({
  27591. mainAxis: 0,
  27592. altAxis: 0
  27593. }, tetherOffsetValue);
  27594. var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
  27595. var data = {
  27596. x: 0,
  27597. y: 0
  27598. };
  27599. if (!popperOffsets) {
  27600. return;
  27601. }
  27602. if (checkMainAxis) {
  27603. var _offsetModifierState$;
  27604. var mainSide = mainAxis === 'y' ? enums_top : left;
  27605. var altSide = mainAxis === 'y' ? bottom : right;
  27606. var len = mainAxis === 'y' ? 'height' : 'width';
  27607. var offset = popperOffsets[mainAxis];
  27608. var min = offset + overflow[mainSide];
  27609. var max = offset - overflow[altSide];
  27610. var additive = tether ? -popperRect[len] / 2 : 0;
  27611. var minLen = variation === start ? referenceRect[len] : popperRect[len];
  27612. var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
  27613. // outside the reference bounds
  27614. var arrowElement = state.elements.arrow;
  27615. var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
  27616. width: 0,
  27617. height: 0
  27618. };
  27619. var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();
  27620. var arrowPaddingMin = arrowPaddingObject[mainSide];
  27621. var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want
  27622. // to include its full size in the calculation. If the reference is small
  27623. // and near the edge of a boundary, the popper can overflow even if the
  27624. // reference is not overflowing as well (e.g. virtual elements with no
  27625. // width or height)
  27626. var arrowLen = within(0, referenceRect[len], arrowRect[len]);
  27627. var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
  27628. var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
  27629. var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
  27630. var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
  27631. var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
  27632. var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
  27633. var tetherMax = offset + maxOffset - offsetModifierValue;
  27634. var preventedOffset = within(tether ? math_min(min, tetherMin) : min, offset, tether ? math_max(max, tetherMax) : max);
  27635. popperOffsets[mainAxis] = preventedOffset;
  27636. data[mainAxis] = preventedOffset - offset;
  27637. }
  27638. if (checkAltAxis) {
  27639. var _offsetModifierState$2;
  27640. var _mainSide = mainAxis === 'x' ? enums_top : left;
  27641. var _altSide = mainAxis === 'x' ? bottom : right;
  27642. var _offset = popperOffsets[altAxis];
  27643. var _len = altAxis === 'y' ? 'height' : 'width';
  27644. var _min = _offset + overflow[_mainSide];
  27645. var _max = _offset - overflow[_altSide];
  27646. var isOriginSide = [enums_top, left].indexOf(basePlacement) !== -1;
  27647. var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
  27648. var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
  27649. var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
  27650. var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
  27651. popperOffsets[altAxis] = _preventedOffset;
  27652. data[altAxis] = _preventedOffset - _offset;
  27653. }
  27654. state.modifiersData[name] = data;
  27655. } // eslint-disable-next-line import/no-unused-modules
  27656. /* harmony default export */ var modifiers_preventOverflow = ({
  27657. name: 'preventOverflow',
  27658. enabled: true,
  27659. phase: 'main',
  27660. fn: preventOverflow,
  27661. requiresIfExists: ['offset']
  27662. });
  27663. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/modifiers/arrow.js
  27664. // eslint-disable-next-line import/no-unused-modules
  27665. var toPaddingObject = function toPaddingObject(padding, state) {
  27666. padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
  27667. placement: state.placement
  27668. })) : padding;
  27669. return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
  27670. };
  27671. function arrow_arrow(_ref) {
  27672. var _state$modifiersData$;
  27673. var state = _ref.state,
  27674. name = _ref.name,
  27675. options = _ref.options;
  27676. var arrowElement = state.elements.arrow;
  27677. var popperOffsets = state.modifiersData.popperOffsets;
  27678. var basePlacement = getBasePlacement(state.placement);
  27679. var axis = getMainAxisFromPlacement_getMainAxisFromPlacement(basePlacement);
  27680. var isVertical = [left, right].indexOf(basePlacement) >= 0;
  27681. var len = isVertical ? 'height' : 'width';
  27682. if (!arrowElement || !popperOffsets) {
  27683. return;
  27684. }
  27685. var paddingObject = toPaddingObject(options.padding, state);
  27686. var arrowRect = getLayoutRect(arrowElement);
  27687. var minProp = axis === 'y' ? enums_top : left;
  27688. var maxProp = axis === 'y' ? bottom : right;
  27689. var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
  27690. var startDiff = popperOffsets[axis] - state.rects.reference[axis];
  27691. var arrowOffsetParent = getOffsetParent(arrowElement);
  27692. var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
  27693. var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is
  27694. // outside of the popper bounds
  27695. var min = paddingObject[minProp];
  27696. var max = clientSize - arrowRect[len] - paddingObject[maxProp];
  27697. var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
  27698. var offset = within(min, center, max); // Prevents breaking syntax highlighting...
  27699. var axisProp = axis;
  27700. state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
  27701. }
  27702. function arrow_effect(_ref2) {
  27703. var state = _ref2.state,
  27704. options = _ref2.options;
  27705. var _options$element = options.element,
  27706. arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
  27707. if (arrowElement == null) {
  27708. return;
  27709. } // CSS selector
  27710. if (typeof arrowElement === 'string') {
  27711. arrowElement = state.elements.popper.querySelector(arrowElement);
  27712. if (!arrowElement) {
  27713. return;
  27714. }
  27715. }
  27716. if (false) {}
  27717. if (!contains_contains(state.elements.popper, arrowElement)) {
  27718. if (false) {}
  27719. return;
  27720. }
  27721. state.elements.arrow = arrowElement;
  27722. } // eslint-disable-next-line import/no-unused-modules
  27723. /* harmony default export */ var modifiers_arrow = ({
  27724. name: 'arrow',
  27725. enabled: true,
  27726. phase: 'main',
  27727. fn: arrow_arrow,
  27728. effect: arrow_effect,
  27729. requires: ['popperOffsets'],
  27730. requiresIfExists: ['preventOverflow']
  27731. });
  27732. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/modifiers/hide.js
  27733. function getSideOffsets(overflow, rect, preventedOffsets) {
  27734. if (preventedOffsets === void 0) {
  27735. preventedOffsets = {
  27736. x: 0,
  27737. y: 0
  27738. };
  27739. }
  27740. return {
  27741. top: overflow.top - rect.height - preventedOffsets.y,
  27742. right: overflow.right - rect.width + preventedOffsets.x,
  27743. bottom: overflow.bottom - rect.height + preventedOffsets.y,
  27744. left: overflow.left - rect.width - preventedOffsets.x
  27745. };
  27746. }
  27747. function isAnySideFullyClipped(overflow) {
  27748. return [enums_top, right, bottom, left].some(function (side) {
  27749. return overflow[side] >= 0;
  27750. });
  27751. }
  27752. function hide(_ref) {
  27753. var state = _ref.state,
  27754. name = _ref.name;
  27755. var referenceRect = state.rects.reference;
  27756. var popperRect = state.rects.popper;
  27757. var preventedOffsets = state.modifiersData.preventOverflow;
  27758. var referenceOverflow = detectOverflow(state, {
  27759. elementContext: 'reference'
  27760. });
  27761. var popperAltOverflow = detectOverflow(state, {
  27762. altBoundary: true
  27763. });
  27764. var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
  27765. var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
  27766. var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
  27767. var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
  27768. state.modifiersData[name] = {
  27769. referenceClippingOffsets: referenceClippingOffsets,
  27770. popperEscapeOffsets: popperEscapeOffsets,
  27771. isReferenceHidden: isReferenceHidden,
  27772. hasPopperEscaped: hasPopperEscaped
  27773. };
  27774. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  27775. 'data-popper-reference-hidden': isReferenceHidden,
  27776. 'data-popper-escaped': hasPopperEscaped
  27777. });
  27778. } // eslint-disable-next-line import/no-unused-modules
  27779. /* harmony default export */ var modifiers_hide = ({
  27780. name: 'hide',
  27781. enabled: true,
  27782. phase: 'main',
  27783. requiresIfExists: ['preventOverflow'],
  27784. fn: hide
  27785. });
  27786. ;// CONCATENATED MODULE: ./node_modules/@popperjs/core/lib/popper.js
  27787. var defaultModifiers = [eventListeners, modifiers_popperOffsets, modifiers_computeStyles, modifiers_applyStyles, modifiers_offset, modifiers_flip, modifiers_preventOverflow, modifiers_arrow, modifiers_hide];
  27788. var popper_createPopper = /*#__PURE__*/popperGenerator({
  27789. defaultModifiers: defaultModifiers
  27790. }); // eslint-disable-next-line import/no-unused-modules
  27791. // eslint-disable-next-line import/no-unused-modules
  27792. // eslint-disable-next-line import/no-unused-modules
  27793. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Disclosure/DisclosureState.js
  27794. function useLastValue(value) {
  27795. var lastValue = (0,external_React_namespaceObject.useRef)(null);
  27796. useIsomorphicEffect(function () {
  27797. lastValue.current = value;
  27798. }, [value]);
  27799. return lastValue;
  27800. }
  27801. function useDisclosureState(initialState) {
  27802. if (initialState === void 0) {
  27803. initialState = {};
  27804. }
  27805. var _useSealedState = useSealedState(initialState),
  27806. _useSealedState$visib = _useSealedState.visible,
  27807. initialVisible = _useSealedState$visib === void 0 ? false : _useSealedState$visib,
  27808. _useSealedState$anima = _useSealedState.animated,
  27809. initialAnimated = _useSealedState$anima === void 0 ? false : _useSealedState$anima,
  27810. sealed = _objectWithoutPropertiesLoose(_useSealedState, ["visible", "animated"]);
  27811. var id = unstable_useIdState(sealed);
  27812. var _React$useState = (0,external_React_namespaceObject.useState)(initialVisible),
  27813. visible = _React$useState[0],
  27814. setVisible = _React$useState[1];
  27815. var _React$useState2 = (0,external_React_namespaceObject.useState)(initialAnimated),
  27816. animated = _React$useState2[0],
  27817. setAnimated = _React$useState2[1];
  27818. var _React$useState3 = (0,external_React_namespaceObject.useState)(false),
  27819. animating = _React$useState3[0],
  27820. setAnimating = _React$useState3[1];
  27821. var lastVisible = useLastValue(visible);
  27822. var visibleHasChanged = lastVisible.current != null && lastVisible.current !== visible;
  27823. if (animated && !animating && visibleHasChanged) {
  27824. // Sets animating to true when when visible is updated
  27825. setAnimating(true);
  27826. }
  27827. (0,external_React_namespaceObject.useEffect)(function () {
  27828. if (typeof animated === "number" && animating) {
  27829. var timeout = setTimeout(function () {
  27830. return setAnimating(false);
  27831. }, animated);
  27832. return function () {
  27833. clearTimeout(timeout);
  27834. };
  27835. }
  27836. if (animated && animating && "production" === "development") { var _timeout; }
  27837. return function () {};
  27838. }, [animated, animating]);
  27839. var show = (0,external_React_namespaceObject.useCallback)(function () {
  27840. return setVisible(true);
  27841. }, []);
  27842. var hide = (0,external_React_namespaceObject.useCallback)(function () {
  27843. return setVisible(false);
  27844. }, []);
  27845. var toggle = (0,external_React_namespaceObject.useCallback)(function () {
  27846. return setVisible(function (v) {
  27847. return !v;
  27848. });
  27849. }, []);
  27850. var stopAnimation = (0,external_React_namespaceObject.useCallback)(function () {
  27851. return setAnimating(false);
  27852. }, []);
  27853. return _objectSpread2(_objectSpread2({}, id), {}, {
  27854. visible: visible,
  27855. animated: animated,
  27856. animating: animating,
  27857. show: show,
  27858. hide: hide,
  27859. toggle: toggle,
  27860. setVisible: setVisible,
  27861. setAnimated: setAnimated,
  27862. stopAnimation: stopAnimation
  27863. });
  27864. }
  27865. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Dialog/DialogState.js
  27866. function useDialogState(initialState) {
  27867. if (initialState === void 0) {
  27868. initialState = {};
  27869. }
  27870. var _useSealedState = useSealedState(initialState),
  27871. _useSealedState$modal = _useSealedState.modal,
  27872. initialModal = _useSealedState$modal === void 0 ? true : _useSealedState$modal,
  27873. sealed = _objectWithoutPropertiesLoose(_useSealedState, ["modal"]);
  27874. var disclosure = useDisclosureState(sealed);
  27875. var _React$useState = (0,external_React_namespaceObject.useState)(initialModal),
  27876. modal = _React$useState[0],
  27877. setModal = _React$useState[1];
  27878. var disclosureRef = (0,external_React_namespaceObject.useRef)(null);
  27879. return _objectSpread2(_objectSpread2({}, disclosure), {}, {
  27880. modal: modal,
  27881. setModal: setModal,
  27882. unstable_disclosureRef: disclosureRef
  27883. });
  27884. }
  27885. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Popover/PopoverState.js
  27886. var isSafari = isUA("Mac") && !isUA("Chrome") && isUA("Safari");
  27887. function PopoverState_applyStyles(styles) {
  27888. return function (prevStyles) {
  27889. if (styles && !shallowEqual(prevStyles, styles)) {
  27890. return styles;
  27891. }
  27892. return prevStyles;
  27893. };
  27894. }
  27895. function usePopoverState(initialState) {
  27896. if (initialState === void 0) {
  27897. initialState = {};
  27898. }
  27899. var _useSealedState = useSealedState(initialState),
  27900. _useSealedState$gutte = _useSealedState.gutter,
  27901. gutter = _useSealedState$gutte === void 0 ? 12 : _useSealedState$gutte,
  27902. _useSealedState$place = _useSealedState.placement,
  27903. sealedPlacement = _useSealedState$place === void 0 ? "bottom" : _useSealedState$place,
  27904. _useSealedState$unsta = _useSealedState.unstable_flip,
  27905. flip = _useSealedState$unsta === void 0 ? true : _useSealedState$unsta,
  27906. sealedOffset = _useSealedState.unstable_offset,
  27907. _useSealedState$unsta2 = _useSealedState.unstable_preventOverflow,
  27908. preventOverflow = _useSealedState$unsta2 === void 0 ? true : _useSealedState$unsta2,
  27909. _useSealedState$unsta3 = _useSealedState.unstable_fixed,
  27910. fixed = _useSealedState$unsta3 === void 0 ? false : _useSealedState$unsta3,
  27911. _useSealedState$modal = _useSealedState.modal,
  27912. modal = _useSealedState$modal === void 0 ? false : _useSealedState$modal,
  27913. sealed = _objectWithoutPropertiesLoose(_useSealedState, ["gutter", "placement", "unstable_flip", "unstable_offset", "unstable_preventOverflow", "unstable_fixed", "modal"]);
  27914. var popper = (0,external_React_namespaceObject.useRef)(null);
  27915. var referenceRef = (0,external_React_namespaceObject.useRef)(null);
  27916. var popoverRef = (0,external_React_namespaceObject.useRef)(null);
  27917. var arrowRef = (0,external_React_namespaceObject.useRef)(null);
  27918. var _React$useState = (0,external_React_namespaceObject.useState)(sealedPlacement),
  27919. originalPlacement = _React$useState[0],
  27920. place = _React$useState[1];
  27921. var _React$useState2 = (0,external_React_namespaceObject.useState)(sealedPlacement),
  27922. placement = _React$useState2[0],
  27923. setPlacement = _React$useState2[1];
  27924. var _React$useState3 = (0,external_React_namespaceObject.useState)(sealedOffset || [0, gutter]),
  27925. offset = _React$useState3[0];
  27926. var _React$useState4 = (0,external_React_namespaceObject.useState)({
  27927. position: "fixed",
  27928. left: "100%",
  27929. top: "100%"
  27930. }),
  27931. popoverStyles = _React$useState4[0],
  27932. setPopoverStyles = _React$useState4[1];
  27933. var _React$useState5 = (0,external_React_namespaceObject.useState)({}),
  27934. arrowStyles = _React$useState5[0],
  27935. setArrowStyles = _React$useState5[1];
  27936. var dialog = useDialogState(_objectSpread2({
  27937. modal: modal
  27938. }, sealed));
  27939. var update = (0,external_React_namespaceObject.useCallback)(function () {
  27940. if (popper.current) {
  27941. popper.current.forceUpdate();
  27942. return true;
  27943. }
  27944. return false;
  27945. }, []);
  27946. var updateState = (0,external_React_namespaceObject.useCallback)(function (state) {
  27947. if (state.placement) {
  27948. setPlacement(state.placement);
  27949. }
  27950. if (state.styles) {
  27951. setPopoverStyles(PopoverState_applyStyles(state.styles.popper));
  27952. if (arrowRef.current) {
  27953. setArrowStyles(PopoverState_applyStyles(state.styles.arrow));
  27954. }
  27955. }
  27956. }, []);
  27957. useIsomorphicEffect(function () {
  27958. if (referenceRef.current && popoverRef.current) {
  27959. popper.current = popper_createPopper(referenceRef.current, popoverRef.current, {
  27960. // https://popper.js.org/docs/v2/constructors/#options
  27961. placement: originalPlacement,
  27962. strategy: fixed ? "fixed" : "absolute",
  27963. // Safari needs styles to be applied in the first render, otherwise
  27964. // hovering over the popover when it gets visible for the first time
  27965. // will change its dimensions unexpectedly.
  27966. onFirstUpdate: isSafari ? updateState : undefined,
  27967. modifiers: [{
  27968. // https://popper.js.org/docs/v2/modifiers/event-listeners/
  27969. name: "eventListeners",
  27970. enabled: dialog.visible
  27971. }, {
  27972. // https://popper.js.org/docs/v2/modifiers/apply-styles/
  27973. name: "applyStyles",
  27974. enabled: false
  27975. }, {
  27976. // https://popper.js.org/docs/v2/modifiers/flip/
  27977. name: "flip",
  27978. enabled: flip,
  27979. options: {
  27980. padding: 8
  27981. }
  27982. }, {
  27983. // https://popper.js.org/docs/v2/modifiers/offset/
  27984. name: "offset",
  27985. options: {
  27986. offset: offset
  27987. }
  27988. }, {
  27989. // https://popper.js.org/docs/v2/modifiers/prevent-overflow/
  27990. name: "preventOverflow",
  27991. enabled: preventOverflow,
  27992. options: {
  27993. tetherOffset: function tetherOffset() {
  27994. var _arrowRef$current;
  27995. return ((_arrowRef$current = arrowRef.current) === null || _arrowRef$current === void 0 ? void 0 : _arrowRef$current.clientWidth) || 0;
  27996. }
  27997. }
  27998. }, {
  27999. // https://popper.js.org/docs/v2/modifiers/arrow/
  28000. name: "arrow",
  28001. enabled: !!arrowRef.current,
  28002. options: {
  28003. element: arrowRef.current
  28004. }
  28005. }, {
  28006. // https://popper.js.org/docs/v2/modifiers/#custom-modifiers
  28007. name: "updateState",
  28008. phase: "write",
  28009. requires: ["computeStyles"],
  28010. enabled: dialog.visible && "production" !== "test",
  28011. fn: function fn(_ref) {
  28012. var state = _ref.state;
  28013. return updateState(state);
  28014. }
  28015. }]
  28016. });
  28017. }
  28018. return function () {
  28019. if (popper.current) {
  28020. popper.current.destroy();
  28021. popper.current = null;
  28022. }
  28023. };
  28024. }, [originalPlacement, fixed, dialog.visible, flip, offset, preventOverflow]); // Ensure that the popover will be correctly positioned with an additional
  28025. // update.
  28026. (0,external_React_namespaceObject.useEffect)(function () {
  28027. if (!dialog.visible) return undefined;
  28028. var id = window.requestAnimationFrame(function () {
  28029. var _popper$current;
  28030. (_popper$current = popper.current) === null || _popper$current === void 0 ? void 0 : _popper$current.forceUpdate();
  28031. });
  28032. return function () {
  28033. window.cancelAnimationFrame(id);
  28034. };
  28035. }, [dialog.visible]);
  28036. return _objectSpread2(_objectSpread2({}, dialog), {}, {
  28037. unstable_referenceRef: referenceRef,
  28038. unstable_popoverRef: popoverRef,
  28039. unstable_arrowRef: arrowRef,
  28040. unstable_popoverStyles: popoverStyles,
  28041. unstable_arrowStyles: arrowStyles,
  28042. unstable_update: update,
  28043. unstable_originalPlacement: originalPlacement,
  28044. placement: placement,
  28045. place: place
  28046. });
  28047. }
  28048. ;// CONCATENATED MODULE: ./node_modules/reakit/es/__globalState-300469f0.js
  28049. var globalState = {
  28050. currentTooltipId: null,
  28051. listeners: new Set(),
  28052. subscribe: function subscribe(listener) {
  28053. var _this = this;
  28054. this.listeners.add(listener);
  28055. return function () {
  28056. _this.listeners.delete(listener);
  28057. };
  28058. },
  28059. show: function show(id) {
  28060. this.currentTooltipId = id;
  28061. this.listeners.forEach(function (listener) {
  28062. return listener(id);
  28063. });
  28064. },
  28065. hide: function hide(id) {
  28066. if (this.currentTooltipId === id) {
  28067. this.currentTooltipId = null;
  28068. this.listeners.forEach(function (listener) {
  28069. return listener(null);
  28070. });
  28071. }
  28072. }
  28073. };
  28074. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Tooltip/TooltipState.js
  28075. function useTooltipState(initialState) {
  28076. if (initialState === void 0) {
  28077. initialState = {};
  28078. }
  28079. var _useSealedState = useSealedState(initialState),
  28080. _useSealedState$place = _useSealedState.placement,
  28081. placement = _useSealedState$place === void 0 ? "top" : _useSealedState$place,
  28082. _useSealedState$unsta = _useSealedState.unstable_timeout,
  28083. initialTimeout = _useSealedState$unsta === void 0 ? 0 : _useSealedState$unsta,
  28084. sealed = _objectWithoutPropertiesLoose(_useSealedState, ["placement", "unstable_timeout"]);
  28085. var _React$useState = (0,external_React_namespaceObject.useState)(initialTimeout),
  28086. timeout = _React$useState[0],
  28087. setTimeout = _React$useState[1];
  28088. var showTimeout = (0,external_React_namespaceObject.useRef)(null);
  28089. var hideTimeout = (0,external_React_namespaceObject.useRef)(null);
  28090. var _usePopoverState = usePopoverState(_objectSpread2(_objectSpread2({}, sealed), {}, {
  28091. placement: placement
  28092. })),
  28093. modal = _usePopoverState.modal,
  28094. setModal = _usePopoverState.setModal,
  28095. popover = _objectWithoutPropertiesLoose(_usePopoverState, ["modal", "setModal"]);
  28096. var clearTimeouts = (0,external_React_namespaceObject.useCallback)(function () {
  28097. if (showTimeout.current !== null) {
  28098. window.clearTimeout(showTimeout.current);
  28099. }
  28100. if (hideTimeout.current !== null) {
  28101. window.clearTimeout(hideTimeout.current);
  28102. }
  28103. }, []);
  28104. var hide = (0,external_React_namespaceObject.useCallback)(function () {
  28105. clearTimeouts();
  28106. popover.hide(); // Let's give some time so people can move from a reference to another
  28107. // and still show tooltips immediately
  28108. hideTimeout.current = window.setTimeout(function () {
  28109. globalState.hide(popover.baseId);
  28110. }, timeout);
  28111. }, [clearTimeouts, popover.hide, timeout, popover.baseId]);
  28112. var show = (0,external_React_namespaceObject.useCallback)(function () {
  28113. clearTimeouts();
  28114. if (!timeout || globalState.currentTooltipId) {
  28115. // If there's no timeout or a tooltip visible already, we can show this
  28116. // immediately
  28117. globalState.show(popover.baseId);
  28118. popover.show();
  28119. } else {
  28120. // There may be a reference with focus whose tooltip is still not visible
  28121. // In this case, we want to update it before it gets shown.
  28122. globalState.show(null); // Otherwise, wait a little bit to show the tooltip
  28123. showTimeout.current = window.setTimeout(function () {
  28124. globalState.show(popover.baseId);
  28125. popover.show();
  28126. }, timeout);
  28127. }
  28128. }, [clearTimeouts, timeout, popover.show, popover.baseId]);
  28129. (0,external_React_namespaceObject.useEffect)(function () {
  28130. return globalState.subscribe(function (id) {
  28131. if (id !== popover.baseId) {
  28132. clearTimeouts();
  28133. if (popover.visible) {
  28134. // Make sure there will be only one tooltip visible
  28135. popover.hide();
  28136. }
  28137. }
  28138. });
  28139. }, [popover.baseId, clearTimeouts, popover.visible, popover.hide]);
  28140. (0,external_React_namespaceObject.useEffect)(function () {
  28141. return function () {
  28142. clearTimeouts();
  28143. globalState.hide(popover.baseId);
  28144. };
  28145. }, [clearTimeouts, popover.baseId]);
  28146. return _objectSpread2(_objectSpread2({}, popover), {}, {
  28147. hide: hide,
  28148. show: show,
  28149. unstable_timeout: timeout,
  28150. unstable_setTimeout: setTimeout
  28151. });
  28152. }
  28153. ;// CONCATENATED MODULE: ./node_modules/reakit/es/__keys-d101cb3b.js
  28154. // Automatically generated
  28155. 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"];
  28156. var TOOLTIP_KEYS = [].concat(TOOLTIP_STATE_KEYS, ["unstable_portal"]);
  28157. var TOOLTIP_ARROW_KEYS = TOOLTIP_STATE_KEYS;
  28158. var TOOLTIP_REFERENCE_KEYS = TOOLTIP_ARROW_KEYS;
  28159. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Tooltip/TooltipReference.js
  28160. var useTooltipReference = createHook({
  28161. name: "TooltipReference",
  28162. compose: useRole,
  28163. keys: TOOLTIP_REFERENCE_KEYS,
  28164. useProps: function useProps(options, _ref) {
  28165. var htmlRef = _ref.ref,
  28166. htmlOnFocus = _ref.onFocus,
  28167. htmlOnBlur = _ref.onBlur,
  28168. htmlOnMouseEnter = _ref.onMouseEnter,
  28169. htmlOnMouseLeave = _ref.onMouseLeave,
  28170. htmlProps = _objectWithoutPropertiesLoose(_ref, ["ref", "onFocus", "onBlur", "onMouseEnter", "onMouseLeave"]);
  28171. var onFocusRef = useLiveRef(htmlOnFocus);
  28172. var onBlurRef = useLiveRef(htmlOnBlur);
  28173. var onMouseEnterRef = useLiveRef(htmlOnMouseEnter);
  28174. var onMouseLeaveRef = useLiveRef(htmlOnMouseLeave);
  28175. var onFocus = (0,external_React_namespaceObject.useCallback)(function (event) {
  28176. var _onFocusRef$current, _options$show;
  28177. (_onFocusRef$current = onFocusRef.current) === null || _onFocusRef$current === void 0 ? void 0 : _onFocusRef$current.call(onFocusRef, event);
  28178. if (event.defaultPrevented) return;
  28179. (_options$show = options.show) === null || _options$show === void 0 ? void 0 : _options$show.call(options);
  28180. }, [options.show]);
  28181. var onBlur = (0,external_React_namespaceObject.useCallback)(function (event) {
  28182. var _onBlurRef$current, _options$hide;
  28183. (_onBlurRef$current = onBlurRef.current) === null || _onBlurRef$current === void 0 ? void 0 : _onBlurRef$current.call(onBlurRef, event);
  28184. if (event.defaultPrevented) return;
  28185. (_options$hide = options.hide) === null || _options$hide === void 0 ? void 0 : _options$hide.call(options);
  28186. }, [options.hide]);
  28187. var onMouseEnter = (0,external_React_namespaceObject.useCallback)(function (event) {
  28188. var _onMouseEnterRef$curr, _options$show2;
  28189. (_onMouseEnterRef$curr = onMouseEnterRef.current) === null || _onMouseEnterRef$curr === void 0 ? void 0 : _onMouseEnterRef$curr.call(onMouseEnterRef, event);
  28190. if (event.defaultPrevented) return;
  28191. (_options$show2 = options.show) === null || _options$show2 === void 0 ? void 0 : _options$show2.call(options);
  28192. }, [options.show]);
  28193. var onMouseLeave = (0,external_React_namespaceObject.useCallback)(function (event) {
  28194. var _onMouseLeaveRef$curr, _options$hide2;
  28195. (_onMouseLeaveRef$curr = onMouseLeaveRef.current) === null || _onMouseLeaveRef$curr === void 0 ? void 0 : _onMouseLeaveRef$curr.call(onMouseLeaveRef, event);
  28196. if (event.defaultPrevented) return;
  28197. (_options$hide2 = options.hide) === null || _options$hide2 === void 0 ? void 0 : _options$hide2.call(options);
  28198. }, [options.hide]);
  28199. return _objectSpread2({
  28200. ref: useForkRef(options.unstable_referenceRef, htmlRef),
  28201. tabIndex: 0,
  28202. onFocus: onFocus,
  28203. onBlur: onBlur,
  28204. onMouseEnter: onMouseEnter,
  28205. onMouseLeave: onMouseLeave,
  28206. "aria-describedby": options.baseId
  28207. }, htmlProps);
  28208. }
  28209. });
  28210. var TooltipReference = createComponent({
  28211. as: "div",
  28212. useHook: useTooltipReference
  28213. });
  28214. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/tooltip/context.js
  28215. /**
  28216. * WordPress dependencies
  28217. */
  28218. /**
  28219. * @type {import('react').Context<{ tooltip?: import('reakit').TooltipState }>}
  28220. */
  28221. const TooltipContext = (0,external_wp_element_namespaceObject.createContext)({});
  28222. const useTooltipContext = () => (0,external_wp_element_namespaceObject.useContext)(TooltipContext);
  28223. ;// CONCATENATED MODULE: ./node_modules/reakit/es/__keys-e6a5cfbe.js
  28224. // Automatically generated
  28225. var DISCLOSURE_STATE_KEYS = ["baseId", "unstable_idCountRef", "visible", "animated", "animating", "setBaseId", "show", "hide", "toggle", "setVisible", "setAnimated", "stopAnimation"];
  28226. var DISCLOSURE_KEYS = DISCLOSURE_STATE_KEYS;
  28227. var DISCLOSURE_CONTENT_KEYS = DISCLOSURE_KEYS;
  28228. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Disclosure/DisclosureContent.js
  28229. var useDisclosureContent = createHook({
  28230. name: "DisclosureContent",
  28231. compose: useRole,
  28232. keys: DISCLOSURE_CONTENT_KEYS,
  28233. useProps: function useProps(options, _ref) {
  28234. var htmlOnTransitionEnd = _ref.onTransitionEnd,
  28235. htmlOnAnimationEnd = _ref.onAnimationEnd,
  28236. htmlStyle = _ref.style,
  28237. htmlProps = _objectWithoutPropertiesLoose(_ref, ["onTransitionEnd", "onAnimationEnd", "style"]);
  28238. var animating = options.animated && options.animating;
  28239. var _React$useState = (0,external_React_namespaceObject.useState)(null),
  28240. transition = _React$useState[0],
  28241. setTransition = _React$useState[1];
  28242. var hidden = !options.visible && !animating;
  28243. var style = hidden ? _objectSpread2({
  28244. display: "none"
  28245. }, htmlStyle) : htmlStyle;
  28246. var onTransitionEndRef = useLiveRef(htmlOnTransitionEnd);
  28247. var onAnimationEndRef = useLiveRef(htmlOnAnimationEnd);
  28248. var raf = (0,external_React_namespaceObject.useRef)(0);
  28249. (0,external_React_namespaceObject.useEffect)(function () {
  28250. if (!options.animated) return undefined; // Double RAF is needed so the browser has enough time to paint the
  28251. // default styles before processing the `data-enter` attribute. Otherwise
  28252. // it wouldn't be considered a transition.
  28253. // See https://github.com/reakit/reakit/issues/643
  28254. raf.current = window.requestAnimationFrame(function () {
  28255. raf.current = window.requestAnimationFrame(function () {
  28256. if (options.visible) {
  28257. setTransition("enter");
  28258. } else if (animating) {
  28259. setTransition("leave");
  28260. } else {
  28261. setTransition(null);
  28262. }
  28263. });
  28264. });
  28265. return function () {
  28266. return window.cancelAnimationFrame(raf.current);
  28267. };
  28268. }, [options.animated, options.visible, animating]);
  28269. var onEnd = (0,external_React_namespaceObject.useCallback)(function (event) {
  28270. if (!isSelfTarget(event)) return;
  28271. if (!animating) return; // Ignores number animated
  28272. if (options.animated === true) {
  28273. var _options$stopAnimatio;
  28274. (_options$stopAnimatio = options.stopAnimation) === null || _options$stopAnimatio === void 0 ? void 0 : _options$stopAnimatio.call(options);
  28275. }
  28276. }, [options.animated, animating, options.stopAnimation]);
  28277. var onTransitionEnd = (0,external_React_namespaceObject.useCallback)(function (event) {
  28278. var _onTransitionEndRef$c;
  28279. (_onTransitionEndRef$c = onTransitionEndRef.current) === null || _onTransitionEndRef$c === void 0 ? void 0 : _onTransitionEndRef$c.call(onTransitionEndRef, event);
  28280. onEnd(event);
  28281. }, [onEnd]);
  28282. var onAnimationEnd = (0,external_React_namespaceObject.useCallback)(function (event) {
  28283. var _onAnimationEndRef$cu;
  28284. (_onAnimationEndRef$cu = onAnimationEndRef.current) === null || _onAnimationEndRef$cu === void 0 ? void 0 : _onAnimationEndRef$cu.call(onAnimationEndRef, event);
  28285. onEnd(event);
  28286. }, [onEnd]);
  28287. return _objectSpread2({
  28288. id: options.baseId,
  28289. "data-enter": transition === "enter" ? "" : undefined,
  28290. "data-leave": transition === "leave" ? "" : undefined,
  28291. onTransitionEnd: onTransitionEnd,
  28292. onAnimationEnd: onAnimationEnd,
  28293. hidden: hidden,
  28294. style: style
  28295. }, htmlProps);
  28296. }
  28297. });
  28298. var DisclosureContent = createComponent({
  28299. as: "div",
  28300. useHook: useDisclosureContent
  28301. });
  28302. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Portal/Portal.js
  28303. function getBodyElement() {
  28304. return canUseDOM ? document.body : null;
  28305. }
  28306. var PortalContext = /*#__PURE__*/(0,external_React_namespaceObject.createContext)(getBodyElement());
  28307. function Portal(_ref) {
  28308. var children = _ref.children;
  28309. // if it's a nested portal, context is the parent portal
  28310. // otherwise it's document.body
  28311. // https://github.com/reakit/reakit/issues/513
  28312. var context = (0,external_React_namespaceObject.useContext)(PortalContext) || getBodyElement();
  28313. var _React$useState = (0,external_React_namespaceObject.useState)(function () {
  28314. if (canUseDOM) {
  28315. var element = document.createElement("div");
  28316. element.className = Portal.__className;
  28317. return element;
  28318. } // ssr
  28319. return null;
  28320. }),
  28321. hostNode = _React$useState[0];
  28322. useIsomorphicEffect(function () {
  28323. if (!hostNode || !context) return undefined;
  28324. context.appendChild(hostNode);
  28325. return function () {
  28326. context.removeChild(hostNode);
  28327. };
  28328. }, [hostNode, context]);
  28329. if (hostNode) {
  28330. return /*#__PURE__*/(0,external_ReactDOM_namespaceObject.createPortal)( /*#__PURE__*/(0,external_React_namespaceObject.createElement)(PortalContext.Provider, {
  28331. value: hostNode
  28332. }, children), hostNode);
  28333. } // ssr
  28334. return null;
  28335. }
  28336. Portal.__className = "__reakit-portal";
  28337. Portal.__selector = "." + Portal.__className;
  28338. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Tooltip/Tooltip.js
  28339. function globallyHideTooltipOnEscape(event) {
  28340. if (event.defaultPrevented) return;
  28341. if (event.key === "Escape") {
  28342. globalState.show(null);
  28343. }
  28344. }
  28345. var useTooltip = createHook({
  28346. name: "Tooltip",
  28347. compose: useDisclosureContent,
  28348. keys: TOOLTIP_KEYS,
  28349. useOptions: function useOptions(_ref) {
  28350. var _ref$unstable_portal = _ref.unstable_portal,
  28351. unstable_portal = _ref$unstable_portal === void 0 ? true : _ref$unstable_portal,
  28352. options = _objectWithoutPropertiesLoose(_ref, ["unstable_portal"]);
  28353. return _objectSpread2({
  28354. unstable_portal: unstable_portal
  28355. }, options);
  28356. },
  28357. useProps: function useProps(options, _ref2) {
  28358. var htmlRef = _ref2.ref,
  28359. htmlStyle = _ref2.style,
  28360. htmlWrapElement = _ref2.wrapElement,
  28361. htmlProps = _objectWithoutPropertiesLoose(_ref2, ["ref", "style", "wrapElement"]);
  28362. (0,external_React_namespaceObject.useEffect)(function () {
  28363. var _options$unstable_pop;
  28364. var document = getDocument((_options$unstable_pop = options.unstable_popoverRef) === null || _options$unstable_pop === void 0 ? void 0 : _options$unstable_pop.current);
  28365. document.addEventListener("keydown", globallyHideTooltipOnEscape);
  28366. }, []);
  28367. var wrapElement = (0,external_React_namespaceObject.useCallback)(function (element) {
  28368. if (options.unstable_portal) {
  28369. element = /*#__PURE__*/(0,external_React_namespaceObject.createElement)(Portal, null, element);
  28370. }
  28371. if (htmlWrapElement) {
  28372. return htmlWrapElement(element);
  28373. }
  28374. return element;
  28375. }, [options.unstable_portal, htmlWrapElement]);
  28376. return _objectSpread2({
  28377. ref: useForkRef(options.unstable_popoverRef, htmlRef),
  28378. role: "tooltip",
  28379. style: _objectSpread2(_objectSpread2({}, options.unstable_popoverStyles), {}, {
  28380. pointerEvents: "none"
  28381. }, htmlStyle),
  28382. wrapElement: wrapElement
  28383. }, htmlProps);
  28384. }
  28385. });
  28386. var Tooltip_Tooltip = createComponent({
  28387. as: "div",
  28388. memo: true,
  28389. useHook: useTooltip
  28390. });
  28391. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/shortcut/component.js
  28392. /**
  28393. * External dependencies
  28394. */
  28395. /**
  28396. * Internal dependencies
  28397. */
  28398. function component_Shortcut(props, forwardedRef) {
  28399. const {
  28400. as: asProp = 'span',
  28401. shortcut,
  28402. className,
  28403. ...otherProps
  28404. } = useContextSystem(props, 'Shortcut');
  28405. if (!shortcut) {
  28406. return null;
  28407. }
  28408. let displayText;
  28409. let ariaLabel;
  28410. if (typeof shortcut === 'string') {
  28411. displayText = shortcut;
  28412. } else {
  28413. displayText = shortcut.display;
  28414. ariaLabel = shortcut.ariaLabel;
  28415. }
  28416. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({
  28417. as: asProp,
  28418. className: className,
  28419. "aria-label": ariaLabel,
  28420. ref: forwardedRef
  28421. }, otherProps), displayText);
  28422. }
  28423. const ConnectedShortcut = contextConnect(component_Shortcut, 'Shortcut');
  28424. /* harmony default export */ var shortcut_component = (ConnectedShortcut);
  28425. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/z-index.js
  28426. const Flyout = 10000;
  28427. const z_index_Tooltip = 1000002;
  28428. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/tooltip/styles.js
  28429. 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)."; }
  28430. /**
  28431. * External dependencies
  28432. */
  28433. /**
  28434. * Internal dependencies
  28435. */
  28436. 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;font-size:", config_values.fontSize, ";&[data-enter]{opacity:1;}" + ( true ? "" : 0), true ? "" : 0);
  28437. const TooltipPopoverView = emotion_styled_base_browser_esm("div", true ? {
  28438. target: "e7tfjmw1"
  28439. } : 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));
  28440. const noOutline = true ? {
  28441. name: "12mkfdx",
  28442. styles: "outline:none"
  28443. } : 0;
  28444. const TooltipShortcut = /*#__PURE__*/emotion_styled_base_browser_esm(shortcut_component, true ? {
  28445. target: "e7tfjmw0"
  28446. } : 0)("display:inline-block;margin-left:", space(1), ";" + ( true ? "" : 0));
  28447. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/tooltip/content.js
  28448. /**
  28449. * External dependencies
  28450. */
  28451. // eslint-disable-next-line no-restricted-imports
  28452. /**
  28453. * Internal dependencies
  28454. */
  28455. const {
  28456. TooltipPopoverView: content_TooltipPopoverView
  28457. } = tooltip_styles_namespaceObject;
  28458. /**
  28459. *
  28460. * @param {import('../context').WordPressComponentProps<import('./types').ContentProps, 'div'>} props
  28461. * @param {import('react').ForwardedRef<any>} forwardedRef
  28462. */
  28463. function content_TooltipContent(props, forwardedRef) {
  28464. const {
  28465. children,
  28466. className,
  28467. ...otherProps
  28468. } = useContextSystem(props, 'TooltipContent');
  28469. const {
  28470. tooltip
  28471. } = useTooltipContext();
  28472. const cx = useCx();
  28473. const classes = cx(TooltipContent, className);
  28474. return (0,external_wp_element_namespaceObject.createElement)(Tooltip_Tooltip, extends_extends({
  28475. as: component
  28476. }, otherProps, tooltip, {
  28477. className: classes,
  28478. ref: forwardedRef
  28479. }), (0,external_wp_element_namespaceObject.createElement)(content_TooltipPopoverView, null, children));
  28480. }
  28481. /* harmony default export */ var tooltip_content = (contextConnect(content_TooltipContent, 'TooltipContent'));
  28482. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/tooltip/component.js
  28483. /**
  28484. * External dependencies
  28485. */
  28486. // eslint-disable-next-line no-restricted-imports
  28487. /**
  28488. * WordPress dependencies
  28489. */
  28490. /**
  28491. * Internal dependencies
  28492. */
  28493. /**
  28494. * @param {import('../context').WordPressComponentProps<import('./types').Props, 'div'>} props
  28495. * @param {import('react').ForwardedRef<any>} forwardedRef
  28496. */
  28497. function component_Tooltip(props, forwardedRef) {
  28498. const {
  28499. animated = true,
  28500. animationDuration = 160,
  28501. baseId,
  28502. children,
  28503. content,
  28504. focusable = true,
  28505. gutter = 4,
  28506. id,
  28507. modal = true,
  28508. placement,
  28509. visible = false,
  28510. shortcut,
  28511. ...otherProps
  28512. } = useContextSystem(props, 'Tooltip');
  28513. const tooltip = useTooltipState({
  28514. animated: animated ? animationDuration : undefined,
  28515. baseId: baseId || id,
  28516. gutter,
  28517. placement,
  28518. visible,
  28519. ...otherProps
  28520. });
  28521. const contextProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
  28522. tooltip
  28523. }), [tooltip]);
  28524. return (0,external_wp_element_namespaceObject.createElement)(TooltipContext.Provider, {
  28525. value: contextProps
  28526. }, content && (0,external_wp_element_namespaceObject.createElement)(tooltip_content, {
  28527. unstable_portal: modal,
  28528. ref: forwardedRef
  28529. }, content, shortcut && (0,external_wp_element_namespaceObject.createElement)(TooltipShortcut, {
  28530. shortcut: shortcut
  28531. })), children && (0,external_wp_element_namespaceObject.createElement)(TooltipReference, extends_extends({}, tooltip, children.props, {
  28532. // @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)
  28533. ref: children === null || children === void 0 ? void 0 : children.ref
  28534. }), referenceProps => {
  28535. if (!focusable) {
  28536. referenceProps.tabIndex = undefined;
  28537. }
  28538. return (0,external_wp_element_namespaceObject.cloneElement)(children, referenceProps);
  28539. }));
  28540. }
  28541. /**
  28542. * `Tooltip` is a component that provides context for a user interface element.
  28543. *
  28544. * @example
  28545. * ```jsx
  28546. * import { Tooltip, Text } from `@wordpress/components/ui`;
  28547. *
  28548. * function Example() {
  28549. * return (
  28550. * <Tooltip content="Code is Poetry">
  28551. * <Text>WordPress.org</Text>
  28552. * </Tooltip>
  28553. * )
  28554. * }
  28555. * ```
  28556. */
  28557. const ConnectedTooltip = contextConnect(component_Tooltip, 'Tooltip');
  28558. /* harmony default export */ var tooltip_component = (ConnectedTooltip);
  28559. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/color-copy-button.js
  28560. /**
  28561. * WordPress dependencies
  28562. */
  28563. /**
  28564. * Internal dependencies
  28565. */
  28566. const ColorCopyButton = props => {
  28567. const {
  28568. color,
  28569. colorType
  28570. } = props;
  28571. const [copiedColor, setCopiedColor] = (0,external_wp_element_namespaceObject.useState)(null);
  28572. const copyTimer = (0,external_wp_element_namespaceObject.useRef)();
  28573. const copyRef = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(() => {
  28574. switch (colorType) {
  28575. case 'hsl':
  28576. {
  28577. return color.toHslString();
  28578. }
  28579. case 'rgb':
  28580. {
  28581. return color.toRgbString();
  28582. }
  28583. default:
  28584. case 'hex':
  28585. {
  28586. return color.toHex();
  28587. }
  28588. }
  28589. }, () => {
  28590. if (copyTimer.current) {
  28591. clearTimeout(copyTimer.current);
  28592. }
  28593. setCopiedColor(color.toHex());
  28594. copyTimer.current = setTimeout(() => {
  28595. setCopiedColor(null);
  28596. copyTimer.current = undefined;
  28597. }, 3000);
  28598. });
  28599. (0,external_wp_element_namespaceObject.useEffect)(() => {
  28600. // Clear copyTimer on component unmount.
  28601. return () => {
  28602. if (copyTimer.current) {
  28603. clearTimeout(copyTimer.current);
  28604. }
  28605. };
  28606. }, []);
  28607. return (0,external_wp_element_namespaceObject.createElement)(tooltip_component, {
  28608. content: (0,external_wp_element_namespaceObject.createElement)(text_component, {
  28609. color: "white"
  28610. }, copiedColor === color.toHex() ? (0,external_wp_i18n_namespaceObject.__)('Copied!') : (0,external_wp_i18n_namespaceObject.__)('Copy')),
  28611. placement: "bottom"
  28612. }, (0,external_wp_element_namespaceObject.createElement)(CopyButton, {
  28613. isSmall: true,
  28614. ref: copyRef,
  28615. icon: library_copy,
  28616. showTooltip: false
  28617. }));
  28618. };
  28619. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/input-with-slider.js
  28620. /**
  28621. * Internal dependencies
  28622. */
  28623. const InputWithSlider = _ref => {
  28624. let {
  28625. min,
  28626. max,
  28627. label,
  28628. abbreviation,
  28629. onChange,
  28630. value
  28631. } = _ref;
  28632. return (0,external_wp_element_namespaceObject.createElement)(h_stack_component, {
  28633. spacing: 4
  28634. }, (0,external_wp_element_namespaceObject.createElement)(NumberControlWrapper, {
  28635. min: min,
  28636. max: max,
  28637. label: label,
  28638. hideLabelFromVision: true,
  28639. value: value // @ts-expect-error TODO: Resolve discrepancy in NumberControl
  28640. ,
  28641. onChange: onChange,
  28642. prefix: (0,external_wp_element_namespaceObject.createElement)(spacer_component, {
  28643. as: text_component,
  28644. paddingLeft: space(4),
  28645. color: COLORS.ui.theme,
  28646. lineHeight: 1
  28647. }, abbreviation),
  28648. hideHTMLArrows: true,
  28649. size: "__unstable-large"
  28650. }), (0,external_wp_element_namespaceObject.createElement)(styles_RangeControl, {
  28651. label: label,
  28652. hideLabelFromVision: true,
  28653. min: min,
  28654. max: max,
  28655. value: value // @ts-expect-error
  28656. // See: https://github.com/WordPress/gutenberg/pull/40535#issuecomment-1172418185
  28657. ,
  28658. onChange: onChange,
  28659. withInputField: false
  28660. }));
  28661. };
  28662. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/rgb-input.js
  28663. /**
  28664. * External dependencies
  28665. */
  28666. /**
  28667. * Internal dependencies
  28668. */
  28669. const RgbInput = _ref => {
  28670. let {
  28671. color,
  28672. onChange,
  28673. enableAlpha
  28674. } = _ref;
  28675. const {
  28676. r,
  28677. g,
  28678. b,
  28679. a
  28680. } = color.toRgb();
  28681. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(InputWithSlider, {
  28682. min: 0,
  28683. max: 255,
  28684. label: "Red",
  28685. abbreviation: "R",
  28686. value: r,
  28687. onChange: nextR => onChange(colord_w({
  28688. r: nextR,
  28689. g,
  28690. b,
  28691. a
  28692. }))
  28693. }), (0,external_wp_element_namespaceObject.createElement)(InputWithSlider, {
  28694. min: 0,
  28695. max: 255,
  28696. label: "Green",
  28697. abbreviation: "G",
  28698. value: g,
  28699. onChange: nextG => onChange(colord_w({
  28700. r,
  28701. g: nextG,
  28702. b,
  28703. a
  28704. }))
  28705. }), (0,external_wp_element_namespaceObject.createElement)(InputWithSlider, {
  28706. min: 0,
  28707. max: 255,
  28708. label: "Blue",
  28709. abbreviation: "B",
  28710. value: b,
  28711. onChange: nextB => onChange(colord_w({
  28712. r,
  28713. g,
  28714. b: nextB,
  28715. a
  28716. }))
  28717. }), enableAlpha && (0,external_wp_element_namespaceObject.createElement)(InputWithSlider, {
  28718. min: 0,
  28719. max: 100,
  28720. label: "Alpha",
  28721. abbreviation: "A",
  28722. value: Math.trunc(a * 100),
  28723. onChange: nextA => onChange(colord_w({
  28724. r,
  28725. g,
  28726. b,
  28727. a: nextA / 100
  28728. }))
  28729. }));
  28730. };
  28731. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/hsl-input.js
  28732. /**
  28733. * External dependencies
  28734. */
  28735. /**
  28736. * Internal dependencies
  28737. */
  28738. const HslInput = _ref => {
  28739. let {
  28740. color,
  28741. onChange,
  28742. enableAlpha
  28743. } = _ref;
  28744. const {
  28745. h,
  28746. s,
  28747. l,
  28748. a
  28749. } = color.toHsl();
  28750. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(InputWithSlider, {
  28751. min: 0,
  28752. max: 359,
  28753. label: "Hue",
  28754. abbreviation: "H",
  28755. value: h,
  28756. onChange: nextH => {
  28757. onChange(colord_w({
  28758. h: nextH,
  28759. s,
  28760. l,
  28761. a
  28762. }));
  28763. }
  28764. }), (0,external_wp_element_namespaceObject.createElement)(InputWithSlider, {
  28765. min: 0,
  28766. max: 100,
  28767. label: "Saturation",
  28768. abbreviation: "S",
  28769. value: s,
  28770. onChange: nextS => {
  28771. onChange(colord_w({
  28772. h,
  28773. s: nextS,
  28774. l,
  28775. a
  28776. }));
  28777. }
  28778. }), (0,external_wp_element_namespaceObject.createElement)(InputWithSlider, {
  28779. min: 0,
  28780. max: 100,
  28781. label: "Lightness",
  28782. abbreviation: "L",
  28783. value: l,
  28784. onChange: nextL => {
  28785. onChange(colord_w({
  28786. h,
  28787. s,
  28788. l: nextL,
  28789. a
  28790. }));
  28791. }
  28792. }), enableAlpha && (0,external_wp_element_namespaceObject.createElement)(InputWithSlider, {
  28793. min: 0,
  28794. max: 100,
  28795. label: "Alpha",
  28796. abbreviation: "A",
  28797. value: Math.trunc(100 * a),
  28798. onChange: nextA => {
  28799. onChange(colord_w({
  28800. h,
  28801. s,
  28802. l,
  28803. a: nextA / 100
  28804. }));
  28805. }
  28806. }));
  28807. };
  28808. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/hex-input.js
  28809. /**
  28810. * External dependencies
  28811. */
  28812. /**
  28813. * WordPress dependencies
  28814. */
  28815. /**
  28816. * Internal dependencies
  28817. */
  28818. const HexInput = _ref => {
  28819. let {
  28820. color,
  28821. onChange,
  28822. enableAlpha
  28823. } = _ref;
  28824. const handleChange = nextValue => {
  28825. if (!nextValue) return;
  28826. const hexValue = nextValue.startsWith('#') ? nextValue : '#' + nextValue;
  28827. onChange(colord_w(hexValue));
  28828. };
  28829. const stateReducer = (state, action) => {
  28830. var _action$payload, _action$payload$event, _state$value, _state$value2;
  28831. const nativeEvent = (_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : (_action$payload$event = _action$payload.event) === null || _action$payload$event === void 0 ? void 0 : _action$payload$event.nativeEvent;
  28832. if ('insertFromPaste' !== (nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.inputType)) {
  28833. return { ...state
  28834. };
  28835. }
  28836. const value = (_state$value = state.value) !== null && _state$value !== void 0 && _state$value.startsWith('#') ? state.value.slice(1).toUpperCase() : (_state$value2 = state.value) === null || _state$value2 === void 0 ? void 0 : _state$value2.toUpperCase();
  28837. return { ...state,
  28838. value
  28839. };
  28840. };
  28841. return (0,external_wp_element_namespaceObject.createElement)(InputControl, {
  28842. prefix: (0,external_wp_element_namespaceObject.createElement)(spacer_component, {
  28843. as: text_component,
  28844. marginLeft: space(4),
  28845. color: COLORS.ui.theme,
  28846. lineHeight: 1
  28847. }, "#"),
  28848. value: color.toHex().slice(1).toUpperCase(),
  28849. onChange: handleChange,
  28850. maxLength: enableAlpha ? 9 : 7,
  28851. label: (0,external_wp_i18n_namespaceObject.__)('Hex color'),
  28852. hideLabelFromVision: true,
  28853. size: "__unstable-large",
  28854. __unstableStateReducer: stateReducer,
  28855. __unstableInputWidth: "9em"
  28856. });
  28857. };
  28858. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/color-input.js
  28859. /**
  28860. * External dependencies
  28861. */
  28862. /**
  28863. * Internal dependencies
  28864. */
  28865. const ColorInput = _ref => {
  28866. let {
  28867. colorType,
  28868. color,
  28869. onChange,
  28870. enableAlpha
  28871. } = _ref;
  28872. const props = {
  28873. color,
  28874. onChange,
  28875. enableAlpha
  28876. };
  28877. switch (colorType) {
  28878. case 'hsl':
  28879. return (0,external_wp_element_namespaceObject.createElement)(HslInput, props);
  28880. case 'rgb':
  28881. return (0,external_wp_element_namespaceObject.createElement)(RgbInput, props);
  28882. default:
  28883. case 'hex':
  28884. return (0,external_wp_element_namespaceObject.createElement)(HexInput, props);
  28885. }
  28886. };
  28887. ;// CONCATENATED MODULE: ./node_modules/react-colorful/dist/index.mjs
  28888. function dist_u(){return(dist_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 dist_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 dist_i(e){var t=(0,external_React_namespaceObject.useRef)(e),n=(0,external_React_namespaceObject.useRef)(function(e){t.current&&t.current(e)});return t.current=e,n.current}var dist_s=function(e,r,t){return void 0===r&&(r=0),void 0===t&&(t=1),e>t?t:e<r?r:e},dist_f=function(e){return"touches"in e},dist_v=function(e){return e&&e.ownerDocument.defaultView||self},dist_d=function(e,r,t){var n=e.getBoundingClientRect(),o=dist_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:dist_s((o.pageX-(n.left+dist_v(e).pageXOffset))/n.width),top:dist_s((o.pageY-(n.top+dist_v(e).pageYOffset))/n.height)}},dist_h=function(e){!dist_f(e)&&e.preventDefault()},dist_m=external_React_namespaceObject.memo(function(o){var a=o.onMove,l=o.onKey,s=dist_c(o,["onMove","onKey"]),m=(0,external_React_namespaceObject.useRef)(null),g=dist_i(a),p=dist_i(l),b=(0,external_React_namespaceObject.useRef)(null),_=(0,external_React_namespaceObject.useRef)(!1),x=(0,external_React_namespaceObject.useMemo)(function(){var e=function(e){dist_h(e),(dist_f(e)?e.touches.length>0:e.buttons>0)&&m.current?g(dist_d(m.current,e,b.current)):t(!1)},r=function(){return t(!1)};function t(t){var n=_.current,o=dist_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&&(dist_h(r),!function(e,r){return r&&!dist_f(e)}(r,_.current)&&n)){if(dist_f(r)){_.current=!0;var o=r.changedTouches||[];o.length&&(b.current=o[0].identifier)}n.focus(),g(dist_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_namespaceObject.useEffect)(function(){return H},[H]),external_React_namespaceObject.createElement("div",dist_u({},s,{onTouchStart:C,onMouseDown:C,className:"react-colorful__interactive",ref:m,onKeyDown:E,tabIndex:0,role:"slider"}))}),dist_g=function(e){return e.filter(Boolean).join(" ")},dist_p=function(r){var t=r.color,n=r.left,o=r.top,a=void 0===o?.5:o,l=dist_g(["react-colorful__pointer",r.className]);return external_React_namespaceObject.createElement("div",{className:l,style:{top:100*a+"%",left:100*n+"%"}},external_React_namespaceObject.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},dist_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)},dist_x=function(e){return dist_L(dist_C(e))},dist_C=function(e){return"#"===e[0]&&(e=e.substring(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:4===e.length?dist_b(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:8===e.length?dist_b(parseInt(e.substring(6,8),16)/255,2):1}},dist_E=function(e,r){return void 0===r&&(r="deg"),Number(e)*(_[r]||1)},dist_H=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?dist_N({h:dist_E(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}},dist_M=dist_H,dist_N=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}},dist_w=function(e){return K(dist_I(e))},dist_y=function(e){var r=e.s,t=e.v,n=e.a,o=(200-r)*t/100;return{h:dist_b(e.h),s:dist_b(o>0&&o<200?r*t/100/(o<=100?o:200-o)*100:0),l:dist_b(o/2),a:dist_b(n,2)}},q=function(e){var r=dist_y(e);return"hsl("+r.h+", "+r.s+"%, "+r.l+"%)"},dist_k=function(e){var r=dist_y(e);return"hsla("+r.h+", "+r.s+"%, "+r.l+"%, "+r.a+")"},dist_I=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:dist_b(255*[n,u,l,l,c,n][i]),g:dist_b(255*[c,n,n,u,l,l][i]),b:dist_b(255*[l,l,c,n,n,u][i]),a:dist_b(o,2)}},dist_O=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?dist_A({h:dist_E(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}},dist_j=dist_O,dist_z=function(e){var r=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return r?dist_L({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}},B=dist_z,dist_D=function(e){var r=e.toString(16);return r.length<2?"0"+r:r},K=function(e){var r=e.r,t=e.g,n=e.b,o=e.a,a=o<1?dist_D(dist_b(255*o)):"";return"#"+dist_D(r)+dist_D(t)+dist_D(n)+a},dist_L=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:dist_b(60*(u<0?u+6:u)),s:dist_b(a?l/a*100:0),v:dist_b(a/255*100),a:o}},dist_A=function(e){return{h:dist_b(e.h),s:dist_b(e.s),v:dist_b(e.v),a:dist_b(e.a,2)}},dist_S=external_React_namespaceObject.memo(function(r){var t=r.hue,n=r.onChange,o=dist_g(["react-colorful__hue",r.className]);return external_React_namespaceObject.createElement("div",{className:o},external_React_namespaceObject.createElement(dist_m,{onMove:function(e){n({h:360*e.left})},onKey:function(e){n({h:dist_s(t+360*e.left,0,360)})},"aria-label":"Hue","aria-valuenow":dist_b(t),"aria-valuemax":"360","aria-valuemin":"0"},external_React_namespaceObject.createElement(dist_p,{className:"react-colorful__hue-pointer",left:t/360,color:q({h:t,s:100,v:100,a:1})})))}),dist_T=external_React_namespaceObject.memo(function(r){var t=r.hsva,n=r.onChange,o={backgroundColor:q({h:t.h,s:100,v:100,a:1})};return external_React_namespaceObject.createElement("div",{className:"react-colorful__saturation",style:o},external_React_namespaceObject.createElement(dist_m,{onMove:function(e){n({s:100*e.left,v:100-100*e.top})},onKey:function(e){n({s:dist_s(t.s+100*e.left,0,100),v:dist_s(t.v-100*e.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+dist_b(t.s)+"%, Brightness "+dist_b(t.v)+"%"},external_React_namespaceObject.createElement(dist_p,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:q(t)})))}),F=function(e,r){if(e===r)return!0;for(var t in e)if(e[t]!==r[t])return!1;return!0},dist_P=function(e,r){return e.replace(/\s/g,"")===r.replace(/\s/g,"")},X=function(e,r){return e.toLowerCase()===r.toLowerCase()||F(dist_C(e),dist_C(r))};function Y(e,t,l){var u=dist_i(l),c=(0,external_React_namespaceObject.useState)(function(){return e.toHsva(t)}),s=c[0],f=c[1],v=(0,external_React_namespaceObject.useRef)({color:t,hsva:s});(0,external_React_namespaceObject.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_namespaceObject.useEffect)(function(){var r;F(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_namespaceObject.useCallback)(function(e){f(function(r){return Object.assign({},r,e)})},[]);return[s,d]}var dist_R,dist_V="undefined"!=typeof window?external_React_namespaceObject.useLayoutEffect:external_React_namespaceObject.useEffect,dist_$=function(){return dist_R||( true?__webpack_require__.nc:0)},G=function(e){dist_R=e},J=new Map,Q=function(e){dist_V(function(){var r=e.current?e.current.ownerDocument:document;if(void 0!==r&&!J.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}',J.set(r,t);var n=dist_$();n&&t.setAttribute("nonce",n),r.head.appendChild(t)}},[])},U=function(t){var n=t.className,o=t.colorModel,a=t.color,l=void 0===a?o.defaultColor:a,i=t.onChange,s=dist_c(t,["className","colorModel","color","onChange"]),f=(0,external_React_namespaceObject.useRef)(null);Q(f);var v=Y(o,l,i),d=v[0],h=v[1],m=dist_g(["react-colorful",n]);return external_React_namespaceObject.createElement("div",dist_u({},s,{ref:f,className:m}),external_React_namespaceObject.createElement(dist_T,{hsva:d,onChange:h}),external_React_namespaceObject.createElement(dist_S,{hue:d.h,onChange:h,className:"react-colorful__last-control"}))},dist_W={defaultColor:"000",toHsva:dist_x,fromHsva:function(e){return dist_w({h:e.h,s:e.s,v:e.v,a:1})},equal:X},Z=function(r){return e.createElement(U,dist_u({},r,{colorModel:dist_W}))},ee=function(r){var t=r.className,n=r.hsva,o=r.onChange,a={backgroundImage:"linear-gradient(90deg, "+dist_k(Object.assign({},n,{a:0}))+", "+dist_k(Object.assign({},n,{a:1}))+")"},l=dist_g(["react-colorful__alpha",t]),u=dist_b(100*n.a);return external_React_namespaceObject.createElement("div",{className:l},external_React_namespaceObject.createElement("div",{className:"react-colorful__alpha-gradient",style:a}),external_React_namespaceObject.createElement(dist_m,{onMove:function(e){o({a:e.left})},onKey:function(e){o({a:dist_s(n.a+e.left)})},"aria-label":"Alpha","aria-valuetext":u+"%","aria-valuenow":u,"aria-valuemin":"0","aria-valuemax":"100"},external_React_namespaceObject.createElement(dist_p,{className:"react-colorful__alpha-pointer",left:n.a,color:dist_k(n)})))},re=function(t){var n=t.className,o=t.colorModel,a=t.color,l=void 0===a?o.defaultColor:a,i=t.onChange,s=dist_c(t,["className","colorModel","color","onChange"]),f=(0,external_React_namespaceObject.useRef)(null);Q(f);var v=Y(o,l,i),d=v[0],h=v[1],m=dist_g(["react-colorful",n]);return external_React_namespaceObject.createElement("div",dist_u({},s,{ref:f,className:m}),external_React_namespaceObject.createElement(dist_T,{hsva:d,onChange:h}),external_React_namespaceObject.createElement(dist_S,{hue:d.h,onChange:h}),external_React_namespaceObject.createElement(ee,{hsva:d,onChange:h,className:"react-colorful__last-control"}))},te={defaultColor:"0001",toHsva:dist_x,fromHsva:dist_w,equal:X},ne=function(r){return e.createElement(re,dist_u({},r,{colorModel:te}))},oe={defaultColor:{h:0,s:0,l:0,a:1},toHsva:dist_N,fromHsva:dist_y,equal:F},ae=function(r){return e.createElement(re,dist_u({},r,{colorModel:oe}))},le={defaultColor:"hsla(0, 0%, 0%, 1)",toHsva:dist_H,fromHsva:dist_k,equal:dist_P},ue=function(r){return e.createElement(re,dist_u({},r,{colorModel:le}))},ce={defaultColor:{h:0,s:0,l:0},toHsva:function(e){return dist_N({h:e.h,s:e.s,l:e.l,a:1})},fromHsva:function(e){return{h:(r=dist_y(e)).h,s:r.s,l:r.l};var r},equal:F},ie=function(r){return e.createElement(U,dist_u({},r,{colorModel:ce}))},se={defaultColor:"hsl(0, 0%, 0%)",toHsva:dist_M,fromHsva:q,equal:dist_P},fe=function(r){return e.createElement(U,dist_u({},r,{colorModel:se}))},ve={defaultColor:{h:0,s:0,v:0,a:1},toHsva:function(e){return e},fromHsva:dist_A,equal:F},de=function(r){return e.createElement(re,dist_u({},r,{colorModel:ve}))},he={defaultColor:"hsva(0, 0%, 0%, 1)",toHsva:dist_O,fromHsva:function(e){var r=dist_A(e);return"hsva("+r.h+", "+r.s+"%, "+r.v+"%, "+r.a+")"},equal:dist_P},me=function(r){return e.createElement(re,dist_u({},r,{colorModel:he}))},ge={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=dist_A(e);return{h:r.h,s:r.s,v:r.v}},equal:F},pe=function(r){return e.createElement(U,dist_u({},r,{colorModel:ge}))},be={defaultColor:"hsv(0, 0%, 0%)",toHsva:dist_j,fromHsva:function(e){var r=dist_A(e);return"hsv("+r.h+", "+r.s+"%, "+r.v+"%)"},equal:dist_P},_e=function(r){return e.createElement(U,dist_u({},r,{colorModel:be}))},xe={defaultColor:{r:0,g:0,b:0,a:1},toHsva:dist_L,fromHsva:dist_I,equal:F},Ce=function(r){return e.createElement(re,dist_u({},r,{colorModel:xe}))},Ee={defaultColor:"rgba(0, 0, 0, 1)",toHsva:dist_z,fromHsva:function(e){var r=dist_I(e);return"rgba("+r.r+", "+r.g+", "+r.b+", "+r.a+")"},equal:dist_P},He=function(r){return external_React_namespaceObject.createElement(re,dist_u({},r,{colorModel:Ee}))},Me={defaultColor:{r:0,g:0,b:0},toHsva:function(e){return dist_L({r:e.r,g:e.g,b:e.b,a:1})},fromHsva:function(e){return{r:(r=dist_I(e)).r,g:r.g,b:r.b};var r},equal:F},Ne=function(r){return e.createElement(U,dist_u({},r,{colorModel:Me}))},we={defaultColor:"rgb(0, 0, 0)",toHsva:B,fromHsva:function(e){var r=dist_I(e);return"rgb("+r.r+", "+r.g+", "+r.b+")"},equal:dist_P},ye=function(r){return external_React_namespaceObject.createElement(U,dist_u({},r,{colorModel:we}))},qe=/^#?([0-9A-F]{3,8})$/i,ke=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=dist_c(r,["color","onChange","onBlur","escape","validate","format","process"]),p=o(function(){return v(l)}),b=p[0],_=p[1],x=dist_i(s),C=dist_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",dist_u({},g,{value:h?h(b):b,spellCheck:"false",onChange:E,onBlur:H}))},Ie=function(e){return"#"+e},Oe=function(r){var t=r.prefixed,n=r.alpha,o=dist_c(r,["prefixed","alpha"]),l=a(function(e){return e.replace(/([^0-9A-F]+)/gi,"").substring(0,n?8:6)},[n]),i=a(function(e){return function(e,r){var t=qe.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(ke,dist_u({},o,{escape:l,format:t?Ie:void 0,process:Ie,validate:i}))};
  28889. //# sourceMappingURL=index.module.js.map
  28890. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/picker.js
  28891. /**
  28892. * External dependencies
  28893. */
  28894. /**
  28895. * WordPress dependencies
  28896. */
  28897. const Picker = _ref => {
  28898. let {
  28899. color,
  28900. enableAlpha,
  28901. onChange
  28902. } = _ref;
  28903. const Component = enableAlpha ? He : ye;
  28904. const rgbColor = (0,external_wp_element_namespaceObject.useMemo)(() => color.toRgbString(), [color]);
  28905. return (0,external_wp_element_namespaceObject.createElement)(Component, {
  28906. color: rgbColor,
  28907. onChange: nextColor => {
  28908. onChange(colord_w(nextColor));
  28909. }
  28910. });
  28911. };
  28912. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/hooks/use-controlled-value.js
  28913. /**
  28914. * WordPress dependencies
  28915. */
  28916. /**
  28917. * Simplified and improved implementation of useControlledState.
  28918. *
  28919. * @param props
  28920. * @param props.defaultValue
  28921. * @param props.value
  28922. * @param props.onChange
  28923. * @return The controlled value and the value setter.
  28924. */
  28925. function useControlledValue(_ref) {
  28926. let {
  28927. defaultValue,
  28928. onChange,
  28929. value: valueProp
  28930. } = _ref;
  28931. const hasValue = typeof valueProp !== 'undefined';
  28932. const initialValue = hasValue ? valueProp : defaultValue;
  28933. const [state, setState] = (0,external_wp_element_namespaceObject.useState)(initialValue);
  28934. const value = hasValue ? valueProp : state;
  28935. let setValue;
  28936. if (hasValue && typeof onChange === 'function') {
  28937. setValue = onChange;
  28938. } else if (!hasValue && typeof onChange === 'function') {
  28939. setValue = nextValue => {
  28940. onChange(nextValue);
  28941. setState(nextValue);
  28942. };
  28943. } else {
  28944. setValue = setState;
  28945. }
  28946. return [value, setValue];
  28947. }
  28948. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/component.js
  28949. /**
  28950. * External dependencies
  28951. */
  28952. /**
  28953. * WordPress dependencies
  28954. */
  28955. /**
  28956. * Internal dependencies
  28957. */
  28958. colord_k([plugins_names]);
  28959. const options = [{
  28960. label: 'RGB',
  28961. value: 'rgb'
  28962. }, {
  28963. label: 'HSL',
  28964. value: 'hsl'
  28965. }, {
  28966. label: 'Hex',
  28967. value: 'hex'
  28968. }];
  28969. const ColorPicker = (props, forwardedRef) => {
  28970. const {
  28971. enableAlpha = false,
  28972. color: colorProp,
  28973. onChange,
  28974. defaultValue = '#fff',
  28975. copyFormat,
  28976. ...divProps
  28977. } = useContextSystem(props, 'ColorPicker'); // Use a safe default value for the color and remove the possibility of `undefined`.
  28978. const [color, setColor] = useControlledValue({
  28979. onChange,
  28980. value: colorProp,
  28981. defaultValue
  28982. });
  28983. const safeColordColor = (0,external_wp_element_namespaceObject.useMemo)(() => {
  28984. return colord_w(color || '');
  28985. }, [color]);
  28986. const debouncedSetColor = (0,external_wp_compose_namespaceObject.useDebounce)(setColor);
  28987. const handleChange = (0,external_wp_element_namespaceObject.useCallback)(nextValue => {
  28988. debouncedSetColor(nextValue.toHex());
  28989. }, [debouncedSetColor]);
  28990. const [colorType, setColorType] = (0,external_wp_element_namespaceObject.useState)(copyFormat || 'hex');
  28991. return (0,external_wp_element_namespaceObject.createElement)(ColorfulWrapper, extends_extends({
  28992. ref: forwardedRef
  28993. }, divProps), (0,external_wp_element_namespaceObject.createElement)(Picker, {
  28994. onChange: handleChange,
  28995. color: safeColordColor,
  28996. enableAlpha: enableAlpha
  28997. }), (0,external_wp_element_namespaceObject.createElement)(AuxiliaryColorArtefactWrapper, null, (0,external_wp_element_namespaceObject.createElement)(AuxiliaryColorArtefactHStackHeader, {
  28998. justify: "space-between"
  28999. }, (0,external_wp_element_namespaceObject.createElement)(styles_SelectControl, {
  29000. options: options,
  29001. value: colorType,
  29002. onChange: nextColorType => setColorType(nextColorType),
  29003. label: (0,external_wp_i18n_namespaceObject.__)('Color format'),
  29004. hideLabelFromVision: true
  29005. }), (0,external_wp_element_namespaceObject.createElement)(ColorCopyButton, {
  29006. color: safeColordColor,
  29007. colorType: copyFormat || colorType
  29008. })), (0,external_wp_element_namespaceObject.createElement)(ColorInputWrapper, {
  29009. direction: "column",
  29010. gap: 2
  29011. }, (0,external_wp_element_namespaceObject.createElement)(ColorInput, {
  29012. colorType: colorType,
  29013. color: safeColordColor,
  29014. onChange: handleChange,
  29015. enableAlpha: enableAlpha
  29016. }))));
  29017. };
  29018. const ConnectedColorPicker = contextConnect(ColorPicker, 'ColorPicker');
  29019. /* harmony default export */ var color_picker_component = (ConnectedColorPicker);
  29020. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/use-deprecated-props.js
  29021. /**
  29022. * External dependencies
  29023. */
  29024. /**
  29025. * WordPress dependencies
  29026. */
  29027. /**
  29028. * Internal dependencies
  29029. */
  29030. function isLegacyProps(props) {
  29031. var _props$color;
  29032. 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';
  29033. }
  29034. function getColorFromLegacyProps(color) {
  29035. if (color === undefined) return;
  29036. if (typeof color === 'string') return color;
  29037. if (color.hex) return color.hex;
  29038. return undefined;
  29039. }
  29040. const transformColorStringToLegacyColor = memize_default()(color => {
  29041. const colordColor = colord_w(color);
  29042. const hex = colordColor.toHex();
  29043. const rgb = colordColor.toRgb();
  29044. const hsv = colordColor.toHsv();
  29045. const hsl = colordColor.toHsl();
  29046. return {
  29047. hex,
  29048. rgb,
  29049. hsv,
  29050. hsl,
  29051. source: 'hex',
  29052. oldHue: hsl.h
  29053. };
  29054. });
  29055. function use_deprecated_props_useDeprecatedProps(props) {
  29056. const {
  29057. onChangeComplete
  29058. } = props;
  29059. const legacyChangeHandler = (0,external_wp_element_namespaceObject.useCallback)(color => {
  29060. onChangeComplete(transformColorStringToLegacyColor(color));
  29061. }, [onChangeComplete]);
  29062. if (isLegacyProps(props)) {
  29063. return {
  29064. color: getColorFromLegacyProps(props.color),
  29065. enableAlpha: !props.disableAlpha,
  29066. onChange: legacyChangeHandler
  29067. };
  29068. }
  29069. return { ...props,
  29070. color: props.color,
  29071. enableAlpha: props.enableAlpha,
  29072. onChange: props.onChange
  29073. };
  29074. }
  29075. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/legacy-adapter.js
  29076. /**
  29077. * Internal dependencies
  29078. */
  29079. const LegacyAdapter = props => {
  29080. return (0,external_wp_element_namespaceObject.createElement)(color_picker_component, use_deprecated_props_useDeprecatedProps(props));
  29081. };
  29082. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js
  29083. /**
  29084. * WordPress dependencies
  29085. */
  29086. const check = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  29087. xmlns: "http://www.w3.org/2000/svg",
  29088. viewBox: "0 0 24 24"
  29089. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  29090. d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"
  29091. }));
  29092. /* harmony default export */ var library_check = (check);
  29093. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/circular-option-picker/index.js
  29094. // @ts-nocheck
  29095. /**
  29096. * External dependencies
  29097. */
  29098. /**
  29099. * WordPress dependencies
  29100. */
  29101. /**
  29102. * Internal dependencies
  29103. */
  29104. function Option(props) {
  29105. const {
  29106. className,
  29107. isSelected,
  29108. selectedIconProps,
  29109. tooltipText,
  29110. ...additionalProps
  29111. } = props;
  29112. const optionButton = (0,external_wp_element_namespaceObject.createElement)(build_module_button, extends_extends({
  29113. isPressed: isSelected,
  29114. className: "components-circular-option-picker__option"
  29115. }, additionalProps));
  29116. return (0,external_wp_element_namespaceObject.createElement)("div", {
  29117. className: classnames_default()(className, 'components-circular-option-picker__option-wrapper')
  29118. }, tooltipText ? (0,external_wp_element_namespaceObject.createElement)(tooltip, {
  29119. text: tooltipText
  29120. }, optionButton) : optionButton, isSelected && (0,external_wp_element_namespaceObject.createElement)(icons_build_module_icon, extends_extends({
  29121. icon: library_check
  29122. }, selectedIconProps ? selectedIconProps : {})));
  29123. }
  29124. function DropdownLinkAction(props) {
  29125. const {
  29126. buttonProps,
  29127. className,
  29128. dropdownProps,
  29129. linkText
  29130. } = props;
  29131. return (0,external_wp_element_namespaceObject.createElement)(Dropdown, extends_extends({
  29132. className: classnames_default()('components-circular-option-picker__dropdown-link-action', className),
  29133. renderToggle: _ref => {
  29134. let {
  29135. isOpen,
  29136. onToggle
  29137. } = _ref;
  29138. return (0,external_wp_element_namespaceObject.createElement)(build_module_button, extends_extends({
  29139. "aria-expanded": isOpen,
  29140. "aria-haspopup": "true",
  29141. onClick: onToggle,
  29142. variant: "link"
  29143. }, buttonProps), linkText);
  29144. }
  29145. }, dropdownProps));
  29146. }
  29147. function ButtonAction(props) {
  29148. const {
  29149. className,
  29150. children,
  29151. ...additionalProps
  29152. } = props;
  29153. return (0,external_wp_element_namespaceObject.createElement)(build_module_button, extends_extends({
  29154. className: classnames_default()('components-circular-option-picker__clear', className),
  29155. variant: "tertiary"
  29156. }, additionalProps), children);
  29157. }
  29158. function CircularOptionPicker(props) {
  29159. const {
  29160. actions,
  29161. className,
  29162. options,
  29163. children
  29164. } = props;
  29165. return (0,external_wp_element_namespaceObject.createElement)("div", {
  29166. className: classnames_default()('components-circular-option-picker', className)
  29167. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  29168. className: "components-circular-option-picker__swatches"
  29169. }, options), children, actions && (0,external_wp_element_namespaceObject.createElement)("div", {
  29170. className: "components-circular-option-picker__custom-clear-wrapper"
  29171. }, actions));
  29172. }
  29173. CircularOptionPicker.Option = Option;
  29174. CircularOptionPicker.ButtonAction = ButtonAction;
  29175. CircularOptionPicker.DropdownLinkAction = DropdownLinkAction;
  29176. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/v-stack/hook.js
  29177. /**
  29178. * Internal dependencies
  29179. */
  29180. function useVStack(props) {
  29181. const {
  29182. expanded = false,
  29183. ...otherProps
  29184. } = useContextSystem(props, 'VStack');
  29185. const hStackProps = useHStack({
  29186. direction: 'column',
  29187. expanded,
  29188. ...otherProps
  29189. });
  29190. return hStackProps;
  29191. }
  29192. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/v-stack/component.js
  29193. /**
  29194. * External dependencies
  29195. */
  29196. /**
  29197. * Internal dependencies
  29198. */
  29199. function UnconnectedVStack(props, forwardedRef) {
  29200. const vStackProps = useVStack(props);
  29201. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, vStackProps, {
  29202. ref: forwardedRef
  29203. }));
  29204. }
  29205. /**
  29206. * `VStack` (or Vertical Stack) is a layout component that arranges child
  29207. * elements in a vertical line.
  29208. *
  29209. * `VStack` can render anything inside.
  29210. *
  29211. * ```jsx
  29212. * import {
  29213. * __experimentalText as Text,
  29214. * __experimentalVStack as VStack,
  29215. * } from `@wordpress/components`;
  29216. *
  29217. * function Example() {
  29218. * return (
  29219. * <VStack>
  29220. * <Text>Code</Text>
  29221. * <Text>is</Text>
  29222. * <Text>Poetry</Text>
  29223. * </VStack>
  29224. * );
  29225. * }
  29226. * ```
  29227. */
  29228. const VStack = contextConnect(UnconnectedVStack, 'VStack');
  29229. /* harmony default export */ var v_stack_component = (VStack);
  29230. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/truncate/component.js
  29231. /**
  29232. * External dependencies
  29233. */
  29234. /**
  29235. * Internal dependencies
  29236. */
  29237. function UnconnectedTruncate(props, forwardedRef) {
  29238. const truncateProps = useTruncate(props);
  29239. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({
  29240. as: "span"
  29241. }, truncateProps, {
  29242. ref: forwardedRef
  29243. }));
  29244. }
  29245. /**
  29246. * `Truncate` is a typography primitive that trims text content.
  29247. * For almost all cases, it is recommended that `Text`, `Heading`, or
  29248. * `Subheading` is used to render text content. However,`Truncate` is
  29249. * available for custom implementations.
  29250. *
  29251. * ```jsx
  29252. * import { __experimentalTruncate as Truncate } from `@wordpress/components`;
  29253. *
  29254. * function Example() {
  29255. * return (
  29256. * <Truncate>
  29257. * Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ex
  29258. * neque, vulputate a diam et, luctus convallis lacus. Vestibulum ac
  29259. * mollis mi. Morbi id elementum massa.
  29260. * </Truncate>
  29261. * );
  29262. * }
  29263. * ```
  29264. */
  29265. const component_Truncate = contextConnect(UnconnectedTruncate, 'Truncate');
  29266. /* harmony default export */ var truncate_component = (component_Truncate);
  29267. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/heading/hook.js
  29268. /**
  29269. * Internal dependencies
  29270. */
  29271. function useHeading(props) {
  29272. const {
  29273. as: asProp,
  29274. level = 2,
  29275. ...otherProps
  29276. } = useContextSystem(props, 'Heading');
  29277. const as = asProp || `h${level}`;
  29278. const a11yProps = {};
  29279. if (typeof as === 'string' && as[0] !== 'h') {
  29280. // If not a semantic `h` element, add a11y props:
  29281. a11yProps.role = 'heading';
  29282. a11yProps['aria-level'] = typeof level === 'string' ? parseInt(level) : level;
  29283. }
  29284. const textProps = useText({
  29285. color: COLORS.gray[900],
  29286. size: getHeadingFontSize(level),
  29287. isBlock: true,
  29288. weight: config_values.fontWeightHeading,
  29289. ...otherProps
  29290. });
  29291. return { ...textProps,
  29292. ...a11yProps,
  29293. as
  29294. };
  29295. }
  29296. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/heading/component.js
  29297. /**
  29298. * External dependencies
  29299. */
  29300. /**
  29301. * Internal dependencies
  29302. */
  29303. function UnconnectedHeading(props, forwardedRef) {
  29304. const headerProps = useHeading(props);
  29305. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, headerProps, {
  29306. ref: forwardedRef
  29307. }));
  29308. }
  29309. /**
  29310. * `Heading` renders headings and titles using the library's typography system.
  29311. *
  29312. * ```jsx
  29313. * import { __experimentalHeading as Heading } from "@wordpress/components";
  29314. *
  29315. * function Example() {
  29316. * return <Heading>Code is Poetry</Heading>;
  29317. * }
  29318. * ```
  29319. */
  29320. const Heading = contextConnect(UnconnectedHeading, 'Heading');
  29321. /* harmony default export */ var heading_component = (Heading);
  29322. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-palette/styles.js
  29323. 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)."; }
  29324. /**
  29325. * External dependencies
  29326. */
  29327. /**
  29328. * Internal dependencies
  29329. */
  29330. const ColorHeading = /*#__PURE__*/emotion_styled_base_browser_esm(heading_component, true ? {
  29331. target: "ev9wop70"
  29332. } : 0)( true ? {
  29333. name: "13lxv2o",
  29334. styles: "text-transform:uppercase;line-height:24px;font-weight:500;&&&{font-size:11px;margin-bottom:0;}"
  29335. } : 0);
  29336. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/dropdown/styles.js
  29337. /**
  29338. * External dependencies
  29339. */
  29340. /**
  29341. * Internal dependencies
  29342. */
  29343. const padding = _ref => {
  29344. let {
  29345. paddingSize = 'small'
  29346. } = _ref;
  29347. if (paddingSize === 'none') return;
  29348. const paddingValues = {
  29349. small: space(2),
  29350. medium: space(4)
  29351. };
  29352. return /*#__PURE__*/emotion_react_browser_esm_css("padding:", paddingValues[paddingSize] || paddingValues.small, ";" + ( true ? "" : 0), true ? "" : 0);
  29353. };
  29354. const DropdownContentWrapperDiv = emotion_styled_base_browser_esm("div", true ? {
  29355. target: "eovvns30"
  29356. } : 0)("margin-left:", space(-2), ";margin-right:", space(-2), ";&:first-of-type{margin-top:", space(-2), ";}&:last-of-type{margin-bottom:", space(-2), ";}", padding, ";" + ( true ? "" : 0));
  29357. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/dropdown/dropdown-content-wrapper.js
  29358. /**
  29359. * External dependencies
  29360. */
  29361. /**
  29362. * Internal dependencies
  29363. */
  29364. function UnconnectedDropdownContentWrapper(props, forwardedRef) {
  29365. const {
  29366. paddingSize = 'small',
  29367. ...derivedProps
  29368. } = useContextSystem(props, 'DropdownContentWrapper');
  29369. return (0,external_wp_element_namespaceObject.createElement)(DropdownContentWrapperDiv, extends_extends({}, derivedProps, {
  29370. paddingSize: paddingSize,
  29371. ref: forwardedRef
  29372. }));
  29373. }
  29374. /**
  29375. * A convenience wrapper for the `renderContent` when you want to apply
  29376. * different padding. (Default is `paddingSize="small"`).
  29377. *
  29378. * ```jsx
  29379. * import {
  29380. * Dropdown,
  29381. * __experimentalDropdownContentWrapper as DropdownContentWrapper,
  29382. * } from '@wordpress/components';
  29383. *
  29384. * <Dropdown
  29385. * renderContent={ () => (
  29386. * <DropdownContentWrapper paddingSize="medium">
  29387. * My dropdown content
  29388. * </DropdownContentWrapper>
  29389. * ) }
  29390. * />
  29391. * ```
  29392. */
  29393. const DropdownContentWrapper = contextConnect(UnconnectedDropdownContentWrapper, 'DropdownContentWrapper');
  29394. /* harmony default export */ var dropdown_content_wrapper = (DropdownContentWrapper);
  29395. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-palette/index.js
  29396. /**
  29397. * External dependencies
  29398. */
  29399. /**
  29400. * WordPress dependencies
  29401. */
  29402. /**
  29403. * Internal dependencies
  29404. */
  29405. colord_k([plugins_names, a11y]);
  29406. function SinglePalette(_ref) {
  29407. let {
  29408. className,
  29409. clearColor,
  29410. colors,
  29411. onChange,
  29412. value,
  29413. actions
  29414. } = _ref;
  29415. const colorOptions = (0,external_wp_element_namespaceObject.useMemo)(() => {
  29416. return colors.map((_ref2, index) => {
  29417. let {
  29418. color,
  29419. name
  29420. } = _ref2;
  29421. const colordColor = colord_w(color);
  29422. const isSelected = value === color;
  29423. return (0,external_wp_element_namespaceObject.createElement)(CircularOptionPicker.Option, {
  29424. key: `${color}-${index}`,
  29425. isSelected: isSelected,
  29426. selectedIconProps: isSelected ? {
  29427. fill: colordColor.contrast() > colordColor.contrast('#000') ? '#fff' : '#000'
  29428. } : {},
  29429. tooltipText: name || // translators: %s: color hex code e.g: "#f00".
  29430. (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Color code: %s'), color),
  29431. style: {
  29432. backgroundColor: color,
  29433. color
  29434. },
  29435. onClick: isSelected ? clearColor : () => onChange(color),
  29436. "aria-label": name ? // translators: %s: The name of the color e.g: "vivid red".
  29437. (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Color: %s'), name) : // translators: %s: color hex code e.g: "#f00".
  29438. (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Color code: %s'), color)
  29439. });
  29440. });
  29441. }, [colors, value, onChange, clearColor]);
  29442. if (colors.length === 0) {
  29443. return null;
  29444. }
  29445. return (0,external_wp_element_namespaceObject.createElement)(CircularOptionPicker, {
  29446. className: className,
  29447. options: colorOptions,
  29448. actions: actions
  29449. });
  29450. }
  29451. function MultiplePalettes(_ref3) {
  29452. let {
  29453. className,
  29454. clearColor,
  29455. colors,
  29456. onChange,
  29457. value,
  29458. actions
  29459. } = _ref3;
  29460. if (colors.length === 0) {
  29461. return null;
  29462. }
  29463. return (0,external_wp_element_namespaceObject.createElement)(v_stack_component, {
  29464. spacing: 3,
  29465. className: className
  29466. }, colors.map((_ref4, index) => {
  29467. let {
  29468. name,
  29469. colors: colorPalette
  29470. } = _ref4;
  29471. return (0,external_wp_element_namespaceObject.createElement)(v_stack_component, {
  29472. spacing: 2,
  29473. key: index
  29474. }, (0,external_wp_element_namespaceObject.createElement)(ColorHeading, null, name), (0,external_wp_element_namespaceObject.createElement)(SinglePalette, {
  29475. clearColor: clearColor,
  29476. colors: colorPalette,
  29477. onChange: onChange,
  29478. value: value,
  29479. actions: colors.length === index + 1 ? actions : null
  29480. }));
  29481. }));
  29482. }
  29483. function CustomColorPickerDropdown(_ref5) {
  29484. let {
  29485. isRenderedInSidebar,
  29486. popoverProps: receivedPopoverProps,
  29487. ...props
  29488. } = _ref5;
  29489. const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
  29490. shift: true,
  29491. ...(isRenderedInSidebar ? {
  29492. // When in the sidebar: open to the left (stacking),
  29493. // leaving the same gap as the parent popover.
  29494. placement: 'left-start',
  29495. offset: 34
  29496. } : {
  29497. // Default behavior: open below the anchor
  29498. placement: 'bottom',
  29499. offset: 8
  29500. }),
  29501. ...receivedPopoverProps
  29502. }), [isRenderedInSidebar, receivedPopoverProps]);
  29503. return (0,external_wp_element_namespaceObject.createElement)(Dropdown, extends_extends({
  29504. contentClassName: "components-color-palette__custom-color-dropdown-content",
  29505. popoverProps: popoverProps
  29506. }, props));
  29507. }
  29508. const extractColorNameFromCurrentValue = function (currentValue) {
  29509. let colors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  29510. let showMultiplePalettes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  29511. if (!currentValue) {
  29512. return '';
  29513. }
  29514. const currentValueIsCssVariable = /^var\(/.test(currentValue);
  29515. const normalizedCurrentValue = currentValueIsCssVariable ? currentValue : colord_w(currentValue).toHex(); // Normalize format of `colors` to simplify the following loop
  29516. const colorPalettes = showMultiplePalettes ? colors : [{
  29517. colors: colors
  29518. }];
  29519. for (const {
  29520. colors: paletteColors
  29521. } of colorPalettes) {
  29522. for (const {
  29523. name: colorName,
  29524. color: colorValue
  29525. } of paletteColors) {
  29526. const normalizedColorValue = currentValueIsCssVariable ? colorValue : colord_w(colorValue).toHex();
  29527. if (normalizedCurrentValue === normalizedColorValue) {
  29528. return colorName;
  29529. }
  29530. }
  29531. } // translators: shown when the user has picked a custom color (i.e not in the palette of colors).
  29532. return (0,external_wp_i18n_namespaceObject.__)('Custom');
  29533. };
  29534. const showTransparentBackground = currentValue => {
  29535. if (typeof currentValue === 'undefined') {
  29536. return true;
  29537. }
  29538. return colord_w(currentValue).alpha() === 0;
  29539. };
  29540. const areColorsMultiplePalette = colors => {
  29541. return colors.every(colorObj => Array.isArray(colorObj.colors));
  29542. };
  29543. function UnforwardedColorPalette(props, forwardedRef) {
  29544. const {
  29545. clearable = true,
  29546. colors = [],
  29547. disableCustomColors = false,
  29548. enableAlpha,
  29549. onChange,
  29550. value,
  29551. __experimentalHasMultipleOrigins = false,
  29552. __experimentalIsRenderedInSidebar = false,
  29553. ...otherProps
  29554. } = props;
  29555. const clearColor = (0,external_wp_element_namespaceObject.useCallback)(() => onChange(undefined), [onChange]);
  29556. const buttonLabelName = (0,external_wp_element_namespaceObject.useMemo)(() => extractColorNameFromCurrentValue(value, colors, __experimentalHasMultipleOrigins), [value, colors, __experimentalHasMultipleOrigins]); // Make sure that the `colors` array has a format (single/multiple) that is
  29557. // compatible with the `__experimentalHasMultipleOrigins` flag. This is true
  29558. // when __experimentalHasMultipleOrigins and areColorsMultiplePalette() are
  29559. // either both `true` or both `false`.
  29560. if (colors.length > 0 && __experimentalHasMultipleOrigins !== areColorsMultiplePalette(colors)) {
  29561. // eslint-disable-next-line no-console
  29562. console.warn('wp.components.ColorPalette: please specify a format for the `colors` prop that is compatible with the `__experimentalHasMultipleOrigins` prop.');
  29563. return null;
  29564. }
  29565. const renderCustomColorPicker = () => (0,external_wp_element_namespaceObject.createElement)(dropdown_content_wrapper, {
  29566. paddingSize: "none"
  29567. }, (0,external_wp_element_namespaceObject.createElement)(LegacyAdapter, {
  29568. color: value,
  29569. onChange: color => onChange(color),
  29570. enableAlpha: enableAlpha
  29571. }));
  29572. const colordColor = colord_w(value !== null && value !== void 0 ? value : '');
  29573. const valueWithoutLeadingHash = value !== null && value !== void 0 && value.startsWith('#') ? value.substring(1) : value !== null && value !== void 0 ? value : '';
  29574. 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".
  29575. (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.');
  29576. const paletteCommonProps = {
  29577. clearable,
  29578. clearColor,
  29579. onChange,
  29580. value,
  29581. actions: !!clearable && (0,external_wp_element_namespaceObject.createElement)(CircularOptionPicker.ButtonAction, {
  29582. onClick: clearColor
  29583. }, (0,external_wp_i18n_namespaceObject.__)('Clear'))
  29584. };
  29585. return (0,external_wp_element_namespaceObject.createElement)(v_stack_component, extends_extends({
  29586. spacing: 3,
  29587. ref: forwardedRef
  29588. }, otherProps), !disableCustomColors && (0,external_wp_element_namespaceObject.createElement)(CustomColorPickerDropdown, {
  29589. isRenderedInSidebar: __experimentalIsRenderedInSidebar,
  29590. renderContent: renderCustomColorPicker,
  29591. renderToggle: _ref6 => {
  29592. let {
  29593. isOpen,
  29594. onToggle
  29595. } = _ref6;
  29596. return (0,external_wp_element_namespaceObject.createElement)(flex_component, {
  29597. as: 'button',
  29598. justify: "space-between",
  29599. align: "flex-start",
  29600. className: "components-color-palette__custom-color",
  29601. "aria-expanded": isOpen,
  29602. "aria-haspopup": "true",
  29603. onClick: onToggle,
  29604. "aria-label": customColorAccessibleLabel,
  29605. style: showTransparentBackground(value) ? {
  29606. color: '#000'
  29607. } : {
  29608. background: value,
  29609. color: colordColor.contrast() > colordColor.contrast('#000') ? '#fff' : '#000'
  29610. }
  29611. }, (0,external_wp_element_namespaceObject.createElement)(flex_item_component, {
  29612. isBlock: true,
  29613. as: truncate_component,
  29614. className: "components-color-palette__custom-color-name"
  29615. }, buttonLabelName), (0,external_wp_element_namespaceObject.createElement)(flex_item_component, {
  29616. as: "span",
  29617. className: "components-color-palette__custom-color-value"
  29618. }, valueWithoutLeadingHash));
  29619. }
  29620. }), __experimentalHasMultipleOrigins ? (0,external_wp_element_namespaceObject.createElement)(MultiplePalettes, extends_extends({}, paletteCommonProps, {
  29621. colors: colors
  29622. })) : (0,external_wp_element_namespaceObject.createElement)(SinglePalette, extends_extends({}, paletteCommonProps, {
  29623. colors: colors
  29624. })));
  29625. }
  29626. /**
  29627. * Allows the user to pick a color from a list of pre-defined color entries.
  29628. *
  29629. * ```jsx
  29630. * import { ColorPalette } from '@wordpress/components';
  29631. * import { useState } from '@wordpress/element';
  29632. *
  29633. * const MyColorPalette = () => {
  29634. * const [ color, setColor ] = useState ( '#f00' )
  29635. * const colors = [
  29636. * { name: 'red', color: '#f00' },
  29637. * { name: 'white', color: '#fff' },
  29638. * { name: 'blue', color: '#00f' },
  29639. * ];
  29640. * return (
  29641. * <ColorPalette
  29642. * colors={ colors }
  29643. * value={ color }
  29644. * onChange={ ( color ) => setColor( color ) }
  29645. * />
  29646. * );
  29647. * } );
  29648. * ```
  29649. */
  29650. const ColorPalette = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedColorPalette);
  29651. /* harmony default export */ var color_palette = (ColorPalette);
  29652. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/unit-control/utils.js
  29653. /**
  29654. * WordPress dependencies
  29655. */
  29656. /**
  29657. * Internal dependencies
  29658. */
  29659. const isWeb = external_wp_element_namespaceObject.Platform.OS === 'web';
  29660. const allUnits = {
  29661. px: {
  29662. value: 'px',
  29663. label: isWeb ? 'px' : (0,external_wp_i18n_namespaceObject.__)('Pixels (px)'),
  29664. a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Pixels (px)'),
  29665. step: 1
  29666. },
  29667. '%': {
  29668. value: '%',
  29669. label: isWeb ? '%' : (0,external_wp_i18n_namespaceObject.__)('Percentage (%)'),
  29670. a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Percent (%)'),
  29671. step: 0.1
  29672. },
  29673. em: {
  29674. value: 'em',
  29675. label: isWeb ? 'em' : (0,external_wp_i18n_namespaceObject.__)('Relative to parent font size (em)'),
  29676. a11yLabel: (0,external_wp_i18n_namespaceObject._x)('ems', 'Relative to parent font size (em)'),
  29677. step: 0.01
  29678. },
  29679. rem: {
  29680. value: 'rem',
  29681. label: isWeb ? 'rem' : (0,external_wp_i18n_namespaceObject.__)('Relative to root font size (rem)'),
  29682. a11yLabel: (0,external_wp_i18n_namespaceObject._x)('rems', 'Relative to root font size (rem)'),
  29683. step: 0.01
  29684. },
  29685. vw: {
  29686. value: 'vw',
  29687. label: isWeb ? 'vw' : (0,external_wp_i18n_namespaceObject.__)('Viewport width (vw)'),
  29688. a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Viewport width (vw)'),
  29689. step: 0.1
  29690. },
  29691. vh: {
  29692. value: 'vh',
  29693. label: isWeb ? 'vh' : (0,external_wp_i18n_namespaceObject.__)('Viewport height (vh)'),
  29694. a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Viewport height (vh)'),
  29695. step: 0.1
  29696. },
  29697. vmin: {
  29698. value: 'vmin',
  29699. label: isWeb ? 'vmin' : (0,external_wp_i18n_namespaceObject.__)('Viewport smallest dimension (vmin)'),
  29700. a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Viewport smallest dimension (vmin)'),
  29701. step: 0.1
  29702. },
  29703. vmax: {
  29704. value: 'vmax',
  29705. label: isWeb ? 'vmax' : (0,external_wp_i18n_namespaceObject.__)('Viewport largest dimension (vmax)'),
  29706. a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Viewport largest dimension (vmax)'),
  29707. step: 0.1
  29708. },
  29709. ch: {
  29710. value: 'ch',
  29711. label: isWeb ? 'ch' : (0,external_wp_i18n_namespaceObject.__)('Width of the zero (0) character (ch)'),
  29712. a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Width of the zero (0) character (ch)'),
  29713. step: 0.01
  29714. },
  29715. ex: {
  29716. value: 'ex',
  29717. label: isWeb ? 'ex' : (0,external_wp_i18n_namespaceObject.__)('x-height of the font (ex)'),
  29718. a11yLabel: (0,external_wp_i18n_namespaceObject.__)('x-height of the font (ex)'),
  29719. step: 0.01
  29720. },
  29721. cm: {
  29722. value: 'cm',
  29723. label: isWeb ? 'cm' : (0,external_wp_i18n_namespaceObject.__)('Centimeters (cm)'),
  29724. a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Centimeters (cm)'),
  29725. step: 0.001
  29726. },
  29727. mm: {
  29728. value: 'mm',
  29729. label: isWeb ? 'mm' : (0,external_wp_i18n_namespaceObject.__)('Millimeters (mm)'),
  29730. a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Millimeters (mm)'),
  29731. step: 0.1
  29732. },
  29733. in: {
  29734. value: 'in',
  29735. label: isWeb ? 'in' : (0,external_wp_i18n_namespaceObject.__)('Inches (in)'),
  29736. a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Inches (in)'),
  29737. step: 0.001
  29738. },
  29739. pc: {
  29740. value: 'pc',
  29741. label: isWeb ? 'pc' : (0,external_wp_i18n_namespaceObject.__)('Picas (pc)'),
  29742. a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Picas (pc)'),
  29743. step: 1
  29744. },
  29745. pt: {
  29746. value: 'pt',
  29747. label: isWeb ? 'pt' : (0,external_wp_i18n_namespaceObject.__)('Points (pt)'),
  29748. a11yLabel: (0,external_wp_i18n_namespaceObject.__)('Points (pt)'),
  29749. step: 1
  29750. }
  29751. };
  29752. /**
  29753. * An array of all available CSS length units.
  29754. */
  29755. const ALL_CSS_UNITS = Object.values(allUnits);
  29756. /**
  29757. * Units of measurements. `a11yLabel` is used by screenreaders.
  29758. */
  29759. const CSS_UNITS = [allUnits.px, allUnits['%'], allUnits.em, allUnits.rem, allUnits.vw, allUnits.vh];
  29760. const DEFAULT_UNIT = allUnits.px;
  29761. /**
  29762. * Handles legacy value + unit handling.
  29763. * This component use to manage both incoming value and units separately.
  29764. *
  29765. * Moving forward, ideally the value should be a string that contains both
  29766. * the value and unit, example: '10px'
  29767. *
  29768. * @param rawValue The raw value as a string (may or may not contain the unit)
  29769. * @param fallbackUnit The unit used as a fallback, if not unit is detected in the `value`
  29770. * @param allowedUnits Units to derive from.
  29771. * @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value
  29772. * could not be parsed to a number correctly. The unit can be `undefined` in case the unit parse
  29773. * from the raw value could not be matched against the list of allowed units.
  29774. */
  29775. function getParsedQuantityAndUnit(rawValue, fallbackUnit, allowedUnits) {
  29776. const initialValue = fallbackUnit ? `${rawValue !== null && rawValue !== void 0 ? rawValue : ''}${fallbackUnit}` : rawValue;
  29777. return parseQuantityAndUnitFromRawValue(initialValue, allowedUnits);
  29778. }
  29779. /**
  29780. * Checks if units are defined.
  29781. *
  29782. * @param units List of units.
  29783. * @return Whether the list actually contains any units.
  29784. */
  29785. function hasUnits(units) {
  29786. // Although the `isArray` check shouldn't be necessary (given the signature of
  29787. // this typed function), it's better to stay on the side of caution, since
  29788. // this function may be called from un-typed environments.
  29789. return Array.isArray(units) && !!units.length;
  29790. }
  29791. /**
  29792. * Parses a quantity and unit from a raw string value, given a list of allowed
  29793. * units and otherwise falling back to the default unit.
  29794. *
  29795. * @param rawValue The raw value as a string (may or may not contain the unit)
  29796. * @param allowedUnits Units to derive from.
  29797. * @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value
  29798. * could not be parsed to a number correctly. The unit can be `undefined` in case the unit parsed
  29799. * from the raw value could not be matched against the list of allowed units.
  29800. */
  29801. function parseQuantityAndUnitFromRawValue(rawValue) {
  29802. var _trimmedValue, _unitMatch$;
  29803. let allowedUnits = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ALL_CSS_UNITS;
  29804. let trimmedValue;
  29805. let quantityToReturn;
  29806. if (typeof rawValue !== 'undefined' || rawValue === null) {
  29807. trimmedValue = `${rawValue}`.trim();
  29808. const parsedQuantity = parseFloat(trimmedValue);
  29809. quantityToReturn = !isFinite(parsedQuantity) ? undefined : parsedQuantity;
  29810. }
  29811. const unitMatch = (_trimmedValue = trimmedValue) === null || _trimmedValue === void 0 ? void 0 : _trimmedValue.match(/[\d.\-\+]*\s*(.*)/);
  29812. const matchedUnit = unitMatch === null || unitMatch === void 0 ? void 0 : (_unitMatch$ = unitMatch[1]) === null || _unitMatch$ === void 0 ? void 0 : _unitMatch$.toLowerCase();
  29813. let unitToReturn;
  29814. if (hasUnits(allowedUnits)) {
  29815. const match = allowedUnits.find(item => item.value === matchedUnit);
  29816. unitToReturn = match === null || match === void 0 ? void 0 : match.value;
  29817. } else {
  29818. unitToReturn = DEFAULT_UNIT.value;
  29819. }
  29820. return [quantityToReturn, unitToReturn];
  29821. }
  29822. /**
  29823. * Parses quantity and unit from a raw value. Validates parsed value, using fallback
  29824. * value if invalid.
  29825. *
  29826. * @param rawValue The next value.
  29827. * @param allowedUnits Units to derive from.
  29828. * @param fallbackQuantity The fallback quantity, used in case it's not possible to parse a valid quantity from the raw value.
  29829. * @param fallbackUnit The fallback unit, used in case it's not possible to parse a valid unit from the raw value.
  29830. * @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value
  29831. * could not be parsed to a number correctly, and the `fallbackQuantity` was also `undefined`. The
  29832. * unit can be `undefined` only if the unit parsed from the raw value could not be matched against
  29833. * the list of allowed units, the `fallbackQuantity` is also `undefined` and the list of
  29834. * `allowedUnits` is passed empty.
  29835. */
  29836. function getValidParsedQuantityAndUnit(rawValue, allowedUnits, fallbackQuantity, fallbackUnit) {
  29837. const [parsedQuantity, parsedUnit] = parseQuantityAndUnitFromRawValue(rawValue, allowedUnits); // The parsed value from `parseQuantityAndUnitFromRawValue` should now be
  29838. // either a real number or undefined. If undefined, use the fallback value.
  29839. 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
  29840. // defined, use the first value from the list of allowed units as fallback.
  29841. let unitToReturn = parsedUnit || fallbackUnit;
  29842. if (!unitToReturn && hasUnits(allowedUnits)) {
  29843. unitToReturn = allowedUnits[0].value;
  29844. }
  29845. return [quantityToReturn, unitToReturn];
  29846. }
  29847. /**
  29848. * Takes a unit value and finds the matching accessibility label for the
  29849. * unit abbreviation.
  29850. *
  29851. * @param unit Unit value (example: `px`)
  29852. * @return a11y label for the unit abbreviation
  29853. */
  29854. function getAccessibleLabelForUnit(unit) {
  29855. const match = ALL_CSS_UNITS.find(item => item.value === unit);
  29856. 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;
  29857. }
  29858. /**
  29859. * Filters available units based on values defined a list of allowed unit values.
  29860. *
  29861. * @param allowedUnitValues Collection of allowed unit value strings.
  29862. * @param availableUnits Collection of available unit objects.
  29863. * @return Filtered units.
  29864. */
  29865. function filterUnitsWithSettings() {
  29866. let allowedUnitValues = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  29867. let availableUnits = arguments.length > 1 ? arguments[1] : undefined;
  29868. // Although the `isArray` check shouldn't be necessary (given the signature of
  29869. // this typed function), it's better to stay on the side of caution, since
  29870. // this function may be called from un-typed environments.
  29871. return Array.isArray(availableUnits) ? availableUnits.filter(unit => allowedUnitValues.includes(unit.value)) : [];
  29872. }
  29873. /**
  29874. * Custom hook to retrieve and consolidate units setting from add_theme_support().
  29875. * TODO: ideally this hook shouldn't be needed
  29876. * https://github.com/WordPress/gutenberg/pull/31822#discussion_r633280823
  29877. *
  29878. * @param args An object containing units, settingPath & defaultUnits.
  29879. * @param args.units Collection of all potentially available units.
  29880. * @param args.availableUnits Collection of unit value strings for filtering available units.
  29881. * @param args.defaultValues Collection of default values for defined units. Example: `{ px: 350, em: 15 }`.
  29882. *
  29883. * @return Filtered list of units, with their default values updated following the `defaultValues`
  29884. * argument's property.
  29885. */
  29886. const useCustomUnits = _ref => {
  29887. let {
  29888. units = ALL_CSS_UNITS,
  29889. availableUnits = [],
  29890. defaultValues
  29891. } = _ref;
  29892. const customUnitsToReturn = filterUnitsWithSettings(availableUnits, units);
  29893. if (defaultValues) {
  29894. customUnitsToReturn.forEach((unit, i) => {
  29895. if (defaultValues[unit.value]) {
  29896. const [parsedDefaultValue] = parseQuantityAndUnitFromRawValue(defaultValues[unit.value]);
  29897. customUnitsToReturn[i].default = parsedDefaultValue;
  29898. }
  29899. });
  29900. }
  29901. return customUnitsToReturn;
  29902. };
  29903. /**
  29904. * Get available units with the unit for the currently selected value
  29905. * prepended if it is not available in the list of units.
  29906. *
  29907. * This is useful to ensure that the current value's unit is always
  29908. * accurately displayed in the UI, even if the intention is to hide
  29909. * the availability of that unit.
  29910. *
  29911. * @param rawValue Selected value to parse.
  29912. * @param legacyUnit Legacy unit value, if rawValue needs it appended.
  29913. * @param units List of available units.
  29914. *
  29915. * @return A collection of units containing the unit for the current value.
  29916. */
  29917. function getUnitsWithCurrentUnit(rawValue, legacyUnit) {
  29918. let units = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ALL_CSS_UNITS;
  29919. const unitsToReturn = Array.isArray(units) ? [...units] : [];
  29920. const [, currentUnit] = getParsedQuantityAndUnit(rawValue, legacyUnit, ALL_CSS_UNITS);
  29921. if (currentUnit && !unitsToReturn.some(unit => unit.value === currentUnit)) {
  29922. if (allUnits[currentUnit]) {
  29923. unitsToReturn.unshift(allUnits[currentUnit]);
  29924. }
  29925. }
  29926. return unitsToReturn;
  29927. }
  29928. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-control/border-control-dropdown/hook.js
  29929. /**
  29930. * WordPress dependencies
  29931. */
  29932. /**
  29933. * Internal dependencies
  29934. */
  29935. function useBorderControlDropdown(props) {
  29936. const {
  29937. border,
  29938. className,
  29939. colors,
  29940. onChange,
  29941. previousStyleSelection,
  29942. __next36pxDefaultSize,
  29943. ...otherProps
  29944. } = useContextSystem(props, 'BorderControlDropdown');
  29945. const [widthValue] = parseQuantityAndUnitFromRawValue(border === null || border === void 0 ? void 0 : border.width);
  29946. const hasZeroWidth = widthValue === 0;
  29947. const onColorChange = color => {
  29948. const style = (border === null || border === void 0 ? void 0 : border.style) === 'none' ? previousStyleSelection : border === null || border === void 0 ? void 0 : border.style;
  29949. const width = hasZeroWidth && !!color ? '1px' : border === null || border === void 0 ? void 0 : border.width;
  29950. onChange({
  29951. color,
  29952. style,
  29953. width
  29954. });
  29955. };
  29956. const onStyleChange = style => {
  29957. const width = hasZeroWidth && !!style ? '1px' : border === null || border === void 0 ? void 0 : border.width;
  29958. onChange({ ...border,
  29959. style,
  29960. width
  29961. });
  29962. };
  29963. const onReset = () => {
  29964. onChange({ ...border,
  29965. color: undefined,
  29966. style: undefined
  29967. });
  29968. }; // Generate class names.
  29969. const cx = useCx();
  29970. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  29971. return cx(borderControlDropdown(), className);
  29972. }, [className, cx]);
  29973. const indicatorClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
  29974. return cx(borderColorIndicator);
  29975. }, [cx]);
  29976. const indicatorWrapperClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
  29977. return cx(colorIndicatorWrapper(border, __next36pxDefaultSize));
  29978. }, [border, cx, __next36pxDefaultSize]);
  29979. const popoverControlsClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
  29980. return cx(borderControlPopoverControls);
  29981. }, [cx]);
  29982. const popoverContentClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
  29983. return cx(borderControlPopoverContent);
  29984. }, [cx]);
  29985. const resetButtonClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
  29986. return cx(resetButton);
  29987. }, [cx]);
  29988. return { ...otherProps,
  29989. border,
  29990. className: classes,
  29991. colors,
  29992. indicatorClassName,
  29993. indicatorWrapperClassName,
  29994. onColorChange,
  29995. onStyleChange,
  29996. onReset,
  29997. popoverContentClassName,
  29998. popoverControlsClassName,
  29999. resetButtonClassName
  30000. };
  30001. }
  30002. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-control/border-control-dropdown/component.js
  30003. /**
  30004. * External dependencies
  30005. */
  30006. /**
  30007. * WordPress dependencies
  30008. */
  30009. /**
  30010. * Internal dependencies
  30011. */
  30012. const component_noop = () => undefined;
  30013. const getColorObject = (colorValue, colors, hasMultipleColorOrigins) => {
  30014. if (!colorValue || !colors) {
  30015. return;
  30016. }
  30017. if (hasMultipleColorOrigins) {
  30018. let matchedColor;
  30019. colors.some(origin => origin.colors.some(color => {
  30020. if (color.color === colorValue) {
  30021. matchedColor = color;
  30022. return true;
  30023. }
  30024. return false;
  30025. }));
  30026. return matchedColor;
  30027. }
  30028. return colors.find(color => color.color === colorValue);
  30029. };
  30030. const getToggleAriaLabel = (colorValue, colorObject, style, isStyleEnabled) => {
  30031. if (isStyleEnabled) {
  30032. if (colorObject) {
  30033. 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".
  30034. '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:".
  30035. 'Border color and style picker. The currently selected color is called "%1$s" and has a value of "%2$s".', colorObject.name, colorObject.color);
  30036. }
  30037. if (colorValue) {
  30038. 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".
  30039. '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:".
  30040. 'Border color and style picker. The currently selected color has a value of "%1$s".', colorValue);
  30041. }
  30042. return (0,external_wp_i18n_namespaceObject.__)('Border color and style picker.');
  30043. }
  30044. if (colorObject) {
  30045. 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:".
  30046. 'Border color picker. The currently selected color is called "%1$s" and has a value of "%2$s".', colorObject.name, colorObject.color);
  30047. }
  30048. if (colorValue) {
  30049. return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %1$s: The color's hex code e.g.: "#f00:".
  30050. 'Border color picker. The currently selected color has a value of "%1$s".', colorValue);
  30051. }
  30052. return (0,external_wp_i18n_namespaceObject.__)('Border color picker.');
  30053. };
  30054. const BorderControlDropdown = (props, forwardedRef) => {
  30055. const {
  30056. __experimentalHasMultipleOrigins,
  30057. __experimentalIsRenderedInSidebar,
  30058. border,
  30059. colors,
  30060. disableCustomColors,
  30061. enableAlpha,
  30062. indicatorClassName,
  30063. indicatorWrapperClassName,
  30064. onReset,
  30065. onColorChange,
  30066. onStyleChange,
  30067. popoverContentClassName,
  30068. popoverControlsClassName,
  30069. resetButtonClassName,
  30070. showDropdownHeader,
  30071. enableStyle = true,
  30072. __unstablePopoverProps,
  30073. ...otherProps
  30074. } = useBorderControlDropdown(props);
  30075. const {
  30076. color,
  30077. style
  30078. } = border || {};
  30079. const colorObject = getColorObject(color, colors, !!__experimentalHasMultipleOrigins);
  30080. const toggleAriaLabel = getToggleAriaLabel(color, colorObject, style, enableStyle);
  30081. const showResetButton = color || style && style !== 'none';
  30082. const dropdownPosition = __experimentalIsRenderedInSidebar ? 'bottom left' : undefined;
  30083. const renderToggle = _ref => {
  30084. let {
  30085. onToggle = component_noop
  30086. } = _ref;
  30087. return (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  30088. onClick: onToggle,
  30089. variant: "tertiary",
  30090. "aria-label": toggleAriaLabel,
  30091. position: dropdownPosition,
  30092. label: (0,external_wp_i18n_namespaceObject.__)('Border color and style picker'),
  30093. showTooltip: true
  30094. }, (0,external_wp_element_namespaceObject.createElement)("span", {
  30095. className: indicatorWrapperClassName
  30096. }, (0,external_wp_element_namespaceObject.createElement)(color_indicator, {
  30097. className: indicatorClassName,
  30098. colorValue: color
  30099. })));
  30100. }; // TODO: update types once Dropdown component is refactored to TypeScript.
  30101. const renderContent = _ref2 => {
  30102. let {
  30103. onClose
  30104. } = _ref2;
  30105. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(dropdown_content_wrapper, {
  30106. paddingSize: "medium"
  30107. }, (0,external_wp_element_namespaceObject.createElement)(v_stack_component, {
  30108. className: popoverControlsClassName,
  30109. spacing: 6
  30110. }, 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, {
  30111. isSmall: true,
  30112. label: (0,external_wp_i18n_namespaceObject.__)('Close border color'),
  30113. icon: close_small,
  30114. onClick: onClose
  30115. })) : undefined, (0,external_wp_element_namespaceObject.createElement)(color_palette, {
  30116. className: popoverContentClassName,
  30117. value: color,
  30118. onChange: onColorChange,
  30119. colors,
  30120. disableCustomColors,
  30121. __experimentalHasMultipleOrigins: __experimentalHasMultipleOrigins,
  30122. __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,
  30123. clearable: false,
  30124. enableAlpha: enableAlpha
  30125. }), enableStyle && (0,external_wp_element_namespaceObject.createElement)(border_control_style_picker_component, {
  30126. label: (0,external_wp_i18n_namespaceObject.__)('Style'),
  30127. value: style,
  30128. onChange: onStyleChange
  30129. }))), showResetButton && (0,external_wp_element_namespaceObject.createElement)(dropdown_content_wrapper, {
  30130. paddingSize: "none"
  30131. }, (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  30132. className: resetButtonClassName,
  30133. variant: "tertiary",
  30134. onClick: () => {
  30135. onReset();
  30136. onClose();
  30137. }
  30138. }, (0,external_wp_i18n_namespaceObject.__)('Reset to default'))));
  30139. };
  30140. return (0,external_wp_element_namespaceObject.createElement)(Dropdown, extends_extends({
  30141. renderToggle: renderToggle,
  30142. renderContent: renderContent,
  30143. popoverProps: { ...__unstablePopoverProps
  30144. }
  30145. }, otherProps, {
  30146. ref: forwardedRef
  30147. }));
  30148. };
  30149. const ConnectedBorderControlDropdown = contextConnect(BorderControlDropdown, 'BorderControlDropdown');
  30150. /* harmony default export */ var border_control_dropdown_component = (ConnectedBorderControlDropdown);
  30151. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/unit-control/unit-select-control.js
  30152. /**
  30153. * External dependencies
  30154. */
  30155. function UnitSelectControl(_ref) {
  30156. let {
  30157. className,
  30158. isUnitSelectTabbable: isTabbable = true,
  30159. onChange,
  30160. size = 'default',
  30161. unit = 'px',
  30162. units = CSS_UNITS,
  30163. ...props
  30164. } = _ref;
  30165. if (!hasUnits(units) || (units === null || units === void 0 ? void 0 : units.length) === 1) {
  30166. return (0,external_wp_element_namespaceObject.createElement)(UnitLabel, {
  30167. className: "components-unit-control__unit-label",
  30168. selectSize: size
  30169. }, unit);
  30170. }
  30171. const handleOnChange = event => {
  30172. const {
  30173. value: unitValue
  30174. } = event.target;
  30175. const data = units.find(option => option.value === unitValue);
  30176. onChange === null || onChange === void 0 ? void 0 : onChange(unitValue, {
  30177. event,
  30178. data
  30179. });
  30180. };
  30181. const classes = classnames_default()('components-unit-control__select', className);
  30182. return (0,external_wp_element_namespaceObject.createElement)(UnitSelect, extends_extends({
  30183. className: classes,
  30184. onChange: handleOnChange,
  30185. selectSize: size,
  30186. tabIndex: isTabbable ? undefined : -1,
  30187. value: unit
  30188. }, props), units.map(option => (0,external_wp_element_namespaceObject.createElement)("option", {
  30189. value: option.value,
  30190. key: option.value
  30191. }, option.label)));
  30192. }
  30193. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/unit-control/index.js
  30194. /**
  30195. * External dependencies
  30196. */
  30197. /**
  30198. * WordPress dependencies
  30199. */
  30200. /**
  30201. * Internal dependencies
  30202. */
  30203. function UnforwardedUnitControl(unitControlProps, forwardedRef) {
  30204. const {
  30205. __unstableStateReducer: stateReducerProp,
  30206. autoComplete = 'off',
  30207. // @ts-expect-error Ensure that children is omitted from restProps
  30208. children,
  30209. className,
  30210. disabled = false,
  30211. disableUnits = false,
  30212. isPressEnterToChange = false,
  30213. isResetValueOnUnitChange = false,
  30214. isUnitSelectTabbable = true,
  30215. label,
  30216. onChange: onChangeProp,
  30217. onUnitChange,
  30218. size = 'default',
  30219. style,
  30220. unit: unitProp,
  30221. units: unitsProp = CSS_UNITS,
  30222. value: valueProp,
  30223. onBlur: onBlurProp,
  30224. ...props
  30225. } = unitControlProps;
  30226. if ('unit' in unitControlProps) {
  30227. external_wp_deprecated_default()('UnitControl unit prop', {
  30228. since: '5.6',
  30229. hint: 'The unit should be provided within the `value` prop.',
  30230. version: '6.2'
  30231. });
  30232. } // The `value` prop, in theory, should not be `null`, but the following line
  30233. // ensures it fallback to `undefined` in case a consumer of `UnitControl`
  30234. // still passes `null` as a `value`.
  30235. const nonNullValueProp = valueProp !== null && valueProp !== void 0 ? valueProp : undefined;
  30236. const units = (0,external_wp_element_namespaceObject.useMemo)(() => getUnitsWithCurrentUnit(nonNullValueProp, unitProp, unitsProp), [nonNullValueProp, unitProp, unitsProp]);
  30237. const [parsedQuantity, parsedUnit] = getParsedQuantityAndUnit(nonNullValueProp, unitProp, units);
  30238. const [unit, setUnit] = use_controlled_state(units.length === 1 ? units[0].value : unitProp, {
  30239. initial: parsedUnit,
  30240. fallback: ''
  30241. });
  30242. (0,external_wp_element_namespaceObject.useEffect)(() => {
  30243. if (parsedUnit !== undefined) {
  30244. setUnit(parsedUnit);
  30245. }
  30246. }, [parsedUnit]); // Stores parsed value for hand-off in state reducer.
  30247. const refParsedQuantity = (0,external_wp_element_namespaceObject.useRef)(undefined);
  30248. const classes = classnames_default()('components-unit-control', className);
  30249. const handleOnQuantityChange = (nextQuantityValue, changeProps) => {
  30250. if (nextQuantityValue === '' || typeof nextQuantityValue === 'undefined' || nextQuantityValue === null) {
  30251. onChangeProp === null || onChangeProp === void 0 ? void 0 : onChangeProp('', changeProps);
  30252. return;
  30253. }
  30254. /*
  30255. * Customizing the onChange callback.
  30256. * This allows as to broadcast a combined value+unit to onChange.
  30257. */
  30258. const onChangeValue = getValidParsedQuantityAndUnit(nextQuantityValue, units, parsedQuantity, unit).join('');
  30259. onChangeProp === null || onChangeProp === void 0 ? void 0 : onChangeProp(onChangeValue, changeProps);
  30260. };
  30261. const handleOnUnitChange = (nextUnitValue, changeProps) => {
  30262. const {
  30263. data
  30264. } = changeProps;
  30265. let nextValue = `${parsedQuantity !== null && parsedQuantity !== void 0 ? parsedQuantity : ''}${nextUnitValue}`;
  30266. if (isResetValueOnUnitChange && (data === null || data === void 0 ? void 0 : data.default) !== undefined) {
  30267. nextValue = `${data.default}${nextUnitValue}`;
  30268. }
  30269. onChangeProp === null || onChangeProp === void 0 ? void 0 : onChangeProp(nextValue, changeProps);
  30270. onUnitChange === null || onUnitChange === void 0 ? void 0 : onUnitChange(nextUnitValue, changeProps);
  30271. setUnit(nextUnitValue);
  30272. };
  30273. const mayUpdateUnit = event => {
  30274. if (!isNaN(Number(event.currentTarget.value))) {
  30275. refParsedQuantity.current = undefined;
  30276. return;
  30277. }
  30278. const [validParsedQuantity, validParsedUnit] = getValidParsedQuantityAndUnit(event.currentTarget.value, units, parsedQuantity, unit);
  30279. refParsedQuantity.current = validParsedQuantity;
  30280. if (isPressEnterToChange && validParsedUnit !== unit) {
  30281. const data = Array.isArray(units) ? units.find(option => option.value === validParsedUnit) : undefined;
  30282. const changeProps = {
  30283. event,
  30284. data
  30285. }; // The `onChange` callback already gets called, no need to call it explicitely.
  30286. onUnitChange === null || onUnitChange === void 0 ? void 0 : onUnitChange(validParsedUnit, changeProps);
  30287. setUnit(validParsedUnit);
  30288. }
  30289. };
  30290. const handleOnBlur = event => {
  30291. mayUpdateUnit(event);
  30292. onBlurProp === null || onBlurProp === void 0 ? void 0 : onBlurProp(event);
  30293. };
  30294. const handleOnKeyDown = event => {
  30295. const {
  30296. key
  30297. } = event;
  30298. if (key === 'Enter') {
  30299. mayUpdateUnit(event);
  30300. }
  30301. };
  30302. /**
  30303. * "Middleware" function that intercepts updates from InputControl.
  30304. * This allows us to tap into actions to transform the (next) state for
  30305. * InputControl.
  30306. *
  30307. * @param state State from InputControl
  30308. * @param action Action triggering state change
  30309. * @return The updated state to apply to InputControl
  30310. */
  30311. const unitControlStateReducer = (state, action) => {
  30312. const nextState = { ...state
  30313. };
  30314. /*
  30315. * On commits (when pressing ENTER and on blur if
  30316. * isPressEnterToChange is true), if a parse has been performed
  30317. * then use that result to update the state.
  30318. */
  30319. if (action.type === COMMIT) {
  30320. if (refParsedQuantity.current !== undefined) {
  30321. var _refParsedQuantity$cu;
  30322. nextState.value = ((_refParsedQuantity$cu = refParsedQuantity.current) !== null && _refParsedQuantity$cu !== void 0 ? _refParsedQuantity$cu : '').toString();
  30323. refParsedQuantity.current = undefined;
  30324. }
  30325. }
  30326. return nextState;
  30327. };
  30328. let stateReducer = unitControlStateReducer;
  30329. if (stateReducerProp) {
  30330. stateReducer = (state, action) => {
  30331. const baseState = unitControlStateReducer(state, action);
  30332. return stateReducerProp(baseState, action);
  30333. };
  30334. }
  30335. const inputSuffix = !disableUnits ? (0,external_wp_element_namespaceObject.createElement)(UnitSelectControl, {
  30336. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Select unit'),
  30337. disabled: disabled,
  30338. isUnitSelectTabbable: isUnitSelectTabbable,
  30339. onChange: handleOnUnitChange,
  30340. size: size,
  30341. unit: unit,
  30342. units: units,
  30343. onBlur: onBlurProp
  30344. }) : null;
  30345. let step = props.step;
  30346. /*
  30347. * If no step prop has been passed, lookup the active unit and
  30348. * try to get step from `units`, or default to a value of `1`
  30349. */
  30350. if (!step && units) {
  30351. var _activeUnit$step;
  30352. const activeUnit = units.find(option => option.value === unit);
  30353. step = (_activeUnit$step = activeUnit === null || activeUnit === void 0 ? void 0 : activeUnit.step) !== null && _activeUnit$step !== void 0 ? _activeUnit$step : 1;
  30354. }
  30355. return (0,external_wp_element_namespaceObject.createElement)(unit_control_styles_Root, {
  30356. className: "components-unit-control-wrapper",
  30357. style: style
  30358. }, (0,external_wp_element_namespaceObject.createElement)(ValueInput, extends_extends({
  30359. type: isPressEnterToChange ? 'text' : 'number'
  30360. }, props, {
  30361. autoComplete: autoComplete,
  30362. className: classes,
  30363. disabled: disabled,
  30364. disableUnits: disableUnits,
  30365. isPressEnterToChange: isPressEnterToChange,
  30366. label: label,
  30367. onBlur: handleOnBlur,
  30368. onKeyDown: handleOnKeyDown,
  30369. onChange: handleOnQuantityChange,
  30370. ref: forwardedRef,
  30371. size: size,
  30372. suffix: inputSuffix,
  30373. value: parsedQuantity !== null && parsedQuantity !== void 0 ? parsedQuantity : '',
  30374. step: step,
  30375. __unstableStateReducer: stateReducer
  30376. })));
  30377. }
  30378. /**
  30379. * `UnitControl` allows the user to set a numeric quantity as well as a unit (e.g. `px`).
  30380. *
  30381. *
  30382. * @example
  30383. * ```jsx
  30384. * import { __experimentalUnitControl as UnitControl } from '@wordpress/components';
  30385. * import { useState } from '@wordpress/element';
  30386. *
  30387. * const Example = () => {
  30388. * const [ value, setValue ] = useState( '10px' );
  30389. *
  30390. * return <UnitControl onChange={ setValue } value={ value } />;
  30391. * };
  30392. * ```
  30393. */
  30394. const UnitControl = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedUnitControl);
  30395. /* harmony default export */ var unit_control = (UnitControl);
  30396. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-control/border-control/hook.js
  30397. /**
  30398. * WordPress dependencies
  30399. */
  30400. /**
  30401. * Internal dependencies
  30402. */
  30403. const sanitizeBorder = border => {
  30404. const hasNoWidth = (border === null || border === void 0 ? void 0 : border.width) === undefined || border.width === '';
  30405. const hasNoColor = (border === null || border === void 0 ? void 0 : border.color) === undefined; // If width and color are undefined, unset any style selection as well.
  30406. if (hasNoWidth && hasNoColor) {
  30407. return undefined;
  30408. }
  30409. return border;
  30410. };
  30411. function useBorderControl(props) {
  30412. const {
  30413. className,
  30414. isCompact,
  30415. onChange,
  30416. shouldSanitizeBorder = true,
  30417. value: border,
  30418. width,
  30419. __next36pxDefaultSize = false,
  30420. ...otherProps
  30421. } = useContextSystem(props, 'BorderControl');
  30422. const [widthValue, originalWidthUnit] = parseQuantityAndUnitFromRawValue(border === null || border === void 0 ? void 0 : border.width);
  30423. const widthUnit = originalWidthUnit || 'px';
  30424. const hadPreviousZeroWidth = widthValue === 0;
  30425. const [colorSelection, setColorSelection] = (0,external_wp_element_namespaceObject.useState)();
  30426. const [styleSelection, setStyleSelection] = (0,external_wp_element_namespaceObject.useState)();
  30427. const onBorderChange = (0,external_wp_element_namespaceObject.useCallback)(newBorder => {
  30428. if (shouldSanitizeBorder) {
  30429. return onChange(sanitizeBorder(newBorder));
  30430. }
  30431. onChange(newBorder);
  30432. }, [onChange, shouldSanitizeBorder]);
  30433. const onWidthChange = (0,external_wp_element_namespaceObject.useCallback)(newWidth => {
  30434. const newWidthValue = newWidth === '' ? undefined : newWidth;
  30435. const [parsedValue] = parseQuantityAndUnitFromRawValue(newWidth);
  30436. const hasZeroWidth = parsedValue === 0;
  30437. const updatedBorder = { ...border,
  30438. width: newWidthValue
  30439. }; // Setting the border width explicitly to zero will also set the
  30440. // border style to `none` and clear the border color.
  30441. if (hasZeroWidth && !hadPreviousZeroWidth) {
  30442. // Before clearing the color and style selections, keep track of
  30443. // the current selections so they can be restored when the width
  30444. // changes to a non-zero value.
  30445. setColorSelection(border === null || border === void 0 ? void 0 : border.color);
  30446. setStyleSelection(border === null || border === void 0 ? void 0 : border.style); // Clear the color and style border properties.
  30447. updatedBorder.color = undefined;
  30448. updatedBorder.style = 'none';
  30449. } // Selection has changed from zero border width to non-zero width.
  30450. if (!hasZeroWidth && hadPreviousZeroWidth) {
  30451. // Restore previous border color and style selections if width
  30452. // is now not zero.
  30453. if (updatedBorder.color === undefined) {
  30454. updatedBorder.color = colorSelection;
  30455. }
  30456. if (updatedBorder.style === 'none') {
  30457. updatedBorder.style = styleSelection;
  30458. }
  30459. }
  30460. onBorderChange(updatedBorder);
  30461. }, [border, hadPreviousZeroWidth, colorSelection, styleSelection, onBorderChange]);
  30462. const onSliderChange = (0,external_wp_element_namespaceObject.useCallback)(value => {
  30463. onWidthChange(`${value}${widthUnit}`);
  30464. }, [onWidthChange, widthUnit]); // Generate class names.
  30465. const cx = useCx();
  30466. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  30467. return cx(borderControl, className);
  30468. }, [className, cx]);
  30469. const wrapperWidth = isCompact ? '90px' : width;
  30470. const innerWrapperClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
  30471. const widthStyle = !!wrapperWidth && styles_wrapperWidth;
  30472. const heightStyle = wrapperHeight(__next36pxDefaultSize);
  30473. return cx(innerWrapper(), widthStyle, heightStyle);
  30474. }, [wrapperWidth, cx, __next36pxDefaultSize]);
  30475. const sliderClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
  30476. return cx(borderSlider());
  30477. }, [cx]);
  30478. return { ...otherProps,
  30479. className: classes,
  30480. innerWrapperClassName,
  30481. inputWidth: wrapperWidth,
  30482. onBorderChange,
  30483. onSliderChange,
  30484. onWidthChange,
  30485. previousStyleSelection: styleSelection,
  30486. sliderClassName,
  30487. value: border,
  30488. widthUnit,
  30489. widthValue,
  30490. __next36pxDefaultSize
  30491. };
  30492. }
  30493. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-control/border-control/component.js
  30494. /**
  30495. * WordPress dependencies
  30496. */
  30497. /**
  30498. * Internal dependencies
  30499. */
  30500. const BorderLabel = props => {
  30501. const {
  30502. label,
  30503. hideLabelFromVision
  30504. } = props;
  30505. if (!label) {
  30506. return null;
  30507. }
  30508. return hideLabelFromVision ? (0,external_wp_element_namespaceObject.createElement)(visually_hidden_component, {
  30509. as: "legend"
  30510. }, label) : (0,external_wp_element_namespaceObject.createElement)(StyledLabel, {
  30511. as: "legend"
  30512. }, label);
  30513. };
  30514. const UnconnectedBorderControl = (props, forwardedRef) => {
  30515. const {
  30516. colors,
  30517. disableCustomColors,
  30518. enableAlpha,
  30519. enableStyle = true,
  30520. hideLabelFromVision,
  30521. innerWrapperClassName,
  30522. inputWidth,
  30523. label,
  30524. onBorderChange,
  30525. onSliderChange,
  30526. onWidthChange,
  30527. placeholder,
  30528. __unstablePopoverProps,
  30529. previousStyleSelection,
  30530. showDropdownHeader,
  30531. sliderClassName,
  30532. value: border,
  30533. widthUnit,
  30534. widthValue,
  30535. withSlider,
  30536. __experimentalHasMultipleOrigins,
  30537. __experimentalIsRenderedInSidebar,
  30538. __next36pxDefaultSize,
  30539. ...otherProps
  30540. } = useBorderControl(props);
  30541. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({
  30542. as: "fieldset"
  30543. }, otherProps, {
  30544. ref: forwardedRef
  30545. }), (0,external_wp_element_namespaceObject.createElement)(BorderLabel, {
  30546. label: label,
  30547. hideLabelFromVision: hideLabelFromVision
  30548. }), (0,external_wp_element_namespaceObject.createElement)(h_stack_component, {
  30549. spacing: 3,
  30550. className: innerWrapperClassName
  30551. }, (0,external_wp_element_namespaceObject.createElement)(unit_control, {
  30552. prefix: (0,external_wp_element_namespaceObject.createElement)(border_control_dropdown_component, {
  30553. border: border,
  30554. colors: colors,
  30555. __unstablePopoverProps: __unstablePopoverProps,
  30556. disableCustomColors: disableCustomColors,
  30557. enableAlpha: enableAlpha,
  30558. enableStyle: enableStyle,
  30559. onChange: onBorderChange,
  30560. previousStyleSelection: previousStyleSelection,
  30561. showDropdownHeader: showDropdownHeader,
  30562. __experimentalHasMultipleOrigins: __experimentalHasMultipleOrigins,
  30563. __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,
  30564. __next36pxDefaultSize: __next36pxDefaultSize
  30565. }),
  30566. label: (0,external_wp_i18n_namespaceObject.__)('Border width'),
  30567. hideLabelFromVision: true,
  30568. min: 0,
  30569. onChange: onWidthChange,
  30570. value: (border === null || border === void 0 ? void 0 : border.width) || '',
  30571. placeholder: placeholder,
  30572. __unstableInputWidth: inputWidth
  30573. }), withSlider && (0,external_wp_element_namespaceObject.createElement)(range_control, {
  30574. label: (0,external_wp_i18n_namespaceObject.__)('Border width'),
  30575. hideLabelFromVision: true,
  30576. className: sliderClassName,
  30577. initialPosition: 0,
  30578. max: 100,
  30579. min: 0,
  30580. onChange: onSliderChange,
  30581. step: ['px', '%'].includes(widthUnit) ? 1 : 0.1,
  30582. value: widthValue || undefined,
  30583. withInputField: false
  30584. })));
  30585. };
  30586. /**
  30587. * The `BorderControl` brings together internal sub-components which allow users to
  30588. * set the various properties of a border. The first sub-component, a
  30589. * `BorderDropdown` contains options representing border color and style. The
  30590. * border width is controlled via a `UnitControl` and an optional `RangeControl`.
  30591. *
  30592. * Border radius is not covered by this control as it may be desired separate to
  30593. * color, style, and width. For example, the border radius may be absorbed under
  30594. * a "shape" abstraction.
  30595. *
  30596. * ```jsx
  30597. * import { __experimentalBorderControl as BorderControl } from '@wordpress/components';
  30598. * import { __ } from '@wordpress/i18n';
  30599. *
  30600. * const colors = [
  30601. * { name: 'Blue 20', color: '#72aee6' },
  30602. * // ...
  30603. * ];
  30604. *
  30605. * const MyBorderControl = () => {
  30606. * const [ border, setBorder ] = useState();
  30607. * const onChange = ( newBorder ) => setBorder( newBorder );
  30608. *
  30609. * return (
  30610. * <BorderControl
  30611. * colors={ colors }
  30612. * label={ __( 'Border' ) }
  30613. * onChange={ onChange }
  30614. * value={ border }
  30615. * />
  30616. * );
  30617. * };
  30618. * ```
  30619. */
  30620. const BorderControl = contextConnect(UnconnectedBorderControl, 'BorderControl');
  30621. /* harmony default export */ var border_control_component = (BorderControl);
  30622. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/grid/utils.js
  30623. /**
  30624. * External dependencies
  30625. */
  30626. const utils_ALIGNMENTS = {
  30627. bottom: {
  30628. alignItems: 'flex-end',
  30629. justifyContent: 'center'
  30630. },
  30631. bottomLeft: {
  30632. alignItems: 'flex-start',
  30633. justifyContent: 'flex-end'
  30634. },
  30635. bottomRight: {
  30636. alignItems: 'flex-end',
  30637. justifyContent: 'flex-end'
  30638. },
  30639. center: {
  30640. alignItems: 'center',
  30641. justifyContent: 'center'
  30642. },
  30643. spaced: {
  30644. alignItems: 'center',
  30645. justifyContent: 'space-between'
  30646. },
  30647. left: {
  30648. alignItems: 'center',
  30649. justifyContent: 'flex-start'
  30650. },
  30651. right: {
  30652. alignItems: 'center',
  30653. justifyContent: 'flex-end'
  30654. },
  30655. stretch: {
  30656. alignItems: 'stretch'
  30657. },
  30658. top: {
  30659. alignItems: 'flex-start',
  30660. justifyContent: 'center'
  30661. },
  30662. topLeft: {
  30663. alignItems: 'flex-start',
  30664. justifyContent: 'flex-start'
  30665. },
  30666. topRight: {
  30667. alignItems: 'flex-start',
  30668. justifyContent: 'flex-end'
  30669. }
  30670. };
  30671. function utils_getAlignmentProps(alignment) {
  30672. const alignmentProps = alignment ? utils_ALIGNMENTS[alignment] : {};
  30673. return alignmentProps;
  30674. }
  30675. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/grid/hook.js
  30676. /**
  30677. * External dependencies
  30678. */
  30679. /**
  30680. * WordPress dependencies
  30681. */
  30682. /**
  30683. * Internal dependencies
  30684. */
  30685. function useGrid(props) {
  30686. const {
  30687. align,
  30688. alignment,
  30689. className,
  30690. columnGap,
  30691. columns = 2,
  30692. gap = 3,
  30693. isInline = false,
  30694. justify,
  30695. rowGap,
  30696. rows,
  30697. templateColumns,
  30698. templateRows,
  30699. ...otherProps
  30700. } = useContextSystem(props, 'Grid');
  30701. const columnsAsArray = Array.isArray(columns) ? columns : [columns];
  30702. const column = useResponsiveValue(columnsAsArray);
  30703. const rowsAsArray = Array.isArray(rows) ? rows : [rows];
  30704. const row = useResponsiveValue(rowsAsArray);
  30705. const gridTemplateColumns = templateColumns || !!columns && `repeat( ${column}, 1fr )`;
  30706. const gridTemplateRows = templateRows || !!rows && `repeat( ${row}, 1fr )`;
  30707. const cx = useCx();
  30708. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  30709. const alignmentProps = utils_getAlignmentProps(alignment);
  30710. const gridClasses = /*#__PURE__*/emotion_react_browser_esm_css({
  30711. alignItems: align,
  30712. display: isInline ? 'inline-grid' : 'grid',
  30713. gap: `calc( ${config_values.gridBase} * ${gap} )`,
  30714. gridTemplateColumns: gridTemplateColumns || undefined,
  30715. gridTemplateRows: gridTemplateRows || undefined,
  30716. gridRowGap: rowGap,
  30717. gridColumnGap: columnGap,
  30718. justifyContent: justify,
  30719. verticalAlign: isInline ? 'middle' : undefined,
  30720. ...alignmentProps
  30721. }, true ? "" : 0, true ? "" : 0);
  30722. return cx(gridClasses, className);
  30723. }, [align, alignment, className, columnGap, cx, gap, gridTemplateColumns, gridTemplateRows, isInline, justify, rowGap]);
  30724. return { ...otherProps,
  30725. className: classes
  30726. };
  30727. }
  30728. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/grid/component.js
  30729. /**
  30730. * External dependencies
  30731. */
  30732. /**
  30733. * Internal dependencies
  30734. */
  30735. function UnconnectedGrid(props, forwardedRef) {
  30736. const gridProps = useGrid(props);
  30737. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, gridProps, {
  30738. ref: forwardedRef
  30739. }));
  30740. }
  30741. /**
  30742. * `Grid` is a primitive layout component that can arrange content in a grid configuration.
  30743. *
  30744. * ```jsx
  30745. * import {
  30746. * __experimentalGrid as Grid,
  30747. * __experimentalText as Text
  30748. * } from `@wordpress/components`;
  30749. *
  30750. * function Example() {
  30751. * return (
  30752. * <Grid columns={ 3 }>
  30753. * <Text>Code</Text>
  30754. * <Text>is</Text>
  30755. * <Text>Poetry</Text>
  30756. * </Grid>
  30757. * );
  30758. * }
  30759. * ```
  30760. */
  30761. const Grid = contextConnect(UnconnectedGrid, 'Grid');
  30762. /* harmony default export */ var grid_component = (Grid);
  30763. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control-split-controls/hook.js
  30764. /**
  30765. * WordPress dependencies
  30766. */
  30767. /**
  30768. * Internal dependencies
  30769. */
  30770. function useBorderBoxControlSplitControls(props) {
  30771. const {
  30772. className,
  30773. ...otherProps
  30774. } = useContextSystem(props, 'BorderBoxControlSplitControls'); // Generate class names.
  30775. const cx = useCx();
  30776. const rtlWatchResult = rtl.watch();
  30777. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  30778. return cx(borderBoxControlSplitControls(), className); // rtlWatchResult is needed to refresh styles when the writing direction changes
  30779. // eslint-disable-next-line react-hooks/exhaustive-deps
  30780. }, [cx, className, rtlWatchResult]);
  30781. const centeredClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
  30782. return cx(CenteredBorderControl, className);
  30783. }, [cx, className]);
  30784. const rightAlignedClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
  30785. return cx(rightBorderControl(), className); // rtlWatchResult is needed to refresh styles when the writing direction changes
  30786. // eslint-disable-next-line react-hooks/exhaustive-deps
  30787. }, [cx, className, rtlWatchResult]);
  30788. return { ...otherProps,
  30789. centeredClassName,
  30790. className: classes,
  30791. rightAlignedClassName
  30792. };
  30793. }
  30794. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control-split-controls/component.js
  30795. /**
  30796. * WordPress dependencies
  30797. */
  30798. /**
  30799. * Internal dependencies
  30800. */
  30801. const BorderBoxControlSplitControls = (props, forwardedRef) => {
  30802. const {
  30803. centeredClassName,
  30804. colors,
  30805. disableCustomColors,
  30806. enableAlpha,
  30807. enableStyle,
  30808. onChange,
  30809. popoverPlacement,
  30810. popoverOffset,
  30811. rightAlignedClassName,
  30812. value,
  30813. __experimentalHasMultipleOrigins,
  30814. __experimentalIsRenderedInSidebar,
  30815. __next36pxDefaultSize,
  30816. ...otherProps
  30817. } = useBorderBoxControlSplitControls(props); // Use internal state instead of a ref to make sure that the component
  30818. // re-renders when the popover's anchor updates.
  30819. const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); // Memoize popoverProps to avoid returning a new object every time.
  30820. const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => popoverPlacement ? {
  30821. placement: popoverPlacement,
  30822. offset: popoverOffset,
  30823. anchor: popoverAnchor,
  30824. shift: true
  30825. } : undefined, [popoverPlacement, popoverOffset, popoverAnchor]);
  30826. const sharedBorderControlProps = {
  30827. colors,
  30828. disableCustomColors,
  30829. enableAlpha,
  30830. enableStyle,
  30831. isCompact: true,
  30832. __experimentalHasMultipleOrigins,
  30833. __experimentalIsRenderedInSidebar,
  30834. __next36pxDefaultSize
  30835. };
  30836. const mergedRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([setPopoverAnchor, forwardedRef]);
  30837. return (0,external_wp_element_namespaceObject.createElement)(grid_component, extends_extends({}, otherProps, {
  30838. ref: mergedRef,
  30839. gap: 4
  30840. }), (0,external_wp_element_namespaceObject.createElement)(border_box_control_visualizer_component, {
  30841. value: value,
  30842. __next36pxDefaultSize: __next36pxDefaultSize
  30843. }), (0,external_wp_element_namespaceObject.createElement)(border_control_component, extends_extends({
  30844. className: centeredClassName,
  30845. hideLabelFromVision: true,
  30846. label: (0,external_wp_i18n_namespaceObject.__)('Top border'),
  30847. onChange: newBorder => onChange(newBorder, 'top'),
  30848. __unstablePopoverProps: popoverProps,
  30849. value: value === null || value === void 0 ? void 0 : value.top
  30850. }, sharedBorderControlProps)), (0,external_wp_element_namespaceObject.createElement)(border_control_component, extends_extends({
  30851. hideLabelFromVision: true,
  30852. label: (0,external_wp_i18n_namespaceObject.__)('Left border'),
  30853. onChange: newBorder => onChange(newBorder, 'left'),
  30854. __unstablePopoverProps: popoverProps,
  30855. value: value === null || value === void 0 ? void 0 : value.left
  30856. }, sharedBorderControlProps)), (0,external_wp_element_namespaceObject.createElement)(border_control_component, extends_extends({
  30857. className: rightAlignedClassName,
  30858. hideLabelFromVision: true,
  30859. label: (0,external_wp_i18n_namespaceObject.__)('Right border'),
  30860. onChange: newBorder => onChange(newBorder, 'right'),
  30861. __unstablePopoverProps: popoverProps,
  30862. value: value === null || value === void 0 ? void 0 : value.right
  30863. }, sharedBorderControlProps)), (0,external_wp_element_namespaceObject.createElement)(border_control_component, extends_extends({
  30864. className: centeredClassName,
  30865. hideLabelFromVision: true,
  30866. label: (0,external_wp_i18n_namespaceObject.__)('Bottom border'),
  30867. onChange: newBorder => onChange(newBorder, 'bottom'),
  30868. __unstablePopoverProps: popoverProps,
  30869. value: value === null || value === void 0 ? void 0 : value.bottom
  30870. }, sharedBorderControlProps)));
  30871. };
  30872. const ConnectedBorderBoxControlSplitControls = contextConnect(BorderBoxControlSplitControls, 'BorderBoxControlSplitControls');
  30873. /* harmony default export */ var border_box_control_split_controls_component = (ConnectedBorderBoxControlSplitControls);
  30874. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-box-control/utils.js
  30875. /**
  30876. * External dependencies
  30877. */
  30878. /**
  30879. * Internal dependencies
  30880. */
  30881. const sides = ['top', 'right', 'bottom', 'left'];
  30882. const borderProps = ['color', 'style', 'width'];
  30883. const isEmptyBorder = border => {
  30884. if (!border) {
  30885. return true;
  30886. }
  30887. return !borderProps.some(prop => border[prop] !== undefined);
  30888. };
  30889. const isDefinedBorder = border => {
  30890. // No border, no worries :)
  30891. if (!border) {
  30892. return false;
  30893. } // If we have individual borders per side within the border object we
  30894. // need to check whether any of those side borders have been set.
  30895. if (hasSplitBorders(border)) {
  30896. const allSidesEmpty = sides.every(side => isEmptyBorder(border[side]));
  30897. return !allSidesEmpty;
  30898. } // If we have a top-level border only, check if that is empty. e.g.
  30899. // { color: undefined, style: undefined, width: undefined }
  30900. // Border radius can still be set within the border object as it is
  30901. // handled separately.
  30902. return !isEmptyBorder(border);
  30903. };
  30904. const isCompleteBorder = border => {
  30905. if (!border) {
  30906. return false;
  30907. }
  30908. return borderProps.every(prop => border[prop] !== undefined);
  30909. };
  30910. const hasSplitBorders = function () {
  30911. let border = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  30912. return Object.keys(border).some(side => sides.indexOf(side) !== -1);
  30913. };
  30914. const hasMixedBorders = borders => {
  30915. if (!hasSplitBorders(borders)) {
  30916. return false;
  30917. }
  30918. const shorthandBorders = sides.map(side => getShorthandBorderStyle(borders === null || borders === void 0 ? void 0 : borders[side]));
  30919. return !shorthandBorders.every(border => border === shorthandBorders[0]);
  30920. };
  30921. const getSplitBorders = border => {
  30922. if (!border || isEmptyBorder(border)) {
  30923. return undefined;
  30924. }
  30925. return {
  30926. top: border,
  30927. right: border,
  30928. bottom: border,
  30929. left: border
  30930. };
  30931. };
  30932. const getBorderDiff = (original, updated) => {
  30933. const diff = {};
  30934. if (original.color !== updated.color) {
  30935. diff.color = updated.color;
  30936. }
  30937. if (original.style !== updated.style) {
  30938. diff.style = updated.style;
  30939. }
  30940. if (original.width !== updated.width) {
  30941. diff.width = updated.width;
  30942. }
  30943. return diff;
  30944. };
  30945. const getCommonBorder = borders => {
  30946. if (!borders) {
  30947. return undefined;
  30948. }
  30949. const colors = [];
  30950. const styles = [];
  30951. const widths = [];
  30952. sides.forEach(side => {
  30953. var _borders$side, _borders$side2, _borders$side3;
  30954. colors.push((_borders$side = borders[side]) === null || _borders$side === void 0 ? void 0 : _borders$side.color);
  30955. styles.push((_borders$side2 = borders[side]) === null || _borders$side2 === void 0 ? void 0 : _borders$side2.style);
  30956. widths.push((_borders$side3 = borders[side]) === null || _borders$side3 === void 0 ? void 0 : _borders$side3.width);
  30957. });
  30958. const allColorsMatch = colors.every(value => value === colors[0]);
  30959. const allStylesMatch = styles.every(value => value === styles[0]);
  30960. const allWidthsMatch = widths.every(value => value === widths[0]);
  30961. return {
  30962. color: allColorsMatch ? colors[0] : undefined,
  30963. style: allStylesMatch ? styles[0] : undefined,
  30964. width: allWidthsMatch ? widths[0] : undefined
  30965. };
  30966. };
  30967. const getShorthandBorderStyle = (border, fallbackBorder) => {
  30968. if (isEmptyBorder(border)) {
  30969. return fallbackBorder;
  30970. }
  30971. const {
  30972. color: fallbackColor,
  30973. style: fallbackStyle,
  30974. width: fallbackWidth
  30975. } = fallbackBorder || {};
  30976. const {
  30977. color = fallbackColor,
  30978. style = fallbackStyle,
  30979. width = fallbackWidth
  30980. } = border;
  30981. const hasVisibleBorder = !!width && width !== '0' || !!color;
  30982. const borderStyle = hasVisibleBorder ? style || 'solid' : style;
  30983. return [width, borderStyle, color].filter(Boolean).join(' ');
  30984. };
  30985. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control/hook.js
  30986. /**
  30987. * WordPress dependencies
  30988. */
  30989. /**
  30990. * Internal dependencies
  30991. */
  30992. function useBorderBoxControl(props) {
  30993. const {
  30994. className,
  30995. onChange,
  30996. value,
  30997. ...otherProps
  30998. } = useContextSystem(props, 'BorderBoxControl');
  30999. const mixedBorders = hasMixedBorders(value);
  31000. const splitBorders = hasSplitBorders(value);
  31001. const linkedValue = splitBorders ? getCommonBorder(value) : value;
  31002. const splitValue = splitBorders ? value : getSplitBorders(value);
  31003. const [isLinked, setIsLinked] = (0,external_wp_element_namespaceObject.useState)(!mixedBorders);
  31004. const toggleLinked = () => setIsLinked(!isLinked);
  31005. const onLinkedChange = newBorder => {
  31006. if (!newBorder) {
  31007. return onChange(undefined);
  31008. } // If we have all props defined on the new border apply it.
  31009. if (!mixedBorders || isCompleteBorder(newBorder)) {
  31010. return onChange(isEmptyBorder(newBorder) ? undefined : newBorder);
  31011. } // If we had mixed borders we might have had some shared border props
  31012. // that we need to maintain. For example; we could have mixed borders
  31013. // with all the same color but different widths. Then from the linked
  31014. // control we change the color. We should keep the separate widths.
  31015. const changes = getBorderDiff(linkedValue, newBorder);
  31016. const updatedBorders = {
  31017. top: { ...(value === null || value === void 0 ? void 0 : value.top),
  31018. ...changes
  31019. },
  31020. right: { ...(value === null || value === void 0 ? void 0 : value.right),
  31021. ...changes
  31022. },
  31023. bottom: { ...(value === null || value === void 0 ? void 0 : value.bottom),
  31024. ...changes
  31025. },
  31026. left: { ...(value === null || value === void 0 ? void 0 : value.left),
  31027. ...changes
  31028. }
  31029. };
  31030. if (hasMixedBorders(updatedBorders)) {
  31031. return onChange(updatedBorders);
  31032. }
  31033. const filteredResult = isEmptyBorder(updatedBorders.top) ? undefined : updatedBorders.top;
  31034. onChange(filteredResult);
  31035. };
  31036. const onSplitChange = (newBorder, side) => {
  31037. const updatedBorders = { ...splitValue,
  31038. [side]: newBorder
  31039. };
  31040. if (hasMixedBorders(updatedBorders)) {
  31041. onChange(updatedBorders);
  31042. } else {
  31043. onChange(newBorder);
  31044. }
  31045. };
  31046. const cx = useCx();
  31047. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  31048. return cx(BorderBoxControl, className);
  31049. }, [cx, className]);
  31050. const linkedControlClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
  31051. return cx(LinkedBorderControl);
  31052. }, [cx]);
  31053. return { ...otherProps,
  31054. className: classes,
  31055. hasMixedBorders: mixedBorders,
  31056. isLinked,
  31057. linkedControlClassName,
  31058. onLinkedChange,
  31059. onSplitChange,
  31060. toggleLinked,
  31061. linkedValue,
  31062. splitValue
  31063. };
  31064. }
  31065. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/border-box-control/border-box-control/component.js
  31066. /**
  31067. * WordPress dependencies
  31068. */
  31069. /**
  31070. * Internal dependencies
  31071. */
  31072. const component_BorderLabel = props => {
  31073. const {
  31074. label,
  31075. hideLabelFromVision
  31076. } = props;
  31077. if (!label) {
  31078. return null;
  31079. }
  31080. return hideLabelFromVision ? (0,external_wp_element_namespaceObject.createElement)(visually_hidden_component, {
  31081. as: "label"
  31082. }, label) : (0,external_wp_element_namespaceObject.createElement)(StyledLabel, null, label);
  31083. };
  31084. const component_BorderBoxControl = (props, forwardedRef) => {
  31085. const {
  31086. className,
  31087. colors,
  31088. disableCustomColors,
  31089. enableAlpha,
  31090. enableStyle,
  31091. hasMixedBorders,
  31092. hideLabelFromVision,
  31093. isLinked,
  31094. label,
  31095. linkedControlClassName,
  31096. linkedValue,
  31097. onLinkedChange,
  31098. onSplitChange,
  31099. popoverPlacement,
  31100. popoverOffset,
  31101. splitValue,
  31102. toggleLinked,
  31103. __experimentalHasMultipleOrigins,
  31104. __experimentalIsRenderedInSidebar,
  31105. __next36pxDefaultSize = false,
  31106. ...otherProps
  31107. } = useBorderBoxControl(props); // Use internal state instead of a ref to make sure that the component
  31108. // re-renders when the popover's anchor updates.
  31109. const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); // Memoize popoverProps to avoid returning a new object every time.
  31110. const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => popoverPlacement ? {
  31111. placement: popoverPlacement,
  31112. offset: popoverOffset,
  31113. anchor: popoverAnchor,
  31114. shift: true
  31115. } : undefined, [popoverPlacement, popoverOffset, popoverAnchor]);
  31116. const mergedRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([setPopoverAnchor, forwardedRef]);
  31117. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({
  31118. className: className
  31119. }, otherProps, {
  31120. ref: mergedRef
  31121. }), (0,external_wp_element_namespaceObject.createElement)(component_BorderLabel, {
  31122. label: label,
  31123. hideLabelFromVision: hideLabelFromVision
  31124. }), (0,external_wp_element_namespaceObject.createElement)(h_stack_component, {
  31125. alignment: 'start',
  31126. expanded: true,
  31127. spacing: 0
  31128. }, isLinked ? (0,external_wp_element_namespaceObject.createElement)(border_control_component, {
  31129. className: linkedControlClassName,
  31130. colors: colors,
  31131. disableCustomColors: disableCustomColors,
  31132. enableAlpha: enableAlpha,
  31133. enableStyle: enableStyle,
  31134. onChange: onLinkedChange,
  31135. placeholder: hasMixedBorders ? (0,external_wp_i18n_namespaceObject.__)('Mixed') : undefined,
  31136. __unstablePopoverProps: popoverProps,
  31137. shouldSanitizeBorder: false // This component will handle that.
  31138. ,
  31139. value: linkedValue,
  31140. withSlider: true,
  31141. width: '110px',
  31142. __experimentalHasMultipleOrigins: __experimentalHasMultipleOrigins,
  31143. __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,
  31144. __next36pxDefaultSize: __next36pxDefaultSize
  31145. }) : (0,external_wp_element_namespaceObject.createElement)(border_box_control_split_controls_component, {
  31146. colors: colors,
  31147. disableCustomColors: disableCustomColors,
  31148. enableAlpha: enableAlpha,
  31149. enableStyle: enableStyle,
  31150. onChange: onSplitChange,
  31151. popoverPlacement: popoverPlacement,
  31152. popoverOffset: popoverOffset,
  31153. value: splitValue,
  31154. __experimentalHasMultipleOrigins: __experimentalHasMultipleOrigins,
  31155. __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,
  31156. __next36pxDefaultSize: __next36pxDefaultSize
  31157. }), (0,external_wp_element_namespaceObject.createElement)(border_box_control_linked_button_component, {
  31158. onClick: toggleLinked,
  31159. isLinked: isLinked,
  31160. __next36pxDefaultSize: __next36pxDefaultSize
  31161. })));
  31162. };
  31163. const ConnectedBorderBoxControl = contextConnect(component_BorderBoxControl, 'BorderBoxControl');
  31164. /* harmony default export */ var border_box_control_component = (ConnectedBorderBoxControl);
  31165. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/styles/box-control-styles.js
  31166. 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)."; }
  31167. /**
  31168. * External dependencies
  31169. */
  31170. /**
  31171. * Internal dependencies
  31172. */
  31173. const box_control_styles_Root = emotion_styled_base_browser_esm("div", true ? {
  31174. target: "e7pk0lh6"
  31175. } : 0)( true ? {
  31176. name: "14bvcyk",
  31177. styles: "box-sizing:border-box;max-width:235px;padding-bottom:12px;width:100%"
  31178. } : 0);
  31179. const Header = /*#__PURE__*/emotion_styled_base_browser_esm(flex_component, true ? {
  31180. target: "e7pk0lh5"
  31181. } : 0)( true ? {
  31182. name: "5bhc30",
  31183. styles: "margin-bottom:8px"
  31184. } : 0);
  31185. const HeaderControlWrapper = /*#__PURE__*/emotion_styled_base_browser_esm(flex_component, true ? {
  31186. target: "e7pk0lh4"
  31187. } : 0)( true ? {
  31188. name: "aujtid",
  31189. styles: "min-height:30px;gap:0"
  31190. } : 0);
  31191. const UnitControlWrapper = emotion_styled_base_browser_esm("div", true ? {
  31192. target: "e7pk0lh3"
  31193. } : 0)( true ? {
  31194. name: "112jwab",
  31195. styles: "box-sizing:border-box;max-width:80px"
  31196. } : 0);
  31197. const LayoutContainer = /*#__PURE__*/emotion_styled_base_browser_esm(flex_component, true ? {
  31198. target: "e7pk0lh2"
  31199. } : 0)( true ? {
  31200. name: "xy18ro",
  31201. styles: "justify-content:center;padding-top:8px"
  31202. } : 0);
  31203. const Layout = /*#__PURE__*/emotion_styled_base_browser_esm(flex_component, true ? {
  31204. target: "e7pk0lh1"
  31205. } : 0)( true ? {
  31206. name: "3tw5wk",
  31207. styles: "position:relative;height:100%;width:100%;justify-content:flex-start"
  31208. } : 0);
  31209. var box_control_styles_ref = true ? {
  31210. name: "1ch9yvl",
  31211. styles: "border-radius:0"
  31212. } : 0;
  31213. var box_control_styles_ref2 = true ? {
  31214. name: "tg3mx0",
  31215. styles: "border-radius:2px"
  31216. } : 0;
  31217. const unitControlBorderRadiusStyles = _ref3 => {
  31218. let {
  31219. isFirst,
  31220. isLast,
  31221. isOnly
  31222. } = _ref3;
  31223. if (isFirst) {
  31224. return rtl({
  31225. borderTopRightRadius: 0,
  31226. borderBottomRightRadius: 0
  31227. })();
  31228. }
  31229. if (isLast) {
  31230. return rtl({
  31231. borderTopLeftRadius: 0,
  31232. borderBottomLeftRadius: 0
  31233. })();
  31234. }
  31235. if (isOnly) {
  31236. return box_control_styles_ref2;
  31237. }
  31238. return box_control_styles_ref;
  31239. };
  31240. const unitControlMarginStyles = _ref4 => {
  31241. let {
  31242. isFirst,
  31243. isOnly
  31244. } = _ref4;
  31245. const marginLeft = isFirst || isOnly ? 0 : -1;
  31246. return rtl({
  31247. marginLeft
  31248. })();
  31249. };
  31250. const box_control_styles_UnitControl = /*#__PURE__*/emotion_styled_base_browser_esm(unit_control, true ? {
  31251. target: "e7pk0lh0"
  31252. } : 0)("max-width:60px;", unitControlBorderRadiusStyles, ";", unitControlMarginStyles, ";" + ( true ? "" : 0));
  31253. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/unit-control.js
  31254. /**
  31255. * External dependencies
  31256. */
  31257. /**
  31258. * Internal dependencies
  31259. */
  31260. const unit_control_noop = () => {};
  31261. function BoxUnitControl(_ref) {
  31262. let {
  31263. isFirst,
  31264. isLast,
  31265. isOnly,
  31266. onHoverOn = unit_control_noop,
  31267. onHoverOff = unit_control_noop,
  31268. label,
  31269. value,
  31270. ...props
  31271. } = _ref;
  31272. const bindHoverGesture = useHover(_ref2 => {
  31273. let {
  31274. event,
  31275. ...state
  31276. } = _ref2;
  31277. if (state.hovering) {
  31278. onHoverOn(event, state);
  31279. } else {
  31280. onHoverOff(event, state);
  31281. }
  31282. });
  31283. return (0,external_wp_element_namespaceObject.createElement)(UnitControlWrapper, bindHoverGesture(), (0,external_wp_element_namespaceObject.createElement)(unit_control_Tooltip, {
  31284. text: label
  31285. }, (0,external_wp_element_namespaceObject.createElement)(box_control_styles_UnitControl, extends_extends({
  31286. "aria-label": label,
  31287. className: "component-box-control__unit-control",
  31288. hideHTMLArrows: true,
  31289. isFirst: isFirst,
  31290. isLast: isLast,
  31291. isOnly: isOnly,
  31292. isPressEnterToChange: true,
  31293. isResetValueOnUnitChange: false,
  31294. value: value
  31295. }, props))));
  31296. }
  31297. function unit_control_Tooltip(_ref3) {
  31298. let {
  31299. children,
  31300. text
  31301. } = _ref3;
  31302. if (!text) return children;
  31303. /**
  31304. * Wrapping the children in a `<div />` as Tooltip as it attempts
  31305. * to render the <UnitControl />. Using a plain `<div />` appears to
  31306. * resolve this issue.
  31307. *
  31308. * Originally discovered and referenced here:
  31309. * https://github.com/WordPress/gutenberg/pull/24966#issuecomment-685875026
  31310. */
  31311. return (0,external_wp_element_namespaceObject.createElement)(tooltip, {
  31312. text: text,
  31313. position: "top"
  31314. }, (0,external_wp_element_namespaceObject.createElement)("div", null, children));
  31315. }
  31316. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/utils.js
  31317. /**
  31318. * WordPress dependencies
  31319. */
  31320. /**
  31321. * Internal dependencies
  31322. */
  31323. const LABELS = {
  31324. all: (0,external_wp_i18n_namespaceObject.__)('All'),
  31325. top: (0,external_wp_i18n_namespaceObject.__)('Top'),
  31326. bottom: (0,external_wp_i18n_namespaceObject.__)('Bottom'),
  31327. left: (0,external_wp_i18n_namespaceObject.__)('Left'),
  31328. right: (0,external_wp_i18n_namespaceObject.__)('Right'),
  31329. mixed: (0,external_wp_i18n_namespaceObject.__)('Mixed'),
  31330. vertical: (0,external_wp_i18n_namespaceObject.__)('Vertical'),
  31331. horizontal: (0,external_wp_i18n_namespaceObject.__)('Horizontal')
  31332. };
  31333. const DEFAULT_VALUES = {
  31334. top: undefined,
  31335. right: undefined,
  31336. bottom: undefined,
  31337. left: undefined
  31338. };
  31339. const ALL_SIDES = ['top', 'right', 'bottom', 'left'];
  31340. /**
  31341. * Gets an items with the most occurrence within an array
  31342. * https://stackoverflow.com/a/20762713
  31343. *
  31344. * @param {Array<any>} arr Array of items to check.
  31345. * @return {any} The item with the most occurrences.
  31346. */
  31347. function mode(arr) {
  31348. return arr.sort((a, b) => arr.filter(v => v === a).length - arr.filter(v => v === b).length).pop();
  31349. }
  31350. /**
  31351. * Gets the 'all' input value and unit from values data.
  31352. *
  31353. * @param {Object} values Box values.
  31354. * @param {Object} selectedUnits Box units.
  31355. * @param {Array} availableSides Available box sides to evaluate.
  31356. *
  31357. * @return {string} A value + unit for the 'all' input.
  31358. */
  31359. function getAllValue() {
  31360. let values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  31361. let selectedUnits = arguments.length > 1 ? arguments[1] : undefined;
  31362. let availableSides = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ALL_SIDES;
  31363. const sides = normalizeSides(availableSides);
  31364. const parsedQuantitiesAndUnits = sides.map(side => parseQuantityAndUnitFromRawValue(values[side]));
  31365. const allParsedQuantities = parsedQuantitiesAndUnits.map(value => {
  31366. var _value$;
  31367. return (_value$ = value[0]) !== null && _value$ !== void 0 ? _value$ : '';
  31368. });
  31369. const allParsedUnits = parsedQuantitiesAndUnits.map(value => value[1]);
  31370. const commonQuantity = allParsedQuantities.every(v => v === allParsedQuantities[0]) ? allParsedQuantities[0] : '';
  31371. /**
  31372. * The typeof === 'number' check is important. On reset actions, the incoming value
  31373. * may be null or an empty string.
  31374. *
  31375. * Also, the value may also be zero (0), which is considered a valid unit value.
  31376. *
  31377. * typeof === 'number' is more specific for these cases, rather than relying on a
  31378. * simple truthy check.
  31379. */
  31380. let commonUnit;
  31381. if (typeof commonQuantity === 'number') {
  31382. commonUnit = mode(allParsedUnits);
  31383. } else {
  31384. var _getAllUnitFallback;
  31385. // Set meaningful unit selection if no commonQuantity and user has previously
  31386. // selected units without assigning values while controls were unlinked.
  31387. commonUnit = (_getAllUnitFallback = getAllUnitFallback(selectedUnits)) !== null && _getAllUnitFallback !== void 0 ? _getAllUnitFallback : mode(allParsedUnits);
  31388. }
  31389. return [commonQuantity, commonUnit].join('');
  31390. }
  31391. /**
  31392. * Determine the most common unit selection to use as a fallback option.
  31393. *
  31394. * @param {Object} selectedUnits Current unit selections for individual sides.
  31395. * @return {string} Most common unit selection.
  31396. */
  31397. function getAllUnitFallback(selectedUnits) {
  31398. if (!selectedUnits || typeof selectedUnits !== 'object') {
  31399. return undefined;
  31400. }
  31401. const filteredUnits = Object.values(selectedUnits).filter(Boolean);
  31402. return mode(filteredUnits);
  31403. }
  31404. /**
  31405. * Checks to determine if values are mixed.
  31406. *
  31407. * @param {Object} values Box values.
  31408. * @param {Object} selectedUnits Box units.
  31409. * @param {Array} sides Available box sides to evaluate.
  31410. *
  31411. * @return {boolean} Whether values are mixed.
  31412. */
  31413. function isValuesMixed() {
  31414. let values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  31415. let selectedUnits = arguments.length > 1 ? arguments[1] : undefined;
  31416. let sides = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ALL_SIDES;
  31417. const allValue = getAllValue(values, selectedUnits, sides);
  31418. const isMixed = isNaN(parseFloat(allValue));
  31419. return isMixed;
  31420. }
  31421. /**
  31422. * Checks to determine if values are defined.
  31423. *
  31424. * @param {Object} values Box values.
  31425. *
  31426. * @return {boolean} Whether values are mixed.
  31427. */
  31428. function isValuesDefined(values) {
  31429. return values !== undefined && Object.values(values).filter( // Switching units when input is empty causes values only
  31430. // containing units. This gives false positive on mixed values
  31431. // unless filtered.
  31432. value => !!value && /\d/.test(value)).length > 0;
  31433. }
  31434. /**
  31435. * Get initial selected side, factoring in whether the sides are linked,
  31436. * and whether the vertical / horizontal directions are grouped via splitOnAxis.
  31437. *
  31438. * @param {boolean} isLinked Whether the box control's fields are linked.
  31439. * @param {boolean} splitOnAxis Whether splitting by horizontal or vertical axis.
  31440. * @return {string} The initial side.
  31441. */
  31442. function getInitialSide(isLinked, splitOnAxis) {
  31443. let initialSide = 'all';
  31444. if (!isLinked) {
  31445. initialSide = splitOnAxis ? 'vertical' : 'top';
  31446. }
  31447. return initialSide;
  31448. }
  31449. /**
  31450. * Normalizes provided sides configuration to an array containing only top,
  31451. * right, bottom and left. This essentially just maps `horizontal` or `vertical`
  31452. * to their appropriate sides to facilitate correctly determining value for
  31453. * all input control.
  31454. *
  31455. * @param {Array} sides Available sides for box control.
  31456. * @return {Array} Normalized sides configuration.
  31457. */
  31458. function normalizeSides(sides) {
  31459. const filteredSides = [];
  31460. if (!(sides !== null && sides !== void 0 && sides.length)) {
  31461. return ALL_SIDES;
  31462. }
  31463. if (sides.includes('vertical')) {
  31464. filteredSides.push(...['top', 'bottom']);
  31465. } else if (sides.includes('horizontal')) {
  31466. filteredSides.push(...['left', 'right']);
  31467. } else {
  31468. const newSides = ALL_SIDES.filter(side => sides.includes(side));
  31469. filteredSides.push(...newSides);
  31470. }
  31471. return filteredSides;
  31472. }
  31473. /**
  31474. * Applies a value to an object representing top, right, bottom and left sides
  31475. * while taking into account any custom side configuration.
  31476. *
  31477. * @param {Object} currentValues The current values for each side.
  31478. * @param {string|number} newValue The value to apply to the sides object.
  31479. * @param {string[]} sides Array defining valid sides.
  31480. *
  31481. * @return {Object} Object containing the updated values for each side.
  31482. */
  31483. function applyValueToSides(currentValues, newValue, sides) {
  31484. const newValues = { ...currentValues
  31485. };
  31486. if (sides !== null && sides !== void 0 && sides.length) {
  31487. sides.forEach(side => {
  31488. if (side === 'vertical') {
  31489. newValues.top = newValue;
  31490. newValues.bottom = newValue;
  31491. } else if (side === 'horizontal') {
  31492. newValues.left = newValue;
  31493. newValues.right = newValue;
  31494. } else {
  31495. newValues[side] = newValue;
  31496. }
  31497. });
  31498. } else {
  31499. ALL_SIDES.forEach(side => newValues[side] = newValue);
  31500. }
  31501. return newValues;
  31502. }
  31503. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/all-input-control.js
  31504. /**
  31505. * Internal dependencies
  31506. */
  31507. const all_input_control_noop = () => {};
  31508. function AllInputControl(_ref) {
  31509. let {
  31510. onChange = all_input_control_noop,
  31511. onFocus = all_input_control_noop,
  31512. onHoverOn = all_input_control_noop,
  31513. onHoverOff = all_input_control_noop,
  31514. values,
  31515. sides,
  31516. selectedUnits,
  31517. setSelectedUnits,
  31518. ...props
  31519. } = _ref;
  31520. const allValue = getAllValue(values, selectedUnits, sides);
  31521. const hasValues = isValuesDefined(values);
  31522. const isMixed = hasValues && isValuesMixed(values, selectedUnits, sides);
  31523. const allPlaceholder = isMixed ? LABELS.mixed : null;
  31524. const handleOnFocus = event => {
  31525. onFocus(event, {
  31526. side: 'all'
  31527. });
  31528. };
  31529. const handleOnChange = next => {
  31530. const isNumeric = !isNaN(parseFloat(next));
  31531. const nextValue = isNumeric ? next : undefined;
  31532. const nextValues = applyValueToSides(values, nextValue, sides);
  31533. onChange(nextValues);
  31534. }; // Set selected unit so it can be used as fallback by unlinked controls
  31535. // when individual sides do not have a value containing a unit.
  31536. const handleOnUnitChange = unit => {
  31537. const newUnits = applyValueToSides(selectedUnits, unit, sides);
  31538. setSelectedUnits(newUnits);
  31539. };
  31540. const handleOnHoverOn = () => {
  31541. onHoverOn({
  31542. top: true,
  31543. bottom: true,
  31544. left: true,
  31545. right: true
  31546. });
  31547. };
  31548. const handleOnHoverOff = () => {
  31549. onHoverOff({
  31550. top: false,
  31551. bottom: false,
  31552. left: false,
  31553. right: false
  31554. });
  31555. };
  31556. return (0,external_wp_element_namespaceObject.createElement)(BoxUnitControl, extends_extends({}, props, {
  31557. disableUnits: isMixed,
  31558. isOnly: true,
  31559. value: allValue,
  31560. onChange: handleOnChange,
  31561. onUnitChange: handleOnUnitChange,
  31562. onFocus: handleOnFocus,
  31563. onHoverOn: handleOnHoverOn,
  31564. onHoverOff: handleOnHoverOff,
  31565. placeholder: allPlaceholder
  31566. }));
  31567. }
  31568. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/input-controls.js
  31569. /**
  31570. * Internal dependencies
  31571. */
  31572. const input_controls_noop = () => {};
  31573. function BoxInputControls(_ref) {
  31574. let {
  31575. onChange = input_controls_noop,
  31576. onFocus = input_controls_noop,
  31577. onHoverOn = input_controls_noop,
  31578. onHoverOff = input_controls_noop,
  31579. values,
  31580. selectedUnits,
  31581. setSelectedUnits,
  31582. sides,
  31583. ...props
  31584. } = _ref;
  31585. const createHandleOnFocus = side => event => {
  31586. onFocus(event, {
  31587. side
  31588. });
  31589. };
  31590. const createHandleOnHoverOn = side => () => {
  31591. onHoverOn({
  31592. [side]: true
  31593. });
  31594. };
  31595. const createHandleOnHoverOff = side => () => {
  31596. onHoverOff({
  31597. [side]: false
  31598. });
  31599. };
  31600. const handleOnChange = nextValues => {
  31601. onChange(nextValues);
  31602. };
  31603. const createHandleOnChange = side => (next, _ref2) => {
  31604. let {
  31605. event
  31606. } = _ref2;
  31607. const {
  31608. altKey
  31609. } = event;
  31610. const nextValues = { ...values
  31611. };
  31612. const isNumeric = !isNaN(parseFloat(next));
  31613. const nextValue = isNumeric ? next : undefined;
  31614. nextValues[side] = nextValue;
  31615. /**
  31616. * Supports changing pair sides. For example, holding the ALT key
  31617. * when changing the TOP will also update BOTTOM.
  31618. */
  31619. if (altKey) {
  31620. switch (side) {
  31621. case 'top':
  31622. nextValues.bottom = nextValue;
  31623. break;
  31624. case 'bottom':
  31625. nextValues.top = nextValue;
  31626. break;
  31627. case 'left':
  31628. nextValues.right = nextValue;
  31629. break;
  31630. case 'right':
  31631. nextValues.left = nextValue;
  31632. break;
  31633. }
  31634. }
  31635. handleOnChange(nextValues);
  31636. };
  31637. const createHandleOnUnitChange = side => next => {
  31638. const newUnits = { ...selectedUnits
  31639. };
  31640. newUnits[side] = next;
  31641. setSelectedUnits(newUnits);
  31642. }; // Filter sides if custom configuration provided, maintaining default order.
  31643. const filteredSides = sides !== null && sides !== void 0 && sides.length ? ALL_SIDES.filter(side => sides.includes(side)) : ALL_SIDES;
  31644. const first = filteredSides[0];
  31645. const last = filteredSides[filteredSides.length - 1];
  31646. const only = first === last && first;
  31647. return (0,external_wp_element_namespaceObject.createElement)(LayoutContainer, {
  31648. className: "component-box-control__input-controls-wrapper"
  31649. }, (0,external_wp_element_namespaceObject.createElement)(Layout, {
  31650. gap: 0,
  31651. align: "top",
  31652. className: "component-box-control__input-controls"
  31653. }, filteredSides.map(side => {
  31654. const [parsedQuantity, parsedUnit] = parseQuantityAndUnitFromRawValue(values[side]);
  31655. const computedUnit = values[side] ? parsedUnit : selectedUnits[side];
  31656. return (0,external_wp_element_namespaceObject.createElement)(BoxUnitControl, extends_extends({}, props, {
  31657. isFirst: first === side,
  31658. isLast: last === side,
  31659. isOnly: only === side,
  31660. value: [parsedQuantity, computedUnit].join(''),
  31661. onChange: createHandleOnChange(side),
  31662. onUnitChange: createHandleOnUnitChange(side),
  31663. onFocus: createHandleOnFocus(side),
  31664. onHoverOn: createHandleOnHoverOn(side),
  31665. onHoverOff: createHandleOnHoverOff(side),
  31666. label: LABELS[side],
  31667. key: `box-control-${side}`
  31668. }));
  31669. })));
  31670. }
  31671. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/axial-input-controls.js
  31672. /**
  31673. * Internal dependencies
  31674. */
  31675. const groupedSides = ['vertical', 'horizontal'];
  31676. function AxialInputControls(_ref) {
  31677. let {
  31678. onChange,
  31679. onFocus,
  31680. onHoverOn,
  31681. onHoverOff,
  31682. values,
  31683. selectedUnits,
  31684. setSelectedUnits,
  31685. sides,
  31686. ...props
  31687. } = _ref;
  31688. const createHandleOnFocus = side => event => {
  31689. if (!onFocus) {
  31690. return;
  31691. }
  31692. onFocus(event, {
  31693. side
  31694. });
  31695. };
  31696. const createHandleOnHoverOn = side => () => {
  31697. if (!onHoverOn) {
  31698. return;
  31699. }
  31700. if (side === 'vertical') {
  31701. onHoverOn({
  31702. top: true,
  31703. bottom: true
  31704. });
  31705. }
  31706. if (side === 'horizontal') {
  31707. onHoverOn({
  31708. left: true,
  31709. right: true
  31710. });
  31711. }
  31712. };
  31713. const createHandleOnHoverOff = side => () => {
  31714. if (!onHoverOff) {
  31715. return;
  31716. }
  31717. if (side === 'vertical') {
  31718. onHoverOff({
  31719. top: false,
  31720. bottom: false
  31721. });
  31722. }
  31723. if (side === 'horizontal') {
  31724. onHoverOff({
  31725. left: false,
  31726. right: false
  31727. });
  31728. }
  31729. };
  31730. const createHandleOnChange = side => next => {
  31731. if (!onChange) {
  31732. return;
  31733. }
  31734. const nextValues = { ...values
  31735. };
  31736. const isNumeric = !isNaN(parseFloat(next));
  31737. const nextValue = isNumeric ? next : undefined;
  31738. if (side === 'vertical') {
  31739. nextValues.top = nextValue;
  31740. nextValues.bottom = nextValue;
  31741. }
  31742. if (side === 'horizontal') {
  31743. nextValues.left = nextValue;
  31744. nextValues.right = nextValue;
  31745. }
  31746. onChange(nextValues);
  31747. };
  31748. const createHandleOnUnitChange = side => next => {
  31749. const newUnits = { ...selectedUnits
  31750. };
  31751. if (side === 'vertical') {
  31752. newUnits.top = next;
  31753. newUnits.bottom = next;
  31754. }
  31755. if (side === 'horizontal') {
  31756. newUnits.left = next;
  31757. newUnits.right = next;
  31758. }
  31759. setSelectedUnits(newUnits);
  31760. }; // Filter sides if custom configuration provided, maintaining default order.
  31761. const filteredSides = sides !== null && sides !== void 0 && sides.length ? groupedSides.filter(side => sides.includes(side)) : groupedSides;
  31762. const first = filteredSides[0];
  31763. const last = filteredSides[filteredSides.length - 1];
  31764. const only = first === last && first;
  31765. return (0,external_wp_element_namespaceObject.createElement)(Layout, {
  31766. gap: 0,
  31767. align: "top",
  31768. className: "component-box-control__vertical-horizontal-input-controls"
  31769. }, filteredSides.map(side => {
  31770. const [parsedQuantity, parsedUnit] = parseQuantityAndUnitFromRawValue(side === 'vertical' ? values.top : values.left);
  31771. const selectedUnit = side === 'vertical' ? selectedUnits.top : selectedUnits.left;
  31772. return (0,external_wp_element_namespaceObject.createElement)(BoxUnitControl, extends_extends({}, props, {
  31773. isFirst: first === side,
  31774. isLast: last === side,
  31775. isOnly: only === side,
  31776. value: [parsedQuantity, selectedUnit !== null && selectedUnit !== void 0 ? selectedUnit : parsedUnit].join(''),
  31777. onChange: createHandleOnChange(side),
  31778. onUnitChange: createHandleOnUnitChange(side),
  31779. onFocus: createHandleOnFocus(side),
  31780. onHoverOn: createHandleOnHoverOn(side),
  31781. onHoverOff: createHandleOnHoverOff(side),
  31782. label: LABELS[side],
  31783. key: side
  31784. }));
  31785. }));
  31786. }
  31787. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/styles/box-control-icon-styles.js
  31788. 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)."; }
  31789. /**
  31790. * External dependencies
  31791. */
  31792. const box_control_icon_styles_Root = emotion_styled_base_browser_esm("span", true ? {
  31793. target: "eaw9yqk8"
  31794. } : 0)( true ? {
  31795. name: "1w884gc",
  31796. styles: "box-sizing:border-box;display:block;width:24px;height:24px;position:relative;padding:4px"
  31797. } : 0);
  31798. const Viewbox = emotion_styled_base_browser_esm("span", true ? {
  31799. target: "eaw9yqk7"
  31800. } : 0)( true ? {
  31801. name: "i6vjox",
  31802. styles: "box-sizing:border-box;display:block;position:relative;width:100%;height:100%"
  31803. } : 0);
  31804. const strokeFocus = _ref => {
  31805. let {
  31806. isFocused
  31807. } = _ref;
  31808. return /*#__PURE__*/emotion_react_browser_esm_css({
  31809. backgroundColor: 'currentColor',
  31810. opacity: isFocused ? 1 : 0.3
  31811. }, true ? "" : 0, true ? "" : 0);
  31812. };
  31813. const Stroke = emotion_styled_base_browser_esm("span", true ? {
  31814. target: "eaw9yqk6"
  31815. } : 0)("box-sizing:border-box;display:block;pointer-events:none;position:absolute;", strokeFocus, ";" + ( true ? "" : 0));
  31816. const VerticalStroke = /*#__PURE__*/emotion_styled_base_browser_esm(Stroke, true ? {
  31817. target: "eaw9yqk5"
  31818. } : 0)( true ? {
  31819. name: "1k2w39q",
  31820. styles: "bottom:3px;top:3px;width:2px"
  31821. } : 0);
  31822. const HorizontalStroke = /*#__PURE__*/emotion_styled_base_browser_esm(Stroke, true ? {
  31823. target: "eaw9yqk4"
  31824. } : 0)( true ? {
  31825. name: "1q9b07k",
  31826. styles: "height:2px;left:3px;right:3px"
  31827. } : 0);
  31828. const TopStroke = /*#__PURE__*/emotion_styled_base_browser_esm(HorizontalStroke, true ? {
  31829. target: "eaw9yqk3"
  31830. } : 0)( true ? {
  31831. name: "abcix4",
  31832. styles: "top:0"
  31833. } : 0);
  31834. const RightStroke = /*#__PURE__*/emotion_styled_base_browser_esm(VerticalStroke, true ? {
  31835. target: "eaw9yqk2"
  31836. } : 0)( true ? {
  31837. name: "1wf8jf",
  31838. styles: "right:0"
  31839. } : 0);
  31840. const BottomStroke = /*#__PURE__*/emotion_styled_base_browser_esm(HorizontalStroke, true ? {
  31841. target: "eaw9yqk1"
  31842. } : 0)( true ? {
  31843. name: "8tapst",
  31844. styles: "bottom:0"
  31845. } : 0);
  31846. const LeftStroke = /*#__PURE__*/emotion_styled_base_browser_esm(VerticalStroke, true ? {
  31847. target: "eaw9yqk0"
  31848. } : 0)( true ? {
  31849. name: "1ode3cm",
  31850. styles: "left:0"
  31851. } : 0);
  31852. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/icon.js
  31853. /**
  31854. * Internal dependencies
  31855. */
  31856. const BASE_ICON_SIZE = 24;
  31857. function BoxControlIcon(_ref) {
  31858. let {
  31859. size = 24,
  31860. side = 'all',
  31861. sides,
  31862. ...props
  31863. } = _ref;
  31864. const isSideDisabled = value => (sides === null || sides === void 0 ? void 0 : sides.length) && !sides.includes(value);
  31865. const hasSide = value => {
  31866. if (isSideDisabled(value)) {
  31867. return false;
  31868. }
  31869. return side === 'all' || side === value;
  31870. };
  31871. const top = hasSide('top') || hasSide('vertical');
  31872. const right = hasSide('right') || hasSide('horizontal');
  31873. const bottom = hasSide('bottom') || hasSide('vertical');
  31874. const left = hasSide('left') || hasSide('horizontal'); // Simulates SVG Icon scaling.
  31875. const scale = size / BASE_ICON_SIZE;
  31876. return (0,external_wp_element_namespaceObject.createElement)(box_control_icon_styles_Root, extends_extends({
  31877. style: {
  31878. transform: `scale(${scale})`
  31879. }
  31880. }, props), (0,external_wp_element_namespaceObject.createElement)(Viewbox, null, (0,external_wp_element_namespaceObject.createElement)(TopStroke, {
  31881. isFocused: top
  31882. }), (0,external_wp_element_namespaceObject.createElement)(RightStroke, {
  31883. isFocused: right
  31884. }), (0,external_wp_element_namespaceObject.createElement)(BottomStroke, {
  31885. isFocused: bottom
  31886. }), (0,external_wp_element_namespaceObject.createElement)(LeftStroke, {
  31887. isFocused: left
  31888. })));
  31889. }
  31890. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/linked-button.js
  31891. /**
  31892. * WordPress dependencies
  31893. */
  31894. /**
  31895. * Internal dependencies
  31896. */
  31897. function LinkedButton(_ref) {
  31898. let {
  31899. isLinked,
  31900. ...props
  31901. } = _ref;
  31902. const label = isLinked ? (0,external_wp_i18n_namespaceObject.__)('Unlink sides') : (0,external_wp_i18n_namespaceObject.__)('Link sides'); // TODO: Remove span after merging https://github.com/WordPress/gutenberg/pull/44198
  31903. return (0,external_wp_element_namespaceObject.createElement)(tooltip, {
  31904. text: label
  31905. }, (0,external_wp_element_namespaceObject.createElement)("span", null, (0,external_wp_element_namespaceObject.createElement)(build_module_button, extends_extends({}, props, {
  31906. className: "component-box-control__linked-button",
  31907. isSmall: true,
  31908. icon: isLinked ? library_link : link_off,
  31909. iconSize: 24,
  31910. "aria-label": label
  31911. }))));
  31912. }
  31913. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/index.js
  31914. /**
  31915. * WordPress dependencies
  31916. */
  31917. /**
  31918. * Internal dependencies
  31919. */
  31920. const defaultInputProps = {
  31921. min: 0
  31922. };
  31923. const box_control_noop = () => {};
  31924. function box_control_useUniqueId(idProp) {
  31925. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BoxControl, 'inspector-box-control');
  31926. return idProp || instanceId;
  31927. }
  31928. function BoxControl(_ref) {
  31929. let {
  31930. id: idProp,
  31931. inputProps = defaultInputProps,
  31932. onChange = box_control_noop,
  31933. label = (0,external_wp_i18n_namespaceObject.__)('Box Control'),
  31934. values: valuesProp,
  31935. units,
  31936. sides,
  31937. splitOnAxis = false,
  31938. allowReset = true,
  31939. resetValues = DEFAULT_VALUES
  31940. } = _ref;
  31941. const [values, setValues] = use_controlled_state(valuesProp, {
  31942. fallback: DEFAULT_VALUES
  31943. });
  31944. const inputValues = values || DEFAULT_VALUES;
  31945. const hasInitialValue = isValuesDefined(valuesProp);
  31946. const hasOneSide = (sides === null || sides === void 0 ? void 0 : sides.length) === 1;
  31947. const [isDirty, setIsDirty] = (0,external_wp_element_namespaceObject.useState)(hasInitialValue);
  31948. const [isLinked, setIsLinked] = (0,external_wp_element_namespaceObject.useState)(!hasInitialValue || !isValuesMixed(inputValues) || hasOneSide);
  31949. const [side, setSide] = (0,external_wp_element_namespaceObject.useState)(getInitialSide(isLinked, splitOnAxis)); // Tracking selected units via internal state allows filtering of CSS unit
  31950. // only values from being saved while maintaining preexisting unit selection
  31951. // behaviour. Filtering CSS only values prevents invalid style values.
  31952. const [selectedUnits, setSelectedUnits] = (0,external_wp_element_namespaceObject.useState)({
  31953. top: parseQuantityAndUnitFromRawValue(valuesProp === null || valuesProp === void 0 ? void 0 : valuesProp.top)[1],
  31954. right: parseQuantityAndUnitFromRawValue(valuesProp === null || valuesProp === void 0 ? void 0 : valuesProp.right)[1],
  31955. bottom: parseQuantityAndUnitFromRawValue(valuesProp === null || valuesProp === void 0 ? void 0 : valuesProp.bottom)[1],
  31956. left: parseQuantityAndUnitFromRawValue(valuesProp === null || valuesProp === void 0 ? void 0 : valuesProp.left)[1]
  31957. });
  31958. const id = box_control_useUniqueId(idProp);
  31959. const headingId = `${id}-heading`;
  31960. const toggleLinked = () => {
  31961. setIsLinked(!isLinked);
  31962. setSide(getInitialSide(!isLinked, splitOnAxis));
  31963. };
  31964. const handleOnFocus = (event, _ref2) => {
  31965. let {
  31966. side: nextSide
  31967. } = _ref2;
  31968. setSide(nextSide);
  31969. };
  31970. const handleOnChange = nextValues => {
  31971. onChange(nextValues);
  31972. setValues(nextValues);
  31973. setIsDirty(true);
  31974. };
  31975. const handleOnReset = () => {
  31976. onChange(resetValues);
  31977. setValues(resetValues);
  31978. setSelectedUnits(resetValues);
  31979. setIsDirty(false);
  31980. };
  31981. const inputControlProps = { ...inputProps,
  31982. onChange: handleOnChange,
  31983. onFocus: handleOnFocus,
  31984. isLinked,
  31985. units,
  31986. selectedUnits,
  31987. setSelectedUnits,
  31988. sides,
  31989. values: inputValues
  31990. };
  31991. return (0,external_wp_element_namespaceObject.createElement)(box_control_styles_Root, {
  31992. id: id,
  31993. role: "group",
  31994. "aria-labelledby": headingId
  31995. }, (0,external_wp_element_namespaceObject.createElement)(Header, {
  31996. className: "component-box-control__header"
  31997. }, (0,external_wp_element_namespaceObject.createElement)(flex_item_component, null, (0,external_wp_element_namespaceObject.createElement)(BaseControl.VisualLabel, {
  31998. id: headingId
  31999. }, label)), allowReset && (0,external_wp_element_namespaceObject.createElement)(flex_item_component, null, (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  32000. className: "component-box-control__reset-button",
  32001. isSecondary: true,
  32002. isSmall: true,
  32003. onClick: handleOnReset,
  32004. disabled: !isDirty
  32005. }, (0,external_wp_i18n_namespaceObject.__)('Reset')))), (0,external_wp_element_namespaceObject.createElement)(HeaderControlWrapper, {
  32006. className: "component-box-control__header-control-wrapper"
  32007. }, (0,external_wp_element_namespaceObject.createElement)(flex_item_component, null, (0,external_wp_element_namespaceObject.createElement)(BoxControlIcon, {
  32008. side: side,
  32009. sides: sides
  32010. })), isLinked && (0,external_wp_element_namespaceObject.createElement)(flex_block_component, null, (0,external_wp_element_namespaceObject.createElement)(AllInputControl, extends_extends({
  32011. "aria-label": label
  32012. }, 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, {
  32013. onClick: toggleLinked,
  32014. isLinked: isLinked
  32015. }))), !isLinked && !splitOnAxis && (0,external_wp_element_namespaceObject.createElement)(BoxInputControls, inputControlProps));
  32016. }
  32017. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/button-group/index.js
  32018. /**
  32019. * External dependencies
  32020. */
  32021. /**
  32022. * WordPress dependencies
  32023. */
  32024. /**
  32025. * Internal dependencies
  32026. */
  32027. function UnforwardedButtonGroup(props, ref) {
  32028. const {
  32029. className,
  32030. ...restProps
  32031. } = props;
  32032. const classes = classnames_default()('components-button-group', className);
  32033. return (0,external_wp_element_namespaceObject.createElement)("div", extends_extends({
  32034. ref: ref,
  32035. role: "group",
  32036. className: classes
  32037. }, restProps));
  32038. }
  32039. /**
  32040. * ButtonGroup can be used to group any related buttons together. To emphasize
  32041. * related buttons, a group should share a common container.
  32042. *
  32043. * ```jsx
  32044. * import { Button, ButtonGroup } from '@wordpress/components';
  32045. *
  32046. * const MyButtonGroup = () => (
  32047. * <ButtonGroup>
  32048. * <Button variant="primary">Button 1</Button>
  32049. * <Button variant="primary">Button 2</Button>
  32050. * </ButtonGroup>
  32051. * );
  32052. * ```
  32053. */
  32054. const ButtonGroup = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedButtonGroup);
  32055. /* harmony default export */ var button_group = (ButtonGroup);
  32056. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/elevation/styles.js
  32057. 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)."; }
  32058. /**
  32059. * External dependencies
  32060. */
  32061. const Elevation = true ? {
  32062. name: "12ip69d",
  32063. styles: "background:transparent;display:block;margin:0!important;pointer-events:none;position:absolute;will-change:box-shadow"
  32064. } : 0;
  32065. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/elevation/hook.js
  32066. /**
  32067. * External dependencies
  32068. */
  32069. /**
  32070. * WordPress dependencies
  32071. */
  32072. /**
  32073. * Internal dependencies
  32074. */
  32075. function getBoxShadow(value) {
  32076. const boxShadowColor = `rgba(0, 0, 0, ${value / 20})`;
  32077. const boxShadow = `0 ${value}px ${value * 2}px 0
  32078. ${boxShadowColor}`;
  32079. return boxShadow;
  32080. }
  32081. function useElevation(props) {
  32082. const {
  32083. active,
  32084. borderRadius = 'inherit',
  32085. className,
  32086. focus,
  32087. hover,
  32088. isInteractive = false,
  32089. offset = 0,
  32090. value = 0,
  32091. ...otherProps
  32092. } = useContextSystem(props, 'Elevation');
  32093. const cx = useCx();
  32094. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  32095. let hoverValue = isValueDefined(hover) ? hover : value * 2;
  32096. let activeValue = isValueDefined(active) ? active : value / 2;
  32097. if (!isInteractive) {
  32098. hoverValue = isValueDefined(hover) ? hover : undefined;
  32099. activeValue = isValueDefined(active) ? active : undefined;
  32100. }
  32101. const transition = `box-shadow ${config_values.transitionDuration} ${config_values.transitionTimingFunction}`;
  32102. const sx = {};
  32103. sx.Base = /*#__PURE__*/emotion_react_browser_esm_css({
  32104. borderRadius,
  32105. bottom: offset,
  32106. boxShadow: getBoxShadow(value),
  32107. opacity: config_values.elevationIntensity,
  32108. left: offset,
  32109. right: offset,
  32110. top: offset,
  32111. transition
  32112. }, reduceMotion('transition'), true ? "" : 0, true ? "" : 0);
  32113. if (isValueDefined(hoverValue)) {
  32114. sx.hover = /*#__PURE__*/emotion_react_browser_esm_css("*:hover>&{box-shadow:", getBoxShadow(hoverValue), ";}" + ( true ? "" : 0), true ? "" : 0);
  32115. }
  32116. if (isValueDefined(activeValue)) {
  32117. sx.active = /*#__PURE__*/emotion_react_browser_esm_css("*:active>&{box-shadow:", getBoxShadow(activeValue), ";}" + ( true ? "" : 0), true ? "" : 0);
  32118. }
  32119. if (isValueDefined(focus)) {
  32120. sx.focus = /*#__PURE__*/emotion_react_browser_esm_css("*:focus>&{box-shadow:", getBoxShadow(focus), ";}" + ( true ? "" : 0), true ? "" : 0);
  32121. }
  32122. return cx(Elevation, sx.Base, sx.hover, sx.focus, sx.active, className);
  32123. }, [active, borderRadius, className, cx, focus, hover, isInteractive, offset, value]);
  32124. return { ...otherProps,
  32125. className: classes,
  32126. 'aria-hidden': true
  32127. };
  32128. }
  32129. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/elevation/component.js
  32130. /**
  32131. * External dependencies
  32132. */
  32133. /**
  32134. * Internal dependencies
  32135. */
  32136. function UnconnectedElevation(props, forwardedRef) {
  32137. const elevationProps = useElevation(props);
  32138. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, elevationProps, {
  32139. ref: forwardedRef
  32140. }));
  32141. }
  32142. /**
  32143. * `Elevation` is a core component that renders shadow, using the component
  32144. * system's shadow system.
  32145. *
  32146. * The shadow effect is generated using the `value` prop.
  32147. *
  32148. * ```jsx
  32149. * import {
  32150. * __experimentalElevation as Elevation,
  32151. * __experimentalSurface as Surface,
  32152. * __experimentalText as Text,
  32153. * } from '@wordpress/components';
  32154. *
  32155. * function Example() {
  32156. * return (
  32157. * <Surface>
  32158. * <Text>Code is Poetry</Text>
  32159. * <Elevation value={ 5 } />
  32160. * </Surface>
  32161. * );
  32162. * }
  32163. * ```
  32164. */
  32165. const component_Elevation = contextConnect(UnconnectedElevation, 'Elevation');
  32166. /* harmony default export */ var elevation_component = (component_Elevation);
  32167. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/styles.js
  32168. 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)."; }
  32169. /**
  32170. * External dependencies
  32171. */
  32172. /**
  32173. * Internal dependencies
  32174. */
  32175. // Since the border for `Card` is rendered via the `box-shadow` property
  32176. // (as opposed to the `border` property), the value of the border radius needs
  32177. // to be adjusted by removing 1px (this is because the `box-shadow` renders
  32178. // as an "outer radius").
  32179. const adjustedBorderRadius = `calc(${config_values.cardBorderRadius} - 1px)`;
  32180. const Card = /*#__PURE__*/emotion_react_browser_esm_css("box-shadow:0 0 0 1px ", config_values.surfaceBorderColor, ";outline:none;" + ( true ? "" : 0), true ? "" : 0);
  32181. const styles_Header = true ? {
  32182. name: "1showjb",
  32183. styles: "border-bottom:1px solid;box-sizing:border-box;&:last-child{border-bottom:none;}"
  32184. } : 0;
  32185. const Footer = true ? {
  32186. name: "14n5oej",
  32187. styles: "border-top:1px solid;box-sizing:border-box;&:first-of-type{border-top:none;}"
  32188. } : 0;
  32189. const Content = true ? {
  32190. name: "13udsys",
  32191. styles: "height:100%"
  32192. } : 0;
  32193. const Body = true ? {
  32194. name: "6ywzd",
  32195. styles: "box-sizing:border-box;height:auto;max-height:100%"
  32196. } : 0;
  32197. const Media = true ? {
  32198. name: "dq805e",
  32199. styles: "box-sizing:border-box;overflow:hidden;&>img,&>iframe{display:block;height:auto;max-width:100%;width:100%;}"
  32200. } : 0;
  32201. const Divider = true ? {
  32202. name: "c990dr",
  32203. styles: "box-sizing:border-box;display:block;width:100%"
  32204. } : 0;
  32205. 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);
  32206. const borderColor = /*#__PURE__*/emotion_react_browser_esm_css("border-color:", config_values.colorDivider, ";" + ( true ? "" : 0), true ? "" : 0);
  32207. const boxShadowless = true ? {
  32208. name: "1t90u8d",
  32209. styles: "box-shadow:none"
  32210. } : 0;
  32211. const borderless = true ? {
  32212. name: "1e1ncky",
  32213. styles: "border:none"
  32214. } : 0;
  32215. const rounded = /*#__PURE__*/emotion_react_browser_esm_css("border-radius:", adjustedBorderRadius, ";" + ( true ? "" : 0), true ? "" : 0);
  32216. const xSmallCardPadding = /*#__PURE__*/emotion_react_browser_esm_css("padding:", config_values.cardPaddingXSmall, ";" + ( true ? "" : 0), true ? "" : 0);
  32217. const cardPaddings = {
  32218. large: /*#__PURE__*/emotion_react_browser_esm_css("padding:", config_values.cardPaddingLarge, ";" + ( true ? "" : 0), true ? "" : 0),
  32219. medium: /*#__PURE__*/emotion_react_browser_esm_css("padding:", config_values.cardPaddingMedium, ";" + ( true ? "" : 0), true ? "" : 0),
  32220. small: /*#__PURE__*/emotion_react_browser_esm_css("padding:", config_values.cardPaddingSmall, ";" + ( true ? "" : 0), true ? "" : 0),
  32221. xSmall: xSmallCardPadding,
  32222. // The `extraSmall` size is not officially documented, but the following styles
  32223. // are kept for legacy reasons to support older values of the `size` prop.
  32224. extraSmall: xSmallCardPadding
  32225. };
  32226. const shady = /*#__PURE__*/emotion_react_browser_esm_css("background-color:", COLORS.ui.backgroundDisabled, ";" + ( true ? "" : 0), true ? "" : 0);
  32227. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/surface/styles.js
  32228. /**
  32229. * External dependencies
  32230. */
  32231. /**
  32232. * Internal dependencies
  32233. */
  32234. const Surface = /*#__PURE__*/emotion_react_browser_esm_css("background-color:", config_values.surfaceColor, ";color:", COLORS.gray[900], ";position:relative;" + ( true ? "" : 0), true ? "" : 0);
  32235. const background = /*#__PURE__*/emotion_react_browser_esm_css("background-color:", config_values.surfaceBackgroundColor, ";" + ( true ? "" : 0), true ? "" : 0);
  32236. function getBorders(_ref) {
  32237. let {
  32238. borderBottom,
  32239. borderLeft,
  32240. borderRight,
  32241. borderTop
  32242. } = _ref;
  32243. const borderStyle = `1px solid ${config_values.surfaceBorderColor}`;
  32244. return /*#__PURE__*/emotion_react_browser_esm_css({
  32245. borderBottom: borderBottom ? borderStyle : undefined,
  32246. borderLeft: borderLeft ? borderStyle : undefined,
  32247. borderRight: borderRight ? borderStyle : undefined,
  32248. borderTop: borderTop ? borderStyle : undefined
  32249. }, true ? "" : 0, true ? "" : 0);
  32250. }
  32251. const primary = /*#__PURE__*/emotion_react_browser_esm_css( true ? "" : 0, true ? "" : 0);
  32252. const secondary = /*#__PURE__*/emotion_react_browser_esm_css("background:", config_values.surfaceBackgroundTintColor, ";" + ( true ? "" : 0), true ? "" : 0);
  32253. const tertiary = /*#__PURE__*/emotion_react_browser_esm_css("background:", config_values.surfaceBackgroundTertiaryColor, ";" + ( true ? "" : 0), true ? "" : 0);
  32254. const customBackgroundSize = surfaceBackgroundSize => [surfaceBackgroundSize, surfaceBackgroundSize].join(' ');
  32255. const dottedBackground1 = surfaceBackgroundSizeDotted => ['90deg', [config_values.surfaceBackgroundColor, surfaceBackgroundSizeDotted].join(' '), 'transparent 1%'].join(',');
  32256. const dottedBackground2 = surfaceBackgroundSizeDotted => [[config_values.surfaceBackgroundColor, surfaceBackgroundSizeDotted].join(' '), 'transparent 1%'].join(',');
  32257. const dottedBackgroundCombined = surfaceBackgroundSizeDotted => [`linear-gradient( ${dottedBackground1(surfaceBackgroundSizeDotted)} ) center`, `linear-gradient( ${dottedBackground2(surfaceBackgroundSizeDotted)} ) center`, config_values.surfaceBorderBoldColor].join(',');
  32258. const getDotted = (surfaceBackgroundSize, surfaceBackgroundSizeDotted) => /*#__PURE__*/emotion_react_browser_esm_css("background:", dottedBackgroundCombined(surfaceBackgroundSizeDotted), ";background-size:", customBackgroundSize(surfaceBackgroundSize), ";" + ( true ? "" : 0), true ? "" : 0);
  32259. const gridBackground1 = [`${config_values.surfaceBorderSubtleColor} 1px`, 'transparent 1px'].join(',');
  32260. const gridBackground2 = ['90deg', `${config_values.surfaceBorderSubtleColor} 1px`, 'transparent 1px'].join(',');
  32261. const gridBackgroundCombined = [`linear-gradient( ${gridBackground1} )`, `linear-gradient( ${gridBackground2} )`].join(',');
  32262. const getGrid = surfaceBackgroundSize => {
  32263. return /*#__PURE__*/emotion_react_browser_esm_css("background:", config_values.surfaceBackgroundColor, ";background-image:", gridBackgroundCombined, ";background-size:", customBackgroundSize(surfaceBackgroundSize), ";" + ( true ? "" : 0), true ? "" : 0);
  32264. };
  32265. const getVariant = (variant, surfaceBackgroundSize, surfaceBackgroundSizeDotted) => {
  32266. switch (variant) {
  32267. case 'dotted':
  32268. {
  32269. return getDotted(surfaceBackgroundSize, surfaceBackgroundSizeDotted);
  32270. }
  32271. case 'grid':
  32272. {
  32273. return getGrid(surfaceBackgroundSize);
  32274. }
  32275. case 'primary':
  32276. {
  32277. return primary;
  32278. }
  32279. case 'secondary':
  32280. {
  32281. return secondary;
  32282. }
  32283. case 'tertiary':
  32284. {
  32285. return tertiary;
  32286. }
  32287. }
  32288. };
  32289. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/surface/hook.js
  32290. /**
  32291. * WordPress dependencies
  32292. */
  32293. /**
  32294. * Internal dependencies
  32295. */
  32296. function useSurface(props) {
  32297. const {
  32298. backgroundSize = 12,
  32299. borderBottom = false,
  32300. borderLeft = false,
  32301. borderRight = false,
  32302. borderTop = false,
  32303. className,
  32304. variant = 'primary',
  32305. ...otherProps
  32306. } = useContextSystem(props, 'Surface');
  32307. const cx = useCx();
  32308. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  32309. const sx = {
  32310. borders: getBorders({
  32311. borderBottom,
  32312. borderLeft,
  32313. borderRight,
  32314. borderTop
  32315. })
  32316. };
  32317. return cx(Surface, sx.borders, getVariant(variant, `${backgroundSize}px`, `${backgroundSize - 1}px`), className);
  32318. }, [backgroundSize, borderBottom, borderLeft, borderRight, borderTop, className, cx, variant]);
  32319. return { ...otherProps,
  32320. className: classes
  32321. };
  32322. }
  32323. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card/hook.js
  32324. /**
  32325. * WordPress dependencies
  32326. */
  32327. /**
  32328. * Internal dependencies
  32329. */
  32330. function card_hook_useDeprecatedProps(_ref) {
  32331. let {
  32332. elevation,
  32333. isElevated,
  32334. ...otherProps
  32335. } = _ref;
  32336. const propsToReturn = { ...otherProps
  32337. };
  32338. let computedElevation = elevation;
  32339. if (isElevated) {
  32340. var _computedElevation;
  32341. external_wp_deprecated_default()('Card isElevated prop', {
  32342. since: '5.9',
  32343. alternative: 'elevation'
  32344. });
  32345. (_computedElevation = computedElevation) !== null && _computedElevation !== void 0 ? _computedElevation : computedElevation = 2;
  32346. } // The `elevation` prop should only be passed when it's not `undefined`,
  32347. // otherwise it will override the value that gets derived from `useContextSystem`.
  32348. if (typeof computedElevation !== 'undefined') {
  32349. propsToReturn.elevation = computedElevation;
  32350. }
  32351. return propsToReturn;
  32352. }
  32353. function useCard(props) {
  32354. const {
  32355. className,
  32356. elevation = 0,
  32357. isBorderless = false,
  32358. isRounded = true,
  32359. size = 'medium',
  32360. ...otherProps
  32361. } = useContextSystem(card_hook_useDeprecatedProps(props), 'Card');
  32362. const cx = useCx();
  32363. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  32364. return cx(Card, isBorderless && boxShadowless, isRounded && rounded, className);
  32365. }, [className, cx, isBorderless, isRounded]);
  32366. const surfaceProps = useSurface({ ...otherProps,
  32367. className: classes
  32368. });
  32369. return { ...surfaceProps,
  32370. elevation,
  32371. isBorderless,
  32372. isRounded,
  32373. size
  32374. };
  32375. }
  32376. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card/component.js
  32377. /**
  32378. * External dependencies
  32379. */
  32380. /**
  32381. * WordPress dependencies
  32382. */
  32383. /**
  32384. * Internal dependencies
  32385. */
  32386. function UnconnectedCard(props, forwardedRef) {
  32387. const {
  32388. children,
  32389. elevation,
  32390. isBorderless,
  32391. isRounded,
  32392. size,
  32393. ...otherProps
  32394. } = useCard(props);
  32395. const elevationBorderRadius = isRounded ? config_values.cardBorderRadius : 0;
  32396. const cx = useCx();
  32397. const elevationClassName = (0,external_wp_element_namespaceObject.useMemo)(() => cx( /*#__PURE__*/emotion_react_browser_esm_css({
  32398. borderRadius: elevationBorderRadius
  32399. }, true ? "" : 0, true ? "" : 0)), [cx, elevationBorderRadius]);
  32400. const contextProviderValue = (0,external_wp_element_namespaceObject.useMemo)(() => {
  32401. const contextProps = {
  32402. size,
  32403. isBorderless
  32404. };
  32405. return {
  32406. CardBody: contextProps,
  32407. CardHeader: contextProps,
  32408. CardFooter: contextProps
  32409. };
  32410. }, [isBorderless, size]);
  32411. return (0,external_wp_element_namespaceObject.createElement)(ContextSystemProvider, {
  32412. value: contextProviderValue
  32413. }, (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, otherProps, {
  32414. ref: forwardedRef
  32415. }), (0,external_wp_element_namespaceObject.createElement)(component, {
  32416. className: cx(Content)
  32417. }, children), (0,external_wp_element_namespaceObject.createElement)(elevation_component, {
  32418. className: elevationClassName,
  32419. isInteractive: false,
  32420. value: elevation ? 1 : 0
  32421. }), (0,external_wp_element_namespaceObject.createElement)(elevation_component, {
  32422. className: elevationClassName,
  32423. isInteractive: false,
  32424. value: elevation
  32425. })));
  32426. }
  32427. /**
  32428. * `Card` provides a flexible and extensible content container.
  32429. * `Card` also provides a convenient set of sub-components such as `CardBody`,
  32430. * `CardHeader`, `CardFooter`, and more.
  32431. *
  32432. * ```jsx
  32433. * import {
  32434. * Card,
  32435. * CardHeader,
  32436. * CardBody,
  32437. * CardFooter,
  32438. * Text,
  32439. * Heading,
  32440. * } from `@wordpress/components`;
  32441. *
  32442. * function Example() {
  32443. * return (
  32444. * <Card>
  32445. * <CardHeader>
  32446. * <Heading size={ 4 }>Card Title</Heading>
  32447. * </CardHeader>
  32448. * <CardBody>
  32449. * <Text>Card Content</Text>
  32450. * </CardBody>
  32451. * <CardFooter>
  32452. * <Text>Card Footer</Text>
  32453. * </CardFooter>
  32454. * </Card>
  32455. * );
  32456. * }
  32457. * ```
  32458. */
  32459. const component_Card = contextConnect(UnconnectedCard, 'Card');
  32460. /* harmony default export */ var card_component = (component_Card);
  32461. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/scrollable/styles.js
  32462. 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)."; }
  32463. /**
  32464. * External dependencies
  32465. */
  32466. /**
  32467. * Internal dependencies
  32468. */
  32469. 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);
  32470. const Scrollable = true ? {
  32471. name: "13udsys",
  32472. styles: "height:100%"
  32473. } : 0;
  32474. const styles_Content = true ? {
  32475. name: "bjn8wh",
  32476. styles: "position:relative"
  32477. } : 0;
  32478. const styles_smoothScroll = true ? {
  32479. name: "7zq9w",
  32480. styles: "scroll-behavior:smooth"
  32481. } : 0;
  32482. const scrollX = true ? {
  32483. name: "q33xhg",
  32484. styles: "overflow-x:auto;overflow-y:hidden"
  32485. } : 0;
  32486. const scrollY = true ? {
  32487. name: "103x71s",
  32488. styles: "overflow-x:hidden;overflow-y:auto"
  32489. } : 0;
  32490. const scrollAuto = true ? {
  32491. name: "umwchj",
  32492. styles: "overflow-y:auto"
  32493. } : 0;
  32494. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/scrollable/hook.js
  32495. /**
  32496. * WordPress dependencies
  32497. */
  32498. /**
  32499. * Internal dependencies
  32500. */
  32501. function useScrollable(props) {
  32502. const {
  32503. className,
  32504. scrollDirection = 'y',
  32505. smoothScroll = false,
  32506. ...otherProps
  32507. } = useContextSystem(props, 'Scrollable');
  32508. const cx = useCx();
  32509. 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]);
  32510. return { ...otherProps,
  32511. className: classes
  32512. };
  32513. }
  32514. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/scrollable/component.js
  32515. /**
  32516. * External dependencies
  32517. */
  32518. /**
  32519. * Internal dependencies
  32520. */
  32521. function UnconnectedScrollable(props, forwardedRef) {
  32522. const scrollableProps = useScrollable(props);
  32523. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, scrollableProps, {
  32524. ref: forwardedRef
  32525. }));
  32526. }
  32527. /**
  32528. * `Scrollable` is a layout component that content in a scrollable container.
  32529. *
  32530. * ```jsx
  32531. * import { __experimentalScrollable as Scrollable } from `@wordpress/components`;
  32532. *
  32533. * function Example() {
  32534. * return (
  32535. * <Scrollable style={ { maxHeight: 200 } }>
  32536. * <div style={ { height: 500 } }>...</div>
  32537. * </Scrollable>
  32538. * );
  32539. * }
  32540. * ```
  32541. */
  32542. const component_Scrollable = contextConnect(UnconnectedScrollable, 'Scrollable');
  32543. /* harmony default export */ var scrollable_component = (component_Scrollable);
  32544. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card-body/hook.js
  32545. /**
  32546. * WordPress dependencies
  32547. */
  32548. /**
  32549. * Internal dependencies
  32550. */
  32551. function useCardBody(props) {
  32552. const {
  32553. className,
  32554. isScrollable = false,
  32555. isShady = false,
  32556. size = 'medium',
  32557. ...otherProps
  32558. } = useContextSystem(props, 'CardBody');
  32559. const cx = useCx();
  32560. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(Body, borderRadius, cardPaddings[size], isShady && shady, // This classname is added for legacy compatibility reasons.
  32561. 'components-card__body', className), [className, cx, isShady, size]);
  32562. return { ...otherProps,
  32563. className: classes,
  32564. isScrollable
  32565. };
  32566. }
  32567. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card-body/component.js
  32568. /**
  32569. * External dependencies
  32570. */
  32571. /**
  32572. * Internal dependencies
  32573. */
  32574. function UnconnectedCardBody(props, forwardedRef) {
  32575. const {
  32576. isScrollable,
  32577. ...otherProps
  32578. } = useCardBody(props);
  32579. if (isScrollable) {
  32580. return (0,external_wp_element_namespaceObject.createElement)(scrollable_component, extends_extends({}, otherProps, {
  32581. ref: forwardedRef
  32582. }));
  32583. }
  32584. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, otherProps, {
  32585. ref: forwardedRef
  32586. }));
  32587. }
  32588. /**
  32589. * `CardBody` renders an optional content area for a `Card`.
  32590. * Multiple `CardBody` components can be used within `Card` if needed.
  32591. *
  32592. * ```jsx
  32593. * import { Card, CardBody } from `@wordpress/components`;
  32594. *
  32595. * <Card>
  32596. * <CardBody>
  32597. * ...
  32598. * </CardBody>
  32599. * </Card>
  32600. * ```
  32601. */
  32602. const CardBody = contextConnect(UnconnectedCardBody, 'CardBody');
  32603. /* harmony default export */ var card_body_component = (CardBody);
  32604. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Separator/Separator.js
  32605. // Automatically generated
  32606. var SEPARATOR_KEYS = ["orientation"];
  32607. var useSeparator = createHook({
  32608. name: "Separator",
  32609. compose: useRole,
  32610. keys: SEPARATOR_KEYS,
  32611. useOptions: function useOptions(_ref) {
  32612. var _ref$orientation = _ref.orientation,
  32613. orientation = _ref$orientation === void 0 ? "horizontal" : _ref$orientation,
  32614. options = _objectWithoutPropertiesLoose(_ref, ["orientation"]);
  32615. return _objectSpread2({
  32616. orientation: orientation
  32617. }, options);
  32618. },
  32619. useProps: function useProps(options, htmlProps) {
  32620. return _objectSpread2({
  32621. role: "separator",
  32622. "aria-orientation": options.orientation
  32623. }, htmlProps);
  32624. }
  32625. });
  32626. var Separator = createComponent({
  32627. as: "hr",
  32628. memo: true,
  32629. useHook: useSeparator
  32630. });
  32631. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/divider/styles.js
  32632. 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)."; }
  32633. /**
  32634. * External dependencies
  32635. */
  32636. /**
  32637. * Internal dependencies
  32638. */
  32639. const MARGIN_DIRECTIONS = {
  32640. vertical: {
  32641. start: 'marginLeft',
  32642. end: 'marginRight'
  32643. },
  32644. horizontal: {
  32645. start: 'marginTop',
  32646. end: 'marginBottom'
  32647. }
  32648. }; // Renders the correct margins given the Divider's `orientation` and the writing direction.
  32649. // When both the generic `margin` and the specific `marginStart|marginEnd` props are defined,
  32650. // the latter will take priority.
  32651. const renderMargin = _ref2 => {
  32652. let {
  32653. 'aria-orientation': orientation = 'horizontal',
  32654. margin,
  32655. marginStart,
  32656. marginEnd
  32657. } = _ref2;
  32658. return /*#__PURE__*/emotion_react_browser_esm_css(rtl({
  32659. [MARGIN_DIRECTIONS[orientation].start]: space(marginStart !== null && marginStart !== void 0 ? marginStart : margin),
  32660. [MARGIN_DIRECTIONS[orientation].end]: space(marginEnd !== null && marginEnd !== void 0 ? marginEnd : margin)
  32661. })(), true ? "" : 0, true ? "" : 0);
  32662. };
  32663. var divider_styles_ref = true ? {
  32664. name: "1u4hpl4",
  32665. styles: "display:inline"
  32666. } : 0;
  32667. const renderDisplay = _ref3 => {
  32668. let {
  32669. 'aria-orientation': orientation = 'horizontal'
  32670. } = _ref3;
  32671. return orientation === 'vertical' ? divider_styles_ref : undefined;
  32672. };
  32673. const renderBorder = _ref4 => {
  32674. let {
  32675. 'aria-orientation': orientation = 'horizontal'
  32676. } = _ref4;
  32677. return /*#__PURE__*/emotion_react_browser_esm_css({
  32678. [orientation === 'vertical' ? 'borderRight' : 'borderBottom']: '1px solid currentColor'
  32679. }, true ? "" : 0, true ? "" : 0);
  32680. };
  32681. const renderSize = _ref5 => {
  32682. let {
  32683. 'aria-orientation': orientation = 'horizontal'
  32684. } = _ref5;
  32685. return /*#__PURE__*/emotion_react_browser_esm_css({
  32686. height: orientation === 'vertical' ? 'auto' : 0,
  32687. width: orientation === 'vertical' ? 0 : 'auto'
  32688. }, true ? "" : 0, true ? "" : 0);
  32689. };
  32690. const DividerView = emotion_styled_base_browser_esm("hr", true ? {
  32691. target: "e19on6iw0"
  32692. } : 0)("border:0;margin:0;", renderDisplay, " ", renderBorder, " ", renderSize, " ", renderMargin, ";" + ( true ? "" : 0));
  32693. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/divider/component.js
  32694. /**
  32695. * External dependencies
  32696. */
  32697. // eslint-disable-next-line no-restricted-imports
  32698. /**
  32699. * Internal dependencies
  32700. */
  32701. function UnconnectedDivider(props, forwardedRef) {
  32702. const contextProps = useContextSystem(props, 'Divider');
  32703. return (0,external_wp_element_namespaceObject.createElement)(Separator, extends_extends({
  32704. as: DividerView
  32705. }, contextProps, {
  32706. ref: forwardedRef
  32707. }));
  32708. }
  32709. /**
  32710. * `Divider` is a layout component that separates groups of related content.
  32711. *
  32712. * ```js
  32713. * import {
  32714. * __experimentalDivider as Divider,
  32715. * __experimentalText as Text,
  32716. * __experimentalVStack as VStack,
  32717. * } from `@wordpress/components`;
  32718. *
  32719. * function Example() {
  32720. * return (
  32721. * <VStack spacing={4}>
  32722. * <Text>Some text here</Text>
  32723. * <Divider />
  32724. * <Text>Some more text here</Text>
  32725. * </VStack>
  32726. * );
  32727. * }
  32728. * ```
  32729. */
  32730. const component_Divider = contextConnect(UnconnectedDivider, 'Divider');
  32731. /* harmony default export */ var divider_component = (component_Divider);
  32732. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card-divider/hook.js
  32733. /**
  32734. * WordPress dependencies
  32735. */
  32736. /**
  32737. * Internal dependencies
  32738. */
  32739. function useCardDivider(props) {
  32740. const {
  32741. className,
  32742. ...otherProps
  32743. } = useContextSystem(props, 'CardDivider');
  32744. const cx = useCx();
  32745. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(Divider, borderColor, // This classname is added for legacy compatibility reasons.
  32746. 'components-card__divider', className), [className, cx]);
  32747. return { ...otherProps,
  32748. className: classes
  32749. };
  32750. }
  32751. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card-divider/component.js
  32752. /**
  32753. * External dependencies
  32754. */
  32755. /**
  32756. * Internal dependencies
  32757. */
  32758. function UnconnectedCardDivider(props, forwardedRef) {
  32759. const dividerProps = useCardDivider(props);
  32760. return (0,external_wp_element_namespaceObject.createElement)(divider_component, extends_extends({}, dividerProps, {
  32761. ref: forwardedRef
  32762. }));
  32763. }
  32764. /**
  32765. * `CardDivider` renders an optional divider within a `Card`.
  32766. * It is typically used to divide multiple `CardBody` components from each other.
  32767. *
  32768. * ```jsx
  32769. * import { Card, CardBody, CardDivider } from `@wordpress/components`;
  32770. *
  32771. * <Card>
  32772. * <CardBody>...</CardBody>
  32773. * <CardDivider />
  32774. * <CardBody>...</CardBody>
  32775. * </Card>
  32776. * ```
  32777. */
  32778. const CardDivider = contextConnect(UnconnectedCardDivider, 'CardDivider');
  32779. /* harmony default export */ var card_divider_component = (CardDivider);
  32780. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card-footer/hook.js
  32781. /**
  32782. * WordPress dependencies
  32783. */
  32784. /**
  32785. * Internal dependencies
  32786. */
  32787. function useCardFooter(props) {
  32788. const {
  32789. className,
  32790. justify,
  32791. isBorderless = false,
  32792. isShady = false,
  32793. size = 'medium',
  32794. ...otherProps
  32795. } = useContextSystem(props, 'CardFooter');
  32796. const cx = useCx();
  32797. 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.
  32798. 'components-card__footer', className), [className, cx, isBorderless, isShady, size]);
  32799. return { ...otherProps,
  32800. className: classes,
  32801. justify
  32802. };
  32803. }
  32804. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card-footer/component.js
  32805. /**
  32806. * External dependencies
  32807. */
  32808. /**
  32809. * Internal dependencies
  32810. */
  32811. function UnconnectedCardFooter(props, forwardedRef) {
  32812. const footerProps = useCardFooter(props);
  32813. return (0,external_wp_element_namespaceObject.createElement)(flex_component, extends_extends({}, footerProps, {
  32814. ref: forwardedRef
  32815. }));
  32816. }
  32817. /**
  32818. * `CardFooter` renders an optional footer within a `Card`.
  32819. *
  32820. * ```jsx
  32821. * import { Card, CardBody, CardFooter } from `@wordpress/components`;
  32822. *
  32823. * <Card>
  32824. * <CardBody>...</CardBody>
  32825. * <CardFooter>...</CardFooter>
  32826. * </Card>
  32827. * ```
  32828. */
  32829. const CardFooter = contextConnect(UnconnectedCardFooter, 'CardFooter');
  32830. /* harmony default export */ var card_footer_component = (CardFooter);
  32831. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card-header/hook.js
  32832. /**
  32833. * WordPress dependencies
  32834. */
  32835. /**
  32836. * Internal dependencies
  32837. */
  32838. function useCardHeader(props) {
  32839. const {
  32840. className,
  32841. isBorderless = false,
  32842. isShady = false,
  32843. size = 'medium',
  32844. ...otherProps
  32845. } = useContextSystem(props, 'CardHeader');
  32846. const cx = useCx();
  32847. 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.
  32848. 'components-card__header', className), [className, cx, isBorderless, isShady, size]);
  32849. return { ...otherProps,
  32850. className: classes
  32851. };
  32852. }
  32853. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card-header/component.js
  32854. /**
  32855. * External dependencies
  32856. */
  32857. /**
  32858. * Internal dependencies
  32859. */
  32860. function UnconnectedCardHeader(props, forwardedRef) {
  32861. const headerProps = useCardHeader(props);
  32862. return (0,external_wp_element_namespaceObject.createElement)(flex_component, extends_extends({}, headerProps, {
  32863. ref: forwardedRef
  32864. }));
  32865. }
  32866. /**
  32867. * `CardHeader` renders an optional header within a `Card`.
  32868. *
  32869. * ```jsx
  32870. * import { Card, CardBody, CardHeader } from `@wordpress/components`;
  32871. *
  32872. * <Card>
  32873. * <CardHeader>...</CardHeader>
  32874. * <CardBody>...</CardBody>
  32875. * </Card>
  32876. * ```
  32877. */
  32878. const CardHeader = contextConnect(UnconnectedCardHeader, 'CardHeader');
  32879. /* harmony default export */ var card_header_component = (CardHeader);
  32880. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card-media/hook.js
  32881. /**
  32882. * WordPress dependencies
  32883. */
  32884. /**
  32885. * Internal dependencies
  32886. */
  32887. function useCardMedia(props) {
  32888. const {
  32889. className,
  32890. ...otherProps
  32891. } = useContextSystem(props, 'CardMedia');
  32892. const cx = useCx();
  32893. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(Media, borderRadius, // This classname is added for legacy compatibility reasons.
  32894. 'components-card__media', className), [className, cx]);
  32895. return { ...otherProps,
  32896. className: classes
  32897. };
  32898. }
  32899. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/card-media/component.js
  32900. /**
  32901. * External dependencies
  32902. */
  32903. /**
  32904. * Internal dependencies
  32905. */
  32906. function UnconnectedCardMedia(props, forwardedRef) {
  32907. const cardMediaProps = useCardMedia(props);
  32908. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, cardMediaProps, {
  32909. ref: forwardedRef
  32910. }));
  32911. }
  32912. /**
  32913. * `CardMedia` provides a container for media elements within a `Card`.
  32914. *
  32915. * @example
  32916. * ```jsx
  32917. * import { Card, CardBody, CardMedia } from '@wordpress/components';
  32918. *
  32919. * const Example = () => (
  32920. * <Card>
  32921. * <CardMedia>
  32922. * <img src="..." />
  32923. * </CardMedia>
  32924. * <CardBody>...</CardBody>
  32925. * </Card>
  32926. * );
  32927. * ```
  32928. */
  32929. const CardMedia = contextConnect(UnconnectedCardMedia, 'CardMedia');
  32930. /* harmony default export */ var card_media_component = (CardMedia);
  32931. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/reset.js
  32932. /**
  32933. * WordPress dependencies
  32934. */
  32935. const reset_reset = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  32936. xmlns: "http://www.w3.org/2000/svg",
  32937. viewBox: "0 0 24 24"
  32938. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  32939. d: "M7 11.5h10V13H7z"
  32940. }));
  32941. /* harmony default export */ var library_reset = (reset_reset);
  32942. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/checkbox-control/index.js
  32943. /**
  32944. * External dependencies
  32945. */
  32946. /**
  32947. * WordPress dependencies
  32948. */
  32949. /**
  32950. * Internal dependencies
  32951. */
  32952. /**
  32953. * Checkboxes allow the user to select one or more items from a set.
  32954. *
  32955. * ```jsx
  32956. * import { CheckboxControl } from '@wordpress/components';
  32957. * import { useState } from '@wordpress/element';
  32958. *
  32959. * const MyCheckboxControl = () => {
  32960. * const [ isChecked, setChecked ] = useState( true );
  32961. * return (
  32962. * <CheckboxControl
  32963. * label="Is author"
  32964. * help="Is the user a author or not?"
  32965. * checked={ isChecked }
  32966. * onChange={ setChecked }
  32967. * />
  32968. * );
  32969. * };
  32970. * ```
  32971. */
  32972. function CheckboxControl(props) {
  32973. const {
  32974. __nextHasNoMarginBottom,
  32975. label,
  32976. className,
  32977. heading,
  32978. checked,
  32979. indeterminate,
  32980. help,
  32981. onChange,
  32982. ...additionalProps
  32983. } = props;
  32984. if (heading) {
  32985. external_wp_deprecated_default()('`heading` prop in `CheckboxControl`', {
  32986. alternative: 'a separate element to implement a heading',
  32987. since: '5.8'
  32988. });
  32989. }
  32990. const [showCheckedIcon, setShowCheckedIcon] = (0,external_wp_element_namespaceObject.useState)(false);
  32991. const [showIndeterminateIcon, setShowIndeterminateIcon] = (0,external_wp_element_namespaceObject.useState)(false); // Run the following callback every time the `ref` (and the additional
  32992. // dependencies) change.
  32993. const ref = (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
  32994. if (!node) {
  32995. return;
  32996. } // It cannot be set using an HTML attribute.
  32997. node.indeterminate = !!indeterminate;
  32998. setShowCheckedIcon(node.matches(':checked'));
  32999. setShowIndeterminateIcon(node.matches(':indeterminate'));
  33000. }, [checked, indeterminate]);
  33001. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(CheckboxControl);
  33002. const id = `inspector-checkbox-control-${instanceId}`;
  33003. const onChangeValue = event => onChange(event.target.checked);
  33004. return (0,external_wp_element_namespaceObject.createElement)(base_control, {
  33005. __nextHasNoMarginBottom: __nextHasNoMarginBottom,
  33006. label: heading,
  33007. id: id,
  33008. help: help,
  33009. className: classnames_default()('components-checkbox-control', className)
  33010. }, (0,external_wp_element_namespaceObject.createElement)("span", {
  33011. className: "components-checkbox-control__input-container"
  33012. }, (0,external_wp_element_namespaceObject.createElement)("input", extends_extends({
  33013. ref: ref,
  33014. id: id,
  33015. className: "components-checkbox-control__input",
  33016. type: "checkbox",
  33017. value: "1",
  33018. onChange: onChangeValue,
  33019. checked: checked,
  33020. "aria-describedby": !!help ? id + '__help' : undefined
  33021. }, additionalProps)), showIndeterminateIcon ? (0,external_wp_element_namespaceObject.createElement)(icons_build_module_icon, {
  33022. icon: library_reset,
  33023. className: "components-checkbox-control__indeterminate",
  33024. role: "presentation"
  33025. }) : null, showCheckedIcon ? (0,external_wp_element_namespaceObject.createElement)(icons_build_module_icon, {
  33026. icon: library_check,
  33027. className: "components-checkbox-control__checked",
  33028. role: "presentation"
  33029. }) : null), (0,external_wp_element_namespaceObject.createElement)("label", {
  33030. className: "components-checkbox-control__label",
  33031. htmlFor: id
  33032. }, label));
  33033. }
  33034. /* harmony default export */ var checkbox_control = (CheckboxControl);
  33035. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/clipboard-button/index.js
  33036. /**
  33037. * External dependencies
  33038. */
  33039. /**
  33040. * WordPress dependencies
  33041. */
  33042. /**
  33043. * Internal dependencies
  33044. */
  33045. const TIMEOUT = 4000;
  33046. /**
  33047. * @param {Object} props
  33048. * @param {string} [props.className]
  33049. * @param {import('react').ReactNode} props.children
  33050. * @param {() => void} props.onCopy
  33051. * @param {() => void} [props.onFinishCopy]
  33052. * @param {string} props.text
  33053. */
  33054. function ClipboardButton(_ref) {
  33055. let {
  33056. className,
  33057. children,
  33058. onCopy,
  33059. onFinishCopy,
  33060. text,
  33061. ...buttonProps
  33062. } = _ref;
  33063. external_wp_deprecated_default()('wp.components.ClipboardButton', {
  33064. since: '5.8',
  33065. alternative: 'wp.compose.useCopyToClipboard'
  33066. });
  33067. /** @type {import('react').MutableRefObject<ReturnType<setTimeout> | undefined>} */
  33068. const timeoutId = (0,external_wp_element_namespaceObject.useRef)();
  33069. const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(text, () => {
  33070. onCopy(); // @ts-expect-error: Should check if .current is defined, but not changing because this component is deprecated.
  33071. clearTimeout(timeoutId.current);
  33072. if (onFinishCopy) {
  33073. timeoutId.current = setTimeout(() => onFinishCopy(), TIMEOUT);
  33074. }
  33075. });
  33076. (0,external_wp_element_namespaceObject.useEffect)(() => {
  33077. // @ts-expect-error: Should check if .current is defined, but not changing because this component is deprecated.
  33078. clearTimeout(timeoutId.current);
  33079. }, []);
  33080. const classes = classnames_default()('components-clipboard-button', className); // Workaround for inconsistent behavior in Safari, where <textarea> is not
  33081. // the document.activeElement at the moment when the copy event fires.
  33082. // This causes documentHasSelection() in the copy-handler component to
  33083. // mistakenly override the ClipboardButton, and copy a serialized string
  33084. // of the current block instead.
  33085. /** @type {import('react').ClipboardEventHandler<HTMLButtonElement>} */
  33086. const focusOnCopyEventTarget = event => {
  33087. // @ts-expect-error: Should be currentTarget, but not changing because this component is deprecated.
  33088. event.target.focus();
  33089. };
  33090. return (0,external_wp_element_namespaceObject.createElement)(build_module_button, extends_extends({}, buttonProps, {
  33091. className: classes,
  33092. ref: ref,
  33093. onCopy: focusOnCopyEventTarget
  33094. }), children);
  33095. }
  33096. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js
  33097. /**
  33098. * WordPress dependencies
  33099. */
  33100. const plus = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  33101. xmlns: "http://www.w3.org/2000/svg",
  33102. viewBox: "0 0 24 24"
  33103. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  33104. d: "M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"
  33105. }));
  33106. /* harmony default export */ var library_plus = (plus);
  33107. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js
  33108. /**
  33109. * WordPress dependencies
  33110. */
  33111. const moreVertical = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  33112. xmlns: "http://www.w3.org/2000/svg",
  33113. viewBox: "0 0 24 24"
  33114. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  33115. d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"
  33116. }));
  33117. /* harmony default export */ var more_vertical = (moreVertical);
  33118. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/item-group/styles.js
  33119. 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)."; }
  33120. /**
  33121. * External dependencies
  33122. */
  33123. /**
  33124. * Internal dependencies
  33125. */
  33126. const unstyledButton = /*#__PURE__*/emotion_react_browser_esm_css("appearance:none;border:1px solid transparent;cursor:pointer;background:none;text-align:left;&:hover{color:", COLORS.ui.theme, ";}&:focus{background-color:transparent;color:", COLORS.ui.theme, ";border-color:", COLORS.ui.theme, ";outline:3px solid transparent;}" + ( true ? "" : 0), true ? "" : 0);
  33127. const itemWrapper = true ? {
  33128. name: "1bcj5ek",
  33129. styles: "width:100%;display:block"
  33130. } : 0;
  33131. const item = true ? {
  33132. name: "a5hqs6",
  33133. styles: "width:100%;display:block;margin:0;color:inherit"
  33134. } : 0;
  33135. const bordered = /*#__PURE__*/emotion_react_browser_esm_css("border:1px solid ", config_values.surfaceBorderColor, ";" + ( true ? "" : 0), true ? "" : 0);
  33136. 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);
  33137. const styles_borderRadius = config_values.controlBorderRadius;
  33138. const styles_spacedAround = /*#__PURE__*/emotion_react_browser_esm_css("border-radius:", styles_borderRadius, ";" + ( true ? "" : 0), true ? "" : 0);
  33139. 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);
  33140. const baseFontHeight = `calc(${config_values.fontSize} * ${config_values.fontLineHeightBase})`;
  33141. /*
  33142. * Math:
  33143. * - Use the desired height as the base value
  33144. * - Subtract the computed height of (default) text
  33145. * - Subtract the effects of border
  33146. * - Divide the calculated number by 2, in order to get an individual top/bottom padding
  33147. */
  33148. const paddingY = `calc((${config_values.controlHeight} - ${baseFontHeight} - 2px) / 2)`;
  33149. const paddingYSmall = `calc((${config_values.controlHeightSmall} - ${baseFontHeight} - 2px) / 2)`;
  33150. const paddingYLarge = `calc((${config_values.controlHeightLarge} - ${baseFontHeight} - 2px) / 2)`;
  33151. const itemSizes = {
  33152. small: /*#__PURE__*/emotion_react_browser_esm_css("padding:", paddingYSmall, " ", config_values.controlPaddingXSmall, ";" + ( true ? "" : 0), true ? "" : 0),
  33153. medium: /*#__PURE__*/emotion_react_browser_esm_css("padding:", paddingY, " ", config_values.controlPaddingX, ";" + ( true ? "" : 0), true ? "" : 0),
  33154. large: /*#__PURE__*/emotion_react_browser_esm_css("padding:", paddingYLarge, " ", config_values.controlPaddingXLarge, ";" + ( true ? "" : 0), true ? "" : 0)
  33155. };
  33156. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/item-group/item-group/hook.js
  33157. /**
  33158. * Internal dependencies
  33159. */
  33160. /**
  33161. * Internal dependencies
  33162. */
  33163. function useItemGroup(props) {
  33164. const {
  33165. className,
  33166. isBordered = false,
  33167. isRounded = true,
  33168. isSeparated = false,
  33169. role = 'list',
  33170. ...otherProps
  33171. } = useContextSystem(props, 'ItemGroup');
  33172. const cx = useCx();
  33173. const classes = cx(isBordered && bordered, isSeparated && separated, isRounded && styles_rounded, className);
  33174. return {
  33175. isBordered,
  33176. className: classes,
  33177. role,
  33178. isSeparated,
  33179. ...otherProps
  33180. };
  33181. }
  33182. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/item-group/context.js
  33183. /**
  33184. * WordPress dependencies
  33185. */
  33186. /**
  33187. * Internal dependencies
  33188. */
  33189. const ItemGroupContext = (0,external_wp_element_namespaceObject.createContext)({
  33190. size: 'medium'
  33191. });
  33192. const useItemGroupContext = () => (0,external_wp_element_namespaceObject.useContext)(ItemGroupContext);
  33193. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/item-group/item-group/component.js
  33194. /**
  33195. * External dependencies
  33196. */
  33197. /**
  33198. * Internal dependencies
  33199. */
  33200. function ItemGroup(props, forwardedRef) {
  33201. const {
  33202. isBordered,
  33203. isSeparated,
  33204. size: sizeProp,
  33205. ...otherProps
  33206. } = useItemGroup(props);
  33207. const {
  33208. size: contextSize
  33209. } = useItemGroupContext();
  33210. const spacedAround = !isBordered && !isSeparated;
  33211. const size = sizeProp || contextSize;
  33212. const contextValue = {
  33213. spacedAround,
  33214. size
  33215. };
  33216. return (0,external_wp_element_namespaceObject.createElement)(ItemGroupContext.Provider, {
  33217. value: contextValue
  33218. }, (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, otherProps, {
  33219. ref: forwardedRef
  33220. })));
  33221. }
  33222. /* harmony default export */ var item_group_component = (contextConnect(ItemGroup, 'ItemGroup'));
  33223. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-picker/gradient-bar/constants.js
  33224. const GRADIENT_MARKERS_WIDTH = 16;
  33225. const INSERT_POINT_WIDTH = 16;
  33226. const MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT = 10;
  33227. const MINIMUM_DISTANCE_BETWEEN_POINTS = 0;
  33228. const MINIMUM_SIGNIFICANT_MOVE = 5;
  33229. const KEYBOARD_CONTROL_POINT_VARIATION = MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT;
  33230. const MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_MARKER = (INSERT_POINT_WIDTH + GRADIENT_MARKERS_WIDTH) / 2;
  33231. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-picker/gradient-bar/utils.js
  33232. /**
  33233. * Internal dependencies
  33234. */
  33235. /**
  33236. * Control point for the gradient bar.
  33237. *
  33238. * @typedef {Object} ControlPoint
  33239. * @property {string} color Color of the control point.
  33240. * @property {number} position Integer position of the control point as a percentage.
  33241. */
  33242. /**
  33243. * Color as parsed from the gradient by gradient-parser.
  33244. *
  33245. * @typedef {Object} Color
  33246. * @property {string} r Red component.
  33247. * @property {string} g Green component.
  33248. * @property {string} b Green component.
  33249. * @property {string} [a] Optional alpha component.
  33250. */
  33251. /**
  33252. * Clamps a number between 0 and 100.
  33253. *
  33254. * @param {number} value Value to clamp.
  33255. *
  33256. * @return {number} Value clamped between 0 and 100.
  33257. */
  33258. function clampPercent(value) {
  33259. return Math.max(0, Math.min(100, value));
  33260. }
  33261. /**
  33262. * Check if a control point is overlapping with another.
  33263. *
  33264. * @param {ControlPoint[]} value Array of control points.
  33265. * @param {number} initialIndex Index of the position to test.
  33266. * @param {number} newPosition New position of the control point.
  33267. * @param {number} minDistance Distance considered to be overlapping.
  33268. *
  33269. * @return {boolean} True if the point is overlapping.
  33270. */
  33271. function isOverlapping(value, initialIndex, newPosition) {
  33272. let minDistance = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : MINIMUM_DISTANCE_BETWEEN_POINTS;
  33273. const initialPosition = value[initialIndex].position;
  33274. const minPosition = Math.min(initialPosition, newPosition);
  33275. const maxPosition = Math.max(initialPosition, newPosition);
  33276. return value.some((_ref, index) => {
  33277. let {
  33278. position
  33279. } = _ref;
  33280. return index !== initialIndex && (Math.abs(position - newPosition) < minDistance || minPosition < position && position < maxPosition);
  33281. });
  33282. }
  33283. /**
  33284. * Adds a control point from an array and returns the new array.
  33285. *
  33286. * @param {ControlPoint[]} points Array of control points.
  33287. * @param {number} position Position to insert the new point.
  33288. * @param {Color} color Color to update the control point at index.
  33289. *
  33290. * @return {ControlPoint[]} New array of control points.
  33291. */
  33292. function addControlPoint(points, position, color) {
  33293. const nextIndex = points.findIndex(point => point.position > position);
  33294. const newPoint = {
  33295. color,
  33296. position
  33297. };
  33298. const newPoints = points.slice();
  33299. newPoints.splice(nextIndex - 1, 0, newPoint);
  33300. return newPoints;
  33301. }
  33302. /**
  33303. * Removes a control point from an array and returns the new array.
  33304. *
  33305. * @param {ControlPoint[]} points Array of control points.
  33306. * @param {number} index Index to remove.
  33307. *
  33308. * @return {ControlPoint[]} New array of control points.
  33309. */
  33310. function removeControlPoint(points, index) {
  33311. return points.filter((point, pointIndex) => {
  33312. return pointIndex !== index;
  33313. });
  33314. }
  33315. /**
  33316. * Updates a control point from an array and returns the new array.
  33317. *
  33318. * @param {ControlPoint[]} points Array of control points.
  33319. * @param {number} index Index to update.
  33320. * @param {ControlPoint[]} newPoint New control point to replace the index.
  33321. *
  33322. * @return {ControlPoint[]} New array of control points.
  33323. */
  33324. function updateControlPoint(points, index, newPoint) {
  33325. const newValue = points.slice();
  33326. newValue[index] = newPoint;
  33327. return newValue;
  33328. }
  33329. /**
  33330. * Updates the position of a control point from an array and returns the new array.
  33331. *
  33332. * @param {ControlPoint[]} points Array of control points.
  33333. * @param {number} index Index to update.
  33334. * @param {number} newPosition Position to move the control point at index.
  33335. *
  33336. * @return {ControlPoint[]} New array of control points.
  33337. */
  33338. function updateControlPointPosition(points, index, newPosition) {
  33339. if (isOverlapping(points, index, newPosition)) {
  33340. return points;
  33341. }
  33342. const newPoint = { ...points[index],
  33343. position: newPosition
  33344. };
  33345. return updateControlPoint(points, index, newPoint);
  33346. }
  33347. /**
  33348. * Updates the position of a control point from an array and returns the new array.
  33349. *
  33350. * @param {ControlPoint[]} points Array of control points.
  33351. * @param {number} index Index to update.
  33352. * @param {Color} newColor Color to update the control point at index.
  33353. *
  33354. * @return {ControlPoint[]} New array of control points.
  33355. */
  33356. function updateControlPointColor(points, index, newColor) {
  33357. const newPoint = { ...points[index],
  33358. color: newColor
  33359. };
  33360. return updateControlPoint(points, index, newPoint);
  33361. }
  33362. /**
  33363. * Updates the position of a control point from an array and returns the new array.
  33364. *
  33365. * @param {ControlPoint[]} points Array of control points.
  33366. * @param {number} position Position of the color stop.
  33367. * @param {string} newColor Color to update the control point at index.
  33368. *
  33369. * @return {ControlPoint[]} New array of control points.
  33370. */
  33371. function updateControlPointColorByPosition(points, position, newColor) {
  33372. const index = points.findIndex(point => point.position === position);
  33373. return updateControlPointColor(points, index, newColor);
  33374. }
  33375. /**
  33376. * Gets the horizontal coordinate when dragging a control point with the mouse.
  33377. *
  33378. * @param {number} mouseXCoordinate Horizontal coordinate of the mouse position.
  33379. * @param {Element} containerElement Container for the gradient picker.
  33380. *
  33381. * @return {number} Whole number percentage from the left.
  33382. */
  33383. function getHorizontalRelativeGradientPosition(mouseXCoordinate, containerElement) {
  33384. if (!containerElement) {
  33385. return;
  33386. }
  33387. const {
  33388. x,
  33389. width
  33390. } = containerElement.getBoundingClientRect();
  33391. const absolutePositionValue = mouseXCoordinate - x;
  33392. return Math.round(clampPercent(absolutePositionValue * 100 / width));
  33393. }
  33394. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-picker/gradient-bar/control-points.js
  33395. /**
  33396. * External dependencies
  33397. */
  33398. /**
  33399. * WordPress dependencies
  33400. */
  33401. /**
  33402. * Internal dependencies
  33403. */
  33404. function ControlPointButton(_ref) {
  33405. let {
  33406. isOpen,
  33407. position,
  33408. color,
  33409. ...additionalProps
  33410. } = _ref;
  33411. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ControlPointButton);
  33412. const descriptionId = `components-custom-gradient-picker__control-point-button-description-${instanceId}`;
  33413. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(build_module_button, extends_extends({
  33414. "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).
  33415. (0,external_wp_i18n_namespaceObject.__)('Gradient control point at position %1$s%% with color code %2$s.'), position, color),
  33416. "aria-describedby": descriptionId,
  33417. "aria-haspopup": "true",
  33418. "aria-expanded": isOpen,
  33419. className: classnames_default()('components-custom-gradient-picker__control-point-button', {
  33420. 'is-active': isOpen
  33421. })
  33422. }, additionalProps)), (0,external_wp_element_namespaceObject.createElement)(visually_hidden_component, {
  33423. id: descriptionId
  33424. }, (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.')));
  33425. }
  33426. function GradientColorPickerDropdown(_ref2) {
  33427. let {
  33428. isRenderedInSidebar,
  33429. className,
  33430. ...props
  33431. } = _ref2;
  33432. // Open the popover below the gradient control/insertion point
  33433. const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({
  33434. placement: 'bottom',
  33435. offset: 8
  33436. }), []);
  33437. const mergedClassName = classnames_default()('components-custom-gradient-picker__control-point-dropdown', className);
  33438. return (0,external_wp_element_namespaceObject.createElement)(CustomColorPickerDropdown, extends_extends({
  33439. isRenderedInSidebar: isRenderedInSidebar,
  33440. popoverProps: popoverProps,
  33441. className: mergedClassName
  33442. }, props));
  33443. }
  33444. function ControlPoints(_ref3) {
  33445. let {
  33446. disableRemove,
  33447. disableAlpha,
  33448. gradientPickerDomRef,
  33449. ignoreMarkerPosition,
  33450. value: controlPoints,
  33451. onChange,
  33452. onStartControlPointChange,
  33453. onStopControlPointChange,
  33454. __experimentalIsRenderedInSidebar
  33455. } = _ref3;
  33456. const controlPointMoveState = (0,external_wp_element_namespaceObject.useRef)();
  33457. const onMouseMove = event => {
  33458. const relativePosition = getHorizontalRelativeGradientPosition(event.clientX, gradientPickerDomRef.current);
  33459. const {
  33460. initialPosition,
  33461. index,
  33462. significantMoveHappened
  33463. } = controlPointMoveState.current;
  33464. if (!significantMoveHappened && Math.abs(initialPosition - relativePosition) >= MINIMUM_SIGNIFICANT_MOVE) {
  33465. controlPointMoveState.current.significantMoveHappened = true;
  33466. }
  33467. onChange(updateControlPointPosition(controlPoints, index, relativePosition));
  33468. };
  33469. const cleanEventListeners = () => {
  33470. if (window && window.removeEventListener && controlPointMoveState.current && controlPointMoveState.current.listenersActivated) {
  33471. window.removeEventListener('mousemove', onMouseMove);
  33472. window.removeEventListener('mouseup', cleanEventListeners);
  33473. onStopControlPointChange();
  33474. controlPointMoveState.current.listenersActivated = false;
  33475. }
  33476. }; // Adding `cleanEventListeners` to the dependency array below requires the function itself to be wrapped in a `useCallback`
  33477. // This memoization would prevent the event listeners from being properly cleaned.
  33478. // Instead, we'll pass a ref to the function in our `useEffect` so `cleanEventListeners` itself is no longer a dependency.
  33479. const cleanEventListenersRef = (0,external_wp_element_namespaceObject.useRef)();
  33480. cleanEventListenersRef.current = cleanEventListeners;
  33481. (0,external_wp_element_namespaceObject.useEffect)(() => {
  33482. return () => {
  33483. cleanEventListenersRef.current();
  33484. };
  33485. }, []);
  33486. return controlPoints.map((point, index) => {
  33487. const initialPosition = point === null || point === void 0 ? void 0 : point.position;
  33488. return ignoreMarkerPosition !== initialPosition && (0,external_wp_element_namespaceObject.createElement)(GradientColorPickerDropdown, {
  33489. isRenderedInSidebar: __experimentalIsRenderedInSidebar,
  33490. key: index,
  33491. onClose: onStopControlPointChange,
  33492. renderToggle: _ref4 => {
  33493. let {
  33494. isOpen,
  33495. onToggle
  33496. } = _ref4;
  33497. return (0,external_wp_element_namespaceObject.createElement)(ControlPointButton, {
  33498. key: index,
  33499. onClick: () => {
  33500. if (controlPointMoveState.current && controlPointMoveState.current.significantMoveHappened) {
  33501. return;
  33502. }
  33503. if (isOpen) {
  33504. onStopControlPointChange();
  33505. } else {
  33506. onStartControlPointChange();
  33507. }
  33508. onToggle();
  33509. },
  33510. onMouseDown: () => {
  33511. if (window && window.addEventListener) {
  33512. controlPointMoveState.current = {
  33513. initialPosition,
  33514. index,
  33515. significantMoveHappened: false,
  33516. listenersActivated: true
  33517. };
  33518. onStartControlPointChange();
  33519. window.addEventListener('mousemove', onMouseMove);
  33520. window.addEventListener('mouseup', cleanEventListeners);
  33521. }
  33522. },
  33523. onKeyDown: event => {
  33524. if (event.code === 'ArrowLeft') {
  33525. // Stop propagation of the key press event to avoid focus moving
  33526. // to another editor area.
  33527. event.stopPropagation();
  33528. onChange(updateControlPointPosition(controlPoints, index, clampPercent(point.position - KEYBOARD_CONTROL_POINT_VARIATION)));
  33529. } else if (event.code === 'ArrowRight') {
  33530. // Stop propagation of the key press event to avoid focus moving
  33531. // to another editor area.
  33532. event.stopPropagation();
  33533. onChange(updateControlPointPosition(controlPoints, index, clampPercent(point.position + KEYBOARD_CONTROL_POINT_VARIATION)));
  33534. }
  33535. },
  33536. isOpen: isOpen,
  33537. position: point.position,
  33538. color: point.color
  33539. });
  33540. },
  33541. renderContent: _ref5 => {
  33542. let {
  33543. onClose
  33544. } = _ref5;
  33545. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(LegacyAdapter, {
  33546. enableAlpha: !disableAlpha,
  33547. color: point.color,
  33548. onChange: color => {
  33549. onChange(updateControlPointColor(controlPoints, index, colord_w(color).toRgbString()));
  33550. }
  33551. }), !disableRemove && controlPoints.length > 2 && (0,external_wp_element_namespaceObject.createElement)(h_stack_component, {
  33552. className: "components-custom-gradient-picker__remove-control-point-wrapper",
  33553. alignment: "center"
  33554. }, (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  33555. onClick: () => {
  33556. onChange(removeControlPoint(controlPoints, index));
  33557. onClose();
  33558. },
  33559. variant: "link"
  33560. }, (0,external_wp_i18n_namespaceObject.__)('Remove Control Point'))));
  33561. },
  33562. style: {
  33563. left: `${point.position}%`,
  33564. transform: 'translateX( -50% )'
  33565. }
  33566. });
  33567. });
  33568. }
  33569. function InsertPoint(_ref6) {
  33570. let {
  33571. value: controlPoints,
  33572. onChange,
  33573. onOpenInserter,
  33574. onCloseInserter,
  33575. insertPosition,
  33576. disableAlpha,
  33577. __experimentalIsRenderedInSidebar
  33578. } = _ref6;
  33579. const [alreadyInsertedPoint, setAlreadyInsertedPoint] = (0,external_wp_element_namespaceObject.useState)(false);
  33580. return (0,external_wp_element_namespaceObject.createElement)(GradientColorPickerDropdown, {
  33581. isRenderedInSidebar: __experimentalIsRenderedInSidebar,
  33582. className: "components-custom-gradient-picker__inserter",
  33583. onClose: () => {
  33584. onCloseInserter();
  33585. },
  33586. renderToggle: _ref7 => {
  33587. let {
  33588. isOpen,
  33589. onToggle
  33590. } = _ref7;
  33591. return (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  33592. "aria-expanded": isOpen,
  33593. "aria-haspopup": "true",
  33594. onClick: () => {
  33595. if (isOpen) {
  33596. onCloseInserter();
  33597. } else {
  33598. setAlreadyInsertedPoint(false);
  33599. onOpenInserter();
  33600. }
  33601. onToggle();
  33602. },
  33603. className: "components-custom-gradient-picker__insert-point-dropdown",
  33604. icon: library_plus
  33605. });
  33606. },
  33607. renderContent: () => (0,external_wp_element_namespaceObject.createElement)(LegacyAdapter, {
  33608. enableAlpha: !disableAlpha,
  33609. onChange: color => {
  33610. if (!alreadyInsertedPoint) {
  33611. onChange(addControlPoint(controlPoints, insertPosition, colord_w(color).toRgbString()));
  33612. setAlreadyInsertedPoint(true);
  33613. } else {
  33614. onChange(updateControlPointColorByPosition(controlPoints, insertPosition, colord_w(color).toRgbString()));
  33615. }
  33616. }
  33617. }),
  33618. style: insertPosition !== null ? {
  33619. left: `${insertPosition}%`,
  33620. transform: 'translateX( -50% )'
  33621. } : undefined
  33622. });
  33623. }
  33624. ControlPoints.InsertPoint = InsertPoint;
  33625. /* harmony default export */ var control_points = (ControlPoints);
  33626. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-picker/gradient-bar/index.js
  33627. /**
  33628. * External dependencies
  33629. */
  33630. /**
  33631. * WordPress dependencies
  33632. */
  33633. /**
  33634. * Internal dependencies
  33635. */
  33636. function customGradientBarReducer(state, action) {
  33637. switch (action.type) {
  33638. case 'MOVE_INSERTER':
  33639. if (state.id === 'IDLE' || state.id === 'MOVING_INSERTER') {
  33640. return {
  33641. id: 'MOVING_INSERTER',
  33642. insertPosition: action.insertPosition
  33643. };
  33644. }
  33645. break;
  33646. case 'STOP_INSERTER_MOVE':
  33647. if (state.id === 'MOVING_INSERTER') {
  33648. return {
  33649. id: 'IDLE'
  33650. };
  33651. }
  33652. break;
  33653. case 'OPEN_INSERTER':
  33654. if (state.id === 'MOVING_INSERTER') {
  33655. return {
  33656. id: 'INSERTING_CONTROL_POINT',
  33657. insertPosition: state.insertPosition
  33658. };
  33659. }
  33660. break;
  33661. case 'CLOSE_INSERTER':
  33662. if (state.id === 'INSERTING_CONTROL_POINT') {
  33663. return {
  33664. id: 'IDLE'
  33665. };
  33666. }
  33667. break;
  33668. case 'START_CONTROL_CHANGE':
  33669. if (state.id === 'IDLE') {
  33670. return {
  33671. id: 'MOVING_CONTROL_POINT'
  33672. };
  33673. }
  33674. break;
  33675. case 'STOP_CONTROL_CHANGE':
  33676. if (state.id === 'MOVING_CONTROL_POINT') {
  33677. return {
  33678. id: 'IDLE'
  33679. };
  33680. }
  33681. break;
  33682. }
  33683. return state;
  33684. }
  33685. const customGradientBarReducerInitialState = {
  33686. id: 'IDLE'
  33687. };
  33688. function CustomGradientBar(_ref) {
  33689. let {
  33690. background,
  33691. hasGradient,
  33692. value: controlPoints,
  33693. onChange,
  33694. disableInserter = false,
  33695. disableAlpha = false,
  33696. __experimentalIsRenderedInSidebar
  33697. } = _ref;
  33698. const gradientMarkersContainerDomRef = (0,external_wp_element_namespaceObject.useRef)();
  33699. const [gradientBarState, gradientBarStateDispatch] = (0,external_wp_element_namespaceObject.useReducer)(customGradientBarReducer, customGradientBarReducerInitialState);
  33700. const onMouseEnterAndMove = event => {
  33701. const insertPosition = getHorizontalRelativeGradientPosition(event.clientX, gradientMarkersContainerDomRef.current); // If the insert point is close to an existing control point don't show it.
  33702. if ((0,external_lodash_namespaceObject.some)(controlPoints, _ref2 => {
  33703. let {
  33704. position
  33705. } = _ref2;
  33706. return Math.abs(insertPosition - position) < MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT;
  33707. })) {
  33708. if (gradientBarState.id === 'MOVING_INSERTER') {
  33709. gradientBarStateDispatch({
  33710. type: 'STOP_INSERTER_MOVE'
  33711. });
  33712. }
  33713. return;
  33714. }
  33715. gradientBarStateDispatch({
  33716. type: 'MOVE_INSERTER',
  33717. insertPosition
  33718. });
  33719. };
  33720. const onMouseLeave = () => {
  33721. gradientBarStateDispatch({
  33722. type: 'STOP_INSERTER_MOVE'
  33723. });
  33724. };
  33725. const isMovingInserter = gradientBarState.id === 'MOVING_INSERTER';
  33726. const isInsertingControlPoint = gradientBarState.id === 'INSERTING_CONTROL_POINT';
  33727. return (0,external_wp_element_namespaceObject.createElement)("div", {
  33728. className: classnames_default()('components-custom-gradient-picker__gradient-bar', {
  33729. 'has-gradient': hasGradient
  33730. }),
  33731. onMouseEnter: onMouseEnterAndMove,
  33732. onMouseMove: onMouseEnterAndMove,
  33733. style: {
  33734. background
  33735. },
  33736. onMouseLeave: onMouseLeave
  33737. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  33738. ref: gradientMarkersContainerDomRef,
  33739. className: "components-custom-gradient-picker__markers-container"
  33740. }, !disableInserter && (isMovingInserter || isInsertingControlPoint) && (0,external_wp_element_namespaceObject.createElement)(control_points.InsertPoint, {
  33741. __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,
  33742. disableAlpha: disableAlpha,
  33743. insertPosition: gradientBarState.insertPosition,
  33744. value: controlPoints,
  33745. onChange: onChange,
  33746. onOpenInserter: () => {
  33747. gradientBarStateDispatch({
  33748. type: 'OPEN_INSERTER'
  33749. });
  33750. },
  33751. onCloseInserter: () => {
  33752. gradientBarStateDispatch({
  33753. type: 'CLOSE_INSERTER'
  33754. });
  33755. }
  33756. }), (0,external_wp_element_namespaceObject.createElement)(control_points, {
  33757. __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,
  33758. disableAlpha: disableAlpha,
  33759. disableRemove: disableInserter,
  33760. gradientPickerDomRef: gradientMarkersContainerDomRef,
  33761. ignoreMarkerPosition: isInsertingControlPoint ? gradientBarState.insertPosition : undefined,
  33762. value: controlPoints,
  33763. onChange: onChange,
  33764. onStartControlPointChange: () => {
  33765. gradientBarStateDispatch({
  33766. type: 'START_CONTROL_CHANGE'
  33767. });
  33768. },
  33769. onStopControlPointChange: () => {
  33770. gradientBarStateDispatch({
  33771. type: 'STOP_CONTROL_CHANGE'
  33772. });
  33773. }
  33774. })));
  33775. }
  33776. // EXTERNAL MODULE: ./node_modules/gradient-parser/build/node.js
  33777. var build_node = __webpack_require__(7115);
  33778. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-picker/constants.js
  33779. /**
  33780. * WordPress dependencies
  33781. */
  33782. const DEFAULT_GRADIENT = 'linear-gradient(135deg, rgba(6, 147, 227, 1) 0%, rgb(155, 81, 224) 100%)';
  33783. const DEFAULT_LINEAR_GRADIENT_ANGLE = 180;
  33784. const HORIZONTAL_GRADIENT_ORIENTATION = {
  33785. type: 'angular',
  33786. value: 90
  33787. };
  33788. const GRADIENT_OPTIONS = [{
  33789. value: 'linear-gradient',
  33790. label: (0,external_wp_i18n_namespaceObject.__)('Linear')
  33791. }, {
  33792. value: 'radial-gradient',
  33793. label: (0,external_wp_i18n_namespaceObject.__)('Radial')
  33794. }];
  33795. const DIRECTIONAL_ORIENTATION_ANGLE_MAP = {
  33796. top: 0,
  33797. 'top right': 45,
  33798. 'right top': 45,
  33799. right: 90,
  33800. 'right bottom': 135,
  33801. 'bottom right': 135,
  33802. bottom: 180,
  33803. 'bottom left': 225,
  33804. 'left bottom': 225,
  33805. left: 270,
  33806. 'top left': 315,
  33807. 'left top': 315
  33808. };
  33809. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-picker/serializer.js
  33810. function serializeGradientColor(_ref) {
  33811. let {
  33812. type,
  33813. value
  33814. } = _ref;
  33815. if (type === 'literal') {
  33816. return value;
  33817. }
  33818. if (type === 'hex') {
  33819. return `#${value}`;
  33820. }
  33821. return `${type}(${value.join(',')})`;
  33822. }
  33823. function serializeGradientPosition(position) {
  33824. if (!position) {
  33825. return '';
  33826. }
  33827. const {
  33828. value,
  33829. type
  33830. } = position;
  33831. return `${value}${type}`;
  33832. }
  33833. function serializeGradientColorStop(_ref2) {
  33834. let {
  33835. type,
  33836. value,
  33837. length
  33838. } = _ref2;
  33839. return `${serializeGradientColor({
  33840. type,
  33841. value
  33842. })} ${serializeGradientPosition(length)}`;
  33843. }
  33844. function serializeGradientOrientation(orientation) {
  33845. if (!orientation || orientation.type !== 'angular') {
  33846. return;
  33847. }
  33848. return `${orientation.value}deg`;
  33849. }
  33850. function serializeGradient(_ref3) {
  33851. let {
  33852. type,
  33853. orientation,
  33854. colorStops
  33855. } = _ref3;
  33856. const serializedOrientation = serializeGradientOrientation(orientation);
  33857. const serializedColorStops = colorStops.sort((colorStop1, colorStop2) => {
  33858. var _colorStop1$length$va, _colorStop1$length, _colorStop2$length$va, _colorStop2$length;
  33859. return ((_colorStop1$length$va = colorStop1 === null || colorStop1 === void 0 ? void 0 : (_colorStop1$length = colorStop1.length) === null || _colorStop1$length === void 0 ? void 0 : _colorStop1$length.value) !== null && _colorStop1$length$va !== void 0 ? _colorStop1$length$va : 0) - ((_colorStop2$length$va = colorStop2 === null || colorStop2 === void 0 ? void 0 : (_colorStop2$length = colorStop2.length) === null || _colorStop2$length === void 0 ? void 0 : _colorStop2$length.value) !== null && _colorStop2$length$va !== void 0 ? _colorStop2$length$va : 0);
  33860. }).map(serializeGradientColorStop);
  33861. return `${type}(${[serializedOrientation, ...serializedColorStops].filter(Boolean).join(',')})`;
  33862. }
  33863. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-picker/utils.js
  33864. /**
  33865. * External dependencies
  33866. */
  33867. /**
  33868. * Internal dependencies
  33869. */
  33870. colord_k([plugins_names]);
  33871. function getLinearGradientRepresentation(gradientAST) {
  33872. return serializeGradient({
  33873. type: 'linear-gradient',
  33874. orientation: HORIZONTAL_GRADIENT_ORIENTATION,
  33875. colorStops: gradientAST.colorStops
  33876. });
  33877. }
  33878. function hasUnsupportedLength(item) {
  33879. return item.length === undefined || item.length.type !== '%';
  33880. }
  33881. function getGradientAstWithDefault(value) {
  33882. var _gradientAST$orientat;
  33883. // gradientAST will contain the gradient AST as parsed by gradient-parser npm module.
  33884. // More information of its structure available at https://www.npmjs.com/package/gradient-parser#ast.
  33885. let gradientAST;
  33886. try {
  33887. gradientAST = build_node.parse(value)[0];
  33888. gradientAST.value = value;
  33889. } catch (error) {
  33890. gradientAST = build_node.parse(DEFAULT_GRADIENT)[0];
  33891. gradientAST.value = DEFAULT_GRADIENT;
  33892. }
  33893. if (((_gradientAST$orientat = gradientAST.orientation) === null || _gradientAST$orientat === void 0 ? void 0 : _gradientAST$orientat.type) === 'directional') {
  33894. gradientAST.orientation.type = 'angular';
  33895. gradientAST.orientation.value = DIRECTIONAL_ORIENTATION_ANGLE_MAP[gradientAST.orientation.value].toString();
  33896. }
  33897. if (gradientAST.colorStops.some(hasUnsupportedLength)) {
  33898. const {
  33899. colorStops
  33900. } = gradientAST;
  33901. const step = 100 / (colorStops.length - 1);
  33902. colorStops.forEach((stop, index) => {
  33903. stop.length = {
  33904. value: step * index,
  33905. type: '%'
  33906. };
  33907. });
  33908. gradientAST.value = serializeGradient(gradientAST);
  33909. }
  33910. return gradientAST;
  33911. }
  33912. function getGradientAstWithControlPoints(gradientAST, newControlPoints) {
  33913. return { ...gradientAST,
  33914. colorStops: newControlPoints.map(_ref => {
  33915. let {
  33916. position,
  33917. color
  33918. } = _ref;
  33919. const {
  33920. r,
  33921. g,
  33922. b,
  33923. a
  33924. } = colord_w(color).toRgb();
  33925. return {
  33926. length: {
  33927. type: '%',
  33928. value: position === null || position === void 0 ? void 0 : position.toString()
  33929. },
  33930. type: a < 1 ? 'rgba' : 'rgb',
  33931. value: a < 1 ? [r, g, b, a] : [r, g, b]
  33932. };
  33933. })
  33934. };
  33935. }
  33936. function getStopCssColor(colorStop) {
  33937. switch (colorStop.type) {
  33938. case 'hex':
  33939. return `#${colorStop.value}`;
  33940. case 'literal':
  33941. return colorStop.value;
  33942. case 'rgb':
  33943. case 'rgba':
  33944. return `${colorStop.type}(${colorStop.value.join(',')})`;
  33945. default:
  33946. // Should be unreachable if passing an AST from gradient-parser.
  33947. // See https://github.com/rafaelcaricio/gradient-parser#ast.
  33948. return 'transparent';
  33949. }
  33950. }
  33951. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-picker/styles/custom-gradient-picker-styles.js
  33952. 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)."; }
  33953. /**
  33954. * External dependencies
  33955. */
  33956. /**
  33957. * Internal dependencies
  33958. */
  33959. const SelectWrapper = /*#__PURE__*/emotion_styled_base_browser_esm(flex_block_component, true ? {
  33960. target: "e99xvul1"
  33961. } : 0)( true ? {
  33962. name: "1gvx10y",
  33963. styles: "flex-grow:5"
  33964. } : 0);
  33965. const AccessoryWrapper = /*#__PURE__*/emotion_styled_base_browser_esm(flex_block_component, true ? {
  33966. target: "e99xvul0"
  33967. } : 0)( true ? {
  33968. name: "1gvx10y",
  33969. styles: "flex-grow:5"
  33970. } : 0);
  33971. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-picker/index.js
  33972. /**
  33973. * External dependencies
  33974. */
  33975. /**
  33976. * WordPress dependencies
  33977. */
  33978. /**
  33979. * Internal dependencies
  33980. */
  33981. const GradientAnglePicker = _ref => {
  33982. var _gradientAST$orientat, _gradientAST$orientat2;
  33983. let {
  33984. gradientAST,
  33985. hasGradient,
  33986. onChange
  33987. } = _ref;
  33988. const angle = (_gradientAST$orientat = gradientAST === null || gradientAST === void 0 ? void 0 : (_gradientAST$orientat2 = gradientAST.orientation) === null || _gradientAST$orientat2 === void 0 ? void 0 : _gradientAST$orientat2.value) !== null && _gradientAST$orientat !== void 0 ? _gradientAST$orientat : DEFAULT_LINEAR_GRADIENT_ANGLE;
  33989. const onAngleChange = newAngle => {
  33990. onChange(serializeGradient({ ...gradientAST,
  33991. orientation: {
  33992. type: 'angular',
  33993. value: newAngle
  33994. }
  33995. }));
  33996. };
  33997. return (0,external_wp_element_namespaceObject.createElement)(AnglePickerControl, {
  33998. __nextHasNoMarginBottom: true,
  33999. onChange: onAngleChange,
  34000. labelPosition: "top",
  34001. value: hasGradient ? angle : ''
  34002. });
  34003. };
  34004. const GradientTypePicker = _ref2 => {
  34005. let {
  34006. gradientAST,
  34007. hasGradient,
  34008. onChange
  34009. } = _ref2;
  34010. const {
  34011. type
  34012. } = gradientAST;
  34013. const onSetLinearGradient = () => {
  34014. onChange(serializeGradient({ ...gradientAST,
  34015. ...(gradientAST.orientation ? {} : {
  34016. orientation: HORIZONTAL_GRADIENT_ORIENTATION
  34017. }),
  34018. type: 'linear-gradient'
  34019. }));
  34020. };
  34021. const onSetRadialGradient = () => {
  34022. const {
  34023. orientation,
  34024. ...restGradientAST
  34025. } = gradientAST;
  34026. onChange(serializeGradient({ ...restGradientAST,
  34027. type: 'radial-gradient'
  34028. }));
  34029. };
  34030. const handleOnChange = next => {
  34031. if (next === 'linear-gradient') {
  34032. onSetLinearGradient();
  34033. }
  34034. if (next === 'radial-gradient') {
  34035. onSetRadialGradient();
  34036. }
  34037. };
  34038. return (0,external_wp_element_namespaceObject.createElement)(select_control, {
  34039. __nextHasNoMarginBottom: true,
  34040. className: "components-custom-gradient-picker__type-picker",
  34041. label: (0,external_wp_i18n_namespaceObject.__)('Type'),
  34042. labelPosition: "top",
  34043. onChange: handleOnChange,
  34044. options: GRADIENT_OPTIONS,
  34045. size: "__unstable-large",
  34046. value: hasGradient && type
  34047. });
  34048. };
  34049. function CustomGradientPicker(_ref3) {
  34050. let {
  34051. /** Start opting into the new margin-free styles that will become the default in a future version. */
  34052. __nextHasNoMargin = false,
  34053. value,
  34054. onChange,
  34055. __experimentalIsRenderedInSidebar
  34056. } = _ref3;
  34057. const gradientAST = getGradientAstWithDefault(value); // On radial gradients the bar should display a linear gradient.
  34058. // On radial gradients the bar represents a slice of the gradient from the center until the outside.
  34059. // On liner gradients the bar represents the color stops from left to right independently of the angle.
  34060. const background = getLinearGradientRepresentation(gradientAST);
  34061. const hasGradient = gradientAST.value !== DEFAULT_GRADIENT; // Control points color option may be hex from presets, custom colors will be rgb.
  34062. // The position should always be a percentage.
  34063. const controlPoints = gradientAST.colorStops.map(colorStop => ({
  34064. color: getStopCssColor(colorStop),
  34065. position: parseInt(colorStop.length.value)
  34066. }));
  34067. if (!__nextHasNoMargin) {
  34068. external_wp_deprecated_default()('Outer margin styles for wp.components.CustomGradientPicker', {
  34069. since: '6.1',
  34070. version: '6.4',
  34071. hint: 'Set the `__nextHasNoMargin` prop to true to start opting into the new styles, which will become the default in a future version'
  34072. });
  34073. }
  34074. return (0,external_wp_element_namespaceObject.createElement)(v_stack_component, {
  34075. spacing: 4,
  34076. className: classnames_default()('components-custom-gradient-picker', {
  34077. 'is-next-has-no-margin': __nextHasNoMargin
  34078. })
  34079. }, (0,external_wp_element_namespaceObject.createElement)(CustomGradientBar, {
  34080. __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,
  34081. background: background,
  34082. hasGradient: hasGradient,
  34083. value: controlPoints,
  34084. onChange: newControlPoints => {
  34085. onChange(serializeGradient(getGradientAstWithControlPoints(gradientAST, newControlPoints)));
  34086. }
  34087. }), (0,external_wp_element_namespaceObject.createElement)(flex_component, {
  34088. gap: 3,
  34089. className: "components-custom-gradient-picker__ui-line"
  34090. }, (0,external_wp_element_namespaceObject.createElement)(SelectWrapper, null, (0,external_wp_element_namespaceObject.createElement)(GradientTypePicker, {
  34091. gradientAST: gradientAST,
  34092. hasGradient: hasGradient,
  34093. onChange: onChange
  34094. })), (0,external_wp_element_namespaceObject.createElement)(AccessoryWrapper, null, gradientAST.type === 'linear-gradient' && (0,external_wp_element_namespaceObject.createElement)(GradientAnglePicker, {
  34095. gradientAST: gradientAST,
  34096. hasGradient: hasGradient,
  34097. onChange: onChange
  34098. }))));
  34099. }
  34100. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/gradient-picker/index.js
  34101. /**
  34102. * External dependencies
  34103. */
  34104. /**
  34105. * WordPress dependencies
  34106. */
  34107. /**
  34108. * Internal dependencies
  34109. */
  34110. function SingleOrigin(_ref) {
  34111. let {
  34112. className,
  34113. clearGradient,
  34114. gradients,
  34115. onChange,
  34116. value,
  34117. actions
  34118. } = _ref;
  34119. const gradientOptions = (0,external_wp_element_namespaceObject.useMemo)(() => {
  34120. return (0,external_lodash_namespaceObject.map)(gradients, _ref2 => {
  34121. let {
  34122. gradient,
  34123. name
  34124. } = _ref2;
  34125. return (0,external_wp_element_namespaceObject.createElement)(CircularOptionPicker.Option, {
  34126. key: gradient,
  34127. value: gradient,
  34128. isSelected: value === gradient,
  34129. tooltipText: name || // translators: %s: gradient code e.g: "linear-gradient(90deg, rgba(98,16,153,1) 0%, rgba(172,110,22,1) 100%);".
  34130. (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Gradient code: %s'), gradient),
  34131. style: {
  34132. color: 'rgba( 0,0,0,0 )',
  34133. background: gradient
  34134. },
  34135. onClick: value === gradient ? clearGradient : () => onChange(gradient),
  34136. "aria-label": name ? // translators: %s: The name of the gradient e.g: "Angular red to blue".
  34137. (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%);".
  34138. (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Gradient code: %s'), gradient)
  34139. });
  34140. });
  34141. }, [gradients, value, onChange, clearGradient]);
  34142. return (0,external_wp_element_namespaceObject.createElement)(CircularOptionPicker, {
  34143. className: className,
  34144. options: gradientOptions,
  34145. actions: actions
  34146. });
  34147. }
  34148. function MultipleOrigin(_ref3) {
  34149. let {
  34150. className,
  34151. clearGradient,
  34152. gradients,
  34153. onChange,
  34154. value,
  34155. actions
  34156. } = _ref3;
  34157. return (0,external_wp_element_namespaceObject.createElement)(v_stack_component, {
  34158. spacing: 3,
  34159. className: className
  34160. }, gradients.map((_ref4, index) => {
  34161. let {
  34162. name,
  34163. gradients: gradientSet
  34164. } = _ref4;
  34165. return (0,external_wp_element_namespaceObject.createElement)(v_stack_component, {
  34166. spacing: 2,
  34167. key: index
  34168. }, (0,external_wp_element_namespaceObject.createElement)(ColorHeading, null, name), (0,external_wp_element_namespaceObject.createElement)(SingleOrigin, extends_extends({
  34169. clearGradient: clearGradient,
  34170. gradients: gradientSet,
  34171. onChange: onChange,
  34172. value: value
  34173. }, gradients.length === index + 1 ? {
  34174. actions
  34175. } : {})));
  34176. }));
  34177. }
  34178. function GradientPicker(_ref5) {
  34179. let {
  34180. /** Start opting into the new margin-free styles that will become the default in a future version. */
  34181. __nextHasNoMargin = false,
  34182. className,
  34183. gradients,
  34184. onChange,
  34185. value,
  34186. clearable = true,
  34187. disableCustomGradients = false,
  34188. __experimentalHasMultipleOrigins,
  34189. __experimentalIsRenderedInSidebar
  34190. } = _ref5;
  34191. const clearGradient = (0,external_wp_element_namespaceObject.useCallback)(() => onChange(undefined), [onChange]);
  34192. const Component = __experimentalHasMultipleOrigins && gradients !== null && gradients !== void 0 && gradients.length ? MultipleOrigin : SingleOrigin;
  34193. if (!__nextHasNoMargin) {
  34194. external_wp_deprecated_default()('Outer margin styles for wp.components.GradientPicker', {
  34195. since: '6.1',
  34196. version: '6.4',
  34197. hint: 'Set the `__nextHasNoMargin` prop to true to start opting into the new styles, which will become the default in a future version'
  34198. });
  34199. }
  34200. const deprecatedMarginSpacerProps = !__nextHasNoMargin ? {
  34201. marginTop: !(gradients !== null && gradients !== void 0 && gradients.length) ? 3 : undefined,
  34202. marginBottom: !clearable ? 6 : 0
  34203. } : {};
  34204. return (// Outmost Spacer wrapper can be removed when deprecation period is over
  34205. (0,external_wp_element_namespaceObject.createElement)(spacer_component, extends_extends({
  34206. marginBottom: 0
  34207. }, deprecatedMarginSpacerProps), (0,external_wp_element_namespaceObject.createElement)(v_stack_component, {
  34208. spacing: gradients !== null && gradients !== void 0 && gradients.length ? 4 : 0
  34209. }, !disableCustomGradients && (0,external_wp_element_namespaceObject.createElement)(CustomGradientPicker, {
  34210. __nextHasNoMargin: true,
  34211. __experimentalIsRenderedInSidebar: __experimentalIsRenderedInSidebar,
  34212. value: value,
  34213. onChange: onChange
  34214. }), ((gradients === null || gradients === void 0 ? void 0 : gradients.length) || clearable) && (0,external_wp_element_namespaceObject.createElement)(Component, {
  34215. className: className,
  34216. clearable: clearable,
  34217. clearGradient: clearGradient,
  34218. gradients: gradients,
  34219. onChange: onChange,
  34220. value: value,
  34221. actions: clearable && !disableCustomGradients && (0,external_wp_element_namespaceObject.createElement)(CircularOptionPicker.ButtonAction, {
  34222. onClick: clearGradient
  34223. }, (0,external_wp_i18n_namespaceObject.__)('Clear'))
  34224. })))
  34225. );
  34226. }
  34227. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/menu.js
  34228. /**
  34229. * WordPress dependencies
  34230. */
  34231. const menu = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  34232. xmlns: "http://www.w3.org/2000/svg",
  34233. viewBox: "0 0 24 24"
  34234. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  34235. d: "M5 5v1.5h14V5H5zm0 7.8h14v-1.5H5v1.5zM5 19h14v-1.5H5V19z"
  34236. }));
  34237. /* harmony default export */ var library_menu = (menu);
  34238. ;// CONCATENATED MODULE: external ["wp","dom"]
  34239. var external_wp_dom_namespaceObject = window["wp"]["dom"];
  34240. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigable-container/container.js
  34241. // @ts-nocheck
  34242. /**
  34243. * WordPress dependencies
  34244. */
  34245. const container_noop = () => {};
  34246. const MENU_ITEM_ROLES = ['menuitem', 'menuitemradio', 'menuitemcheckbox'];
  34247. function cycleValue(value, total, offset) {
  34248. const nextValue = value + offset;
  34249. if (nextValue < 0) {
  34250. return total + nextValue;
  34251. } else if (nextValue >= total) {
  34252. return nextValue - total;
  34253. }
  34254. return nextValue;
  34255. }
  34256. class NavigableContainer extends external_wp_element_namespaceObject.Component {
  34257. constructor() {
  34258. super(...arguments);
  34259. this.onKeyDown = this.onKeyDown.bind(this);
  34260. this.bindContainer = this.bindContainer.bind(this);
  34261. this.getFocusableContext = this.getFocusableContext.bind(this);
  34262. this.getFocusableIndex = this.getFocusableIndex.bind(this);
  34263. }
  34264. componentDidMount() {
  34265. // We use DOM event listeners instead of React event listeners
  34266. // because we want to catch events from the underlying DOM tree
  34267. // The React Tree can be different from the DOM tree when using
  34268. // portals. Block Toolbars for instance are rendered in a separate
  34269. // React Trees.
  34270. this.container.addEventListener('keydown', this.onKeyDown);
  34271. this.container.addEventListener('focus', this.onFocus);
  34272. }
  34273. componentWillUnmount() {
  34274. this.container.removeEventListener('keydown', this.onKeyDown);
  34275. this.container.removeEventListener('focus', this.onFocus);
  34276. }
  34277. bindContainer(ref) {
  34278. const {
  34279. forwardedRef
  34280. } = this.props;
  34281. this.container = ref;
  34282. if (typeof forwardedRef === 'function') {
  34283. forwardedRef(ref);
  34284. } else if (forwardedRef && 'current' in forwardedRef) {
  34285. forwardedRef.current = ref;
  34286. }
  34287. }
  34288. getFocusableContext(target) {
  34289. const {
  34290. onlyBrowserTabstops
  34291. } = this.props;
  34292. const finder = onlyBrowserTabstops ? external_wp_dom_namespaceObject.focus.tabbable : external_wp_dom_namespaceObject.focus.focusable;
  34293. const focusables = finder.find(this.container);
  34294. const index = this.getFocusableIndex(focusables, target);
  34295. if (index > -1 && target) {
  34296. return {
  34297. index,
  34298. target,
  34299. focusables
  34300. };
  34301. }
  34302. return null;
  34303. }
  34304. getFocusableIndex(focusables, target) {
  34305. const directIndex = focusables.indexOf(target);
  34306. if (directIndex !== -1) {
  34307. return directIndex;
  34308. }
  34309. }
  34310. onKeyDown(event) {
  34311. if (this.props.onKeyDown) {
  34312. this.props.onKeyDown(event);
  34313. }
  34314. const {
  34315. getFocusableContext
  34316. } = this;
  34317. const {
  34318. cycle = true,
  34319. eventToOffset,
  34320. onNavigate = container_noop,
  34321. stopNavigationEvents
  34322. } = this.props;
  34323. const offset = eventToOffset(event); // eventToOffset returns undefined if the event is not handled by the component.
  34324. if (offset !== undefined && stopNavigationEvents) {
  34325. // Prevents arrow key handlers bound to the document directly interfering.
  34326. event.stopImmediatePropagation(); // When navigating a collection of items, prevent scroll containers
  34327. // from scrolling. The preventDefault also prevents Voiceover from
  34328. // 'handling' the event, as voiceover will try to use arrow keys
  34329. // for highlighting text.
  34330. const targetRole = event.target.getAttribute('role');
  34331. const targetHasMenuItemRole = MENU_ITEM_ROLES.includes(targetRole); // `preventDefault()` on tab to avoid having the browser move the focus
  34332. // after this component has already moved it.
  34333. const isTab = event.code === 'Tab';
  34334. if (targetHasMenuItemRole || isTab) {
  34335. event.preventDefault();
  34336. }
  34337. }
  34338. if (!offset) {
  34339. return;
  34340. }
  34341. const context = getFocusableContext(event.target.ownerDocument.activeElement);
  34342. if (!context) {
  34343. return;
  34344. }
  34345. const {
  34346. index,
  34347. focusables
  34348. } = context;
  34349. const nextIndex = cycle ? cycleValue(index, focusables.length, offset) : index + offset;
  34350. if (nextIndex >= 0 && nextIndex < focusables.length) {
  34351. focusables[nextIndex].focus();
  34352. onNavigate(nextIndex, focusables[nextIndex]);
  34353. }
  34354. }
  34355. render() {
  34356. const {
  34357. children,
  34358. stopNavigationEvents,
  34359. eventToOffset,
  34360. onNavigate,
  34361. onKeyDown,
  34362. cycle,
  34363. onlyBrowserTabstops,
  34364. forwardedRef,
  34365. ...restProps
  34366. } = this.props;
  34367. return (0,external_wp_element_namespaceObject.createElement)("div", extends_extends({
  34368. ref: this.bindContainer
  34369. }, restProps), children);
  34370. }
  34371. }
  34372. const forwardedNavigableContainer = (props, ref) => {
  34373. return (0,external_wp_element_namespaceObject.createElement)(NavigableContainer, extends_extends({}, props, {
  34374. forwardedRef: ref
  34375. }));
  34376. };
  34377. forwardedNavigableContainer.displayName = 'NavigableContainer';
  34378. /* harmony default export */ var container = ((0,external_wp_element_namespaceObject.forwardRef)(forwardedNavigableContainer));
  34379. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigable-container/menu.js
  34380. // @ts-nocheck
  34381. /**
  34382. * WordPress dependencies
  34383. */
  34384. /**
  34385. * Internal dependencies
  34386. */
  34387. function NavigableMenu(_ref, ref) {
  34388. let {
  34389. role = 'menu',
  34390. orientation = 'vertical',
  34391. ...rest
  34392. } = _ref;
  34393. const eventToOffset = evt => {
  34394. const {
  34395. code
  34396. } = evt;
  34397. let next = ['ArrowDown'];
  34398. let previous = ['ArrowUp'];
  34399. if (orientation === 'horizontal') {
  34400. next = ['ArrowRight'];
  34401. previous = ['ArrowLeft'];
  34402. }
  34403. if (orientation === 'both') {
  34404. next = ['ArrowRight', 'ArrowDown'];
  34405. previous = ['ArrowLeft', 'ArrowUp'];
  34406. }
  34407. if (next.includes(code)) {
  34408. return 1;
  34409. } else if (previous.includes(code)) {
  34410. return -1;
  34411. } else if (['ArrowDown', 'ArrowUp', 'ArrowLeft', 'ArrowRight'].includes(code)) {
  34412. // Key press should be handled, e.g. have event propagation and
  34413. // default behavior handled by NavigableContainer but not result
  34414. // in an offset.
  34415. return 0;
  34416. }
  34417. };
  34418. return (0,external_wp_element_namespaceObject.createElement)(container, extends_extends({
  34419. ref: ref,
  34420. stopNavigationEvents: true,
  34421. onlyBrowserTabstops: false,
  34422. role: role,
  34423. "aria-orientation": role === 'presentation' ? null : orientation,
  34424. eventToOffset: eventToOffset
  34425. }, rest));
  34426. }
  34427. /* harmony default export */ var navigable_container_menu = ((0,external_wp_element_namespaceObject.forwardRef)(NavigableMenu));
  34428. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/dropdown-menu/index.js
  34429. // @ts-nocheck
  34430. /**
  34431. * External dependencies
  34432. */
  34433. /**
  34434. * WordPress dependencies
  34435. */
  34436. /**
  34437. * Internal dependencies
  34438. */
  34439. function mergeProps() {
  34440. let defaultProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  34441. let props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  34442. const mergedProps = { ...defaultProps,
  34443. ...props
  34444. };
  34445. if (props.className && defaultProps.className) {
  34446. mergedProps.className = classnames_default()(props.className, defaultProps.className);
  34447. }
  34448. return mergedProps;
  34449. }
  34450. /**
  34451. * Whether the argument is a function.
  34452. *
  34453. * @param {*} maybeFunc The argument to check.
  34454. * @return {boolean} True if the argument is a function, false otherwise.
  34455. */
  34456. function dropdown_menu_isFunction(maybeFunc) {
  34457. return typeof maybeFunc === 'function';
  34458. }
  34459. function DropdownMenu(dropdownMenuProps) {
  34460. const {
  34461. children,
  34462. className,
  34463. controls,
  34464. icon = library_menu,
  34465. label,
  34466. popoverProps,
  34467. toggleProps,
  34468. menuProps,
  34469. disableOpenOnArrowDown = false,
  34470. text,
  34471. noIcons
  34472. } = dropdownMenuProps;
  34473. if (!(controls !== null && controls !== void 0 && controls.length) && !dropdown_menu_isFunction(children)) {
  34474. return null;
  34475. } // Normalize controls to nested array of objects (sets of controls)
  34476. let controlSets;
  34477. if (controls !== null && controls !== void 0 && controls.length) {
  34478. controlSets = controls;
  34479. if (!Array.isArray(controlSets[0])) {
  34480. controlSets = [controlSets];
  34481. }
  34482. }
  34483. const mergedPopoverProps = mergeProps({
  34484. className: 'components-dropdown-menu__popover'
  34485. }, popoverProps);
  34486. return (0,external_wp_element_namespaceObject.createElement)(Dropdown, {
  34487. className: classnames_default()('components-dropdown-menu', className),
  34488. popoverProps: mergedPopoverProps,
  34489. renderToggle: _ref => {
  34490. var _toggleProps$showTool;
  34491. let {
  34492. isOpen,
  34493. onToggle
  34494. } = _ref;
  34495. const openOnArrowDown = event => {
  34496. if (disableOpenOnArrowDown) {
  34497. return;
  34498. }
  34499. if (!isOpen && event.code === 'ArrowDown') {
  34500. event.preventDefault();
  34501. onToggle();
  34502. }
  34503. };
  34504. const mergedToggleProps = mergeProps({
  34505. className: classnames_default()('components-dropdown-menu__toggle', {
  34506. 'is-opened': isOpen
  34507. })
  34508. }, toggleProps);
  34509. return (0,external_wp_element_namespaceObject.createElement)(build_module_button, extends_extends({}, mergedToggleProps, {
  34510. icon: icon,
  34511. onClick: event => {
  34512. onToggle(event);
  34513. if (mergedToggleProps.onClick) {
  34514. mergedToggleProps.onClick(event);
  34515. }
  34516. },
  34517. onKeyDown: event => {
  34518. openOnArrowDown(event);
  34519. if (mergedToggleProps.onKeyDown) {
  34520. mergedToggleProps.onKeyDown(event);
  34521. }
  34522. },
  34523. "aria-haspopup": "true",
  34524. "aria-expanded": isOpen,
  34525. label: label,
  34526. text: text,
  34527. showTooltip: (_toggleProps$showTool = toggleProps === null || toggleProps === void 0 ? void 0 : toggleProps.showTooltip) !== null && _toggleProps$showTool !== void 0 ? _toggleProps$showTool : true
  34528. }), mergedToggleProps.children);
  34529. },
  34530. renderContent: props => {
  34531. var _controlSets;
  34532. const mergedMenuProps = mergeProps({
  34533. 'aria-label': label,
  34534. className: classnames_default()('components-dropdown-menu__menu', {
  34535. 'no-icons': noIcons
  34536. })
  34537. }, menuProps);
  34538. return (0,external_wp_element_namespaceObject.createElement)(navigable_container_menu, extends_extends({}, mergedMenuProps, {
  34539. role: "menu"
  34540. }), dropdown_menu_isFunction(children) ? children(props) : null, (_controlSets = controlSets) === null || _controlSets === void 0 ? void 0 : _controlSets.flatMap((controlSet, indexOfSet) => controlSet.map((control, indexOfControl) => (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  34541. key: [indexOfSet, indexOfControl].join(),
  34542. onClick: event => {
  34543. event.stopPropagation();
  34544. props.onClose();
  34545. if (control.onClick) {
  34546. control.onClick();
  34547. }
  34548. },
  34549. className: classnames_default()('components-dropdown-menu__menu-item', {
  34550. 'has-separator': indexOfSet > 0 && indexOfControl === 0,
  34551. 'is-active': control.isActive,
  34552. 'is-icon-only': !control.title
  34553. }),
  34554. icon: control.icon,
  34555. label: control.label,
  34556. "aria-checked": control.role === 'menuitemcheckbox' || control.role === 'menuitemradio' ? control.isActive : undefined,
  34557. role: control.role === 'menuitemcheckbox' || control.role === 'menuitemradio' ? control.role : 'menuitem',
  34558. disabled: control.isDisabled
  34559. }, control.title))));
  34560. }
  34561. });
  34562. }
  34563. /* harmony default export */ var dropdown_menu = (DropdownMenu);
  34564. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/palette-edit/styles.js
  34565. 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)."; }
  34566. /**
  34567. * External dependencies
  34568. */
  34569. /**
  34570. * Internal dependencies
  34571. */
  34572. const IndicatorStyled = /*#__PURE__*/emotion_styled_base_browser_esm(CircularOptionPicker.Option, true ? {
  34573. target: "e5bw3229"
  34574. } : 0)("width:", space(6), ";height:", space(6), ";pointer-events:none;" + ( true ? "" : 0));
  34575. const NameInputControl = /*#__PURE__*/emotion_styled_base_browser_esm(input_control, true ? {
  34576. target: "e5bw3228"
  34577. } : 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));
  34578. const PaletteItem = /*#__PURE__*/emotion_styled_base_browser_esm(component, true ? {
  34579. target: "e5bw3227"
  34580. } : 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.ui.theme, ";}" + ( true ? "" : 0));
  34581. const NameContainer = emotion_styled_base_browser_esm("div", true ? {
  34582. target: "e5bw3226"
  34583. } : 0)("line-height:", space(8), ";margin-left:", space(2), ";margin-right:", space(2), ";white-space:nowrap;overflow:hidden;", PaletteItem, ":hover &{color:", COLORS.ui.theme, ";}" + ( true ? "" : 0));
  34584. const PaletteHeading = /*#__PURE__*/emotion_styled_base_browser_esm(heading_component, true ? {
  34585. target: "e5bw3225"
  34586. } : 0)("text-transform:uppercase;line-height:", space(6), ";font-weight:500;&&&{font-size:11px;margin-bottom:0;}" + ( true ? "" : 0));
  34587. const PaletteActionsContainer = /*#__PURE__*/emotion_styled_base_browser_esm(component, true ? {
  34588. target: "e5bw3224"
  34589. } : 0)("height:", space(6), ";display:flex;" + ( true ? "" : 0));
  34590. const PaletteHStackHeader = /*#__PURE__*/emotion_styled_base_browser_esm(h_stack_component, true ? {
  34591. target: "e5bw3223"
  34592. } : 0)("margin-bottom:", space(2), ";" + ( true ? "" : 0));
  34593. const PaletteEditStyles = /*#__PURE__*/emotion_styled_base_browser_esm(component, true ? {
  34594. target: "e5bw3222"
  34595. } : 0)( true ? {
  34596. name: "u6wnko",
  34597. styles: "&&&{.components-button.has-icon{min-width:0;padding:0;}}"
  34598. } : 0);
  34599. const DoneButton = /*#__PURE__*/emotion_styled_base_browser_esm(build_module_button, true ? {
  34600. target: "e5bw3221"
  34601. } : 0)("&&{color:", COLORS.ui.theme, ";}" + ( true ? "" : 0));
  34602. const RemoveButton = /*#__PURE__*/emotion_styled_base_browser_esm(build_module_button, true ? {
  34603. target: "e5bw3220"
  34604. } : 0)("&&{margin-top:", space(1), ";}" + ( true ? "" : 0));
  34605. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/palette-edit/index.js
  34606. /**
  34607. * External dependencies
  34608. */
  34609. /**
  34610. * WordPress dependencies
  34611. */
  34612. /**
  34613. * Internal dependencies
  34614. */
  34615. const DEFAULT_COLOR = '#000';
  34616. function NameInput(_ref) {
  34617. let {
  34618. value,
  34619. onChange,
  34620. label
  34621. } = _ref;
  34622. return (0,external_wp_element_namespaceObject.createElement)(NameInputControl, {
  34623. label: label,
  34624. hideLabelFromVision: true,
  34625. value: value,
  34626. onChange: onChange
  34627. });
  34628. }
  34629. /**
  34630. * Returns a temporary name for a palette item in the format "Color + id".
  34631. * To ensure there are no duplicate ids, this function checks all slugs for temporary names.
  34632. * It expects slugs to be in the format: slugPrefix + color- + number.
  34633. * It then sets the id component of the new name based on the incremented id of the highest existing slug id.
  34634. *
  34635. * @param {string} elements An array of color palette items.
  34636. * @param {string} slugPrefix The slug prefix used to match the element slug.
  34637. *
  34638. * @return {string} A unique name for a palette item.
  34639. */
  34640. function getNameForPosition(elements, slugPrefix) {
  34641. const temporaryNameRegex = new RegExp(`^${slugPrefix}color-([\\d]+)$`);
  34642. const position = elements.reduce((previousValue, currentValue) => {
  34643. if (typeof (currentValue === null || currentValue === void 0 ? void 0 : currentValue.slug) === 'string') {
  34644. const matches = currentValue === null || currentValue === void 0 ? void 0 : currentValue.slug.match(temporaryNameRegex);
  34645. if (matches) {
  34646. const id = parseInt(matches[1], 10);
  34647. if (id >= previousValue) {
  34648. return id + 1;
  34649. }
  34650. }
  34651. }
  34652. return previousValue;
  34653. }, 1);
  34654. return (0,external_wp_i18n_namespaceObject.sprintf)(
  34655. /* translators: %s: is a temporary id for a custom color */
  34656. (0,external_wp_i18n_namespaceObject.__)('Color %s'), position);
  34657. }
  34658. function palette_edit_Option(_ref2) {
  34659. let {
  34660. canOnlyChangeValues,
  34661. element,
  34662. onChange,
  34663. isEditing,
  34664. onStartEditing,
  34665. onRemove,
  34666. onStopEditing,
  34667. slugPrefix,
  34668. isGradient
  34669. } = _ref2;
  34670. const focusOutsideProps = (0,external_wp_compose_namespaceObject.__experimentalUseFocusOutside)(onStopEditing);
  34671. const value = isGradient ? element.gradient : element.color;
  34672. return (0,external_wp_element_namespaceObject.createElement)(PaletteItem, extends_extends({
  34673. className: isEditing ? 'is-selected' : undefined,
  34674. as: "div",
  34675. onClick: onStartEditing
  34676. }, isEditing ? { ...focusOutsideProps
  34677. } : {
  34678. style: {
  34679. cursor: 'pointer'
  34680. }
  34681. }), (0,external_wp_element_namespaceObject.createElement)(h_stack_component, {
  34682. justify: "flex-start"
  34683. }, (0,external_wp_element_namespaceObject.createElement)(flex_item_component, null, (0,external_wp_element_namespaceObject.createElement)(IndicatorStyled, {
  34684. style: {
  34685. background: value,
  34686. color: 'transparent'
  34687. }
  34688. })), (0,external_wp_element_namespaceObject.createElement)(flex_item_component, null, isEditing && !canOnlyChangeValues ? (0,external_wp_element_namespaceObject.createElement)(NameInput, {
  34689. label: isGradient ? (0,external_wp_i18n_namespaceObject.__)('Gradient name') : (0,external_wp_i18n_namespaceObject.__)('Color name'),
  34690. value: element.name,
  34691. onChange: nextName => onChange({ ...element,
  34692. name: nextName,
  34693. slug: slugPrefix + (0,external_lodash_namespaceObject.kebabCase)(nextName)
  34694. })
  34695. }) : (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, {
  34696. isSmall: true,
  34697. icon: line_solid,
  34698. label: (0,external_wp_i18n_namespaceObject.__)('Remove color'),
  34699. onClick: onRemove
  34700. }))), isEditing && (0,external_wp_element_namespaceObject.createElement)(popover, {
  34701. placement: "left-start",
  34702. offset: 20,
  34703. className: "components-palette-edit__popover"
  34704. }, !isGradient && (0,external_wp_element_namespaceObject.createElement)(LegacyAdapter, {
  34705. color: value,
  34706. enableAlpha: true,
  34707. onChange: newColor => onChange({ ...element,
  34708. color: newColor
  34709. })
  34710. }), isGradient && (0,external_wp_element_namespaceObject.createElement)("div", {
  34711. className: "components-palette-edit__popover-gradient-picker"
  34712. }, (0,external_wp_element_namespaceObject.createElement)(CustomGradientPicker, {
  34713. __nextHasNoMargin: true,
  34714. __experimentalIsRenderedInSidebar: true,
  34715. value: value,
  34716. onChange: newGradient => onChange({ ...element,
  34717. gradient: newGradient
  34718. })
  34719. }))));
  34720. }
  34721. function isTemporaryElement(slugPrefix, _ref3) {
  34722. let {
  34723. slug,
  34724. color,
  34725. gradient
  34726. } = _ref3;
  34727. const regex = new RegExp(`^${slugPrefix}color-([\\d]+)$`);
  34728. return regex.test(slug) && (!!color && color === DEFAULT_COLOR || !!gradient && gradient === DEFAULT_GRADIENT);
  34729. }
  34730. function PaletteEditListView(_ref4) {
  34731. let {
  34732. elements,
  34733. onChange,
  34734. editingElement,
  34735. setEditingElement,
  34736. canOnlyChangeValues,
  34737. slugPrefix,
  34738. isGradient
  34739. } = _ref4;
  34740. // When unmounting the component if there are empty elements (the user did not complete the insertion) clean them.
  34741. const elementsReference = (0,external_wp_element_namespaceObject.useRef)();
  34742. (0,external_wp_element_namespaceObject.useEffect)(() => {
  34743. elementsReference.current = elements;
  34744. }, [elements]);
  34745. (0,external_wp_element_namespaceObject.useEffect)(() => {
  34746. return () => {
  34747. if (elementsReference.current.some((element, index) => isTemporaryElement(slugPrefix, element, index))) {
  34748. const newElements = elementsReference.current.filter(element => !isTemporaryElement(slugPrefix, element));
  34749. onChange(newElements.length ? newElements : undefined);
  34750. }
  34751. };
  34752. }, []);
  34753. const debounceOnChange = (0,external_wp_compose_namespaceObject.useDebounce)(onChange, 100);
  34754. return (0,external_wp_element_namespaceObject.createElement)(v_stack_component, {
  34755. spacing: 3
  34756. }, (0,external_wp_element_namespaceObject.createElement)(item_group_component, {
  34757. isRounded: true
  34758. }, elements.map((element, index) => (0,external_wp_element_namespaceObject.createElement)(palette_edit_Option, {
  34759. isGradient: isGradient,
  34760. canOnlyChangeValues: canOnlyChangeValues,
  34761. key: index,
  34762. element: element,
  34763. onStartEditing: () => {
  34764. if (editingElement !== index) {
  34765. setEditingElement(index);
  34766. }
  34767. },
  34768. onChange: newElement => {
  34769. debounceOnChange(elements.map((currentElement, currentIndex) => {
  34770. if (currentIndex === index) {
  34771. return newElement;
  34772. }
  34773. return currentElement;
  34774. }));
  34775. },
  34776. onRemove: () => {
  34777. setEditingElement(null);
  34778. const newElements = elements.filter((_currentElement, currentIndex) => {
  34779. if (currentIndex === index) {
  34780. return false;
  34781. }
  34782. return true;
  34783. });
  34784. onChange(newElements.length ? newElements : undefined);
  34785. },
  34786. isEditing: index === editingElement,
  34787. onStopEditing: () => {
  34788. if (index === editingElement) {
  34789. setEditingElement(null);
  34790. }
  34791. },
  34792. slugPrefix: slugPrefix
  34793. }))));
  34794. }
  34795. const EMPTY_ARRAY = [];
  34796. function PaletteEdit(_ref5) {
  34797. let {
  34798. gradients,
  34799. colors = EMPTY_ARRAY,
  34800. onChange,
  34801. paletteLabel,
  34802. emptyMessage,
  34803. canOnlyChangeValues,
  34804. canReset,
  34805. slugPrefix = ''
  34806. } = _ref5;
  34807. const isGradient = !!gradients;
  34808. const elements = isGradient ? gradients : colors;
  34809. const [isEditing, setIsEditing] = (0,external_wp_element_namespaceObject.useState)(false);
  34810. const [editingElement, setEditingElement] = (0,external_wp_element_namespaceObject.useState)(null);
  34811. const isAdding = isEditing && editingElement && elements[editingElement] && !elements[editingElement].slug;
  34812. const elementsLength = elements.length;
  34813. const hasElements = elementsLength > 0;
  34814. 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, {
  34815. isSmall: true,
  34816. onClick: () => {
  34817. setIsEditing(false);
  34818. setEditingElement(null);
  34819. }
  34820. }, (0,external_wp_i18n_namespaceObject.__)('Done')), !canOnlyChangeValues && (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  34821. isSmall: true,
  34822. isPressed: isAdding,
  34823. icon: library_plus,
  34824. label: isGradient ? (0,external_wp_i18n_namespaceObject.__)('Add gradient') : (0,external_wp_i18n_namespaceObject.__)('Add color'),
  34825. onClick: () => {
  34826. const tempOptionName = getNameForPosition(elements, slugPrefix);
  34827. onChange([...elements, { ...(isGradient ? {
  34828. gradient: DEFAULT_GRADIENT
  34829. } : {
  34830. color: DEFAULT_COLOR
  34831. }),
  34832. name: tempOptionName,
  34833. slug: slugPrefix + (0,external_lodash_namespaceObject.kebabCase)(tempOptionName)
  34834. }]);
  34835. setIsEditing(true);
  34836. setEditingElement(elements.length);
  34837. }
  34838. }), hasElements && (!isEditing || !canOnlyChangeValues || canReset) && (0,external_wp_element_namespaceObject.createElement)(dropdown_menu, {
  34839. icon: more_vertical,
  34840. label: isGradient ? (0,external_wp_i18n_namespaceObject.__)('Gradient options') : (0,external_wp_i18n_namespaceObject.__)('Color options'),
  34841. toggleProps: {
  34842. isSmall: true
  34843. }
  34844. }, _ref6 => {
  34845. let {
  34846. onClose
  34847. } = _ref6;
  34848. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(navigable_container_menu, {
  34849. role: "menu"
  34850. }, !isEditing && (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  34851. variant: "tertiary",
  34852. onClick: () => {
  34853. setIsEditing(true);
  34854. onClose();
  34855. },
  34856. className: "components-palette-edit__menu-button"
  34857. }, 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, {
  34858. variant: "tertiary",
  34859. onClick: () => {
  34860. setEditingElement(null);
  34861. setIsEditing(false);
  34862. onChange();
  34863. onClose();
  34864. },
  34865. className: "components-palette-edit__menu-button"
  34866. }, 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, {
  34867. variant: "tertiary",
  34868. onClick: () => {
  34869. setEditingElement(null);
  34870. onChange();
  34871. onClose();
  34872. }
  34873. }, isGradient ? (0,external_wp_i18n_namespaceObject.__)('Reset gradient') : (0,external_wp_i18n_namespaceObject.__)('Reset colors'))));
  34874. }))), hasElements && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isEditing && (0,external_wp_element_namespaceObject.createElement)(PaletteEditListView, {
  34875. canOnlyChangeValues: canOnlyChangeValues,
  34876. elements: elements,
  34877. onChange: onChange,
  34878. editingElement: editingElement,
  34879. setEditingElement: setEditingElement,
  34880. slugPrefix: slugPrefix,
  34881. isGradient: isGradient
  34882. }), !isEditing && (isGradient ? (0,external_wp_element_namespaceObject.createElement)(GradientPicker, {
  34883. __nextHasNoMargin: true,
  34884. gradients: gradients,
  34885. onChange: () => {},
  34886. clearable: false,
  34887. disableCustomGradients: true
  34888. }) : (0,external_wp_element_namespaceObject.createElement)(color_palette, {
  34889. colors: colors,
  34890. onChange: () => {},
  34891. clearable: false,
  34892. disableCustomColors: true
  34893. }))), !hasElements && emptyMessage);
  34894. }
  34895. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/combobox-control/styles.js
  34896. /**
  34897. * External dependencies
  34898. */
  34899. /**
  34900. * Internal dependencies
  34901. */
  34902. const deprecatedDefaultSize = _ref => {
  34903. let {
  34904. __next36pxDefaultSize
  34905. } = _ref;
  34906. return !__next36pxDefaultSize && /*#__PURE__*/emotion_react_browser_esm_css("height:28px;padding-left:", space(1), ";padding-right:", space(1), ";" + ( true ? "" : 0), true ? "" : 0);
  34907. };
  34908. const InputWrapperFlex = /*#__PURE__*/emotion_styled_base_browser_esm(flex_component, true ? {
  34909. target: "evuatpg0"
  34910. } : 0)("height:34px;padding-left:", space(2), ";padding-right:", space(2), ";", deprecatedDefaultSize, ";" + ( true ? "" : 0));
  34911. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/form-token-field/token-input.js
  34912. /**
  34913. * External dependencies
  34914. */
  34915. /**
  34916. * WordPress dependencies
  34917. */
  34918. /**
  34919. * Internal dependencies
  34920. */
  34921. function UnForwardedTokenInput(props, ref) {
  34922. const {
  34923. value,
  34924. isExpanded,
  34925. instanceId,
  34926. selectedSuggestionIndex,
  34927. className,
  34928. onChange,
  34929. onFocus,
  34930. onBlur,
  34931. ...restProps
  34932. } = props;
  34933. const [hasFocus, setHasFocus] = (0,external_wp_element_namespaceObject.useState)(false);
  34934. const size = value ? value.length + 1 : 0;
  34935. const onChangeHandler = event => {
  34936. if (onChange) {
  34937. onChange({
  34938. value: event.target.value
  34939. });
  34940. }
  34941. };
  34942. const onFocusHandler = e => {
  34943. setHasFocus(true);
  34944. onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
  34945. };
  34946. const onBlurHandler = e => {
  34947. setHasFocus(false);
  34948. onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
  34949. };
  34950. return (0,external_wp_element_namespaceObject.createElement)("input", extends_extends({
  34951. ref: ref,
  34952. id: `components-form-token-input-${instanceId}`,
  34953. type: "text"
  34954. }, restProps, {
  34955. value: value || '',
  34956. onChange: onChangeHandler,
  34957. onFocus: onFocusHandler,
  34958. onBlur: onBlurHandler,
  34959. size: size,
  34960. className: classnames_default()(className, 'components-form-token-field__input'),
  34961. autoComplete: "off",
  34962. role: "combobox",
  34963. "aria-expanded": isExpanded,
  34964. "aria-autocomplete": "list",
  34965. "aria-owns": isExpanded ? `components-form-token-suggestions-${instanceId}` : undefined,
  34966. "aria-activedescendant": // Only add the `aria-activedescendant` attribute when:
  34967. // - the user is actively interacting with the input (`hasFocus`)
  34968. // - there is a selected suggestion (`selectedSuggestionIndex !== -1`)
  34969. // - the list of suggestions are rendered in the DOM (`isExpanded`)
  34970. hasFocus && selectedSuggestionIndex !== -1 && isExpanded ? `components-form-token-suggestions-${instanceId}-${selectedSuggestionIndex}` : undefined,
  34971. "aria-describedby": `components-form-token-suggestions-howto-${instanceId}`
  34972. }));
  34973. }
  34974. const TokenInput = (0,external_wp_element_namespaceObject.forwardRef)(UnForwardedTokenInput);
  34975. /* harmony default export */ var token_input = (TokenInput);
  34976. // EXTERNAL MODULE: ./node_modules/dom-scroll-into-view/lib/index.js
  34977. var lib = __webpack_require__(5425);
  34978. var lib_default = /*#__PURE__*/__webpack_require__.n(lib);
  34979. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/form-token-field/suggestions-list.js
  34980. /**
  34981. * External dependencies
  34982. */
  34983. /**
  34984. * WordPress dependencies
  34985. */
  34986. /**
  34987. * Internal dependencies
  34988. */
  34989. const handleMouseDown = e => {
  34990. // By preventing default here, we will not lose focus of <input> when clicking a suggestion.
  34991. e.preventDefault();
  34992. };
  34993. function SuggestionsList(_ref) {
  34994. let {
  34995. selectedIndex,
  34996. scrollIntoView,
  34997. match,
  34998. onHover,
  34999. onSelect,
  35000. suggestions = [],
  35001. displayTransform,
  35002. instanceId,
  35003. __experimentalRenderItem
  35004. } = _ref;
  35005. const [scrollingIntoView, setScrollingIntoView] = (0,external_wp_element_namespaceObject.useState)(false);
  35006. const listRef = (0,external_wp_compose_namespaceObject.useRefEffect)(listNode => {
  35007. // only have to worry about scrolling selected suggestion into view
  35008. // when already expanded.
  35009. let id;
  35010. if (selectedIndex > -1 && scrollIntoView && listNode.children[selectedIndex]) {
  35011. setScrollingIntoView(true);
  35012. lib_default()(listNode.children[selectedIndex], listNode, {
  35013. onlyScrollIfNeeded: true
  35014. });
  35015. id = window.setTimeout(() => {
  35016. setScrollingIntoView(false);
  35017. }, 100);
  35018. }
  35019. return () => {
  35020. if (id !== undefined) {
  35021. window.clearTimeout(id);
  35022. }
  35023. };
  35024. }, [selectedIndex, scrollIntoView]);
  35025. const handleHover = suggestion => {
  35026. return () => {
  35027. if (!scrollingIntoView) {
  35028. onHover === null || onHover === void 0 ? void 0 : onHover(suggestion);
  35029. }
  35030. };
  35031. };
  35032. const handleClick = suggestion => {
  35033. return () => {
  35034. onSelect === null || onSelect === void 0 ? void 0 : onSelect(suggestion);
  35035. };
  35036. };
  35037. const computeSuggestionMatch = suggestion => {
  35038. const matchText = displayTransform(match).toLocaleLowerCase();
  35039. if (matchText.length === 0) {
  35040. return null;
  35041. }
  35042. const transformedSuggestion = displayTransform(suggestion);
  35043. const indexOfMatch = transformedSuggestion.toLocaleLowerCase().indexOf(matchText);
  35044. return {
  35045. suggestionBeforeMatch: transformedSuggestion.substring(0, indexOfMatch),
  35046. suggestionMatch: transformedSuggestion.substring(indexOfMatch, indexOfMatch + matchText.length),
  35047. suggestionAfterMatch: transformedSuggestion.substring(indexOfMatch + matchText.length)
  35048. };
  35049. };
  35050. return (0,external_wp_element_namespaceObject.createElement)("ul", {
  35051. ref: listRef,
  35052. className: "components-form-token-field__suggestions-list",
  35053. id: `components-form-token-suggestions-${instanceId}`,
  35054. role: "listbox"
  35055. }, suggestions.map((suggestion, index) => {
  35056. const matchText = computeSuggestionMatch(suggestion);
  35057. const className = classnames_default()('components-form-token-field__suggestion', {
  35058. 'is-selected': index === selectedIndex
  35059. });
  35060. let output;
  35061. if (typeof __experimentalRenderItem === 'function') {
  35062. output = __experimentalRenderItem({
  35063. item: suggestion
  35064. });
  35065. } else if (matchText) {
  35066. output = (0,external_wp_element_namespaceObject.createElement)("span", {
  35067. "aria-label": displayTransform(suggestion)
  35068. }, matchText.suggestionBeforeMatch, (0,external_wp_element_namespaceObject.createElement)("strong", {
  35069. className: "components-form-token-field__suggestion-match"
  35070. }, matchText.suggestionMatch), matchText.suggestionAfterMatch);
  35071. } else {
  35072. output = displayTransform(suggestion);
  35073. }
  35074. /* eslint-disable jsx-a11y/click-events-have-key-events */
  35075. return (0,external_wp_element_namespaceObject.createElement)("li", {
  35076. id: `components-form-token-suggestions-${instanceId}-${index}`,
  35077. role: "option",
  35078. className: className,
  35079. key: typeof suggestion === 'object' && 'value' in suggestion ? suggestion === null || suggestion === void 0 ? void 0 : suggestion.value : displayTransform(suggestion),
  35080. onMouseDown: handleMouseDown,
  35081. onClick: handleClick(suggestion),
  35082. onMouseEnter: handleHover(suggestion),
  35083. "aria-selected": index === selectedIndex
  35084. }, output);
  35085. /* eslint-enable jsx-a11y/click-events-have-key-events */
  35086. }));
  35087. }
  35088. /* harmony default export */ var suggestions_list = (SuggestionsList);
  35089. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-focus-outside/index.js
  35090. //@ts-nocheck
  35091. /**
  35092. * WordPress dependencies
  35093. */
  35094. /* harmony default export */ var with_focus_outside = ((0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => props => {
  35095. const [handleFocusOutside, setHandleFocusOutside] = (0,external_wp_element_namespaceObject.useState)();
  35096. const bindFocusOutsideHandler = (0,external_wp_element_namespaceObject.useCallback)(node => setHandleFocusOutside(() => node !== null && node !== void 0 && node.handleFocusOutside ? node.handleFocusOutside.bind(node) : undefined), []);
  35097. return (0,external_wp_element_namespaceObject.createElement)("div", (0,external_wp_compose_namespaceObject.__experimentalUseFocusOutside)(handleFocusOutside), (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, extends_extends({
  35098. ref: bindFocusOutsideHandler
  35099. }, props)));
  35100. }, 'withFocusOutside'));
  35101. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/combobox-control/index.js
  35102. /**
  35103. * External dependencies
  35104. */
  35105. /**
  35106. * WordPress dependencies
  35107. */
  35108. /**
  35109. * Internal dependencies
  35110. */
  35111. const combobox_control_noop = () => {};
  35112. const DetectOutside = with_focus_outside(class extends external_wp_element_namespaceObject.Component {
  35113. handleFocusOutside(event) {
  35114. this.props.onFocusOutside(event);
  35115. }
  35116. render() {
  35117. return this.props.children;
  35118. }
  35119. });
  35120. function ComboboxControl(_ref) {
  35121. var _currentOption$label;
  35122. let {
  35123. /** Start opting into the new margin-free styles that will become the default in a future version. */
  35124. __nextHasNoMarginBottom = false,
  35125. __next36pxDefaultSize,
  35126. value: valueProp,
  35127. label,
  35128. options,
  35129. onChange: onChangeProp,
  35130. onFilterValueChange = combobox_control_noop,
  35131. hideLabelFromVision,
  35132. help,
  35133. allowReset = true,
  35134. className,
  35135. messages = {
  35136. selected: (0,external_wp_i18n_namespaceObject.__)('Item selected.')
  35137. },
  35138. __experimentalRenderItem
  35139. } = _ref;
  35140. const [value, setValue] = useControlledValue({
  35141. value: valueProp,
  35142. onChange: onChangeProp
  35143. });
  35144. const currentOption = options.find(option => option.value === value);
  35145. const currentLabel = (_currentOption$label = currentOption === null || currentOption === void 0 ? void 0 : currentOption.label) !== null && _currentOption$label !== void 0 ? _currentOption$label : ''; // Use a custom prefix when generating the `instanceId` to avoid having
  35146. // duplicate input IDs when rendering this component and `FormTokenField`
  35147. // in the same page (see https://github.com/WordPress/gutenberg/issues/42112).
  35148. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ComboboxControl, 'combobox-control');
  35149. const [selectedSuggestion, setSelectedSuggestion] = (0,external_wp_element_namespaceObject.useState)(currentOption || null);
  35150. const [isExpanded, setIsExpanded] = (0,external_wp_element_namespaceObject.useState)(false);
  35151. const [inputHasFocus, setInputHasFocus] = (0,external_wp_element_namespaceObject.useState)(false);
  35152. const [inputValue, setInputValue] = (0,external_wp_element_namespaceObject.useState)('');
  35153. const inputContainer = (0,external_wp_element_namespaceObject.useRef)();
  35154. const matchingSuggestions = (0,external_wp_element_namespaceObject.useMemo)(() => {
  35155. const startsWithMatch = [];
  35156. const containsMatch = [];
  35157. const match = normalizeTextString(inputValue);
  35158. options.forEach(option => {
  35159. const index = normalizeTextString(option.label).indexOf(match);
  35160. if (index === 0) {
  35161. startsWithMatch.push(option);
  35162. } else if (index > 0) {
  35163. containsMatch.push(option);
  35164. }
  35165. });
  35166. return startsWithMatch.concat(containsMatch);
  35167. }, [inputValue, options]);
  35168. const onSuggestionSelected = newSelectedSuggestion => {
  35169. setValue(newSelectedSuggestion.value);
  35170. (0,external_wp_a11y_namespaceObject.speak)(messages.selected, 'assertive');
  35171. setSelectedSuggestion(newSelectedSuggestion);
  35172. setInputValue('');
  35173. setIsExpanded(false);
  35174. };
  35175. const handleArrowNavigation = function () {
  35176. let offset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
  35177. const index = matchingSuggestions.indexOf(selectedSuggestion);
  35178. let nextIndex = index + offset;
  35179. if (nextIndex < 0) {
  35180. nextIndex = matchingSuggestions.length - 1;
  35181. } else if (nextIndex >= matchingSuggestions.length) {
  35182. nextIndex = 0;
  35183. }
  35184. setSelectedSuggestion(matchingSuggestions[nextIndex]);
  35185. setIsExpanded(true);
  35186. };
  35187. const onKeyDown = event => {
  35188. let preventDefault = false;
  35189. if (event.defaultPrevented) {
  35190. return;
  35191. }
  35192. switch (event.code) {
  35193. case 'Enter':
  35194. if (selectedSuggestion) {
  35195. onSuggestionSelected(selectedSuggestion);
  35196. preventDefault = true;
  35197. }
  35198. break;
  35199. case 'ArrowUp':
  35200. handleArrowNavigation(-1);
  35201. preventDefault = true;
  35202. break;
  35203. case 'ArrowDown':
  35204. handleArrowNavigation(1);
  35205. preventDefault = true;
  35206. break;
  35207. case 'Escape':
  35208. setIsExpanded(false);
  35209. setSelectedSuggestion(null);
  35210. preventDefault = true;
  35211. break;
  35212. default:
  35213. break;
  35214. }
  35215. if (preventDefault) {
  35216. event.preventDefault();
  35217. }
  35218. };
  35219. const onBlur = () => {
  35220. setInputHasFocus(false);
  35221. };
  35222. const onFocus = () => {
  35223. setInputHasFocus(true);
  35224. setIsExpanded(true);
  35225. onFilterValueChange('');
  35226. setInputValue('');
  35227. };
  35228. const onFocusOutside = () => {
  35229. setIsExpanded(false);
  35230. };
  35231. const onInputChange = event => {
  35232. const text = event.value;
  35233. setInputValue(text);
  35234. onFilterValueChange(text);
  35235. if (inputHasFocus) {
  35236. setIsExpanded(true);
  35237. }
  35238. };
  35239. const handleOnReset = () => {
  35240. setValue(null);
  35241. inputContainer.current.focus();
  35242. }; // Update current selections when the filter input changes.
  35243. (0,external_wp_element_namespaceObject.useEffect)(() => {
  35244. const hasMatchingSuggestions = matchingSuggestions.length > 0;
  35245. const hasSelectedMatchingSuggestions = matchingSuggestions.indexOf(selectedSuggestion) > 0;
  35246. if (hasMatchingSuggestions && !hasSelectedMatchingSuggestions) {
  35247. // If the current selection isn't present in the list of suggestions, then automatically select the first item from the list of suggestions.
  35248. setSelectedSuggestion(matchingSuggestions[0]);
  35249. }
  35250. }, [matchingSuggestions, selectedSuggestion]); // Announcements.
  35251. (0,external_wp_element_namespaceObject.useEffect)(() => {
  35252. const hasMatchingSuggestions = matchingSuggestions.length > 0;
  35253. if (isExpanded) {
  35254. const message = hasMatchingSuggestions ? (0,external_wp_i18n_namespaceObject.sprintf)(
  35255. /* translators: %d: number of results. */
  35256. (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.');
  35257. (0,external_wp_a11y_namespaceObject.speak)(message, 'polite');
  35258. }
  35259. }, [matchingSuggestions, isExpanded]); // Disable reason: There is no appropriate role which describes the
  35260. // input container intended accessible usability.
  35261. // TODO: Refactor click detection to use blur to stop propagation.
  35262. /* eslint-disable jsx-a11y/no-static-element-interactions */
  35263. return (0,external_wp_element_namespaceObject.createElement)(DetectOutside, {
  35264. onFocusOutside: onFocusOutside
  35265. }, (0,external_wp_element_namespaceObject.createElement)(base_control, {
  35266. __nextHasNoMarginBottom: __nextHasNoMarginBottom,
  35267. className: classnames_default()(className, 'components-combobox-control'),
  35268. tabIndex: "-1",
  35269. label: label,
  35270. id: `components-form-token-input-${instanceId}`,
  35271. hideLabelFromVision: hideLabelFromVision,
  35272. help: help
  35273. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  35274. className: "components-combobox-control__suggestions-container",
  35275. tabIndex: "-1",
  35276. onKeyDown: onKeyDown
  35277. }, (0,external_wp_element_namespaceObject.createElement)(InputWrapperFlex, {
  35278. __next36pxDefaultSize: __next36pxDefaultSize
  35279. }, (0,external_wp_element_namespaceObject.createElement)(flex_block_component, null, (0,external_wp_element_namespaceObject.createElement)(token_input, {
  35280. className: "components-combobox-control__input",
  35281. instanceId: instanceId,
  35282. ref: inputContainer,
  35283. value: isExpanded ? inputValue : currentLabel,
  35284. onFocus: onFocus,
  35285. onBlur: onBlur,
  35286. isExpanded: isExpanded,
  35287. selectedSuggestionIndex: matchingSuggestions.indexOf(selectedSuggestion),
  35288. onChange: onInputChange
  35289. })), allowReset && (0,external_wp_element_namespaceObject.createElement)(flex_item_component, null, (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  35290. className: "components-combobox-control__reset",
  35291. icon: close_small,
  35292. disabled: !value,
  35293. onClick: handleOnReset,
  35294. label: (0,external_wp_i18n_namespaceObject.__)('Reset')
  35295. }))), isExpanded && (0,external_wp_element_namespaceObject.createElement)(suggestions_list, {
  35296. instanceId: instanceId,
  35297. match: {
  35298. label: inputValue
  35299. },
  35300. displayTransform: suggestion => suggestion.label,
  35301. suggestions: matchingSuggestions,
  35302. selectedIndex: matchingSuggestions.indexOf(selectedSuggestion),
  35303. onHover: setSelectedSuggestion,
  35304. onSelect: onSuggestionSelected,
  35305. scrollIntoView: true,
  35306. __experimentalRenderItem: __experimentalRenderItem
  35307. }))));
  35308. /* eslint-enable jsx-a11y/no-static-element-interactions */
  35309. }
  35310. /* harmony default export */ var combobox_control = (ComboboxControl);
  35311. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/modal/aria-helper.js
  35312. // @ts-nocheck
  35313. const LIVE_REGION_ARIA_ROLES = new Set(['alert', 'status', 'log', 'marquee', 'timer']);
  35314. let hiddenElements = [],
  35315. isHidden = false;
  35316. /**
  35317. * Hides all elements in the body element from screen-readers except
  35318. * the provided element and elements that should not be hidden from
  35319. * screen-readers.
  35320. *
  35321. * The reason we do this is because `aria-modal="true"` currently is bugged
  35322. * in Safari, and support is spotty in other browsers overall. In the future
  35323. * we should consider removing these helper functions in favor of
  35324. * `aria-modal="true"`.
  35325. *
  35326. * @param {Element} unhiddenElement The element that should not be hidden.
  35327. */
  35328. function hideApp(unhiddenElement) {
  35329. if (isHidden) {
  35330. return;
  35331. }
  35332. const elements = Array.from(document.body.children);
  35333. elements.forEach(element => {
  35334. if (element === unhiddenElement) {
  35335. return;
  35336. }
  35337. if (elementShouldBeHidden(element)) {
  35338. element.setAttribute('aria-hidden', 'true');
  35339. hiddenElements.push(element);
  35340. }
  35341. });
  35342. isHidden = true;
  35343. }
  35344. /**
  35345. * Determines if the passed element should not be hidden from screen readers.
  35346. *
  35347. * @param {HTMLElement} element The element that should be checked.
  35348. *
  35349. * @return {boolean} Whether the element should not be hidden from screen-readers.
  35350. */
  35351. function elementShouldBeHidden(element) {
  35352. const role = element.getAttribute('role');
  35353. return !(element.tagName === 'SCRIPT' || element.hasAttribute('aria-hidden') || element.hasAttribute('aria-live') || LIVE_REGION_ARIA_ROLES.has(role));
  35354. }
  35355. /**
  35356. * Makes all elements in the body that have been hidden by `hideApp`
  35357. * visible again to screen-readers.
  35358. */
  35359. function showApp() {
  35360. if (!isHidden) {
  35361. return;
  35362. }
  35363. hiddenElements.forEach(element => {
  35364. element.removeAttribute('aria-hidden');
  35365. });
  35366. hiddenElements = [];
  35367. isHidden = false;
  35368. }
  35369. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/modal/index.js
  35370. // @ts-nocheck
  35371. /**
  35372. * External dependencies
  35373. */
  35374. /**
  35375. * WordPress dependencies
  35376. */
  35377. /**
  35378. * Internal dependencies
  35379. */
  35380. // Used to count the number of open modals.
  35381. let openModalCount = 0;
  35382. function Modal(props, forwardedRef) {
  35383. const {
  35384. bodyOpenClassName = 'modal-open',
  35385. role = 'dialog',
  35386. title = null,
  35387. focusOnMount = true,
  35388. shouldCloseOnEsc = true,
  35389. shouldCloseOnClickOutside = true,
  35390. isDismissible = true,
  35391. /* Accessibility. */
  35392. aria = {
  35393. labelledby: null,
  35394. describedby: null
  35395. },
  35396. onRequestClose,
  35397. icon,
  35398. closeButtonLabel,
  35399. children,
  35400. style,
  35401. overlayClassName,
  35402. className,
  35403. contentLabel,
  35404. onKeyDown,
  35405. isFullScreen = false,
  35406. __experimentalHideHeader = false
  35407. } = props;
  35408. const ref = (0,external_wp_element_namespaceObject.useRef)();
  35409. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(Modal);
  35410. const headingId = title ? `components-modal-header-${instanceId}` : aria.labelledby;
  35411. const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)(focusOnMount);
  35412. const constrainedTabbingRef = (0,external_wp_compose_namespaceObject.useConstrainedTabbing)();
  35413. const focusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)();
  35414. const focusOutsideProps = (0,external_wp_compose_namespaceObject.__experimentalUseFocusOutside)(onRequestClose);
  35415. const [hasScrolledContent, setHasScrolledContent] = (0,external_wp_element_namespaceObject.useState)(false);
  35416. (0,external_wp_element_namespaceObject.useEffect)(() => {
  35417. openModalCount++;
  35418. if (openModalCount === 1) {
  35419. hideApp(ref.current);
  35420. document.body.classList.add(bodyOpenClassName);
  35421. }
  35422. return () => {
  35423. openModalCount--;
  35424. if (openModalCount === 0) {
  35425. document.body.classList.remove(bodyOpenClassName);
  35426. showApp();
  35427. }
  35428. };
  35429. }, [bodyOpenClassName]);
  35430. function handleEscapeKeyDown(event) {
  35431. if (shouldCloseOnEsc && event.code === 'Escape' && !event.defaultPrevented) {
  35432. event.preventDefault();
  35433. if (onRequestClose) {
  35434. onRequestClose(event);
  35435. }
  35436. }
  35437. }
  35438. const onContentContainerScroll = (0,external_wp_element_namespaceObject.useCallback)(e => {
  35439. var _e$target$scrollTop, _e$target;
  35440. const scrollY = (_e$target$scrollTop = e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.scrollTop) !== null && _e$target$scrollTop !== void 0 ? _e$target$scrollTop : -1;
  35441. if (!hasScrolledContent && scrollY > 0) {
  35442. setHasScrolledContent(true);
  35443. } else if (hasScrolledContent && scrollY <= 0) {
  35444. setHasScrolledContent(false);
  35445. }
  35446. }, [hasScrolledContent]);
  35447. return (0,external_wp_element_namespaceObject.createPortal)( // eslint-disable-next-line jsx-a11y/no-static-element-interactions
  35448. (0,external_wp_element_namespaceObject.createElement)("div", {
  35449. ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, forwardedRef]),
  35450. className: classnames_default()('components-modal__screen-overlay', overlayClassName),
  35451. onKeyDown: handleEscapeKeyDown
  35452. }, (0,external_wp_element_namespaceObject.createElement)(style_provider, {
  35453. document: document
  35454. }, (0,external_wp_element_namespaceObject.createElement)("div", extends_extends({
  35455. className: classnames_default()('components-modal__frame', className, {
  35456. 'is-full-screen': isFullScreen
  35457. }),
  35458. style: style,
  35459. ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([constrainedTabbingRef, focusReturnRef, focusOnMountRef]),
  35460. role: role,
  35461. "aria-label": contentLabel,
  35462. "aria-labelledby": contentLabel ? null : headingId,
  35463. "aria-describedby": aria.describedby,
  35464. tabIndex: "-1"
  35465. }, shouldCloseOnClickOutside ? focusOutsideProps : {}, {
  35466. onKeyDown: onKeyDown
  35467. }), (0,external_wp_element_namespaceObject.createElement)("div", {
  35468. className: classnames_default()('components-modal__content', {
  35469. 'hide-header': __experimentalHideHeader,
  35470. 'has-scrolled-content': hasScrolledContent
  35471. }),
  35472. role: "document",
  35473. onScroll: onContentContainerScroll
  35474. }, !__experimentalHideHeader && (0,external_wp_element_namespaceObject.createElement)("div", {
  35475. className: "components-modal__header"
  35476. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  35477. className: "components-modal__header-heading-container"
  35478. }, icon && (0,external_wp_element_namespaceObject.createElement)("span", {
  35479. className: "components-modal__icon-container",
  35480. "aria-hidden": true
  35481. }, icon), title && (0,external_wp_element_namespaceObject.createElement)("h1", {
  35482. id: headingId,
  35483. className: "components-modal__header-heading"
  35484. }, title)), isDismissible && (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  35485. onClick: onRequestClose,
  35486. icon: library_close,
  35487. label: closeButtonLabel || (0,external_wp_i18n_namespaceObject.__)('Close dialog')
  35488. })), children)))), document.body);
  35489. }
  35490. /* harmony default export */ var modal = ((0,external_wp_element_namespaceObject.forwardRef)(Modal));
  35491. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/confirm-dialog/styles.js
  35492. 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)."; }
  35493. /**
  35494. * External dependencies
  35495. */
  35496. /**
  35497. * The z-index for ConfirmDialog is being set here instead of in
  35498. * packages/base-styles/_z-index.scss, because this component uses
  35499. * emotion instead of sass.
  35500. *
  35501. * ConfirmDialog needs this higher z-index to ensure it renders on top of
  35502. * any parent Popover component.
  35503. */
  35504. const wrapper = true ? {
  35505. name: "7g5ii0",
  35506. styles: "&&{z-index:1000001;}"
  35507. } : 0;
  35508. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/confirm-dialog/component.js
  35509. /**
  35510. * External dependencies
  35511. */
  35512. /**
  35513. * WordPress dependencies
  35514. */
  35515. /**
  35516. * Internal dependencies
  35517. */
  35518. function ConfirmDialog(props, forwardedRef) {
  35519. const {
  35520. isOpen: isOpenProp,
  35521. onConfirm,
  35522. onCancel,
  35523. children,
  35524. confirmButtonText,
  35525. cancelButtonText,
  35526. ...otherProps
  35527. } = useContextSystem(props, 'ConfirmDialog');
  35528. const cx = useCx();
  35529. const wrapperClassName = cx(wrapper);
  35530. const [isOpen, setIsOpen] = (0,external_wp_element_namespaceObject.useState)();
  35531. const [shouldSelfClose, setShouldSelfClose] = (0,external_wp_element_namespaceObject.useState)();
  35532. (0,external_wp_element_namespaceObject.useEffect)(() => {
  35533. // We only allow the dialog to close itself if `isOpenProp` is *not* set.
  35534. // If `isOpenProp` is set, then it (probably) means it's controlled by a
  35535. // parent component. In that case, `shouldSelfClose` might do more harm than
  35536. // good, so we disable it.
  35537. const isIsOpenSet = typeof isOpenProp !== 'undefined';
  35538. setIsOpen(isIsOpenSet ? isOpenProp : true);
  35539. setShouldSelfClose(!isIsOpenSet);
  35540. }, [isOpenProp]);
  35541. const handleEvent = (0,external_wp_element_namespaceObject.useCallback)(callback => event => {
  35542. callback === null || callback === void 0 ? void 0 : callback(event);
  35543. if (shouldSelfClose) {
  35544. setIsOpen(false);
  35545. }
  35546. }, [shouldSelfClose, setIsOpen]);
  35547. const handleEnter = (0,external_wp_element_namespaceObject.useCallback)(event => {
  35548. if (event.key === 'Enter') {
  35549. handleEvent(onConfirm)(event);
  35550. }
  35551. }, [handleEvent, onConfirm]);
  35552. const cancelLabel = cancelButtonText !== null && cancelButtonText !== void 0 ? cancelButtonText : (0,external_wp_i18n_namespaceObject.__)('Cancel');
  35553. const confirmLabel = confirmButtonText !== null && confirmButtonText !== void 0 ? confirmButtonText : (0,external_wp_i18n_namespaceObject.__)('OK');
  35554. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isOpen && (0,external_wp_element_namespaceObject.createElement)(modal, extends_extends({
  35555. onRequestClose: handleEvent(onCancel),
  35556. onKeyDown: handleEnter,
  35557. closeButtonLabel: cancelLabel,
  35558. isDismissible: true,
  35559. ref: forwardedRef,
  35560. overlayClassName: wrapperClassName,
  35561. __experimentalHideHeader: true
  35562. }, otherProps), (0,external_wp_element_namespaceObject.createElement)(v_stack_component, {
  35563. spacing: 8
  35564. }, (0,external_wp_element_namespaceObject.createElement)(text_component, null, children), (0,external_wp_element_namespaceObject.createElement)(flex_component, {
  35565. direction: "row",
  35566. justify: "flex-end"
  35567. }, (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  35568. variant: "tertiary",
  35569. onClick: handleEvent(onCancel)
  35570. }, cancelLabel), (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  35571. variant: "primary",
  35572. onClick: handleEvent(onConfirm)
  35573. }, confirmLabel)))));
  35574. }
  35575. /* harmony default export */ var confirm_dialog_component = (contextConnect(ConfirmDialog, 'ConfirmDialog'));
  35576. // EXTERNAL MODULE: ./node_modules/prop-types/index.js
  35577. var prop_types = __webpack_require__(2652);
  35578. var prop_types_default = /*#__PURE__*/__webpack_require__.n(prop_types);
  35579. // EXTERNAL MODULE: ./node_modules/downshift/node_modules/react-is/index.js
  35580. var react_is = __webpack_require__(2797);
  35581. ;// CONCATENATED MODULE: ./node_modules/compute-scroll-into-view/dist/index.module.js
  35582. 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}
  35583. ;// CONCATENATED MODULE: ./node_modules/downshift/dist/downshift.esm.js
  35584. let idCounter = 0;
  35585. /**
  35586. * Accepts a parameter and returns it if it's a function
  35587. * or a noop function if it's not. This allows us to
  35588. * accept a callback, but not worry about it if it's not
  35589. * passed.
  35590. * @param {Function} cb the callback
  35591. * @return {Function} a function
  35592. */
  35593. function cbToCb(cb) {
  35594. return typeof cb === 'function' ? cb : downshift_esm_noop;
  35595. }
  35596. function downshift_esm_noop() {}
  35597. /**
  35598. * Scroll node into view if necessary
  35599. * @param {HTMLElement} node the element that should scroll into view
  35600. * @param {HTMLElement} menuNode the menu element of the component
  35601. */
  35602. function scrollIntoView(node, menuNode) {
  35603. if (!node) {
  35604. return;
  35605. }
  35606. const actions = index_module(node, {
  35607. boundary: menuNode,
  35608. block: 'nearest',
  35609. scrollMode: 'if-needed'
  35610. });
  35611. actions.forEach(_ref => {
  35612. let {
  35613. el,
  35614. top,
  35615. left
  35616. } = _ref;
  35617. el.scrollTop = top;
  35618. el.scrollLeft = left;
  35619. });
  35620. }
  35621. /**
  35622. * @param {HTMLElement} parent the parent node
  35623. * @param {HTMLElement} child the child node
  35624. * @param {Window} environment The window context where downshift renders.
  35625. * @return {Boolean} whether the parent is the child or the child is in the parent
  35626. */
  35627. function isOrContainsNode(parent, child, environment) {
  35628. const result = parent === child || child instanceof environment.Node && parent.contains && parent.contains(child);
  35629. return result;
  35630. }
  35631. /**
  35632. * Simple debounce implementation. Will call the given
  35633. * function once after the time given has passed since
  35634. * it was last called.
  35635. * @param {Function} fn the function to call after the time
  35636. * @param {Number} time the time to wait
  35637. * @return {Function} the debounced function
  35638. */
  35639. function downshift_esm_debounce(fn, time) {
  35640. let timeoutId;
  35641. function cancel() {
  35642. if (timeoutId) {
  35643. clearTimeout(timeoutId);
  35644. }
  35645. }
  35646. function wrapper() {
  35647. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  35648. args[_key] = arguments[_key];
  35649. }
  35650. cancel();
  35651. timeoutId = setTimeout(() => {
  35652. timeoutId = null;
  35653. fn(...args);
  35654. }, time);
  35655. }
  35656. wrapper.cancel = cancel;
  35657. return wrapper;
  35658. }
  35659. /**
  35660. * This is intended to be used to compose event handlers.
  35661. * They are executed in order until one of them sets
  35662. * `event.preventDownshiftDefault = true`.
  35663. * @param {...Function} fns the event handler functions
  35664. * @return {Function} the event handler to add to an element
  35665. */
  35666. function callAllEventHandlers() {
  35667. for (var _len2 = arguments.length, fns = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  35668. fns[_key2] = arguments[_key2];
  35669. }
  35670. return function (event) {
  35671. for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
  35672. args[_key3 - 1] = arguments[_key3];
  35673. }
  35674. return fns.some(fn => {
  35675. if (fn) {
  35676. fn(event, ...args);
  35677. }
  35678. return event.preventDownshiftDefault || event.hasOwnProperty('nativeEvent') && event.nativeEvent.preventDownshiftDefault;
  35679. });
  35680. };
  35681. }
  35682. function handleRefs() {
  35683. for (var _len4 = arguments.length, refs = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  35684. refs[_key4] = arguments[_key4];
  35685. }
  35686. return node => {
  35687. refs.forEach(ref => {
  35688. if (typeof ref === 'function') {
  35689. ref(node);
  35690. } else if (ref) {
  35691. ref.current = node;
  35692. }
  35693. });
  35694. };
  35695. }
  35696. /**
  35697. * This generates a unique ID for an instance of Downshift
  35698. * @return {String} the unique ID
  35699. */
  35700. function generateId() {
  35701. return String(idCounter++);
  35702. }
  35703. /**
  35704. * Resets idCounter to 0. Used for SSR.
  35705. */
  35706. function resetIdCounter() {
  35707. idCounter = 0;
  35708. }
  35709. /**
  35710. * Default implementation for status message. Only added when menu is open.
  35711. * Will specify if there are results in the list, and if so, how many,
  35712. * and what keys are relevant.
  35713. *
  35714. * @param {Object} param the downshift state and other relevant properties
  35715. * @return {String} the a11y status message
  35716. */
  35717. function getA11yStatusMessage$1(_ref2) {
  35718. let {
  35719. isOpen,
  35720. resultCount,
  35721. previousResultCount
  35722. } = _ref2;
  35723. if (!isOpen) {
  35724. return '';
  35725. }
  35726. if (!resultCount) {
  35727. return 'No results are available.';
  35728. }
  35729. if (resultCount !== previousResultCount) {
  35730. return `${resultCount} result${resultCount === 1 ? ' is' : 's are'} available, use up and down arrow keys to navigate. Press Enter key to select.`;
  35731. }
  35732. return '';
  35733. }
  35734. /**
  35735. * Takes an argument and if it's an array, returns the first item in the array
  35736. * otherwise returns the argument
  35737. * @param {*} arg the maybe-array
  35738. * @param {*} defaultValue the value if arg is falsey not defined
  35739. * @return {*} the arg or it's first item
  35740. */
  35741. function unwrapArray(arg, defaultValue) {
  35742. arg = Array.isArray(arg) ?
  35743. /* istanbul ignore next (preact) */
  35744. arg[0] : arg;
  35745. if (!arg && defaultValue) {
  35746. return defaultValue;
  35747. } else {
  35748. return arg;
  35749. }
  35750. }
  35751. /**
  35752. * @param {Object} element (P)react element
  35753. * @return {Boolean} whether it's a DOM element
  35754. */
  35755. function isDOMElement(element) {
  35756. return typeof element.type === 'string';
  35757. }
  35758. /**
  35759. * @param {Object} element (P)react element
  35760. * @return {Object} the props
  35761. */
  35762. function getElementProps(element) {
  35763. return element.props;
  35764. }
  35765. /**
  35766. * Throws a helpful error message for required properties. Useful
  35767. * to be used as a default in destructuring or object params.
  35768. * @param {String} fnName the function name
  35769. * @param {String} propName the prop name
  35770. */
  35771. function requiredProp(fnName, propName) {
  35772. // eslint-disable-next-line no-console
  35773. console.error(`The property "${propName}" is required in "${fnName}"`);
  35774. }
  35775. const stateKeys = ['highlightedIndex', 'inputValue', 'isOpen', 'selectedItem', 'type'];
  35776. /**
  35777. * @param {Object} state the state object
  35778. * @return {Object} state that is relevant to downshift
  35779. */
  35780. function pickState(state) {
  35781. if (state === void 0) {
  35782. state = {};
  35783. }
  35784. const result = {};
  35785. stateKeys.forEach(k => {
  35786. if (state.hasOwnProperty(k)) {
  35787. result[k] = state[k];
  35788. }
  35789. });
  35790. return result;
  35791. }
  35792. /**
  35793. * This will perform a shallow merge of the given state object
  35794. * with the state coming from props
  35795. * (for the controlled component scenario)
  35796. * This is used in state updater functions so they're referencing
  35797. * the right state regardless of where it comes from.
  35798. *
  35799. * @param {Object} state The state of the component/hook.
  35800. * @param {Object} props The props that may contain controlled values.
  35801. * @returns {Object} The merged controlled state.
  35802. */
  35803. function getState(state, props) {
  35804. return Object.keys(state).reduce((prevState, key) => {
  35805. prevState[key] = isControlledProp(props, key) ? props[key] : state[key];
  35806. return prevState;
  35807. }, {});
  35808. }
  35809. /**
  35810. * This determines whether a prop is a "controlled prop" meaning it is
  35811. * state which is controlled by the outside of this component rather
  35812. * than within this component.
  35813. *
  35814. * @param {Object} props The props that may contain controlled values.
  35815. * @param {String} key the key to check
  35816. * @return {Boolean} whether it is a controlled controlled prop
  35817. */
  35818. function isControlledProp(props, key) {
  35819. return props[key] !== undefined;
  35820. }
  35821. /**
  35822. * Normalizes the 'key' property of a KeyboardEvent in IE/Edge
  35823. * @param {Object} event a keyboardEvent object
  35824. * @return {String} keyboard key
  35825. */
  35826. function normalizeArrowKey(event) {
  35827. const {
  35828. key,
  35829. keyCode
  35830. } = event;
  35831. /* istanbul ignore next (ie) */
  35832. if (keyCode >= 37 && keyCode <= 40 && key.indexOf('Arrow') !== 0) {
  35833. return `Arrow${key}`;
  35834. }
  35835. return key;
  35836. }
  35837. /**
  35838. * Simple check if the value passed is object literal
  35839. * @param {*} obj any things
  35840. * @return {Boolean} whether it's object literal
  35841. */
  35842. function downshift_esm_isPlainObject(obj) {
  35843. return Object.prototype.toString.call(obj) === '[object Object]';
  35844. }
  35845. /**
  35846. * Returns the new index in the list, in a circular way. If next value is out of bonds from the total,
  35847. * it will wrap to either 0 or itemCount - 1.
  35848. *
  35849. * @param {number} moveAmount Number of positions to move. Negative to move backwards, positive forwards.
  35850. * @param {number} baseIndex The initial position to move from.
  35851. * @param {number} itemCount The total number of items.
  35852. * @param {Function} getItemNodeFromIndex Used to check if item is disabled.
  35853. * @param {boolean} circular Specify if navigation is circular. Default is true.
  35854. * @returns {number} The new index after the move.
  35855. */
  35856. function getNextWrappingIndex(moveAmount, baseIndex, itemCount, getItemNodeFromIndex, circular) {
  35857. if (circular === void 0) {
  35858. circular = true;
  35859. }
  35860. if (itemCount === 0) {
  35861. return -1;
  35862. }
  35863. const itemsLastIndex = itemCount - 1;
  35864. if (typeof baseIndex !== 'number' || baseIndex < 0 || baseIndex >= itemCount) {
  35865. baseIndex = moveAmount > 0 ? -1 : itemsLastIndex + 1;
  35866. }
  35867. let newIndex = baseIndex + moveAmount;
  35868. if (newIndex < 0) {
  35869. newIndex = circular ? itemsLastIndex : 0;
  35870. } else if (newIndex > itemsLastIndex) {
  35871. newIndex = circular ? 0 : itemsLastIndex;
  35872. }
  35873. const nonDisabledNewIndex = getNextNonDisabledIndex(moveAmount, newIndex, itemCount, getItemNodeFromIndex, circular);
  35874. if (nonDisabledNewIndex === -1) {
  35875. return baseIndex >= itemCount ? -1 : baseIndex;
  35876. }
  35877. return nonDisabledNewIndex;
  35878. }
  35879. /**
  35880. * Returns the next index in the list of an item that is not disabled.
  35881. *
  35882. * @param {number} moveAmount Number of positions to move. Negative to move backwards, positive forwards.
  35883. * @param {number} baseIndex The initial position to move from.
  35884. * @param {number} itemCount The total number of items.
  35885. * @param {Function} getItemNodeFromIndex Used to check if item is disabled.
  35886. * @param {boolean} circular Specify if navigation is circular. Default is true.
  35887. * @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.
  35888. */
  35889. function getNextNonDisabledIndex(moveAmount, baseIndex, itemCount, getItemNodeFromIndex, circular) {
  35890. const currentElementNode = getItemNodeFromIndex(baseIndex);
  35891. if (!currentElementNode || !currentElementNode.hasAttribute('disabled')) {
  35892. return baseIndex;
  35893. }
  35894. if (moveAmount > 0) {
  35895. for (let index = baseIndex + 1; index < itemCount; index++) {
  35896. if (!getItemNodeFromIndex(index).hasAttribute('disabled')) {
  35897. return index;
  35898. }
  35899. }
  35900. } else {
  35901. for (let index = baseIndex - 1; index >= 0; index--) {
  35902. if (!getItemNodeFromIndex(index).hasAttribute('disabled')) {
  35903. return index;
  35904. }
  35905. }
  35906. }
  35907. if (circular) {
  35908. return moveAmount > 0 ? getNextNonDisabledIndex(1, 0, itemCount, getItemNodeFromIndex, false) : getNextNonDisabledIndex(-1, itemCount - 1, itemCount, getItemNodeFromIndex, false);
  35909. }
  35910. return -1;
  35911. }
  35912. /**
  35913. * Checks if event target is within the downshift elements.
  35914. *
  35915. * @param {EventTarget} target Target to check.
  35916. * @param {HTMLElement[]} downshiftElements The elements that form downshift (list, toggle button etc).
  35917. * @param {Window} environment The window context where downshift renders.
  35918. * @param {boolean} checkActiveElement Whether to also check activeElement.
  35919. *
  35920. * @returns {boolean} Whether or not the target is within downshift elements.
  35921. */
  35922. function targetWithinDownshift(target, downshiftElements, environment, checkActiveElement) {
  35923. if (checkActiveElement === void 0) {
  35924. checkActiveElement = true;
  35925. }
  35926. return downshiftElements.some(contextNode => contextNode && (isOrContainsNode(contextNode, target, environment) || checkActiveElement && isOrContainsNode(contextNode, environment.document.activeElement, environment)));
  35927. } // eslint-disable-next-line import/no-mutable-exports
  35928. let validateControlledUnchanged = (/* unused pure expression or super */ null && (downshift_esm_noop));
  35929. /* istanbul ignore next */
  35930. if (false) {}
  35931. const cleanupStatus = downshift_esm_debounce(documentProp => {
  35932. getStatusDiv(documentProp).textContent = '';
  35933. }, 500);
  35934. /**
  35935. * @param {String} status the status message
  35936. * @param {Object} documentProp document passed by the user.
  35937. */
  35938. function setStatus(status, documentProp) {
  35939. const div = getStatusDiv(documentProp);
  35940. if (!status) {
  35941. return;
  35942. }
  35943. div.textContent = status;
  35944. cleanupStatus(documentProp);
  35945. }
  35946. /**
  35947. * Get the status node or create it if it does not already exist.
  35948. * @param {Object} documentProp document passed by the user.
  35949. * @return {HTMLElement} the status node.
  35950. */
  35951. function getStatusDiv(documentProp) {
  35952. if (documentProp === void 0) {
  35953. documentProp = document;
  35954. }
  35955. let statusDiv = documentProp.getElementById('a11y-status-message');
  35956. if (statusDiv) {
  35957. return statusDiv;
  35958. }
  35959. statusDiv = documentProp.createElement('div');
  35960. statusDiv.setAttribute('id', 'a11y-status-message');
  35961. statusDiv.setAttribute('role', 'status');
  35962. statusDiv.setAttribute('aria-live', 'polite');
  35963. statusDiv.setAttribute('aria-relevant', 'additions text');
  35964. Object.assign(statusDiv.style, {
  35965. border: '0',
  35966. clip: 'rect(0 0 0 0)',
  35967. height: '1px',
  35968. margin: '-1px',
  35969. overflow: 'hidden',
  35970. padding: '0',
  35971. position: 'absolute',
  35972. width: '1px'
  35973. });
  35974. documentProp.body.appendChild(statusDiv);
  35975. return statusDiv;
  35976. }
  35977. const unknown = false ? 0 : 0;
  35978. const mouseUp = false ? 0 : 1;
  35979. const itemMouseEnter = false ? 0 : 2;
  35980. const keyDownArrowUp = false ? 0 : 3;
  35981. const keyDownArrowDown = false ? 0 : 4;
  35982. const keyDownEscape = false ? 0 : 5;
  35983. const keyDownEnter = false ? 0 : 6;
  35984. const keyDownHome = false ? 0 : 7;
  35985. const keyDownEnd = false ? 0 : 8;
  35986. const clickItem = false ? 0 : 9;
  35987. const blurInput = false ? 0 : 10;
  35988. const changeInput = false ? 0 : 11;
  35989. const keyDownSpaceButton = false ? 0 : 12;
  35990. const clickButton = false ? 0 : 13;
  35991. const blurButton = false ? 0 : 14;
  35992. const controlledPropUpdatedSelectedItem = false ? 0 : 15;
  35993. const touchEnd = false ? 0 : 16;
  35994. var stateChangeTypes$3 = /*#__PURE__*/Object.freeze({
  35995. __proto__: null,
  35996. unknown: unknown,
  35997. mouseUp: mouseUp,
  35998. itemMouseEnter: itemMouseEnter,
  35999. keyDownArrowUp: keyDownArrowUp,
  36000. keyDownArrowDown: keyDownArrowDown,
  36001. keyDownEscape: keyDownEscape,
  36002. keyDownEnter: keyDownEnter,
  36003. keyDownHome: keyDownHome,
  36004. keyDownEnd: keyDownEnd,
  36005. clickItem: clickItem,
  36006. blurInput: blurInput,
  36007. changeInput: changeInput,
  36008. keyDownSpaceButton: keyDownSpaceButton,
  36009. clickButton: clickButton,
  36010. blurButton: blurButton,
  36011. controlledPropUpdatedSelectedItem: controlledPropUpdatedSelectedItem,
  36012. touchEnd: touchEnd
  36013. });
  36014. /* eslint camelcase:0 */
  36015. const Downshift = /*#__PURE__*/(() => {
  36016. class Downshift extends external_React_namespaceObject.Component {
  36017. constructor(_props) {
  36018. var _this;
  36019. super(_props);
  36020. _this = this;
  36021. this.id = this.props.id || `downshift-${generateId()}`;
  36022. this.menuId = this.props.menuId || `${this.id}-menu`;
  36023. this.labelId = this.props.labelId || `${this.id}-label`;
  36024. this.inputId = this.props.inputId || `${this.id}-input`;
  36025. this.getItemId = this.props.getItemId || (index => `${this.id}-item-${index}`);
  36026. this.input = null;
  36027. this.items = [];
  36028. this.itemCount = null;
  36029. this.previousResultCount = 0;
  36030. this.timeoutIds = [];
  36031. this.internalSetTimeout = (fn, time) => {
  36032. const id = setTimeout(() => {
  36033. this.timeoutIds = this.timeoutIds.filter(i => i !== id);
  36034. fn();
  36035. }, time);
  36036. this.timeoutIds.push(id);
  36037. };
  36038. this.setItemCount = count => {
  36039. this.itemCount = count;
  36040. };
  36041. this.unsetItemCount = () => {
  36042. this.itemCount = null;
  36043. };
  36044. this.setHighlightedIndex = function (highlightedIndex, otherStateToSet) {
  36045. if (highlightedIndex === void 0) {
  36046. highlightedIndex = _this.props.defaultHighlightedIndex;
  36047. }
  36048. if (otherStateToSet === void 0) {
  36049. otherStateToSet = {};
  36050. }
  36051. otherStateToSet = pickState(otherStateToSet);
  36052. _this.internalSetState({
  36053. highlightedIndex,
  36054. ...otherStateToSet
  36055. });
  36056. };
  36057. this.clearSelection = cb => {
  36058. this.internalSetState({
  36059. selectedItem: null,
  36060. inputValue: '',
  36061. highlightedIndex: this.props.defaultHighlightedIndex,
  36062. isOpen: this.props.defaultIsOpen
  36063. }, cb);
  36064. };
  36065. this.selectItem = (item, otherStateToSet, cb) => {
  36066. otherStateToSet = pickState(otherStateToSet);
  36067. this.internalSetState({
  36068. isOpen: this.props.defaultIsOpen,
  36069. highlightedIndex: this.props.defaultHighlightedIndex,
  36070. selectedItem: item,
  36071. inputValue: this.props.itemToString(item),
  36072. ...otherStateToSet
  36073. }, cb);
  36074. };
  36075. this.selectItemAtIndex = (itemIndex, otherStateToSet, cb) => {
  36076. const item = this.items[itemIndex];
  36077. if (item == null) {
  36078. return;
  36079. }
  36080. this.selectItem(item, otherStateToSet, cb);
  36081. };
  36082. this.selectHighlightedItem = (otherStateToSet, cb) => {
  36083. return this.selectItemAtIndex(this.getState().highlightedIndex, otherStateToSet, cb);
  36084. };
  36085. this.internalSetState = (stateToSet, cb) => {
  36086. let isItemSelected, onChangeArg;
  36087. const onStateChangeArg = {};
  36088. const isStateToSetFunction = typeof stateToSet === 'function'; // we want to call `onInputValueChange` before the `setState` call
  36089. // so someone controlling the `inputValue` state gets notified of
  36090. // the input change as soon as possible. This avoids issues with
  36091. // preserving the cursor position.
  36092. // See https://github.com/downshift-js/downshift/issues/217 for more info.
  36093. if (!isStateToSetFunction && stateToSet.hasOwnProperty('inputValue')) {
  36094. this.props.onInputValueChange(stateToSet.inputValue, { ...this.getStateAndHelpers(),
  36095. ...stateToSet
  36096. });
  36097. }
  36098. return this.setState(state => {
  36099. state = this.getState(state);
  36100. let newStateToSet = isStateToSetFunction ? stateToSet(state) : stateToSet; // Your own function that could modify the state that will be set.
  36101. newStateToSet = this.props.stateReducer(state, newStateToSet); // checks if an item is selected, regardless of if it's different from
  36102. // what was selected before
  36103. // used to determine if onSelect and onChange callbacks should be called
  36104. isItemSelected = newStateToSet.hasOwnProperty('selectedItem'); // this keeps track of the object we want to call with setState
  36105. const nextState = {}; // this is just used to tell whether the state changed
  36106. // and we're trying to update that state. OR if the selection has changed and we're
  36107. // trying to update the selection
  36108. if (isItemSelected && newStateToSet.selectedItem !== state.selectedItem) {
  36109. onChangeArg = newStateToSet.selectedItem;
  36110. }
  36111. newStateToSet.type = newStateToSet.type || unknown;
  36112. Object.keys(newStateToSet).forEach(key => {
  36113. // onStateChangeArg should only have the state that is
  36114. // actually changing
  36115. if (state[key] !== newStateToSet[key]) {
  36116. onStateChangeArg[key] = newStateToSet[key];
  36117. } // the type is useful for the onStateChangeArg
  36118. // but we don't actually want to set it in internal state.
  36119. // this is an undocumented feature for now... Not all internalSetState
  36120. // calls support it and I'm not certain we want them to yet.
  36121. // But it enables users controlling the isOpen state to know when
  36122. // the isOpen state changes due to mouseup events which is quite handy.
  36123. if (key === 'type') {
  36124. return;
  36125. }
  36126. newStateToSet[key]; // if it's coming from props, then we don't care to set it internally
  36127. if (!isControlledProp(this.props, key)) {
  36128. nextState[key] = newStateToSet[key];
  36129. }
  36130. }); // if stateToSet is a function, then we weren't able to call onInputValueChange
  36131. // earlier, so we'll call it now that we know what the inputValue state will be.
  36132. if (isStateToSetFunction && newStateToSet.hasOwnProperty('inputValue')) {
  36133. this.props.onInputValueChange(newStateToSet.inputValue, { ...this.getStateAndHelpers(),
  36134. ...newStateToSet
  36135. });
  36136. }
  36137. return nextState;
  36138. }, () => {
  36139. // call the provided callback if it's a function
  36140. cbToCb(cb)(); // only call the onStateChange and onChange callbacks if
  36141. // we have relevant information to pass them.
  36142. const hasMoreStateThanType = Object.keys(onStateChangeArg).length > 1;
  36143. if (hasMoreStateThanType) {
  36144. this.props.onStateChange(onStateChangeArg, this.getStateAndHelpers());
  36145. }
  36146. if (isItemSelected) {
  36147. this.props.onSelect(stateToSet.selectedItem, this.getStateAndHelpers());
  36148. }
  36149. if (onChangeArg !== undefined) {
  36150. this.props.onChange(onChangeArg, this.getStateAndHelpers());
  36151. } // this is currently undocumented and therefore subject to change
  36152. // We'll try to not break it, but just be warned.
  36153. this.props.onUserAction(onStateChangeArg, this.getStateAndHelpers());
  36154. });
  36155. };
  36156. this.rootRef = node => this._rootNode = node;
  36157. this.getRootProps = function (_temp, _temp2) {
  36158. let {
  36159. refKey = 'ref',
  36160. ref,
  36161. ...rest
  36162. } = _temp === void 0 ? {} : _temp;
  36163. let {
  36164. suppressRefError = false
  36165. } = _temp2 === void 0 ? {} : _temp2;
  36166. // this is used in the render to know whether the user has called getRootProps.
  36167. // It uses that to know whether to apply the props automatically
  36168. _this.getRootProps.called = true;
  36169. _this.getRootProps.refKey = refKey;
  36170. _this.getRootProps.suppressRefError = suppressRefError;
  36171. const {
  36172. isOpen
  36173. } = _this.getState();
  36174. return {
  36175. [refKey]: handleRefs(ref, _this.rootRef),
  36176. role: 'combobox',
  36177. 'aria-expanded': isOpen,
  36178. 'aria-haspopup': 'listbox',
  36179. 'aria-owns': isOpen ? _this.menuId : null,
  36180. 'aria-labelledby': _this.labelId,
  36181. ...rest
  36182. };
  36183. };
  36184. this.keyDownHandlers = {
  36185. ArrowDown(event) {
  36186. event.preventDefault();
  36187. if (this.getState().isOpen) {
  36188. const amount = event.shiftKey ? 5 : 1;
  36189. this.moveHighlightedIndex(amount, {
  36190. type: keyDownArrowDown
  36191. });
  36192. } else {
  36193. this.internalSetState({
  36194. isOpen: true,
  36195. type: keyDownArrowDown
  36196. }, () => {
  36197. const itemCount = this.getItemCount();
  36198. if (itemCount > 0) {
  36199. const {
  36200. highlightedIndex
  36201. } = this.getState();
  36202. const nextHighlightedIndex = getNextWrappingIndex(1, highlightedIndex, itemCount, index => this.getItemNodeFromIndex(index));
  36203. this.setHighlightedIndex(nextHighlightedIndex, {
  36204. type: keyDownArrowDown
  36205. });
  36206. }
  36207. });
  36208. }
  36209. },
  36210. ArrowUp(event) {
  36211. event.preventDefault();
  36212. if (this.getState().isOpen) {
  36213. const amount = event.shiftKey ? -5 : -1;
  36214. this.moveHighlightedIndex(amount, {
  36215. type: keyDownArrowUp
  36216. });
  36217. } else {
  36218. this.internalSetState({
  36219. isOpen: true,
  36220. type: keyDownArrowUp
  36221. }, () => {
  36222. const itemCount = this.getItemCount();
  36223. if (itemCount > 0) {
  36224. const {
  36225. highlightedIndex
  36226. } = this.getState();
  36227. const nextHighlightedIndex = getNextWrappingIndex(-1, highlightedIndex, itemCount, index => this.getItemNodeFromIndex(index));
  36228. this.setHighlightedIndex(nextHighlightedIndex, {
  36229. type: keyDownArrowUp
  36230. });
  36231. }
  36232. });
  36233. }
  36234. },
  36235. Enter(event) {
  36236. if (event.which === 229) {
  36237. return;
  36238. }
  36239. const {
  36240. isOpen,
  36241. highlightedIndex
  36242. } = this.getState();
  36243. if (isOpen && highlightedIndex != null) {
  36244. event.preventDefault();
  36245. const item = this.items[highlightedIndex];
  36246. const itemNode = this.getItemNodeFromIndex(highlightedIndex);
  36247. if (item == null || itemNode && itemNode.hasAttribute('disabled')) {
  36248. return;
  36249. }
  36250. this.selectHighlightedItem({
  36251. type: keyDownEnter
  36252. });
  36253. }
  36254. },
  36255. Escape(event) {
  36256. event.preventDefault();
  36257. this.reset({
  36258. type: keyDownEscape,
  36259. ...(!this.state.isOpen && {
  36260. selectedItem: null,
  36261. inputValue: ''
  36262. })
  36263. });
  36264. }
  36265. };
  36266. this.buttonKeyDownHandlers = { ...this.keyDownHandlers,
  36267. ' '(event) {
  36268. event.preventDefault();
  36269. this.toggleMenu({
  36270. type: keyDownSpaceButton
  36271. });
  36272. }
  36273. };
  36274. this.inputKeyDownHandlers = { ...this.keyDownHandlers,
  36275. Home(event) {
  36276. const {
  36277. isOpen
  36278. } = this.getState();
  36279. if (!isOpen) {
  36280. return;
  36281. }
  36282. event.preventDefault();
  36283. const itemCount = this.getItemCount();
  36284. if (itemCount <= 0 || !isOpen) {
  36285. return;
  36286. } // get next non-disabled starting downwards from 0 if that's disabled.
  36287. const newHighlightedIndex = getNextNonDisabledIndex(1, 0, itemCount, index => this.getItemNodeFromIndex(index), false);
  36288. this.setHighlightedIndex(newHighlightedIndex, {
  36289. type: keyDownHome
  36290. });
  36291. },
  36292. End(event) {
  36293. const {
  36294. isOpen
  36295. } = this.getState();
  36296. if (!isOpen) {
  36297. return;
  36298. }
  36299. event.preventDefault();
  36300. const itemCount = this.getItemCount();
  36301. if (itemCount <= 0 || !isOpen) {
  36302. return;
  36303. } // get next non-disabled starting upwards from last index if that's disabled.
  36304. const newHighlightedIndex = getNextNonDisabledIndex(-1, itemCount - 1, itemCount, index => this.getItemNodeFromIndex(index), false);
  36305. this.setHighlightedIndex(newHighlightedIndex, {
  36306. type: keyDownEnd
  36307. });
  36308. }
  36309. };
  36310. this.getToggleButtonProps = function (_temp3) {
  36311. let {
  36312. onClick,
  36313. onPress,
  36314. onKeyDown,
  36315. onKeyUp,
  36316. onBlur,
  36317. ...rest
  36318. } = _temp3 === void 0 ? {} : _temp3;
  36319. const {
  36320. isOpen
  36321. } = _this.getState();
  36322. const enabledEventHandlers = {
  36323. onClick: callAllEventHandlers(onClick, _this.buttonHandleClick),
  36324. onKeyDown: callAllEventHandlers(onKeyDown, _this.buttonHandleKeyDown),
  36325. onKeyUp: callAllEventHandlers(onKeyUp, _this.buttonHandleKeyUp),
  36326. onBlur: callAllEventHandlers(onBlur, _this.buttonHandleBlur)
  36327. };
  36328. const eventHandlers = rest.disabled ? {} : enabledEventHandlers;
  36329. return {
  36330. type: 'button',
  36331. role: 'button',
  36332. 'aria-label': isOpen ? 'close menu' : 'open menu',
  36333. 'aria-haspopup': true,
  36334. 'data-toggle': true,
  36335. ...eventHandlers,
  36336. ...rest
  36337. };
  36338. };
  36339. this.buttonHandleKeyUp = event => {
  36340. // Prevent click event from emitting in Firefox
  36341. event.preventDefault();
  36342. };
  36343. this.buttonHandleKeyDown = event => {
  36344. const key = normalizeArrowKey(event);
  36345. if (this.buttonKeyDownHandlers[key]) {
  36346. this.buttonKeyDownHandlers[key].call(this, event);
  36347. }
  36348. };
  36349. this.buttonHandleClick = event => {
  36350. event.preventDefault(); // handle odd case for Safari and Firefox which
  36351. // don't give the button the focus properly.
  36352. /* istanbul ignore if (can't reasonably test this) */
  36353. if (this.props.environment.document.activeElement === this.props.environment.document.body) {
  36354. event.target.focus();
  36355. } // to simplify testing components that use downshift, we'll not wrap this in a setTimeout
  36356. // if the NODE_ENV is test. With the proper build system, this should be dead code eliminated
  36357. // when building for production and should therefore have no impact on production code.
  36358. if (false) {} else {
  36359. // Ensure that toggle of menu occurs after the potential blur event in iOS
  36360. this.internalSetTimeout(() => this.toggleMenu({
  36361. type: clickButton
  36362. }));
  36363. }
  36364. };
  36365. this.buttonHandleBlur = event => {
  36366. const blurTarget = event.target; // Save blur target for comparison with activeElement later
  36367. // Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not body element
  36368. this.internalSetTimeout(() => {
  36369. 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)
  36370. ) {
  36371. this.reset({
  36372. type: blurButton
  36373. });
  36374. }
  36375. });
  36376. };
  36377. this.getLabelProps = props => {
  36378. return {
  36379. htmlFor: this.inputId,
  36380. id: this.labelId,
  36381. ...props
  36382. };
  36383. };
  36384. this.getInputProps = function (_temp4) {
  36385. let {
  36386. onKeyDown,
  36387. onBlur,
  36388. onChange,
  36389. onInput,
  36390. onChangeText,
  36391. ...rest
  36392. } = _temp4 === void 0 ? {} : _temp4;
  36393. let onChangeKey;
  36394. let eventHandlers = {};
  36395. /* istanbul ignore next (preact) */
  36396. {
  36397. onChangeKey = 'onChange';
  36398. }
  36399. const {
  36400. inputValue,
  36401. isOpen,
  36402. highlightedIndex
  36403. } = _this.getState();
  36404. if (!rest.disabled) {
  36405. eventHandlers = {
  36406. [onChangeKey]: callAllEventHandlers(onChange, onInput, _this.inputHandleChange),
  36407. onKeyDown: callAllEventHandlers(onKeyDown, _this.inputHandleKeyDown),
  36408. onBlur: callAllEventHandlers(onBlur, _this.inputHandleBlur)
  36409. };
  36410. }
  36411. return {
  36412. 'aria-autocomplete': 'list',
  36413. 'aria-activedescendant': isOpen && typeof highlightedIndex === 'number' && highlightedIndex >= 0 ? _this.getItemId(highlightedIndex) : null,
  36414. 'aria-controls': isOpen ? _this.menuId : null,
  36415. 'aria-labelledby': _this.labelId,
  36416. // https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion
  36417. // revert back since autocomplete="nope" is ignored on latest Chrome and Opera
  36418. autoComplete: 'off',
  36419. value: inputValue,
  36420. id: _this.inputId,
  36421. ...eventHandlers,
  36422. ...rest
  36423. };
  36424. };
  36425. this.inputHandleKeyDown = event => {
  36426. const key = normalizeArrowKey(event);
  36427. if (key && this.inputKeyDownHandlers[key]) {
  36428. this.inputKeyDownHandlers[key].call(this, event);
  36429. }
  36430. };
  36431. this.inputHandleChange = event => {
  36432. this.internalSetState({
  36433. type: changeInput,
  36434. isOpen: true,
  36435. inputValue: event.target.value,
  36436. highlightedIndex: this.props.defaultHighlightedIndex
  36437. });
  36438. };
  36439. this.inputHandleBlur = () => {
  36440. // Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not the body element
  36441. this.internalSetTimeout(() => {
  36442. const 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);
  36443. if (!this.isMouseDown && !downshiftButtonIsActive) {
  36444. this.reset({
  36445. type: blurInput
  36446. });
  36447. }
  36448. });
  36449. };
  36450. this.menuRef = node => {
  36451. this._menuNode = node;
  36452. };
  36453. this.getMenuProps = function (_temp5, _temp6) {
  36454. let {
  36455. refKey = 'ref',
  36456. ref,
  36457. ...props
  36458. } = _temp5 === void 0 ? {} : _temp5;
  36459. let {
  36460. suppressRefError = false
  36461. } = _temp6 === void 0 ? {} : _temp6;
  36462. _this.getMenuProps.called = true;
  36463. _this.getMenuProps.refKey = refKey;
  36464. _this.getMenuProps.suppressRefError = suppressRefError;
  36465. return {
  36466. [refKey]: handleRefs(ref, _this.menuRef),
  36467. role: 'listbox',
  36468. 'aria-labelledby': props && props['aria-label'] ? null : _this.labelId,
  36469. id: _this.menuId,
  36470. ...props
  36471. };
  36472. };
  36473. this.getItemProps = function (_temp7) {
  36474. let {
  36475. onMouseMove,
  36476. onMouseDown,
  36477. onClick,
  36478. onPress,
  36479. index,
  36480. item = true ?
  36481. /* istanbul ignore next */
  36482. undefined : 0,
  36483. ...rest
  36484. } = _temp7 === void 0 ? {} : _temp7;
  36485. if (index === undefined) {
  36486. _this.items.push(item);
  36487. index = _this.items.indexOf(item);
  36488. } else {
  36489. _this.items[index] = item;
  36490. }
  36491. const onSelectKey = 'onClick';
  36492. const customClickHandler = onClick;
  36493. const enabledEventHandlers = {
  36494. // onMouseMove is used over onMouseEnter here. onMouseMove
  36495. // is only triggered on actual mouse movement while onMouseEnter
  36496. // can fire on DOM changes, interrupting keyboard navigation
  36497. onMouseMove: callAllEventHandlers(onMouseMove, () => {
  36498. if (index === _this.getState().highlightedIndex) {
  36499. return;
  36500. }
  36501. _this.setHighlightedIndex(index, {
  36502. type: itemMouseEnter
  36503. }); // We never want to manually scroll when changing state based
  36504. // on `onMouseMove` because we will be moving the element out
  36505. // from under the user which is currently scrolling/moving the
  36506. // cursor
  36507. _this.avoidScrolling = true;
  36508. _this.internalSetTimeout(() => _this.avoidScrolling = false, 250);
  36509. }),
  36510. onMouseDown: callAllEventHandlers(onMouseDown, event => {
  36511. // This prevents the activeElement from being changed
  36512. // to the item so it can remain with the current activeElement
  36513. // which is a more common use case.
  36514. event.preventDefault();
  36515. }),
  36516. [onSelectKey]: callAllEventHandlers(customClickHandler, () => {
  36517. _this.selectItemAtIndex(index, {
  36518. type: clickItem
  36519. });
  36520. })
  36521. }; // Passing down the onMouseDown handler to prevent redirect
  36522. // of the activeElement if clicking on disabled items
  36523. const eventHandlers = rest.disabled ? {
  36524. onMouseDown: enabledEventHandlers.onMouseDown
  36525. } : enabledEventHandlers;
  36526. return {
  36527. id: _this.getItemId(index),
  36528. role: 'option',
  36529. 'aria-selected': _this.getState().highlightedIndex === index,
  36530. ...eventHandlers,
  36531. ...rest
  36532. };
  36533. };
  36534. this.clearItems = () => {
  36535. this.items = [];
  36536. };
  36537. this.reset = function (otherStateToSet, cb) {
  36538. if (otherStateToSet === void 0) {
  36539. otherStateToSet = {};
  36540. }
  36541. otherStateToSet = pickState(otherStateToSet);
  36542. _this.internalSetState(_ref => {
  36543. let {
  36544. selectedItem
  36545. } = _ref;
  36546. return {
  36547. isOpen: _this.props.defaultIsOpen,
  36548. highlightedIndex: _this.props.defaultHighlightedIndex,
  36549. inputValue: _this.props.itemToString(selectedItem),
  36550. ...otherStateToSet
  36551. };
  36552. }, cb);
  36553. };
  36554. this.toggleMenu = function (otherStateToSet, cb) {
  36555. if (otherStateToSet === void 0) {
  36556. otherStateToSet = {};
  36557. }
  36558. otherStateToSet = pickState(otherStateToSet);
  36559. _this.internalSetState(_ref2 => {
  36560. let {
  36561. isOpen
  36562. } = _ref2;
  36563. return {
  36564. isOpen: !isOpen,
  36565. ...(isOpen && {
  36566. highlightedIndex: _this.props.defaultHighlightedIndex
  36567. }),
  36568. ...otherStateToSet
  36569. };
  36570. }, () => {
  36571. const {
  36572. isOpen,
  36573. highlightedIndex
  36574. } = _this.getState();
  36575. if (isOpen) {
  36576. if (_this.getItemCount() > 0 && typeof highlightedIndex === 'number') {
  36577. _this.setHighlightedIndex(highlightedIndex, otherStateToSet);
  36578. }
  36579. }
  36580. cbToCb(cb)();
  36581. });
  36582. };
  36583. this.openMenu = cb => {
  36584. this.internalSetState({
  36585. isOpen: true
  36586. }, cb);
  36587. };
  36588. this.closeMenu = cb => {
  36589. this.internalSetState({
  36590. isOpen: false
  36591. }, cb);
  36592. };
  36593. this.updateStatus = downshift_esm_debounce(() => {
  36594. const state = this.getState();
  36595. const item = this.items[state.highlightedIndex];
  36596. const resultCount = this.getItemCount();
  36597. const status = this.props.getA11yStatusMessage({
  36598. itemToString: this.props.itemToString,
  36599. previousResultCount: this.previousResultCount,
  36600. resultCount,
  36601. highlightedItem: item,
  36602. ...state
  36603. });
  36604. this.previousResultCount = resultCount;
  36605. setStatus(status, this.props.environment.document);
  36606. }, 200);
  36607. // fancy destructuring + defaults + aliases
  36608. // this basically says each value of state should either be set to
  36609. // the initial value or the default value if the initial value is not provided
  36610. const {
  36611. defaultHighlightedIndex,
  36612. initialHighlightedIndex: _highlightedIndex = defaultHighlightedIndex,
  36613. defaultIsOpen,
  36614. initialIsOpen: _isOpen = defaultIsOpen,
  36615. initialInputValue: _inputValue = '',
  36616. initialSelectedItem: _selectedItem = null
  36617. } = this.props;
  36618. const _state = this.getState({
  36619. highlightedIndex: _highlightedIndex,
  36620. isOpen: _isOpen,
  36621. inputValue: _inputValue,
  36622. selectedItem: _selectedItem
  36623. });
  36624. if (_state.selectedItem != null && this.props.initialInputValue === undefined) {
  36625. _state.inputValue = this.props.itemToString(_state.selectedItem);
  36626. }
  36627. this.state = _state;
  36628. }
  36629. /**
  36630. * Clear all running timeouts
  36631. */
  36632. internalClearTimeouts() {
  36633. this.timeoutIds.forEach(id => {
  36634. clearTimeout(id);
  36635. });
  36636. this.timeoutIds = [];
  36637. }
  36638. /**
  36639. * Gets the state based on internal state or props
  36640. * If a state value is passed via props, then that
  36641. * is the value given, otherwise it's retrieved from
  36642. * stateToMerge
  36643. *
  36644. * @param {Object} stateToMerge defaults to this.state
  36645. * @return {Object} the state
  36646. */
  36647. getState(stateToMerge) {
  36648. if (stateToMerge === void 0) {
  36649. stateToMerge = this.state;
  36650. }
  36651. return getState(stateToMerge, this.props);
  36652. }
  36653. getItemCount() {
  36654. // things read better this way. They're in priority order:
  36655. // 1. `this.itemCount`
  36656. // 2. `this.props.itemCount`
  36657. // 3. `this.items.length`
  36658. let itemCount = this.items.length;
  36659. if (this.itemCount != null) {
  36660. itemCount = this.itemCount;
  36661. } else if (this.props.itemCount !== undefined) {
  36662. itemCount = this.props.itemCount;
  36663. }
  36664. return itemCount;
  36665. }
  36666. getItemNodeFromIndex(index) {
  36667. return this.props.environment.document.getElementById(this.getItemId(index));
  36668. }
  36669. scrollHighlightedItemIntoView() {
  36670. /* istanbul ignore else (react-native) */
  36671. {
  36672. const node = this.getItemNodeFromIndex(this.getState().highlightedIndex);
  36673. this.props.scrollIntoView(node, this._menuNode);
  36674. }
  36675. }
  36676. moveHighlightedIndex(amount, otherStateToSet) {
  36677. const itemCount = this.getItemCount();
  36678. const {
  36679. highlightedIndex
  36680. } = this.getState();
  36681. if (itemCount > 0) {
  36682. const nextHighlightedIndex = getNextWrappingIndex(amount, highlightedIndex, itemCount, index => this.getItemNodeFromIndex(index));
  36683. this.setHighlightedIndex(nextHighlightedIndex, otherStateToSet);
  36684. }
  36685. }
  36686. getStateAndHelpers() {
  36687. const {
  36688. highlightedIndex,
  36689. inputValue,
  36690. selectedItem,
  36691. isOpen
  36692. } = this.getState();
  36693. const {
  36694. itemToString
  36695. } = this.props;
  36696. const {
  36697. id
  36698. } = this;
  36699. const {
  36700. getRootProps,
  36701. getToggleButtonProps,
  36702. getLabelProps,
  36703. getMenuProps,
  36704. getInputProps,
  36705. getItemProps,
  36706. openMenu,
  36707. closeMenu,
  36708. toggleMenu,
  36709. selectItem,
  36710. selectItemAtIndex,
  36711. selectHighlightedItem,
  36712. setHighlightedIndex,
  36713. clearSelection,
  36714. clearItems,
  36715. reset,
  36716. setItemCount,
  36717. unsetItemCount,
  36718. internalSetState: setState
  36719. } = this;
  36720. return {
  36721. // prop getters
  36722. getRootProps,
  36723. getToggleButtonProps,
  36724. getLabelProps,
  36725. getMenuProps,
  36726. getInputProps,
  36727. getItemProps,
  36728. // actions
  36729. reset,
  36730. openMenu,
  36731. closeMenu,
  36732. toggleMenu,
  36733. selectItem,
  36734. selectItemAtIndex,
  36735. selectHighlightedItem,
  36736. setHighlightedIndex,
  36737. clearSelection,
  36738. clearItems,
  36739. setItemCount,
  36740. unsetItemCount,
  36741. setState,
  36742. // props
  36743. itemToString,
  36744. // derived
  36745. id,
  36746. // state
  36747. highlightedIndex,
  36748. inputValue,
  36749. isOpen,
  36750. selectedItem
  36751. };
  36752. } //////////////////////////// ROOT
  36753. componentDidMount() {
  36754. /* istanbul ignore if (react-native) */
  36755. if (false) {}
  36756. /* istanbul ignore if (react-native) */
  36757. {
  36758. // this.isMouseDown helps us track whether the mouse is currently held down.
  36759. // This is useful when the user clicks on an item in the list, but holds the mouse
  36760. // down long enough for the list to disappear (because the blur event fires on the input)
  36761. // this.isMouseDown is used in the blur handler on the input to determine whether the blur event should
  36762. // trigger hiding the menu.
  36763. const onMouseDown = () => {
  36764. this.isMouseDown = true;
  36765. };
  36766. const onMouseUp = event => {
  36767. this.isMouseDown = false; // if the target element or the activeElement is within a downshift node
  36768. // then we don't want to reset downshift
  36769. const contextWithinDownshift = targetWithinDownshift(event.target, [this._rootNode, this._menuNode], this.props.environment);
  36770. if (!contextWithinDownshift && this.getState().isOpen) {
  36771. this.reset({
  36772. type: mouseUp
  36773. }, () => this.props.onOuterClick(this.getStateAndHelpers()));
  36774. }
  36775. }; // Touching an element in iOS gives focus and hover states, but touching out of
  36776. // the element will remove hover, and persist the focus state, resulting in the
  36777. // blur event not being triggered.
  36778. // this.isTouchMove helps us track whether the user is tapping or swiping on a touch screen.
  36779. // If the user taps outside of Downshift, the component should be reset,
  36780. // but not if the user is swiping
  36781. const onTouchStart = () => {
  36782. this.isTouchMove = false;
  36783. };
  36784. const onTouchMove = () => {
  36785. this.isTouchMove = true;
  36786. };
  36787. const onTouchEnd = event => {
  36788. const contextWithinDownshift = targetWithinDownshift(event.target, [this._rootNode, this._menuNode], this.props.environment, false);
  36789. if (!this.isTouchMove && !contextWithinDownshift && this.getState().isOpen) {
  36790. this.reset({
  36791. type: touchEnd
  36792. }, () => this.props.onOuterClick(this.getStateAndHelpers()));
  36793. }
  36794. };
  36795. const {
  36796. environment
  36797. } = this.props;
  36798. environment.addEventListener('mousedown', onMouseDown);
  36799. environment.addEventListener('mouseup', onMouseUp);
  36800. environment.addEventListener('touchstart', onTouchStart);
  36801. environment.addEventListener('touchmove', onTouchMove);
  36802. environment.addEventListener('touchend', onTouchEnd);
  36803. this.cleanup = () => {
  36804. this.internalClearTimeouts();
  36805. this.updateStatus.cancel();
  36806. environment.removeEventListener('mousedown', onMouseDown);
  36807. environment.removeEventListener('mouseup', onMouseUp);
  36808. environment.removeEventListener('touchstart', onTouchStart);
  36809. environment.removeEventListener('touchmove', onTouchMove);
  36810. environment.removeEventListener('touchend', onTouchEnd);
  36811. };
  36812. }
  36813. }
  36814. shouldScroll(prevState, prevProps) {
  36815. const {
  36816. highlightedIndex: currentHighlightedIndex
  36817. } = this.props.highlightedIndex === undefined ? this.getState() : this.props;
  36818. const {
  36819. highlightedIndex: prevHighlightedIndex
  36820. } = prevProps.highlightedIndex === undefined ? prevState : prevProps;
  36821. const scrollWhenOpen = currentHighlightedIndex && this.getState().isOpen && !prevState.isOpen;
  36822. const scrollWhenNavigating = currentHighlightedIndex !== prevHighlightedIndex;
  36823. return scrollWhenOpen || scrollWhenNavigating;
  36824. }
  36825. componentDidUpdate(prevProps, prevState) {
  36826. if (false) {}
  36827. if (isControlledProp(this.props, 'selectedItem') && this.props.selectedItemChanged(prevProps.selectedItem, this.props.selectedItem)) {
  36828. this.internalSetState({
  36829. type: controlledPropUpdatedSelectedItem,
  36830. inputValue: this.props.itemToString(this.props.selectedItem)
  36831. });
  36832. }
  36833. if (!this.avoidScrolling && this.shouldScroll(prevState, prevProps)) {
  36834. this.scrollHighlightedItemIntoView();
  36835. }
  36836. /* istanbul ignore else (react-native) */
  36837. {
  36838. this.updateStatus();
  36839. }
  36840. }
  36841. componentWillUnmount() {
  36842. this.cleanup(); // avoids memory leak
  36843. }
  36844. render() {
  36845. const children = unwrapArray(this.props.children, downshift_esm_noop); // because the items are rerendered every time we call the children
  36846. // we clear this out each render and it will be populated again as
  36847. // getItemProps is called.
  36848. this.clearItems(); // we reset this so we know whether the user calls getRootProps during
  36849. // this render. If they do then we don't need to do anything,
  36850. // if they don't then we need to clone the element they return and
  36851. // apply the props for them.
  36852. this.getRootProps.called = false;
  36853. this.getRootProps.refKey = undefined;
  36854. this.getRootProps.suppressRefError = undefined; // we do something similar for getMenuProps
  36855. this.getMenuProps.called = false;
  36856. this.getMenuProps.refKey = undefined;
  36857. this.getMenuProps.suppressRefError = undefined; // we do something similar for getLabelProps
  36858. this.getLabelProps.called = false; // and something similar for getInputProps
  36859. this.getInputProps.called = false;
  36860. const element = unwrapArray(children(this.getStateAndHelpers()));
  36861. if (!element) {
  36862. return null;
  36863. }
  36864. if (this.getRootProps.called || this.props.suppressRefError) {
  36865. if (false) {}
  36866. return element;
  36867. } else if (isDOMElement(element)) {
  36868. // they didn't apply the root props, but we can clone
  36869. // this and apply the props ourselves
  36870. return /*#__PURE__*/(0,external_React_namespaceObject.cloneElement)(element, this.getRootProps(getElementProps(element)));
  36871. }
  36872. /* istanbul ignore else */
  36873. if (false) {}
  36874. /* istanbul ignore next */
  36875. return undefined;
  36876. }
  36877. }
  36878. Downshift.defaultProps = {
  36879. defaultHighlightedIndex: null,
  36880. defaultIsOpen: false,
  36881. getA11yStatusMessage: getA11yStatusMessage$1,
  36882. itemToString: i => {
  36883. if (i == null) {
  36884. return '';
  36885. }
  36886. if (false) {}
  36887. return String(i);
  36888. },
  36889. onStateChange: downshift_esm_noop,
  36890. onInputValueChange: downshift_esm_noop,
  36891. onUserAction: downshift_esm_noop,
  36892. onChange: downshift_esm_noop,
  36893. onSelect: downshift_esm_noop,
  36894. onOuterClick: downshift_esm_noop,
  36895. selectedItemChanged: (prevItem, item) => prevItem !== item,
  36896. environment:
  36897. /* istanbul ignore next (ssr) */
  36898. typeof window === 'undefined' ? {} : window,
  36899. stateReducer: (state, stateToSet) => stateToSet,
  36900. suppressRefError: false,
  36901. scrollIntoView
  36902. };
  36903. Downshift.stateChangeTypes = stateChangeTypes$3;
  36904. return Downshift;
  36905. })();
  36906. false ? 0 : void 0;
  36907. var Downshift$1 = Downshift;
  36908. function validateGetMenuPropsCalledCorrectly(node, _ref3) {
  36909. let {
  36910. refKey
  36911. } = _ref3;
  36912. if (!node) {
  36913. // eslint-disable-next-line no-console
  36914. console.error(`downshift: The ref prop "${refKey}" from getMenuProps was not applied correctly on your menu element.`);
  36915. }
  36916. }
  36917. function validateGetRootPropsCalledCorrectly(element, _ref4) {
  36918. let {
  36919. refKey
  36920. } = _ref4;
  36921. const refKeySpecified = refKey !== 'ref';
  36922. const isComposite = !isDOMElement(element);
  36923. if (isComposite && !refKeySpecified && !isForwardRef(element)) {
  36924. // eslint-disable-next-line no-console
  36925. console.error('downshift: You returned a non-DOM element. You must specify a refKey in getRootProps');
  36926. } else if (!isComposite && refKeySpecified) {
  36927. // eslint-disable-next-line no-console
  36928. console.error(`downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "${refKey}"`);
  36929. }
  36930. if (!isForwardRef(element) && !getElementProps(element)[refKey]) {
  36931. // eslint-disable-next-line no-console
  36932. console.error(`downshift: You must apply the ref prop "${refKey}" from getRootProps onto your root element.`);
  36933. }
  36934. }
  36935. const dropdownDefaultStateValues = {
  36936. highlightedIndex: -1,
  36937. isOpen: false,
  36938. selectedItem: null,
  36939. inputValue: ''
  36940. };
  36941. function callOnChangeProps(action, state, newState) {
  36942. const {
  36943. props,
  36944. type
  36945. } = action;
  36946. const changes = {};
  36947. Object.keys(state).forEach(key => {
  36948. invokeOnChangeHandler(key, action, state, newState);
  36949. if (newState[key] !== state[key]) {
  36950. changes[key] = newState[key];
  36951. }
  36952. });
  36953. if (props.onStateChange && Object.keys(changes).length) {
  36954. props.onStateChange({
  36955. type,
  36956. ...changes
  36957. });
  36958. }
  36959. }
  36960. function invokeOnChangeHandler(key, action, state, newState) {
  36961. const {
  36962. props,
  36963. type
  36964. } = action;
  36965. const handler = `on${capitalizeString(key)}Change`;
  36966. if (props[handler] && newState[key] !== undefined && newState[key] !== state[key]) {
  36967. props[handler]({
  36968. type,
  36969. ...newState
  36970. });
  36971. }
  36972. }
  36973. /**
  36974. * Default state reducer that returns the changes.
  36975. *
  36976. * @param {Object} s state.
  36977. * @param {Object} a action with changes.
  36978. * @returns {Object} changes.
  36979. */
  36980. function stateReducer(s, a) {
  36981. return a.changes;
  36982. }
  36983. /**
  36984. * Returns a message to be added to aria-live region when item is selected.
  36985. *
  36986. * @param {Object} selectionParameters Parameters required to build the message.
  36987. * @returns {string} The a11y message.
  36988. */
  36989. function getA11ySelectionMessage(selectionParameters) {
  36990. const {
  36991. selectedItem,
  36992. itemToString: itemToStringLocal
  36993. } = selectionParameters;
  36994. return selectedItem ? `${itemToStringLocal(selectedItem)} has been selected.` : '';
  36995. }
  36996. /**
  36997. * Debounced call for updating the a11y message.
  36998. */
  36999. const updateA11yStatus = downshift_esm_debounce((getA11yMessage, document) => {
  37000. setStatus(getA11yMessage(), document);
  37001. }, 200); // istanbul ignore next
  37002. const downshift_esm_useIsomorphicLayoutEffect = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined' ? external_React_namespaceObject.useLayoutEffect : external_React_namespaceObject.useEffect;
  37003. function useElementIds(_ref) {
  37004. let {
  37005. id = `downshift-${generateId()}`,
  37006. labelId,
  37007. menuId,
  37008. getItemId,
  37009. toggleButtonId,
  37010. inputId
  37011. } = _ref;
  37012. const elementIdsRef = (0,external_React_namespaceObject.useRef)({
  37013. labelId: labelId || `${id}-label`,
  37014. menuId: menuId || `${id}-menu`,
  37015. getItemId: getItemId || (index => `${id}-item-${index}`),
  37016. toggleButtonId: toggleButtonId || `${id}-toggle-button`,
  37017. inputId: inputId || `${id}-input`
  37018. });
  37019. return elementIdsRef.current;
  37020. }
  37021. function getItemIndex(index, item, items) {
  37022. if (index !== undefined) {
  37023. return index;
  37024. }
  37025. if (items.length === 0) {
  37026. return -1;
  37027. }
  37028. return items.indexOf(item);
  37029. }
  37030. function itemToString(item) {
  37031. return item ? String(item) : '';
  37032. }
  37033. function isAcceptedCharacterKey(key) {
  37034. return /^\S{1}$/.test(key);
  37035. }
  37036. function capitalizeString(string) {
  37037. return `${string.slice(0, 1).toUpperCase()}${string.slice(1)}`;
  37038. }
  37039. function downshift_esm_useLatestRef(val) {
  37040. const ref = (0,external_React_namespaceObject.useRef)(val); // technically this is not "concurrent mode safe" because we're manipulating
  37041. // the value during render (so it's not idempotent). However, the places this
  37042. // hook is used is to support memoizing callbacks which will be called
  37043. // *during* render, so we need the latest values *during* render.
  37044. // If not for this, then we'd probably want to use useLayoutEffect instead.
  37045. ref.current = val;
  37046. return ref;
  37047. }
  37048. /**
  37049. * Computes the controlled state using a the previous state, props,
  37050. * two reducers, one from downshift and an optional one from the user.
  37051. * Also calls the onChange handlers for state values that have changed.
  37052. *
  37053. * @param {Function} reducer Reducer function from downshift.
  37054. * @param {Object} initialState Initial state of the hook.
  37055. * @param {Object} props The hook props.
  37056. * @returns {Array} An array with the state and an action dispatcher.
  37057. */
  37058. function useEnhancedReducer(reducer, initialState, props) {
  37059. const prevStateRef = (0,external_React_namespaceObject.useRef)();
  37060. const actionRef = (0,external_React_namespaceObject.useRef)();
  37061. const enhancedReducer = (0,external_React_namespaceObject.useCallback)((state, action) => {
  37062. actionRef.current = action;
  37063. state = getState(state, action.props);
  37064. const changes = reducer(state, action);
  37065. const newState = action.props.stateReducer(state, { ...action,
  37066. changes
  37067. });
  37068. return newState;
  37069. }, [reducer]);
  37070. const [state, dispatch] = (0,external_React_namespaceObject.useReducer)(enhancedReducer, initialState);
  37071. const propsRef = downshift_esm_useLatestRef(props);
  37072. const dispatchWithProps = (0,external_React_namespaceObject.useCallback)(action => dispatch({
  37073. props: propsRef.current,
  37074. ...action
  37075. }), [propsRef]);
  37076. const action = actionRef.current;
  37077. (0,external_React_namespaceObject.useEffect)(() => {
  37078. if (action && prevStateRef.current && prevStateRef.current !== state) {
  37079. callOnChangeProps(action, getState(prevStateRef.current, action.props), state);
  37080. }
  37081. prevStateRef.current = state;
  37082. }, [state, props, action]);
  37083. return [state, dispatchWithProps];
  37084. }
  37085. /**
  37086. * Wraps the useEnhancedReducer and applies the controlled prop values before
  37087. * returning the new state.
  37088. *
  37089. * @param {Function} reducer Reducer function from downshift.
  37090. * @param {Object} initialState Initial state of the hook.
  37091. * @param {Object} props The hook props.
  37092. * @returns {Array} An array with the state and an action dispatcher.
  37093. */
  37094. function useControlledReducer$1(reducer, initialState, props) {
  37095. const [state, dispatch] = useEnhancedReducer(reducer, initialState, props);
  37096. return [getState(state, props), dispatch];
  37097. }
  37098. const defaultProps$3 = {
  37099. itemToString,
  37100. stateReducer,
  37101. getA11ySelectionMessage,
  37102. scrollIntoView,
  37103. circularNavigation: false,
  37104. environment:
  37105. /* istanbul ignore next (ssr) */
  37106. typeof window === 'undefined' ? {} : window
  37107. };
  37108. function getDefaultValue$1(props, propKey, defaultStateValues) {
  37109. if (defaultStateValues === void 0) {
  37110. defaultStateValues = dropdownDefaultStateValues;
  37111. }
  37112. const defaultValue = props[`default${capitalizeString(propKey)}`];
  37113. if (defaultValue !== undefined) {
  37114. return defaultValue;
  37115. }
  37116. return defaultStateValues[propKey];
  37117. }
  37118. function getInitialValue$1(props, propKey, defaultStateValues) {
  37119. if (defaultStateValues === void 0) {
  37120. defaultStateValues = dropdownDefaultStateValues;
  37121. }
  37122. const value = props[propKey];
  37123. if (value !== undefined) {
  37124. return value;
  37125. }
  37126. const initialValue = props[`initial${capitalizeString(propKey)}`];
  37127. if (initialValue !== undefined) {
  37128. return initialValue;
  37129. }
  37130. return getDefaultValue$1(props, propKey, defaultStateValues);
  37131. }
  37132. function getInitialState$2(props) {
  37133. const selectedItem = getInitialValue$1(props, 'selectedItem');
  37134. const isOpen = getInitialValue$1(props, 'isOpen');
  37135. const highlightedIndex = getInitialValue$1(props, 'highlightedIndex');
  37136. const inputValue = getInitialValue$1(props, 'inputValue');
  37137. return {
  37138. highlightedIndex: highlightedIndex < 0 && selectedItem && isOpen ? props.items.indexOf(selectedItem) : highlightedIndex,
  37139. isOpen,
  37140. selectedItem,
  37141. inputValue
  37142. };
  37143. }
  37144. function getHighlightedIndexOnOpen(props, state, offset, getItemNodeFromIndex) {
  37145. const {
  37146. items,
  37147. initialHighlightedIndex,
  37148. defaultHighlightedIndex
  37149. } = props;
  37150. const {
  37151. selectedItem,
  37152. highlightedIndex
  37153. } = state;
  37154. if (items.length === 0) {
  37155. return -1;
  37156. } // initialHighlightedIndex will give value to highlightedIndex on initial state only.
  37157. if (initialHighlightedIndex !== undefined && highlightedIndex === initialHighlightedIndex) {
  37158. return initialHighlightedIndex;
  37159. }
  37160. if (defaultHighlightedIndex !== undefined) {
  37161. return defaultHighlightedIndex;
  37162. }
  37163. if (selectedItem) {
  37164. if (offset === 0) {
  37165. return items.indexOf(selectedItem);
  37166. }
  37167. return getNextWrappingIndex(offset, items.indexOf(selectedItem), items.length, getItemNodeFromIndex, false);
  37168. }
  37169. if (offset === 0) {
  37170. return -1;
  37171. }
  37172. return offset < 0 ? items.length - 1 : 0;
  37173. }
  37174. /**
  37175. * Reuse the movement tracking of mouse and touch events.
  37176. *
  37177. * @param {boolean} isOpen Whether the dropdown is open or not.
  37178. * @param {Array<Object>} downshiftElementRefs Downshift element refs to track movement (toggleButton, menu etc.)
  37179. * @param {Object} environment Environment where component/hook exists.
  37180. * @param {Function} handleBlur Handler on blur from mouse or touch.
  37181. * @returns {Object} Ref containing whether mouseDown or touchMove event is happening
  37182. */
  37183. function useMouseAndTouchTracker(isOpen, downshiftElementRefs, environment, handleBlur) {
  37184. const mouseAndTouchTrackersRef = (0,external_React_namespaceObject.useRef)({
  37185. isMouseDown: false,
  37186. isTouchMove: false
  37187. });
  37188. (0,external_React_namespaceObject.useEffect)(() => {
  37189. // The same strategy for checking if a click occurred inside or outside downsift
  37190. // as in downshift.js.
  37191. const onMouseDown = () => {
  37192. mouseAndTouchTrackersRef.current.isMouseDown = true;
  37193. };
  37194. const onMouseUp = event => {
  37195. mouseAndTouchTrackersRef.current.isMouseDown = false;
  37196. if (isOpen && !targetWithinDownshift(event.target, downshiftElementRefs.map(ref => ref.current), environment)) {
  37197. handleBlur();
  37198. }
  37199. };
  37200. const onTouchStart = () => {
  37201. mouseAndTouchTrackersRef.current.isTouchMove = false;
  37202. };
  37203. const onTouchMove = () => {
  37204. mouseAndTouchTrackersRef.current.isTouchMove = true;
  37205. };
  37206. const onTouchEnd = event => {
  37207. if (isOpen && !mouseAndTouchTrackersRef.current.isTouchMove && !targetWithinDownshift(event.target, downshiftElementRefs.map(ref => ref.current), environment, false)) {
  37208. handleBlur();
  37209. }
  37210. };
  37211. environment.addEventListener('mousedown', onMouseDown);
  37212. environment.addEventListener('mouseup', onMouseUp);
  37213. environment.addEventListener('touchstart', onTouchStart);
  37214. environment.addEventListener('touchmove', onTouchMove);
  37215. environment.addEventListener('touchend', onTouchEnd);
  37216. return function cleanup() {
  37217. environment.removeEventListener('mousedown', onMouseDown);
  37218. environment.removeEventListener('mouseup', onMouseUp);
  37219. environment.removeEventListener('touchstart', onTouchStart);
  37220. environment.removeEventListener('touchmove', onTouchMove);
  37221. environment.removeEventListener('touchend', onTouchEnd);
  37222. }; // eslint-disable-next-line react-hooks/exhaustive-deps
  37223. }, [isOpen, environment]);
  37224. return mouseAndTouchTrackersRef;
  37225. }
  37226. /* istanbul ignore next */
  37227. // eslint-disable-next-line import/no-mutable-exports
  37228. let useGetterPropsCalledChecker = () => downshift_esm_noop;
  37229. /**
  37230. * Custom hook that checks if getter props are called correctly.
  37231. *
  37232. * @param {...any} propKeys Getter prop names to be handled.
  37233. * @returns {Function} Setter function called inside getter props to set call information.
  37234. */
  37235. /* istanbul ignore next */
  37236. if (false) {}
  37237. function useA11yMessageSetter(getA11yMessage, dependencyArray, _ref2) {
  37238. let {
  37239. isInitialMount,
  37240. highlightedIndex,
  37241. items,
  37242. environment,
  37243. ...rest
  37244. } = _ref2;
  37245. // Sets a11y status message on changes in state.
  37246. (0,external_React_namespaceObject.useEffect)(() => {
  37247. if (isInitialMount || false) {
  37248. return;
  37249. }
  37250. updateA11yStatus(() => getA11yMessage({
  37251. highlightedIndex,
  37252. highlightedItem: items[highlightedIndex],
  37253. resultCount: items.length,
  37254. ...rest
  37255. }), environment.document); // eslint-disable-next-line react-hooks/exhaustive-deps
  37256. }, dependencyArray);
  37257. }
  37258. function useScrollIntoView(_ref3) {
  37259. let {
  37260. highlightedIndex,
  37261. isOpen,
  37262. itemRefs,
  37263. getItemNodeFromIndex,
  37264. menuElement,
  37265. scrollIntoView: scrollIntoViewProp
  37266. } = _ref3;
  37267. // used not to scroll on highlight by mouse.
  37268. const shouldScrollRef = (0,external_React_namespaceObject.useRef)(true); // Scroll on highlighted item if change comes from keyboard.
  37269. downshift_esm_useIsomorphicLayoutEffect(() => {
  37270. if (highlightedIndex < 0 || !isOpen || !Object.keys(itemRefs.current).length) {
  37271. return;
  37272. }
  37273. if (shouldScrollRef.current === false) {
  37274. shouldScrollRef.current = true;
  37275. } else {
  37276. scrollIntoViewProp(getItemNodeFromIndex(highlightedIndex), menuElement);
  37277. } // eslint-disable-next-line react-hooks/exhaustive-deps
  37278. }, [highlightedIndex]);
  37279. return shouldScrollRef;
  37280. } // eslint-disable-next-line import/no-mutable-exports
  37281. let useControlPropsValidator = downshift_esm_noop;
  37282. /* istanbul ignore next */
  37283. if (false) {}
  37284. /* eslint-disable complexity */
  37285. function downshiftCommonReducer(state, action, stateChangeTypes) {
  37286. const {
  37287. type,
  37288. props
  37289. } = action;
  37290. let changes;
  37291. switch (type) {
  37292. case stateChangeTypes.ItemMouseMove:
  37293. changes = {
  37294. highlightedIndex: action.disabled ? -1 : action.index
  37295. };
  37296. break;
  37297. case stateChangeTypes.MenuMouseLeave:
  37298. changes = {
  37299. highlightedIndex: -1
  37300. };
  37301. break;
  37302. case stateChangeTypes.ToggleButtonClick:
  37303. case stateChangeTypes.FunctionToggleMenu:
  37304. changes = {
  37305. isOpen: !state.isOpen,
  37306. highlightedIndex: state.isOpen ? -1 : getHighlightedIndexOnOpen(props, state, 0)
  37307. };
  37308. break;
  37309. case stateChangeTypes.FunctionOpenMenu:
  37310. changes = {
  37311. isOpen: true,
  37312. highlightedIndex: getHighlightedIndexOnOpen(props, state, 0)
  37313. };
  37314. break;
  37315. case stateChangeTypes.FunctionCloseMenu:
  37316. changes = {
  37317. isOpen: false
  37318. };
  37319. break;
  37320. case stateChangeTypes.FunctionSetHighlightedIndex:
  37321. changes = {
  37322. highlightedIndex: action.highlightedIndex
  37323. };
  37324. break;
  37325. case stateChangeTypes.FunctionSetInputValue:
  37326. changes = {
  37327. inputValue: action.inputValue
  37328. };
  37329. break;
  37330. case stateChangeTypes.FunctionReset:
  37331. changes = {
  37332. highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
  37333. isOpen: getDefaultValue$1(props, 'isOpen'),
  37334. selectedItem: getDefaultValue$1(props, 'selectedItem'),
  37335. inputValue: getDefaultValue$1(props, 'inputValue')
  37336. };
  37337. break;
  37338. default:
  37339. throw new Error('Reducer called without proper action type.');
  37340. }
  37341. return { ...state,
  37342. ...changes
  37343. };
  37344. }
  37345. /* eslint-enable complexity */
  37346. function getItemIndexByCharacterKey(_a) {
  37347. var keysSoFar = _a.keysSoFar, highlightedIndex = _a.highlightedIndex, items = _a.items, itemToString = _a.itemToString, getItemNodeFromIndex = _a.getItemNodeFromIndex;
  37348. var lowerCasedKeysSoFar = keysSoFar.toLowerCase();
  37349. for (var index = 0; index < items.length; index++) {
  37350. var offsetIndex = (index + highlightedIndex + 1) % items.length;
  37351. var item = items[offsetIndex];
  37352. if (item !== undefined &&
  37353. itemToString(item)
  37354. .toLowerCase()
  37355. .startsWith(lowerCasedKeysSoFar)) {
  37356. var element = getItemNodeFromIndex(offsetIndex);
  37357. if (!(element === null || element === void 0 ? void 0 : element.hasAttribute('disabled'))) {
  37358. return offsetIndex;
  37359. }
  37360. }
  37361. }
  37362. return highlightedIndex;
  37363. }
  37364. var propTypes$2 = {
  37365. items: (prop_types_default()).array.isRequired,
  37366. itemToString: (prop_types_default()).func,
  37367. getA11yStatusMessage: (prop_types_default()).func,
  37368. getA11ySelectionMessage: (prop_types_default()).func,
  37369. circularNavigation: (prop_types_default()).bool,
  37370. highlightedIndex: (prop_types_default()).number,
  37371. defaultHighlightedIndex: (prop_types_default()).number,
  37372. initialHighlightedIndex: (prop_types_default()).number,
  37373. isOpen: (prop_types_default()).bool,
  37374. defaultIsOpen: (prop_types_default()).bool,
  37375. initialIsOpen: (prop_types_default()).bool,
  37376. selectedItem: (prop_types_default()).any,
  37377. initialSelectedItem: (prop_types_default()).any,
  37378. defaultSelectedItem: (prop_types_default()).any,
  37379. id: (prop_types_default()).string,
  37380. labelId: (prop_types_default()).string,
  37381. menuId: (prop_types_default()).string,
  37382. getItemId: (prop_types_default()).func,
  37383. toggleButtonId: (prop_types_default()).string,
  37384. stateReducer: (prop_types_default()).func,
  37385. onSelectedItemChange: (prop_types_default()).func,
  37386. onHighlightedIndexChange: (prop_types_default()).func,
  37387. onStateChange: (prop_types_default()).func,
  37388. onIsOpenChange: (prop_types_default()).func,
  37389. environment: prop_types_default().shape({
  37390. addEventListener: (prop_types_default()).func,
  37391. removeEventListener: (prop_types_default()).func,
  37392. document: prop_types_default().shape({
  37393. getElementById: (prop_types_default()).func,
  37394. activeElement: (prop_types_default()).any,
  37395. body: (prop_types_default()).any
  37396. })
  37397. })
  37398. };
  37399. /**
  37400. * Default implementation for status message. Only added when menu is open.
  37401. * Will specift if there are results in the list, and if so, how many,
  37402. * and what keys are relevant.
  37403. *
  37404. * @param {Object} param the downshift state and other relevant properties
  37405. * @return {String} the a11y status message
  37406. */
  37407. function getA11yStatusMessage(_a) {
  37408. var isOpen = _a.isOpen, resultCount = _a.resultCount, previousResultCount = _a.previousResultCount;
  37409. if (!isOpen) {
  37410. return '';
  37411. }
  37412. if (!resultCount) {
  37413. return 'No results are available.';
  37414. }
  37415. if (resultCount !== previousResultCount) {
  37416. return "".concat(resultCount, " result").concat(resultCount === 1 ? ' is' : 's are', " available, use up and down arrow keys to navigate. Press Enter or Space Bar keys to select.");
  37417. }
  37418. return '';
  37419. }
  37420. var defaultProps$2 = __assign(__assign({}, defaultProps$3), { getA11yStatusMessage: getA11yStatusMessage });
  37421. // eslint-disable-next-line import/no-mutable-exports
  37422. var validatePropTypes$2 = downshift_esm_noop;
  37423. /* istanbul ignore next */
  37424. if (false) {}
  37425. const MenuKeyDownArrowDown = false ? 0 : 0;
  37426. const MenuKeyDownArrowUp = false ? 0 : 1;
  37427. const MenuKeyDownEscape = false ? 0 : 2;
  37428. const MenuKeyDownHome = false ? 0 : 3;
  37429. const MenuKeyDownEnd = false ? 0 : 4;
  37430. const MenuKeyDownEnter = false ? 0 : 5;
  37431. const MenuKeyDownSpaceButton = false ? 0 : 6;
  37432. const MenuKeyDownCharacter = false ? 0 : 7;
  37433. const MenuBlur = false ? 0 : 8;
  37434. const MenuMouseLeave$1 = false ? 0 : 9;
  37435. const ItemMouseMove$1 = false ? 0 : 10;
  37436. const ItemClick$1 = false ? 0 : 11;
  37437. const ToggleButtonClick$1 = false ? 0 : 12;
  37438. const ToggleButtonKeyDownArrowDown = false ? 0 : 13;
  37439. const ToggleButtonKeyDownArrowUp = false ? 0 : 14;
  37440. const ToggleButtonKeyDownCharacter = false ? 0 : 15;
  37441. const FunctionToggleMenu$1 = false ? 0 : 16;
  37442. const FunctionOpenMenu$1 = false ? 0 : 17;
  37443. const FunctionCloseMenu$1 = false ? 0 : 18;
  37444. const FunctionSetHighlightedIndex$1 = false ? 0 : 19;
  37445. const FunctionSelectItem$1 = false ? 0 : 20;
  37446. const FunctionSetInputValue$1 = false ? 0 : 21;
  37447. const FunctionReset$2 = false ? 0 : 22;
  37448. var stateChangeTypes$2 = /*#__PURE__*/Object.freeze({
  37449. __proto__: null,
  37450. MenuKeyDownArrowDown: MenuKeyDownArrowDown,
  37451. MenuKeyDownArrowUp: MenuKeyDownArrowUp,
  37452. MenuKeyDownEscape: MenuKeyDownEscape,
  37453. MenuKeyDownHome: MenuKeyDownHome,
  37454. MenuKeyDownEnd: MenuKeyDownEnd,
  37455. MenuKeyDownEnter: MenuKeyDownEnter,
  37456. MenuKeyDownSpaceButton: MenuKeyDownSpaceButton,
  37457. MenuKeyDownCharacter: MenuKeyDownCharacter,
  37458. MenuBlur: MenuBlur,
  37459. MenuMouseLeave: MenuMouseLeave$1,
  37460. ItemMouseMove: ItemMouseMove$1,
  37461. ItemClick: ItemClick$1,
  37462. ToggleButtonClick: ToggleButtonClick$1,
  37463. ToggleButtonKeyDownArrowDown: ToggleButtonKeyDownArrowDown,
  37464. ToggleButtonKeyDownArrowUp: ToggleButtonKeyDownArrowUp,
  37465. ToggleButtonKeyDownCharacter: ToggleButtonKeyDownCharacter,
  37466. FunctionToggleMenu: FunctionToggleMenu$1,
  37467. FunctionOpenMenu: FunctionOpenMenu$1,
  37468. FunctionCloseMenu: FunctionCloseMenu$1,
  37469. FunctionSetHighlightedIndex: FunctionSetHighlightedIndex$1,
  37470. FunctionSelectItem: FunctionSelectItem$1,
  37471. FunctionSetInputValue: FunctionSetInputValue$1,
  37472. FunctionReset: FunctionReset$2
  37473. });
  37474. /* eslint-disable complexity */
  37475. function downshiftSelectReducer(state, action) {
  37476. const {
  37477. type,
  37478. props,
  37479. shiftKey
  37480. } = action;
  37481. let changes;
  37482. switch (type) {
  37483. case ItemClick$1:
  37484. changes = {
  37485. isOpen: getDefaultValue$1(props, 'isOpen'),
  37486. highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
  37487. selectedItem: props.items[action.index]
  37488. };
  37489. break;
  37490. case ToggleButtonKeyDownCharacter:
  37491. {
  37492. const lowercasedKey = action.key;
  37493. const inputValue = `${state.inputValue}${lowercasedKey}`;
  37494. const itemIndex = getItemIndexByCharacterKey({
  37495. keysSoFar: inputValue,
  37496. highlightedIndex: state.selectedItem ? props.items.indexOf(state.selectedItem) : -1,
  37497. items: props.items,
  37498. itemToString: props.itemToString,
  37499. getItemNodeFromIndex: action.getItemNodeFromIndex
  37500. });
  37501. changes = {
  37502. inputValue,
  37503. ...(itemIndex >= 0 && {
  37504. selectedItem: props.items[itemIndex]
  37505. })
  37506. };
  37507. }
  37508. break;
  37509. case ToggleButtonKeyDownArrowDown:
  37510. changes = {
  37511. highlightedIndex: getHighlightedIndexOnOpen(props, state, 1, action.getItemNodeFromIndex),
  37512. isOpen: true
  37513. };
  37514. break;
  37515. case ToggleButtonKeyDownArrowUp:
  37516. changes = {
  37517. highlightedIndex: getHighlightedIndexOnOpen(props, state, -1, action.getItemNodeFromIndex),
  37518. isOpen: true
  37519. };
  37520. break;
  37521. case MenuKeyDownEnter:
  37522. case MenuKeyDownSpaceButton:
  37523. changes = {
  37524. isOpen: getDefaultValue$1(props, 'isOpen'),
  37525. highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
  37526. ...(state.highlightedIndex >= 0 && {
  37527. selectedItem: props.items[state.highlightedIndex]
  37528. })
  37529. };
  37530. break;
  37531. case MenuKeyDownHome:
  37532. changes = {
  37533. highlightedIndex: getNextNonDisabledIndex(1, 0, props.items.length, action.getItemNodeFromIndex, false)
  37534. };
  37535. break;
  37536. case MenuKeyDownEnd:
  37537. changes = {
  37538. highlightedIndex: getNextNonDisabledIndex(-1, props.items.length - 1, props.items.length, action.getItemNodeFromIndex, false)
  37539. };
  37540. break;
  37541. case MenuKeyDownEscape:
  37542. changes = {
  37543. isOpen: false,
  37544. highlightedIndex: -1
  37545. };
  37546. break;
  37547. case MenuBlur:
  37548. changes = {
  37549. isOpen: false,
  37550. highlightedIndex: -1
  37551. };
  37552. break;
  37553. case MenuKeyDownCharacter:
  37554. {
  37555. const lowercasedKey = action.key;
  37556. const inputValue = `${state.inputValue}${lowercasedKey}`;
  37557. const highlightedIndex = getItemIndexByCharacterKey({
  37558. keysSoFar: inputValue,
  37559. highlightedIndex: state.highlightedIndex,
  37560. items: props.items,
  37561. itemToString: props.itemToString,
  37562. getItemNodeFromIndex: action.getItemNodeFromIndex
  37563. });
  37564. changes = {
  37565. inputValue,
  37566. ...(highlightedIndex >= 0 && {
  37567. highlightedIndex
  37568. })
  37569. };
  37570. }
  37571. break;
  37572. case MenuKeyDownArrowDown:
  37573. changes = {
  37574. highlightedIndex: getNextWrappingIndex(shiftKey ? 5 : 1, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, props.circularNavigation)
  37575. };
  37576. break;
  37577. case MenuKeyDownArrowUp:
  37578. changes = {
  37579. highlightedIndex: getNextWrappingIndex(shiftKey ? -5 : -1, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, props.circularNavigation)
  37580. };
  37581. break;
  37582. case FunctionSelectItem$1:
  37583. changes = {
  37584. selectedItem: action.selectedItem
  37585. };
  37586. break;
  37587. default:
  37588. return downshiftCommonReducer(state, action, stateChangeTypes$2);
  37589. }
  37590. return { ...state,
  37591. ...changes
  37592. };
  37593. }
  37594. /* eslint-enable complexity */
  37595. /* eslint-disable max-statements */
  37596. useSelect.stateChangeTypes = stateChangeTypes$2;
  37597. function useSelect(userProps) {
  37598. if (userProps === void 0) {
  37599. userProps = {};
  37600. }
  37601. validatePropTypes$2(userProps, useSelect); // Props defaults and destructuring.
  37602. const props = { ...defaultProps$2,
  37603. ...userProps
  37604. };
  37605. const {
  37606. items,
  37607. scrollIntoView,
  37608. environment,
  37609. initialIsOpen,
  37610. defaultIsOpen,
  37611. itemToString,
  37612. getA11ySelectionMessage,
  37613. getA11yStatusMessage
  37614. } = props; // Initial state depending on controlled props.
  37615. const initialState = getInitialState$2(props);
  37616. const [state, dispatch] = useControlledReducer$1(downshiftSelectReducer, initialState, props);
  37617. const {
  37618. isOpen,
  37619. highlightedIndex,
  37620. selectedItem,
  37621. inputValue
  37622. } = state; // Element efs.
  37623. const toggleButtonRef = (0,external_React_namespaceObject.useRef)(null);
  37624. const menuRef = (0,external_React_namespaceObject.useRef)(null);
  37625. const itemRefs = (0,external_React_namespaceObject.useRef)({}); // used not to trigger menu blur action in some scenarios.
  37626. const shouldBlurRef = (0,external_React_namespaceObject.useRef)(true); // used to keep the inputValue clearTimeout object between renders.
  37627. const clearTimeoutRef = (0,external_React_namespaceObject.useRef)(null); // prevent id re-generation between renders.
  37628. const elementIds = useElementIds(props); // used to keep track of how many items we had on previous cycle.
  37629. const previousResultCountRef = (0,external_React_namespaceObject.useRef)();
  37630. const isInitialMountRef = (0,external_React_namespaceObject.useRef)(true); // utility callback to get item element.
  37631. const latest = downshift_esm_useLatestRef({
  37632. state,
  37633. props
  37634. }); // Some utils.
  37635. const getItemNodeFromIndex = (0,external_React_namespaceObject.useCallback)(index => itemRefs.current[elementIds.getItemId(index)], [elementIds]); // Effects.
  37636. // Sets a11y status message on changes in state.
  37637. useA11yMessageSetter(getA11yStatusMessage, [isOpen, highlightedIndex, inputValue, items], {
  37638. isInitialMount: isInitialMountRef.current,
  37639. previousResultCount: previousResultCountRef.current,
  37640. items,
  37641. environment,
  37642. itemToString,
  37643. ...state
  37644. }); // Sets a11y status message on changes in selectedItem.
  37645. useA11yMessageSetter(getA11ySelectionMessage, [selectedItem], {
  37646. isInitialMount: isInitialMountRef.current,
  37647. previousResultCount: previousResultCountRef.current,
  37648. items,
  37649. environment,
  37650. itemToString,
  37651. ...state
  37652. }); // Scroll on highlighted item if change comes from keyboard.
  37653. const shouldScrollRef = useScrollIntoView({
  37654. menuElement: menuRef.current,
  37655. highlightedIndex,
  37656. isOpen,
  37657. itemRefs,
  37658. scrollIntoView,
  37659. getItemNodeFromIndex
  37660. }); // Sets cleanup for the keysSoFar callback, debounded after 500ms.
  37661. (0,external_React_namespaceObject.useEffect)(() => {
  37662. // init the clean function here as we need access to dispatch.
  37663. clearTimeoutRef.current = downshift_esm_debounce(outerDispatch => {
  37664. outerDispatch({
  37665. type: FunctionSetInputValue$1,
  37666. inputValue: ''
  37667. });
  37668. }, 500); // Cancel any pending debounced calls on mount
  37669. return () => {
  37670. clearTimeoutRef.current.cancel();
  37671. };
  37672. }, []); // Invokes the keysSoFar callback set up above.
  37673. (0,external_React_namespaceObject.useEffect)(() => {
  37674. if (!inputValue) {
  37675. return;
  37676. }
  37677. clearTimeoutRef.current(dispatch);
  37678. }, [dispatch, inputValue]);
  37679. useControlPropsValidator({
  37680. isInitialMount: isInitialMountRef.current,
  37681. props,
  37682. state
  37683. });
  37684. /* Controls the focus on the menu or the toggle button. */
  37685. (0,external_React_namespaceObject.useEffect)(() => {
  37686. // Don't focus menu on first render.
  37687. if (isInitialMountRef.current) {
  37688. // Unless it was initialised as open.
  37689. if ((initialIsOpen || defaultIsOpen || isOpen) && menuRef.current) {
  37690. menuRef.current.focus();
  37691. }
  37692. return;
  37693. } // Focus menu on open.
  37694. if (isOpen) {
  37695. // istanbul ignore else
  37696. if (menuRef.current) {
  37697. menuRef.current.focus();
  37698. }
  37699. return;
  37700. } // Focus toggleButton on close, but not if it was closed with (Shift+)Tab.
  37701. if (environment.document.activeElement === menuRef.current) {
  37702. // istanbul ignore else
  37703. if (toggleButtonRef.current) {
  37704. shouldBlurRef.current = false;
  37705. toggleButtonRef.current.focus();
  37706. }
  37707. } // eslint-disable-next-line react-hooks/exhaustive-deps
  37708. }, [isOpen]);
  37709. (0,external_React_namespaceObject.useEffect)(() => {
  37710. if (isInitialMountRef.current) {
  37711. return;
  37712. }
  37713. previousResultCountRef.current = items.length;
  37714. }); // Add mouse/touch events to document.
  37715. const mouseAndTouchTrackersRef = useMouseAndTouchTracker(isOpen, [menuRef, toggleButtonRef], environment, () => {
  37716. dispatch({
  37717. type: MenuBlur
  37718. });
  37719. });
  37720. const setGetterPropCallInfo = useGetterPropsCalledChecker('getMenuProps', 'getToggleButtonProps'); // Make initial ref false.
  37721. (0,external_React_namespaceObject.useEffect)(() => {
  37722. isInitialMountRef.current = false;
  37723. }, []); // Reset itemRefs on close.
  37724. (0,external_React_namespaceObject.useEffect)(() => {
  37725. if (!isOpen) {
  37726. itemRefs.current = {};
  37727. }
  37728. }, [isOpen]); // Event handler functions.
  37729. const toggleButtonKeyDownHandlers = (0,external_React_namespaceObject.useMemo)(() => ({
  37730. ArrowDown(event) {
  37731. event.preventDefault();
  37732. dispatch({
  37733. type: ToggleButtonKeyDownArrowDown,
  37734. getItemNodeFromIndex,
  37735. shiftKey: event.shiftKey
  37736. });
  37737. },
  37738. ArrowUp(event) {
  37739. event.preventDefault();
  37740. dispatch({
  37741. type: ToggleButtonKeyDownArrowUp,
  37742. getItemNodeFromIndex,
  37743. shiftKey: event.shiftKey
  37744. });
  37745. }
  37746. }), [dispatch, getItemNodeFromIndex]);
  37747. const menuKeyDownHandlers = (0,external_React_namespaceObject.useMemo)(() => ({
  37748. ArrowDown(event) {
  37749. event.preventDefault();
  37750. dispatch({
  37751. type: MenuKeyDownArrowDown,
  37752. getItemNodeFromIndex,
  37753. shiftKey: event.shiftKey
  37754. });
  37755. },
  37756. ArrowUp(event) {
  37757. event.preventDefault();
  37758. dispatch({
  37759. type: MenuKeyDownArrowUp,
  37760. getItemNodeFromIndex,
  37761. shiftKey: event.shiftKey
  37762. });
  37763. },
  37764. Home(event) {
  37765. event.preventDefault();
  37766. dispatch({
  37767. type: MenuKeyDownHome,
  37768. getItemNodeFromIndex
  37769. });
  37770. },
  37771. End(event) {
  37772. event.preventDefault();
  37773. dispatch({
  37774. type: MenuKeyDownEnd,
  37775. getItemNodeFromIndex
  37776. });
  37777. },
  37778. Escape() {
  37779. dispatch({
  37780. type: MenuKeyDownEscape
  37781. });
  37782. },
  37783. Enter(event) {
  37784. event.preventDefault();
  37785. dispatch({
  37786. type: MenuKeyDownEnter
  37787. });
  37788. },
  37789. ' '(event) {
  37790. event.preventDefault();
  37791. dispatch({
  37792. type: MenuKeyDownSpaceButton
  37793. });
  37794. }
  37795. }), [dispatch, getItemNodeFromIndex]); // Action functions.
  37796. const toggleMenu = (0,external_React_namespaceObject.useCallback)(() => {
  37797. dispatch({
  37798. type: FunctionToggleMenu$1
  37799. });
  37800. }, [dispatch]);
  37801. const closeMenu = (0,external_React_namespaceObject.useCallback)(() => {
  37802. dispatch({
  37803. type: FunctionCloseMenu$1
  37804. });
  37805. }, [dispatch]);
  37806. const openMenu = (0,external_React_namespaceObject.useCallback)(() => {
  37807. dispatch({
  37808. type: FunctionOpenMenu$1
  37809. });
  37810. }, [dispatch]);
  37811. const setHighlightedIndex = (0,external_React_namespaceObject.useCallback)(newHighlightedIndex => {
  37812. dispatch({
  37813. type: FunctionSetHighlightedIndex$1,
  37814. highlightedIndex: newHighlightedIndex
  37815. });
  37816. }, [dispatch]);
  37817. const selectItem = (0,external_React_namespaceObject.useCallback)(newSelectedItem => {
  37818. dispatch({
  37819. type: FunctionSelectItem$1,
  37820. selectedItem: newSelectedItem
  37821. });
  37822. }, [dispatch]);
  37823. const reset = (0,external_React_namespaceObject.useCallback)(() => {
  37824. dispatch({
  37825. type: FunctionReset$2
  37826. });
  37827. }, [dispatch]);
  37828. const setInputValue = (0,external_React_namespaceObject.useCallback)(newInputValue => {
  37829. dispatch({
  37830. type: FunctionSetInputValue$1,
  37831. inputValue: newInputValue
  37832. });
  37833. }, [dispatch]); // Getter functions.
  37834. const getLabelProps = (0,external_React_namespaceObject.useCallback)(labelProps => ({
  37835. id: elementIds.labelId,
  37836. htmlFor: elementIds.toggleButtonId,
  37837. ...labelProps
  37838. }), [elementIds]);
  37839. const getMenuProps = (0,external_React_namespaceObject.useCallback)(function (_temp, _temp2) {
  37840. let {
  37841. onMouseLeave,
  37842. refKey = 'ref',
  37843. onKeyDown,
  37844. onBlur,
  37845. ref,
  37846. ...rest
  37847. } = _temp === void 0 ? {} : _temp;
  37848. let {
  37849. suppressRefError = false
  37850. } = _temp2 === void 0 ? {} : _temp2;
  37851. const latestState = latest.current.state;
  37852. const menuHandleKeyDown = event => {
  37853. const key = normalizeArrowKey(event);
  37854. if (key && menuKeyDownHandlers[key]) {
  37855. menuKeyDownHandlers[key](event);
  37856. } else if (isAcceptedCharacterKey(key)) {
  37857. dispatch({
  37858. type: MenuKeyDownCharacter,
  37859. key,
  37860. getItemNodeFromIndex
  37861. });
  37862. }
  37863. };
  37864. const menuHandleBlur = () => {
  37865. // if the blur was a result of selection, we don't trigger this action.
  37866. if (shouldBlurRef.current === false) {
  37867. shouldBlurRef.current = true;
  37868. return;
  37869. }
  37870. const shouldBlur = !mouseAndTouchTrackersRef.current.isMouseDown;
  37871. /* istanbul ignore else */
  37872. if (shouldBlur) {
  37873. dispatch({
  37874. type: MenuBlur
  37875. });
  37876. }
  37877. };
  37878. const menuHandleMouseLeave = () => {
  37879. dispatch({
  37880. type: MenuMouseLeave$1
  37881. });
  37882. };
  37883. setGetterPropCallInfo('getMenuProps', suppressRefError, refKey, menuRef);
  37884. return {
  37885. [refKey]: handleRefs(ref, menuNode => {
  37886. menuRef.current = menuNode;
  37887. }),
  37888. id: elementIds.menuId,
  37889. role: 'listbox',
  37890. 'aria-labelledby': elementIds.labelId,
  37891. tabIndex: -1,
  37892. ...(latestState.isOpen && latestState.highlightedIndex > -1 && {
  37893. 'aria-activedescendant': elementIds.getItemId(latestState.highlightedIndex)
  37894. }),
  37895. onMouseLeave: callAllEventHandlers(onMouseLeave, menuHandleMouseLeave),
  37896. onKeyDown: callAllEventHandlers(onKeyDown, menuHandleKeyDown),
  37897. onBlur: callAllEventHandlers(onBlur, menuHandleBlur),
  37898. ...rest
  37899. };
  37900. }, [dispatch, latest, menuKeyDownHandlers, mouseAndTouchTrackersRef, setGetterPropCallInfo, elementIds, getItemNodeFromIndex]);
  37901. const getToggleButtonProps = (0,external_React_namespaceObject.useCallback)(function (_temp3, _temp4) {
  37902. let {
  37903. onClick,
  37904. onKeyDown,
  37905. refKey = 'ref',
  37906. ref,
  37907. ...rest
  37908. } = _temp3 === void 0 ? {} : _temp3;
  37909. let {
  37910. suppressRefError = false
  37911. } = _temp4 === void 0 ? {} : _temp4;
  37912. const toggleButtonHandleClick = () => {
  37913. dispatch({
  37914. type: ToggleButtonClick$1
  37915. });
  37916. };
  37917. const toggleButtonHandleKeyDown = event => {
  37918. const key = normalizeArrowKey(event);
  37919. if (key && toggleButtonKeyDownHandlers[key]) {
  37920. toggleButtonKeyDownHandlers[key](event);
  37921. } else if (isAcceptedCharacterKey(key)) {
  37922. dispatch({
  37923. type: ToggleButtonKeyDownCharacter,
  37924. key,
  37925. getItemNodeFromIndex
  37926. });
  37927. }
  37928. };
  37929. const toggleProps = {
  37930. [refKey]: handleRefs(ref, toggleButtonNode => {
  37931. toggleButtonRef.current = toggleButtonNode;
  37932. }),
  37933. id: elementIds.toggleButtonId,
  37934. 'aria-haspopup': 'listbox',
  37935. 'aria-expanded': latest.current.state.isOpen,
  37936. 'aria-labelledby': `${elementIds.labelId} ${elementIds.toggleButtonId}`,
  37937. ...rest
  37938. };
  37939. if (!rest.disabled) {
  37940. toggleProps.onClick = callAllEventHandlers(onClick, toggleButtonHandleClick);
  37941. toggleProps.onKeyDown = callAllEventHandlers(onKeyDown, toggleButtonHandleKeyDown);
  37942. }
  37943. setGetterPropCallInfo('getToggleButtonProps', suppressRefError, refKey, toggleButtonRef);
  37944. return toggleProps;
  37945. }, [dispatch, latest, toggleButtonKeyDownHandlers, setGetterPropCallInfo, elementIds, getItemNodeFromIndex]);
  37946. const getItemProps = (0,external_React_namespaceObject.useCallback)(function (_temp5) {
  37947. let {
  37948. item,
  37949. index,
  37950. onMouseMove,
  37951. onClick,
  37952. refKey = 'ref',
  37953. ref,
  37954. disabled,
  37955. ...rest
  37956. } = _temp5 === void 0 ? {} : _temp5;
  37957. const {
  37958. state: latestState,
  37959. props: latestProps
  37960. } = latest.current;
  37961. const itemHandleMouseMove = () => {
  37962. if (index === latestState.highlightedIndex) {
  37963. return;
  37964. }
  37965. shouldScrollRef.current = false;
  37966. dispatch({
  37967. type: ItemMouseMove$1,
  37968. index,
  37969. disabled
  37970. });
  37971. };
  37972. const itemHandleClick = () => {
  37973. dispatch({
  37974. type: ItemClick$1,
  37975. index
  37976. });
  37977. };
  37978. const itemIndex = getItemIndex(index, item, latestProps.items);
  37979. if (itemIndex < 0) {
  37980. throw new Error('Pass either item or item index in getItemProps!');
  37981. }
  37982. const itemProps = {
  37983. disabled,
  37984. role: 'option',
  37985. 'aria-selected': `${itemIndex === latestState.highlightedIndex}`,
  37986. id: elementIds.getItemId(itemIndex),
  37987. [refKey]: handleRefs(ref, itemNode => {
  37988. if (itemNode) {
  37989. itemRefs.current[elementIds.getItemId(itemIndex)] = itemNode;
  37990. }
  37991. }),
  37992. ...rest
  37993. };
  37994. if (!disabled) {
  37995. itemProps.onClick = callAllEventHandlers(onClick, itemHandleClick);
  37996. }
  37997. itemProps.onMouseMove = callAllEventHandlers(onMouseMove, itemHandleMouseMove);
  37998. return itemProps;
  37999. }, [dispatch, latest, shouldScrollRef, elementIds]);
  38000. return {
  38001. // prop getters.
  38002. getToggleButtonProps,
  38003. getLabelProps,
  38004. getMenuProps,
  38005. getItemProps,
  38006. // actions.
  38007. toggleMenu,
  38008. openMenu,
  38009. closeMenu,
  38010. setHighlightedIndex,
  38011. selectItem,
  38012. reset,
  38013. setInputValue,
  38014. // state.
  38015. highlightedIndex,
  38016. isOpen,
  38017. selectedItem,
  38018. inputValue
  38019. };
  38020. }
  38021. const InputKeyDownArrowDown = false ? 0 : 0;
  38022. const InputKeyDownArrowUp = false ? 0 : 1;
  38023. const InputKeyDownEscape = false ? 0 : 2;
  38024. const InputKeyDownHome = false ? 0 : 3;
  38025. const InputKeyDownEnd = false ? 0 : 4;
  38026. const InputKeyDownEnter = false ? 0 : 5;
  38027. const InputChange = false ? 0 : 6;
  38028. const InputBlur = false ? 0 : 7;
  38029. const MenuMouseLeave = false ? 0 : 8;
  38030. const ItemMouseMove = false ? 0 : 9;
  38031. const ItemClick = false ? 0 : 10;
  38032. const ToggleButtonClick = false ? 0 : 11;
  38033. const FunctionToggleMenu = false ? 0 : 12;
  38034. const FunctionOpenMenu = false ? 0 : 13;
  38035. const FunctionCloseMenu = false ? 0 : 14;
  38036. const FunctionSetHighlightedIndex = false ? 0 : 15;
  38037. const FunctionSelectItem = false ? 0 : 16;
  38038. const FunctionSetInputValue = false ? 0 : 17;
  38039. const FunctionReset$1 = false ? 0 : 18;
  38040. const ControlledPropUpdatedSelectedItem = false ? 0 : 19;
  38041. var stateChangeTypes$1 = /*#__PURE__*/Object.freeze({
  38042. __proto__: null,
  38043. InputKeyDownArrowDown: InputKeyDownArrowDown,
  38044. InputKeyDownArrowUp: InputKeyDownArrowUp,
  38045. InputKeyDownEscape: InputKeyDownEscape,
  38046. InputKeyDownHome: InputKeyDownHome,
  38047. InputKeyDownEnd: InputKeyDownEnd,
  38048. InputKeyDownEnter: InputKeyDownEnter,
  38049. InputChange: InputChange,
  38050. InputBlur: InputBlur,
  38051. MenuMouseLeave: MenuMouseLeave,
  38052. ItemMouseMove: ItemMouseMove,
  38053. ItemClick: ItemClick,
  38054. ToggleButtonClick: ToggleButtonClick,
  38055. FunctionToggleMenu: FunctionToggleMenu,
  38056. FunctionOpenMenu: FunctionOpenMenu,
  38057. FunctionCloseMenu: FunctionCloseMenu,
  38058. FunctionSetHighlightedIndex: FunctionSetHighlightedIndex,
  38059. FunctionSelectItem: FunctionSelectItem,
  38060. FunctionSetInputValue: FunctionSetInputValue,
  38061. FunctionReset: FunctionReset$1,
  38062. ControlledPropUpdatedSelectedItem: ControlledPropUpdatedSelectedItem
  38063. });
  38064. function getInitialState$1(props) {
  38065. const initialState = getInitialState$2(props);
  38066. const {
  38067. selectedItem
  38068. } = initialState;
  38069. let {
  38070. inputValue
  38071. } = initialState;
  38072. if (inputValue === '' && selectedItem && props.defaultInputValue === undefined && props.initialInputValue === undefined && props.inputValue === undefined) {
  38073. inputValue = props.itemToString(selectedItem);
  38074. }
  38075. return { ...initialState,
  38076. inputValue
  38077. };
  38078. }
  38079. const propTypes$1 = {
  38080. items: (prop_types_default()).array.isRequired,
  38081. itemToString: (prop_types_default()).func,
  38082. getA11yStatusMessage: (prop_types_default()).func,
  38083. getA11ySelectionMessage: (prop_types_default()).func,
  38084. circularNavigation: (prop_types_default()).bool,
  38085. highlightedIndex: (prop_types_default()).number,
  38086. defaultHighlightedIndex: (prop_types_default()).number,
  38087. initialHighlightedIndex: (prop_types_default()).number,
  38088. isOpen: (prop_types_default()).bool,
  38089. defaultIsOpen: (prop_types_default()).bool,
  38090. initialIsOpen: (prop_types_default()).bool,
  38091. selectedItem: (prop_types_default()).any,
  38092. initialSelectedItem: (prop_types_default()).any,
  38093. defaultSelectedItem: (prop_types_default()).any,
  38094. inputValue: (prop_types_default()).string,
  38095. defaultInputValue: (prop_types_default()).string,
  38096. initialInputValue: (prop_types_default()).string,
  38097. id: (prop_types_default()).string,
  38098. labelId: (prop_types_default()).string,
  38099. menuId: (prop_types_default()).string,
  38100. getItemId: (prop_types_default()).func,
  38101. inputId: (prop_types_default()).string,
  38102. toggleButtonId: (prop_types_default()).string,
  38103. stateReducer: (prop_types_default()).func,
  38104. onSelectedItemChange: (prop_types_default()).func,
  38105. onHighlightedIndexChange: (prop_types_default()).func,
  38106. onStateChange: (prop_types_default()).func,
  38107. onIsOpenChange: (prop_types_default()).func,
  38108. onInputValueChange: (prop_types_default()).func,
  38109. environment: prop_types_default().shape({
  38110. addEventListener: (prop_types_default()).func,
  38111. removeEventListener: (prop_types_default()).func,
  38112. document: prop_types_default().shape({
  38113. getElementById: (prop_types_default()).func,
  38114. activeElement: (prop_types_default()).any,
  38115. body: (prop_types_default()).any
  38116. })
  38117. })
  38118. };
  38119. /**
  38120. * The useCombobox version of useControlledReducer, which also
  38121. * checks if the controlled prop selectedItem changed between
  38122. * renders. If so, it will also update inputValue with its
  38123. * string equivalent. It uses the common useEnhancedReducer to
  38124. * compute the rest of the state.
  38125. *
  38126. * @param {Function} reducer Reducer function from downshift.
  38127. * @param {Object} initialState Initial state of the hook.
  38128. * @param {Object} props The hook props.
  38129. * @returns {Array} An array with the state and an action dispatcher.
  38130. */
  38131. function useControlledReducer(reducer, initialState, props) {
  38132. const previousSelectedItemRef = (0,external_React_namespaceObject.useRef)();
  38133. const [state, dispatch] = useEnhancedReducer(reducer, initialState, props); // ToDo: if needed, make same approach as selectedItemChanged from Downshift.
  38134. (0,external_React_namespaceObject.useEffect)(() => {
  38135. if (isControlledProp(props, 'selectedItem')) {
  38136. if (previousSelectedItemRef.current !== props.selectedItem) {
  38137. dispatch({
  38138. type: ControlledPropUpdatedSelectedItem,
  38139. inputValue: props.itemToString(props.selectedItem)
  38140. });
  38141. }
  38142. previousSelectedItemRef.current = state.selectedItem === previousSelectedItemRef.current ? props.selectedItem : state.selectedItem;
  38143. }
  38144. });
  38145. return [getState(state, props), dispatch];
  38146. } // eslint-disable-next-line import/no-mutable-exports
  38147. let validatePropTypes$1 = downshift_esm_noop;
  38148. /* istanbul ignore next */
  38149. if (false) {}
  38150. const defaultProps$1 = { ...defaultProps$3,
  38151. getA11yStatusMessage: getA11yStatusMessage$1,
  38152. circularNavigation: true
  38153. };
  38154. /* eslint-disable complexity */
  38155. function downshiftUseComboboxReducer(state, action) {
  38156. const {
  38157. type,
  38158. props,
  38159. shiftKey
  38160. } = action;
  38161. let changes;
  38162. switch (type) {
  38163. case ItemClick:
  38164. changes = {
  38165. isOpen: getDefaultValue$1(props, 'isOpen'),
  38166. highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
  38167. selectedItem: props.items[action.index],
  38168. inputValue: props.itemToString(props.items[action.index])
  38169. };
  38170. break;
  38171. case InputKeyDownArrowDown:
  38172. if (state.isOpen) {
  38173. changes = {
  38174. highlightedIndex: getNextWrappingIndex(shiftKey ? 5 : 1, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, props.circularNavigation)
  38175. };
  38176. } else {
  38177. changes = {
  38178. highlightedIndex: getHighlightedIndexOnOpen(props, state, 1, action.getItemNodeFromIndex),
  38179. isOpen: props.items.length >= 0
  38180. };
  38181. }
  38182. break;
  38183. case InputKeyDownArrowUp:
  38184. if (state.isOpen) {
  38185. changes = {
  38186. highlightedIndex: getNextWrappingIndex(shiftKey ? -5 : -1, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, props.circularNavigation)
  38187. };
  38188. } else {
  38189. changes = {
  38190. highlightedIndex: getHighlightedIndexOnOpen(props, state, -1, action.getItemNodeFromIndex),
  38191. isOpen: props.items.length >= 0
  38192. };
  38193. }
  38194. break;
  38195. case InputKeyDownEnter:
  38196. changes = { ...(state.isOpen && state.highlightedIndex >= 0 && {
  38197. selectedItem: props.items[state.highlightedIndex],
  38198. isOpen: getDefaultValue$1(props, 'isOpen'),
  38199. highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
  38200. inputValue: props.itemToString(props.items[state.highlightedIndex])
  38201. })
  38202. };
  38203. break;
  38204. case InputKeyDownEscape:
  38205. changes = {
  38206. isOpen: false,
  38207. highlightedIndex: -1,
  38208. ...(!state.isOpen && {
  38209. selectedItem: null,
  38210. inputValue: ''
  38211. })
  38212. };
  38213. break;
  38214. case InputKeyDownHome:
  38215. changes = {
  38216. highlightedIndex: getNextNonDisabledIndex(1, 0, props.items.length, action.getItemNodeFromIndex, false)
  38217. };
  38218. break;
  38219. case InputKeyDownEnd:
  38220. changes = {
  38221. highlightedIndex: getNextNonDisabledIndex(-1, props.items.length - 1, props.items.length, action.getItemNodeFromIndex, false)
  38222. };
  38223. break;
  38224. case InputBlur:
  38225. changes = {
  38226. isOpen: false,
  38227. highlightedIndex: -1,
  38228. ...(state.highlightedIndex >= 0 && action.selectItem && {
  38229. selectedItem: props.items[state.highlightedIndex],
  38230. inputValue: props.itemToString(props.items[state.highlightedIndex])
  38231. })
  38232. };
  38233. break;
  38234. case InputChange:
  38235. changes = {
  38236. isOpen: true,
  38237. highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
  38238. inputValue: action.inputValue
  38239. };
  38240. break;
  38241. case FunctionSelectItem:
  38242. changes = {
  38243. selectedItem: action.selectedItem,
  38244. inputValue: props.itemToString(action.selectedItem)
  38245. };
  38246. break;
  38247. case ControlledPropUpdatedSelectedItem:
  38248. changes = {
  38249. inputValue: action.inputValue
  38250. };
  38251. break;
  38252. default:
  38253. return downshiftCommonReducer(state, action, stateChangeTypes$1);
  38254. }
  38255. return { ...state,
  38256. ...changes
  38257. };
  38258. }
  38259. /* eslint-enable complexity */
  38260. /* eslint-disable max-statements */
  38261. useCombobox.stateChangeTypes = stateChangeTypes$1;
  38262. function useCombobox(userProps) {
  38263. if (userProps === void 0) {
  38264. userProps = {};
  38265. }
  38266. validatePropTypes$1(userProps, useCombobox); // Props defaults and destructuring.
  38267. const props = { ...defaultProps$1,
  38268. ...userProps
  38269. };
  38270. const {
  38271. initialIsOpen,
  38272. defaultIsOpen,
  38273. items,
  38274. scrollIntoView,
  38275. environment,
  38276. getA11yStatusMessage,
  38277. getA11ySelectionMessage,
  38278. itemToString
  38279. } = props; // Initial state depending on controlled props.
  38280. const initialState = getInitialState$1(props);
  38281. const [state, dispatch] = useControlledReducer(downshiftUseComboboxReducer, initialState, props);
  38282. const {
  38283. isOpen,
  38284. highlightedIndex,
  38285. selectedItem,
  38286. inputValue
  38287. } = state; // Element refs.
  38288. const menuRef = (0,external_React_namespaceObject.useRef)(null);
  38289. const itemRefs = (0,external_React_namespaceObject.useRef)({});
  38290. const inputRef = (0,external_React_namespaceObject.useRef)(null);
  38291. const toggleButtonRef = (0,external_React_namespaceObject.useRef)(null);
  38292. const comboboxRef = (0,external_React_namespaceObject.useRef)(null);
  38293. const isInitialMountRef = (0,external_React_namespaceObject.useRef)(true); // prevent id re-generation between renders.
  38294. const elementIds = useElementIds(props); // used to keep track of how many items we had on previous cycle.
  38295. const previousResultCountRef = (0,external_React_namespaceObject.useRef)(); // utility callback to get item element.
  38296. const latest = downshift_esm_useLatestRef({
  38297. state,
  38298. props
  38299. });
  38300. const getItemNodeFromIndex = (0,external_React_namespaceObject.useCallback)(index => itemRefs.current[elementIds.getItemId(index)], [elementIds]); // Effects.
  38301. // Sets a11y status message on changes in state.
  38302. useA11yMessageSetter(getA11yStatusMessage, [isOpen, highlightedIndex, inputValue, items], {
  38303. isInitialMount: isInitialMountRef.current,
  38304. previousResultCount: previousResultCountRef.current,
  38305. items,
  38306. environment,
  38307. itemToString,
  38308. ...state
  38309. }); // Sets a11y status message on changes in selectedItem.
  38310. useA11yMessageSetter(getA11ySelectionMessage, [selectedItem], {
  38311. isInitialMount: isInitialMountRef.current,
  38312. previousResultCount: previousResultCountRef.current,
  38313. items,
  38314. environment,
  38315. itemToString,
  38316. ...state
  38317. }); // Scroll on highlighted item if change comes from keyboard.
  38318. const shouldScrollRef = useScrollIntoView({
  38319. menuElement: menuRef.current,
  38320. highlightedIndex,
  38321. isOpen,
  38322. itemRefs,
  38323. scrollIntoView,
  38324. getItemNodeFromIndex
  38325. });
  38326. useControlPropsValidator({
  38327. isInitialMount: isInitialMountRef.current,
  38328. props,
  38329. state
  38330. }); // Focus the input on first render if required.
  38331. (0,external_React_namespaceObject.useEffect)(() => {
  38332. const focusOnOpen = initialIsOpen || defaultIsOpen || isOpen;
  38333. if (focusOnOpen && inputRef.current) {
  38334. inputRef.current.focus();
  38335. } // eslint-disable-next-line react-hooks/exhaustive-deps
  38336. }, []);
  38337. (0,external_React_namespaceObject.useEffect)(() => {
  38338. if (isInitialMountRef.current) {
  38339. return;
  38340. }
  38341. previousResultCountRef.current = items.length;
  38342. }); // Add mouse/touch events to document.
  38343. const mouseAndTouchTrackersRef = useMouseAndTouchTracker(isOpen, [comboboxRef, menuRef, toggleButtonRef], environment, () => {
  38344. dispatch({
  38345. type: InputBlur,
  38346. selectItem: false
  38347. });
  38348. });
  38349. const setGetterPropCallInfo = useGetterPropsCalledChecker('getInputProps', 'getComboboxProps', 'getMenuProps'); // Make initial ref false.
  38350. (0,external_React_namespaceObject.useEffect)(() => {
  38351. isInitialMountRef.current = false;
  38352. }, []); // Reset itemRefs on close.
  38353. (0,external_React_namespaceObject.useEffect)(() => {
  38354. if (!isOpen) {
  38355. itemRefs.current = {};
  38356. }
  38357. }, [isOpen]);
  38358. /* Event handler functions */
  38359. const inputKeyDownHandlers = (0,external_React_namespaceObject.useMemo)(() => ({
  38360. ArrowDown(event) {
  38361. event.preventDefault();
  38362. dispatch({
  38363. type: InputKeyDownArrowDown,
  38364. shiftKey: event.shiftKey,
  38365. getItemNodeFromIndex
  38366. });
  38367. },
  38368. ArrowUp(event) {
  38369. event.preventDefault();
  38370. dispatch({
  38371. type: InputKeyDownArrowUp,
  38372. shiftKey: event.shiftKey,
  38373. getItemNodeFromIndex
  38374. });
  38375. },
  38376. Home(event) {
  38377. if (!latest.current.state.isOpen) {
  38378. return;
  38379. }
  38380. event.preventDefault();
  38381. dispatch({
  38382. type: InputKeyDownHome,
  38383. getItemNodeFromIndex
  38384. });
  38385. },
  38386. End(event) {
  38387. if (!latest.current.state.isOpen) {
  38388. return;
  38389. }
  38390. event.preventDefault();
  38391. dispatch({
  38392. type: InputKeyDownEnd,
  38393. getItemNodeFromIndex
  38394. });
  38395. },
  38396. Escape(event) {
  38397. const latestState = latest.current.state;
  38398. if (latestState.isOpen || latestState.inputValue || latestState.selectedItem || latestState.highlightedIndex > -1) {
  38399. event.preventDefault();
  38400. dispatch({
  38401. type: InputKeyDownEscape
  38402. });
  38403. }
  38404. },
  38405. Enter(event) {
  38406. const latestState = latest.current.state; // if closed or no highlighted index, do nothing.
  38407. if (!latestState.isOpen || latestState.highlightedIndex < 0 || event.which === 229 // if IME composing, wait for next Enter keydown event.
  38408. ) {
  38409. return;
  38410. }
  38411. event.preventDefault();
  38412. dispatch({
  38413. type: InputKeyDownEnter,
  38414. getItemNodeFromIndex
  38415. });
  38416. }
  38417. }), [dispatch, latest, getItemNodeFromIndex]); // Getter props.
  38418. const getLabelProps = (0,external_React_namespaceObject.useCallback)(labelProps => ({
  38419. id: elementIds.labelId,
  38420. htmlFor: elementIds.inputId,
  38421. ...labelProps
  38422. }), [elementIds]);
  38423. const getMenuProps = (0,external_React_namespaceObject.useCallback)(function (_temp, _temp2) {
  38424. let {
  38425. onMouseLeave,
  38426. refKey = 'ref',
  38427. ref,
  38428. ...rest
  38429. } = _temp === void 0 ? {} : _temp;
  38430. let {
  38431. suppressRefError = false
  38432. } = _temp2 === void 0 ? {} : _temp2;
  38433. setGetterPropCallInfo('getMenuProps', suppressRefError, refKey, menuRef);
  38434. return {
  38435. [refKey]: handleRefs(ref, menuNode => {
  38436. menuRef.current = menuNode;
  38437. }),
  38438. id: elementIds.menuId,
  38439. role: 'listbox',
  38440. 'aria-labelledby': elementIds.labelId,
  38441. onMouseLeave: callAllEventHandlers(onMouseLeave, () => {
  38442. dispatch({
  38443. type: MenuMouseLeave
  38444. });
  38445. }),
  38446. ...rest
  38447. };
  38448. }, [dispatch, setGetterPropCallInfo, elementIds]);
  38449. const getItemProps = (0,external_React_namespaceObject.useCallback)(function (_temp3) {
  38450. let {
  38451. item,
  38452. index,
  38453. refKey = 'ref',
  38454. ref,
  38455. onMouseMove,
  38456. onMouseDown,
  38457. onClick,
  38458. onPress,
  38459. disabled,
  38460. ...rest
  38461. } = _temp3 === void 0 ? {} : _temp3;
  38462. const {
  38463. props: latestProps,
  38464. state: latestState
  38465. } = latest.current;
  38466. const itemIndex = getItemIndex(index, item, latestProps.items);
  38467. if (itemIndex < 0) {
  38468. throw new Error('Pass either item or item index in getItemProps!');
  38469. }
  38470. const onSelectKey = 'onClick';
  38471. const customClickHandler = onClick;
  38472. const itemHandleMouseMove = () => {
  38473. if (index === latestState.highlightedIndex) {
  38474. return;
  38475. }
  38476. shouldScrollRef.current = false;
  38477. dispatch({
  38478. type: ItemMouseMove,
  38479. index,
  38480. disabled
  38481. });
  38482. };
  38483. const itemHandleClick = () => {
  38484. dispatch({
  38485. type: ItemClick,
  38486. index
  38487. });
  38488. };
  38489. const itemHandleMouseDown = e => e.preventDefault();
  38490. return {
  38491. [refKey]: handleRefs(ref, itemNode => {
  38492. if (itemNode) {
  38493. itemRefs.current[elementIds.getItemId(itemIndex)] = itemNode;
  38494. }
  38495. }),
  38496. disabled,
  38497. role: 'option',
  38498. 'aria-selected': `${itemIndex === latestState.highlightedIndex}`,
  38499. id: elementIds.getItemId(itemIndex),
  38500. ...(!disabled && {
  38501. [onSelectKey]: callAllEventHandlers(customClickHandler, itemHandleClick)
  38502. }),
  38503. onMouseMove: callAllEventHandlers(onMouseMove, itemHandleMouseMove),
  38504. onMouseDown: callAllEventHandlers(onMouseDown, itemHandleMouseDown),
  38505. ...rest
  38506. };
  38507. }, [dispatch, latest, shouldScrollRef, elementIds]);
  38508. const getToggleButtonProps = (0,external_React_namespaceObject.useCallback)(function (_temp4) {
  38509. let {
  38510. onClick,
  38511. onPress,
  38512. refKey = 'ref',
  38513. ref,
  38514. ...rest
  38515. } = _temp4 === void 0 ? {} : _temp4;
  38516. const toggleButtonHandleClick = () => {
  38517. dispatch({
  38518. type: ToggleButtonClick
  38519. });
  38520. if (!latest.current.state.isOpen && inputRef.current) {
  38521. inputRef.current.focus();
  38522. }
  38523. };
  38524. return {
  38525. [refKey]: handleRefs(ref, toggleButtonNode => {
  38526. toggleButtonRef.current = toggleButtonNode;
  38527. }),
  38528. id: elementIds.toggleButtonId,
  38529. tabIndex: -1,
  38530. ...(!rest.disabled && { ...({
  38531. onClick: callAllEventHandlers(onClick, toggleButtonHandleClick)
  38532. })
  38533. }),
  38534. ...rest
  38535. };
  38536. }, [dispatch, latest, elementIds]);
  38537. const getInputProps = (0,external_React_namespaceObject.useCallback)(function (_temp5, _temp6) {
  38538. let {
  38539. onKeyDown,
  38540. onChange,
  38541. onInput,
  38542. onBlur,
  38543. onChangeText,
  38544. refKey = 'ref',
  38545. ref,
  38546. ...rest
  38547. } = _temp5 === void 0 ? {} : _temp5;
  38548. let {
  38549. suppressRefError = false
  38550. } = _temp6 === void 0 ? {} : _temp6;
  38551. setGetterPropCallInfo('getInputProps', suppressRefError, refKey, inputRef);
  38552. const latestState = latest.current.state;
  38553. const inputHandleKeyDown = event => {
  38554. const key = normalizeArrowKey(event);
  38555. if (key && inputKeyDownHandlers[key]) {
  38556. inputKeyDownHandlers[key](event);
  38557. }
  38558. };
  38559. const inputHandleChange = event => {
  38560. dispatch({
  38561. type: InputChange,
  38562. inputValue: event.target.value
  38563. });
  38564. };
  38565. const inputHandleBlur = () => {
  38566. /* istanbul ignore else */
  38567. if (latestState.isOpen && !mouseAndTouchTrackersRef.current.isMouseDown) {
  38568. dispatch({
  38569. type: InputBlur,
  38570. selectItem: true
  38571. });
  38572. }
  38573. };
  38574. /* istanbul ignore next (preact) */
  38575. const onChangeKey = 'onChange';
  38576. let eventHandlers = {};
  38577. if (!rest.disabled) {
  38578. eventHandlers = {
  38579. [onChangeKey]: callAllEventHandlers(onChange, onInput, inputHandleChange),
  38580. onKeyDown: callAllEventHandlers(onKeyDown, inputHandleKeyDown),
  38581. onBlur: callAllEventHandlers(onBlur, inputHandleBlur)
  38582. };
  38583. }
  38584. return {
  38585. [refKey]: handleRefs(ref, inputNode => {
  38586. inputRef.current = inputNode;
  38587. }),
  38588. id: elementIds.inputId,
  38589. 'aria-autocomplete': 'list',
  38590. 'aria-controls': elementIds.menuId,
  38591. ...(latestState.isOpen && latestState.highlightedIndex > -1 && {
  38592. 'aria-activedescendant': elementIds.getItemId(latestState.highlightedIndex)
  38593. }),
  38594. 'aria-labelledby': elementIds.labelId,
  38595. // https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion
  38596. // revert back since autocomplete="nope" is ignored on latest Chrome and Opera
  38597. autoComplete: 'off',
  38598. value: latestState.inputValue,
  38599. ...eventHandlers,
  38600. ...rest
  38601. };
  38602. }, [dispatch, inputKeyDownHandlers, latest, mouseAndTouchTrackersRef, setGetterPropCallInfo, elementIds]);
  38603. const getComboboxProps = (0,external_React_namespaceObject.useCallback)(function (_temp7, _temp8) {
  38604. let {
  38605. refKey = 'ref',
  38606. ref,
  38607. ...rest
  38608. } = _temp7 === void 0 ? {} : _temp7;
  38609. let {
  38610. suppressRefError = false
  38611. } = _temp8 === void 0 ? {} : _temp8;
  38612. setGetterPropCallInfo('getComboboxProps', suppressRefError, refKey, comboboxRef);
  38613. return {
  38614. [refKey]: handleRefs(ref, comboboxNode => {
  38615. comboboxRef.current = comboboxNode;
  38616. }),
  38617. role: 'combobox',
  38618. 'aria-haspopup': 'listbox',
  38619. 'aria-owns': elementIds.menuId,
  38620. 'aria-expanded': latest.current.state.isOpen,
  38621. ...rest
  38622. };
  38623. }, [latest, setGetterPropCallInfo, elementIds]); // returns
  38624. const toggleMenu = (0,external_React_namespaceObject.useCallback)(() => {
  38625. dispatch({
  38626. type: FunctionToggleMenu
  38627. });
  38628. }, [dispatch]);
  38629. const closeMenu = (0,external_React_namespaceObject.useCallback)(() => {
  38630. dispatch({
  38631. type: FunctionCloseMenu
  38632. });
  38633. }, [dispatch]);
  38634. const openMenu = (0,external_React_namespaceObject.useCallback)(() => {
  38635. dispatch({
  38636. type: FunctionOpenMenu
  38637. });
  38638. }, [dispatch]);
  38639. const setHighlightedIndex = (0,external_React_namespaceObject.useCallback)(newHighlightedIndex => {
  38640. dispatch({
  38641. type: FunctionSetHighlightedIndex,
  38642. highlightedIndex: newHighlightedIndex
  38643. });
  38644. }, [dispatch]);
  38645. const selectItem = (0,external_React_namespaceObject.useCallback)(newSelectedItem => {
  38646. dispatch({
  38647. type: FunctionSelectItem,
  38648. selectedItem: newSelectedItem
  38649. });
  38650. }, [dispatch]);
  38651. const setInputValue = (0,external_React_namespaceObject.useCallback)(newInputValue => {
  38652. dispatch({
  38653. type: FunctionSetInputValue,
  38654. inputValue: newInputValue
  38655. });
  38656. }, [dispatch]);
  38657. const reset = (0,external_React_namespaceObject.useCallback)(() => {
  38658. dispatch({
  38659. type: FunctionReset$1
  38660. });
  38661. }, [dispatch]);
  38662. return {
  38663. // prop getters.
  38664. getItemProps,
  38665. getLabelProps,
  38666. getMenuProps,
  38667. getInputProps,
  38668. getComboboxProps,
  38669. getToggleButtonProps,
  38670. // actions.
  38671. toggleMenu,
  38672. openMenu,
  38673. closeMenu,
  38674. setHighlightedIndex,
  38675. setInputValue,
  38676. selectItem,
  38677. reset,
  38678. // state.
  38679. highlightedIndex,
  38680. isOpen,
  38681. selectedItem,
  38682. inputValue
  38683. };
  38684. }
  38685. const defaultStateValues = {
  38686. activeIndex: -1,
  38687. selectedItems: []
  38688. };
  38689. /**
  38690. * Returns the initial value for a state key in the following order:
  38691. * 1. controlled prop, 2. initial prop, 3. default prop, 4. default
  38692. * value from Downshift.
  38693. *
  38694. * @param {Object} props Props passed to the hook.
  38695. * @param {string} propKey Props key to generate the value for.
  38696. * @returns {any} The initial value for that prop.
  38697. */
  38698. function getInitialValue(props, propKey) {
  38699. return getInitialValue$1(props, propKey, defaultStateValues);
  38700. }
  38701. /**
  38702. * Returns the default value for a state key in the following order:
  38703. * 1. controlled prop, 2. default prop, 3. default value from Downshift.
  38704. *
  38705. * @param {Object} props Props passed to the hook.
  38706. * @param {string} propKey Props key to generate the value for.
  38707. * @returns {any} The initial value for that prop.
  38708. */
  38709. function getDefaultValue(props, propKey) {
  38710. return getDefaultValue$1(props, propKey, defaultStateValues);
  38711. }
  38712. /**
  38713. * Gets the initial state based on the provided props. It uses initial, default
  38714. * and controlled props related to state in order to compute the initial value.
  38715. *
  38716. * @param {Object} props Props passed to the hook.
  38717. * @returns {Object} The initial state.
  38718. */
  38719. function getInitialState(props) {
  38720. const activeIndex = getInitialValue(props, 'activeIndex');
  38721. const selectedItems = getInitialValue(props, 'selectedItems');
  38722. return {
  38723. activeIndex,
  38724. selectedItems
  38725. };
  38726. }
  38727. /**
  38728. * Returns true if dropdown keydown operation is permitted. Should not be
  38729. * allowed on keydown with modifier keys (ctrl, alt, shift, meta), on
  38730. * input element with text content that is either highlighted or selection
  38731. * cursor is not at the starting position.
  38732. *
  38733. * @param {KeyboardEvent} event The event from keydown.
  38734. * @returns {boolean} Whether the operation is allowed.
  38735. */
  38736. function isKeyDownOperationPermitted(event) {
  38737. if (event.shiftKey || event.metaKey || event.ctrlKey || event.altKey) {
  38738. return false;
  38739. }
  38740. const element = event.target;
  38741. if (element instanceof HTMLInputElement && // if element is a text input
  38742. element.value !== '' && ( // and we have text in it
  38743. // and cursor is either not at the start or is currently highlighting text.
  38744. element.selectionStart !== 0 || element.selectionEnd !== 0)) {
  38745. return false;
  38746. }
  38747. return true;
  38748. }
  38749. /**
  38750. * Returns a message to be added to aria-live region when item is removed.
  38751. *
  38752. * @param {Object} selectionParameters Parameters required to build the message.
  38753. * @returns {string} The a11y message.
  38754. */
  38755. function getA11yRemovalMessage(selectionParameters) {
  38756. const {
  38757. removedSelectedItem,
  38758. itemToString: itemToStringLocal
  38759. } = selectionParameters;
  38760. return `${itemToStringLocal(removedSelectedItem)} has been removed.`;
  38761. }
  38762. const propTypes = {
  38763. selectedItems: (prop_types_default()).array,
  38764. initialSelectedItems: (prop_types_default()).array,
  38765. defaultSelectedItems: (prop_types_default()).array,
  38766. itemToString: (prop_types_default()).func,
  38767. getA11yRemovalMessage: (prop_types_default()).func,
  38768. stateReducer: (prop_types_default()).func,
  38769. activeIndex: (prop_types_default()).number,
  38770. initialActiveIndex: (prop_types_default()).number,
  38771. defaultActiveIndex: (prop_types_default()).number,
  38772. onActiveIndexChange: (prop_types_default()).func,
  38773. onSelectedItemsChange: (prop_types_default()).func,
  38774. keyNavigationNext: (prop_types_default()).string,
  38775. keyNavigationPrevious: (prop_types_default()).string,
  38776. environment: prop_types_default().shape({
  38777. addEventListener: (prop_types_default()).func,
  38778. removeEventListener: (prop_types_default()).func,
  38779. document: prop_types_default().shape({
  38780. getElementById: (prop_types_default()).func,
  38781. activeElement: (prop_types_default()).any,
  38782. body: (prop_types_default()).any
  38783. })
  38784. })
  38785. };
  38786. const defaultProps = {
  38787. itemToString: defaultProps$3.itemToString,
  38788. stateReducer: defaultProps$3.stateReducer,
  38789. environment: defaultProps$3.environment,
  38790. getA11yRemovalMessage,
  38791. keyNavigationNext: 'ArrowRight',
  38792. keyNavigationPrevious: 'ArrowLeft'
  38793. }; // eslint-disable-next-line import/no-mutable-exports
  38794. let validatePropTypes = downshift_esm_noop;
  38795. /* istanbul ignore next */
  38796. if (false) {}
  38797. const SelectedItemClick = false ? 0 : 0;
  38798. const SelectedItemKeyDownDelete = false ? 0 : 1;
  38799. const SelectedItemKeyDownBackspace = false ? 0 : 2;
  38800. const SelectedItemKeyDownNavigationNext = false ? 0 : 3;
  38801. const SelectedItemKeyDownNavigationPrevious = false ? 0 : 4;
  38802. const DropdownKeyDownNavigationPrevious = false ? 0 : 5;
  38803. const DropdownKeyDownBackspace = false ? 0 : 6;
  38804. const DropdownClick = false ? 0 : 7;
  38805. const FunctionAddSelectedItem = false ? 0 : 8;
  38806. const FunctionRemoveSelectedItem = false ? 0 : 9;
  38807. const FunctionSetSelectedItems = false ? 0 : 10;
  38808. const FunctionSetActiveIndex = false ? 0 : 11;
  38809. const FunctionReset = false ? 0 : 12;
  38810. var stateChangeTypes = /*#__PURE__*/Object.freeze({
  38811. __proto__: null,
  38812. SelectedItemClick: SelectedItemClick,
  38813. SelectedItemKeyDownDelete: SelectedItemKeyDownDelete,
  38814. SelectedItemKeyDownBackspace: SelectedItemKeyDownBackspace,
  38815. SelectedItemKeyDownNavigationNext: SelectedItemKeyDownNavigationNext,
  38816. SelectedItemKeyDownNavigationPrevious: SelectedItemKeyDownNavigationPrevious,
  38817. DropdownKeyDownNavigationPrevious: DropdownKeyDownNavigationPrevious,
  38818. DropdownKeyDownBackspace: DropdownKeyDownBackspace,
  38819. DropdownClick: DropdownClick,
  38820. FunctionAddSelectedItem: FunctionAddSelectedItem,
  38821. FunctionRemoveSelectedItem: FunctionRemoveSelectedItem,
  38822. FunctionSetSelectedItems: FunctionSetSelectedItems,
  38823. FunctionSetActiveIndex: FunctionSetActiveIndex,
  38824. FunctionReset: FunctionReset
  38825. });
  38826. /* eslint-disable complexity */
  38827. function downshiftMultipleSelectionReducer(state, action) {
  38828. const {
  38829. type,
  38830. index,
  38831. props,
  38832. selectedItem
  38833. } = action;
  38834. const {
  38835. activeIndex,
  38836. selectedItems
  38837. } = state;
  38838. let changes;
  38839. switch (type) {
  38840. case SelectedItemClick:
  38841. changes = {
  38842. activeIndex: index
  38843. };
  38844. break;
  38845. case SelectedItemKeyDownNavigationPrevious:
  38846. changes = {
  38847. activeIndex: activeIndex - 1 < 0 ? 0 : activeIndex - 1
  38848. };
  38849. break;
  38850. case SelectedItemKeyDownNavigationNext:
  38851. changes = {
  38852. activeIndex: activeIndex + 1 >= selectedItems.length ? -1 : activeIndex + 1
  38853. };
  38854. break;
  38855. case SelectedItemKeyDownBackspace:
  38856. case SelectedItemKeyDownDelete:
  38857. {
  38858. let newActiveIndex = activeIndex;
  38859. if (selectedItems.length === 1) {
  38860. newActiveIndex = -1;
  38861. } else if (activeIndex === selectedItems.length - 1) {
  38862. newActiveIndex = selectedItems.length - 2;
  38863. }
  38864. changes = {
  38865. selectedItems: [...selectedItems.slice(0, activeIndex), ...selectedItems.slice(activeIndex + 1)],
  38866. ...{
  38867. activeIndex: newActiveIndex
  38868. }
  38869. };
  38870. break;
  38871. }
  38872. case DropdownKeyDownNavigationPrevious:
  38873. changes = {
  38874. activeIndex: selectedItems.length - 1
  38875. };
  38876. break;
  38877. case DropdownKeyDownBackspace:
  38878. changes = {
  38879. selectedItems: selectedItems.slice(0, selectedItems.length - 1)
  38880. };
  38881. break;
  38882. case FunctionAddSelectedItem:
  38883. changes = {
  38884. selectedItems: [...selectedItems, selectedItem]
  38885. };
  38886. break;
  38887. case DropdownClick:
  38888. changes = {
  38889. activeIndex: -1
  38890. };
  38891. break;
  38892. case FunctionRemoveSelectedItem:
  38893. {
  38894. let newActiveIndex = activeIndex;
  38895. const selectedItemIndex = selectedItems.indexOf(selectedItem);
  38896. if (selectedItemIndex >= 0) {
  38897. if (selectedItems.length === 1) {
  38898. newActiveIndex = -1;
  38899. } else if (selectedItemIndex === selectedItems.length - 1) {
  38900. newActiveIndex = selectedItems.length - 2;
  38901. }
  38902. changes = {
  38903. selectedItems: [...selectedItems.slice(0, selectedItemIndex), ...selectedItems.slice(selectedItemIndex + 1)],
  38904. activeIndex: newActiveIndex
  38905. };
  38906. }
  38907. break;
  38908. }
  38909. case FunctionSetSelectedItems:
  38910. {
  38911. const {
  38912. selectedItems: newSelectedItems
  38913. } = action;
  38914. changes = {
  38915. selectedItems: newSelectedItems
  38916. };
  38917. break;
  38918. }
  38919. case FunctionSetActiveIndex:
  38920. {
  38921. const {
  38922. activeIndex: newActiveIndex
  38923. } = action;
  38924. changes = {
  38925. activeIndex: newActiveIndex
  38926. };
  38927. break;
  38928. }
  38929. case FunctionReset:
  38930. changes = {
  38931. activeIndex: getDefaultValue(props, 'activeIndex'),
  38932. selectedItems: getDefaultValue(props, 'selectedItems')
  38933. };
  38934. break;
  38935. default:
  38936. throw new Error('Reducer called without proper action type.');
  38937. }
  38938. return { ...state,
  38939. ...changes
  38940. };
  38941. }
  38942. useMultipleSelection.stateChangeTypes = stateChangeTypes;
  38943. function useMultipleSelection(userProps) {
  38944. if (userProps === void 0) {
  38945. userProps = {};
  38946. }
  38947. validatePropTypes(userProps, useMultipleSelection); // Props defaults and destructuring.
  38948. const props = { ...defaultProps,
  38949. ...userProps
  38950. };
  38951. const {
  38952. getA11yRemovalMessage,
  38953. itemToString,
  38954. environment,
  38955. keyNavigationNext,
  38956. keyNavigationPrevious
  38957. } = props; // Reducer init.
  38958. const [state, dispatch] = useControlledReducer$1(downshiftMultipleSelectionReducer, getInitialState(props), props);
  38959. const {
  38960. activeIndex,
  38961. selectedItems
  38962. } = state; // Refs.
  38963. const isInitialMountRef = (0,external_React_namespaceObject.useRef)(true);
  38964. const dropdownRef = (0,external_React_namespaceObject.useRef)(null);
  38965. const previousSelectedItemsRef = (0,external_React_namespaceObject.useRef)(selectedItems);
  38966. const selectedItemRefs = (0,external_React_namespaceObject.useRef)();
  38967. selectedItemRefs.current = [];
  38968. const latest = downshift_esm_useLatestRef({
  38969. state,
  38970. props
  38971. }); // Effects.
  38972. /* Sets a11y status message on changes in selectedItem. */
  38973. (0,external_React_namespaceObject.useEffect)(() => {
  38974. if (isInitialMountRef.current) {
  38975. return;
  38976. }
  38977. if (selectedItems.length < previousSelectedItemsRef.current.length) {
  38978. const removedSelectedItem = previousSelectedItemsRef.current.find(item => selectedItems.indexOf(item) < 0);
  38979. setStatus(getA11yRemovalMessage({
  38980. itemToString,
  38981. resultCount: selectedItems.length,
  38982. removedSelectedItem,
  38983. activeIndex,
  38984. activeSelectedItem: selectedItems[activeIndex]
  38985. }), environment.document);
  38986. }
  38987. previousSelectedItemsRef.current = selectedItems; // eslint-disable-next-line react-hooks/exhaustive-deps
  38988. }, [selectedItems.length]); // Sets focus on active item.
  38989. (0,external_React_namespaceObject.useEffect)(() => {
  38990. if (isInitialMountRef.current) {
  38991. return;
  38992. }
  38993. if (activeIndex === -1 && dropdownRef.current) {
  38994. dropdownRef.current.focus();
  38995. } else if (selectedItemRefs.current[activeIndex]) {
  38996. selectedItemRefs.current[activeIndex].focus();
  38997. }
  38998. }, [activeIndex]);
  38999. useControlPropsValidator({
  39000. isInitialMount: isInitialMountRef.current,
  39001. props,
  39002. state
  39003. });
  39004. const setGetterPropCallInfo = useGetterPropsCalledChecker('getDropdownProps'); // Make initial ref false.
  39005. (0,external_React_namespaceObject.useEffect)(() => {
  39006. isInitialMountRef.current = false;
  39007. }, []); // Event handler functions.
  39008. const selectedItemKeyDownHandlers = (0,external_React_namespaceObject.useMemo)(() => ({
  39009. [keyNavigationPrevious]() {
  39010. dispatch({
  39011. type: SelectedItemKeyDownNavigationPrevious
  39012. });
  39013. },
  39014. [keyNavigationNext]() {
  39015. dispatch({
  39016. type: SelectedItemKeyDownNavigationNext
  39017. });
  39018. },
  39019. Delete() {
  39020. dispatch({
  39021. type: SelectedItemKeyDownDelete
  39022. });
  39023. },
  39024. Backspace() {
  39025. dispatch({
  39026. type: SelectedItemKeyDownBackspace
  39027. });
  39028. }
  39029. }), [dispatch, keyNavigationNext, keyNavigationPrevious]);
  39030. const dropdownKeyDownHandlers = (0,external_React_namespaceObject.useMemo)(() => ({
  39031. [keyNavigationPrevious](event) {
  39032. if (isKeyDownOperationPermitted(event)) {
  39033. dispatch({
  39034. type: DropdownKeyDownNavigationPrevious
  39035. });
  39036. }
  39037. },
  39038. Backspace(event) {
  39039. if (isKeyDownOperationPermitted(event)) {
  39040. dispatch({
  39041. type: DropdownKeyDownBackspace
  39042. });
  39043. }
  39044. }
  39045. }), [dispatch, keyNavigationPrevious]); // Getter props.
  39046. const getSelectedItemProps = (0,external_React_namespaceObject.useCallback)(function (_temp) {
  39047. let {
  39048. refKey = 'ref',
  39049. ref,
  39050. onClick,
  39051. onKeyDown,
  39052. selectedItem,
  39053. index,
  39054. ...rest
  39055. } = _temp === void 0 ? {} : _temp;
  39056. const {
  39057. state: latestState
  39058. } = latest.current;
  39059. const itemIndex = getItemIndex(index, selectedItem, latestState.selectedItems);
  39060. if (itemIndex < 0) {
  39061. throw new Error('Pass either selectedItem or index in getSelectedItemProps!');
  39062. }
  39063. const selectedItemHandleClick = () => {
  39064. dispatch({
  39065. type: SelectedItemClick,
  39066. index
  39067. });
  39068. };
  39069. const selectedItemHandleKeyDown = event => {
  39070. const key = normalizeArrowKey(event);
  39071. if (key && selectedItemKeyDownHandlers[key]) {
  39072. selectedItemKeyDownHandlers[key](event);
  39073. }
  39074. };
  39075. return {
  39076. [refKey]: handleRefs(ref, selectedItemNode => {
  39077. if (selectedItemNode) {
  39078. selectedItemRefs.current.push(selectedItemNode);
  39079. }
  39080. }),
  39081. tabIndex: index === latestState.activeIndex ? 0 : -1,
  39082. onClick: callAllEventHandlers(onClick, selectedItemHandleClick),
  39083. onKeyDown: callAllEventHandlers(onKeyDown, selectedItemHandleKeyDown),
  39084. ...rest
  39085. };
  39086. }, [dispatch, latest, selectedItemKeyDownHandlers]);
  39087. const getDropdownProps = (0,external_React_namespaceObject.useCallback)(function (_temp2, _temp3) {
  39088. let {
  39089. refKey = 'ref',
  39090. ref,
  39091. onKeyDown,
  39092. onClick,
  39093. preventKeyAction = false,
  39094. ...rest
  39095. } = _temp2 === void 0 ? {} : _temp2;
  39096. let {
  39097. suppressRefError = false
  39098. } = _temp3 === void 0 ? {} : _temp3;
  39099. setGetterPropCallInfo('getDropdownProps', suppressRefError, refKey, dropdownRef);
  39100. const dropdownHandleKeyDown = event => {
  39101. const key = normalizeArrowKey(event);
  39102. if (key && dropdownKeyDownHandlers[key]) {
  39103. dropdownKeyDownHandlers[key](event);
  39104. }
  39105. };
  39106. const dropdownHandleClick = () => {
  39107. dispatch({
  39108. type: DropdownClick
  39109. });
  39110. };
  39111. return {
  39112. [refKey]: handleRefs(ref, dropdownNode => {
  39113. if (dropdownNode) {
  39114. dropdownRef.current = dropdownNode;
  39115. }
  39116. }),
  39117. ...(!preventKeyAction && {
  39118. onKeyDown: callAllEventHandlers(onKeyDown, dropdownHandleKeyDown),
  39119. onClick: callAllEventHandlers(onClick, dropdownHandleClick)
  39120. }),
  39121. ...rest
  39122. };
  39123. }, [dispatch, dropdownKeyDownHandlers, setGetterPropCallInfo]); // returns
  39124. const addSelectedItem = (0,external_React_namespaceObject.useCallback)(selectedItem => {
  39125. dispatch({
  39126. type: FunctionAddSelectedItem,
  39127. selectedItem
  39128. });
  39129. }, [dispatch]);
  39130. const removeSelectedItem = (0,external_React_namespaceObject.useCallback)(selectedItem => {
  39131. dispatch({
  39132. type: FunctionRemoveSelectedItem,
  39133. selectedItem
  39134. });
  39135. }, [dispatch]);
  39136. const setSelectedItems = (0,external_React_namespaceObject.useCallback)(newSelectedItems => {
  39137. dispatch({
  39138. type: FunctionSetSelectedItems,
  39139. selectedItems: newSelectedItems
  39140. });
  39141. }, [dispatch]);
  39142. const setActiveIndex = (0,external_React_namespaceObject.useCallback)(newActiveIndex => {
  39143. dispatch({
  39144. type: FunctionSetActiveIndex,
  39145. activeIndex: newActiveIndex
  39146. });
  39147. }, [dispatch]);
  39148. const reset = (0,external_React_namespaceObject.useCallback)(() => {
  39149. dispatch({
  39150. type: FunctionReset
  39151. });
  39152. }, [dispatch]);
  39153. return {
  39154. getSelectedItemProps,
  39155. getDropdownProps,
  39156. addSelectedItem,
  39157. removeSelectedItem,
  39158. setSelectedItems,
  39159. setActiveIndex,
  39160. reset,
  39161. selectedItems,
  39162. activeIndex
  39163. };
  39164. }
  39165. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-select-control/styles.js
  39166. /**
  39167. * External dependencies
  39168. */
  39169. /**
  39170. * Internal dependencies
  39171. */
  39172. const backCompatMinWidth = props => !props.__nextUnconstrainedWidth ? /*#__PURE__*/emotion_react_browser_esm_css(Container, "{min-width:130px;}" + ( true ? "" : 0), true ? "" : 0) : '';
  39173. const InputBaseWithBackCompatMinWidth = /*#__PURE__*/emotion_styled_base_browser_esm(input_base, true ? {
  39174. target: "eswuck60"
  39175. } : 0)(backCompatMinWidth, ";" + ( true ? "" : 0));
  39176. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-select-control/index.js
  39177. /**
  39178. * External dependencies
  39179. */
  39180. /**
  39181. * WordPress dependencies
  39182. */
  39183. /**
  39184. * Internal dependencies
  39185. */
  39186. const custom_select_control_itemToString = item => item === null || item === void 0 ? void 0 : item.name; // This is needed so that in Windows, where
  39187. // the menu does not necessarily open on
  39188. // key up/down, you can still switch between
  39189. // options with the menu closed.
  39190. const custom_select_control_stateReducer = (_ref, _ref2) => {
  39191. let {
  39192. selectedItem
  39193. } = _ref;
  39194. let {
  39195. type,
  39196. changes,
  39197. props: {
  39198. items
  39199. }
  39200. } = _ref2;
  39201. switch (type) {
  39202. case useSelect.stateChangeTypes.ToggleButtonKeyDownArrowDown:
  39203. // If we already have a selected item, try to select the next one,
  39204. // without circular navigation. Otherwise, select the first item.
  39205. return {
  39206. selectedItem: items[selectedItem ? Math.min(items.indexOf(selectedItem) + 1, items.length - 1) : 0]
  39207. };
  39208. case useSelect.stateChangeTypes.ToggleButtonKeyDownArrowUp:
  39209. // If we already have a selected item, try to select the previous one,
  39210. // without circular navigation. Otherwise, select the last item.
  39211. return {
  39212. selectedItem: items[selectedItem ? Math.max(items.indexOf(selectedItem) - 1, 0) : items.length - 1]
  39213. };
  39214. default:
  39215. return changes;
  39216. }
  39217. };
  39218. function CustomSelectControl(_ref3) {
  39219. var _menuProps$ariaActiv;
  39220. let {
  39221. /** Start opting into the larger default height that will become the default size in a future version. */
  39222. __next36pxDefaultSize = false,
  39223. /** Start opting into the unconstrained width that will become the default in a future version. */
  39224. __nextUnconstrainedWidth = false,
  39225. className,
  39226. hideLabelFromVision,
  39227. label,
  39228. describedBy,
  39229. options: items,
  39230. onChange: onSelectedItemChange,
  39231. /** @type {import('../select-control/types').SelectControlProps.size} */
  39232. size = 'default',
  39233. value: _selectedItem
  39234. } = _ref3;
  39235. const {
  39236. getLabelProps,
  39237. getToggleButtonProps,
  39238. getMenuProps,
  39239. getItemProps,
  39240. isOpen,
  39241. highlightedIndex,
  39242. selectedItem
  39243. } = useSelect({
  39244. initialSelectedItem: items[0],
  39245. items,
  39246. itemToString: custom_select_control_itemToString,
  39247. onSelectedItemChange,
  39248. ...(typeof _selectedItem !== 'undefined' && _selectedItem !== null ? {
  39249. selectedItem: _selectedItem
  39250. } : undefined),
  39251. stateReducer: custom_select_control_stateReducer
  39252. });
  39253. const [isFocused, setIsFocused] = (0,external_wp_element_namespaceObject.useState)(false);
  39254. if (!__nextUnconstrainedWidth) {
  39255. external_wp_deprecated_default()('Constrained width styles for wp.components.CustomSelectControl', {
  39256. since: '6.1',
  39257. version: '6.4',
  39258. hint: 'Set the `__nextUnconstrainedWidth` prop to true to start opting into the new styles, which will become the default in a future version'
  39259. });
  39260. }
  39261. function getDescribedBy() {
  39262. if (describedBy) {
  39263. return describedBy;
  39264. }
  39265. if (!selectedItem) {
  39266. return (0,external_wp_i18n_namespaceObject.__)('No selection');
  39267. } // translators: %s: The selected option.
  39268. return (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Currently selected: %s'), selectedItem.name);
  39269. }
  39270. const menuProps = getMenuProps({
  39271. className: 'components-custom-select-control__menu',
  39272. 'aria-hidden': !isOpen
  39273. });
  39274. const onKeyDownHandler = (0,external_wp_element_namespaceObject.useCallback)(e => {
  39275. var _menuProps$onKeyDown;
  39276. e.stopPropagation();
  39277. menuProps === null || menuProps === void 0 ? void 0 : (_menuProps$onKeyDown = menuProps.onKeyDown) === null || _menuProps$onKeyDown === void 0 ? void 0 : _menuProps$onKeyDown.call(menuProps, e);
  39278. }, [menuProps]); // We need this here, because the null active descendant is not fully ARIA compliant.
  39279. if ((_menuProps$ariaActiv = menuProps['aria-activedescendant']) !== null && _menuProps$ariaActiv !== void 0 && _menuProps$ariaActiv.startsWith('downshift-null')) {
  39280. delete menuProps['aria-activedescendant'];
  39281. }
  39282. return (0,external_wp_element_namespaceObject.createElement)("div", {
  39283. className: classnames_default()('components-custom-select-control', className)
  39284. }, hideLabelFromVision ? (0,external_wp_element_namespaceObject.createElement)(visually_hidden_component, extends_extends({
  39285. as: "label"
  39286. }, getLabelProps()), label) :
  39287. /* eslint-disable-next-line jsx-a11y/label-has-associated-control, jsx-a11y/label-has-for */
  39288. (0,external_wp_element_namespaceObject.createElement)(StyledLabel, getLabelProps({
  39289. className: 'components-custom-select-control__label'
  39290. }), label), (0,external_wp_element_namespaceObject.createElement)(InputBaseWithBackCompatMinWidth, {
  39291. __next36pxDefaultSize: __next36pxDefaultSize,
  39292. __nextUnconstrainedWidth: __nextUnconstrainedWidth,
  39293. isFocused: isOpen || isFocused,
  39294. __unstableInputWidth: __nextUnconstrainedWidth ? undefined : 'auto',
  39295. labelPosition: __nextUnconstrainedWidth ? undefined : 'top',
  39296. size: size,
  39297. suffix: (0,external_wp_element_namespaceObject.createElement)(select_control_chevron_down, null)
  39298. }, (0,external_wp_element_namespaceObject.createElement)(Select, extends_extends({
  39299. as: "button",
  39300. onFocus: () => setIsFocused(true),
  39301. onBlur: () => setIsFocused(false),
  39302. selectSize: size,
  39303. __next36pxDefaultSize: __next36pxDefaultSize
  39304. }, getToggleButtonProps({
  39305. // This is needed because some speech recognition software don't support `aria-labelledby`.
  39306. 'aria-label': label,
  39307. 'aria-labelledby': undefined,
  39308. className: 'components-custom-select-control__button',
  39309. describedBy: getDescribedBy()
  39310. })), custom_select_control_itemToString(selectedItem))), (0,external_wp_element_namespaceObject.createElement)("ul", extends_extends({}, menuProps, {
  39311. onKeyDown: onKeyDownHandler
  39312. }), isOpen && items.map((item, index) => // eslint-disable-next-line react/jsx-key
  39313. (0,external_wp_element_namespaceObject.createElement)("li", getItemProps({
  39314. item,
  39315. index,
  39316. key: item.key,
  39317. className: classnames_default()(item.className, 'components-custom-select-control__item', {
  39318. 'is-highlighted': index === highlightedIndex,
  39319. 'has-hint': !!item.__experimentalHint,
  39320. 'is-next-36px-default-size': __next36pxDefaultSize
  39321. }),
  39322. style: item.style
  39323. }), item.name, item.__experimentalHint && (0,external_wp_element_namespaceObject.createElement)("span", {
  39324. className: "components-custom-select-control__item-hint"
  39325. }, item.__experimentalHint), item === selectedItem && (0,external_wp_element_namespaceObject.createElement)(icons_build_module_icon, {
  39326. icon: library_check,
  39327. className: "components-custom-select-control__item-icon"
  39328. })))));
  39329. }
  39330. ;// CONCATENATED MODULE: ./node_modules/use-lilius/build/index.es.js
  39331. function toInteger(dirtyNumber) {
  39332. if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
  39333. return NaN;
  39334. }
  39335. var number = Number(dirtyNumber);
  39336. if (isNaN(number)) {
  39337. return number;
  39338. }
  39339. return number < 0 ? Math.ceil(number) : Math.floor(number);
  39340. }
  39341. function requiredArgs(required, args) {
  39342. if (args.length < required) {
  39343. throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
  39344. }
  39345. }
  39346. /**
  39347. * @name toDate
  39348. * @category Common Helpers
  39349. * @summary Convert the given argument to an instance of Date.
  39350. *
  39351. * @description
  39352. * Convert the given argument to an instance of Date.
  39353. *
  39354. * If the argument is an instance of Date, the function returns its clone.
  39355. *
  39356. * If the argument is a number, it is treated as a timestamp.
  39357. *
  39358. * If the argument is none of the above, the function returns Invalid Date.
  39359. *
  39360. * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
  39361. *
  39362. * @param {Date|Number} argument - the value to convert
  39363. * @returns {Date} the parsed date in the local time zone
  39364. * @throws {TypeError} 1 argument required
  39365. *
  39366. * @example
  39367. * // Clone the date:
  39368. * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
  39369. * //=> Tue Feb 11 2014 11:30:30
  39370. *
  39371. * @example
  39372. * // Convert the timestamp to date:
  39373. * const result = toDate(1392098430000)
  39374. * //=> Tue Feb 11 2014 11:30:30
  39375. */
  39376. function toDate(argument) {
  39377. requiredArgs(1, arguments);
  39378. var argStr = Object.prototype.toString.call(argument); // Clone the date
  39379. if (argument instanceof Date || typeof argument === 'object' && argStr === '[object Date]') {
  39380. // Prevent the date to lose the milliseconds when passed to new Date() in IE10
  39381. return new Date(argument.getTime());
  39382. } else if (typeof argument === 'number' || argStr === '[object Number]') {
  39383. return new Date(argument);
  39384. } else {
  39385. if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
  39386. // eslint-disable-next-line no-console
  39387. console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"); // eslint-disable-next-line no-console
  39388. console.warn(new Error().stack);
  39389. }
  39390. return new Date(NaN);
  39391. }
  39392. }
  39393. /**
  39394. * @name addDays
  39395. * @category Day Helpers
  39396. * @summary Add the specified number of days to the given date.
  39397. *
  39398. * @description
  39399. * Add the specified number of days to the given date.
  39400. *
  39401. * @param {Date|Number} date - the date to be changed
  39402. * @param {Number} amount - the amount of days to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
  39403. * @returns {Date} - the new date with the days added
  39404. * @throws {TypeError} - 2 arguments required
  39405. *
  39406. * @example
  39407. * // Add 10 days to 1 September 2014:
  39408. * const result = addDays(new Date(2014, 8, 1), 10)
  39409. * //=> Thu Sep 11 2014 00:00:00
  39410. */
  39411. function addDays(dirtyDate, dirtyAmount) {
  39412. requiredArgs(2, arguments);
  39413. var date = toDate(dirtyDate);
  39414. var amount = toInteger(dirtyAmount);
  39415. if (isNaN(amount)) {
  39416. return new Date(NaN);
  39417. }
  39418. if (!amount) {
  39419. // If 0 days, no-op to avoid changing times in the hour before end of DST
  39420. return date;
  39421. }
  39422. date.setDate(date.getDate() + amount);
  39423. return date;
  39424. }
  39425. /**
  39426. * @name addMonths
  39427. * @category Month Helpers
  39428. * @summary Add the specified number of months to the given date.
  39429. *
  39430. * @description
  39431. * Add the specified number of months to the given date.
  39432. *
  39433. * @param {Date|Number} date - the date to be changed
  39434. * @param {Number} amount - the amount of months to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
  39435. * @returns {Date} the new date with the months added
  39436. * @throws {TypeError} 2 arguments required
  39437. *
  39438. * @example
  39439. * // Add 5 months to 1 September 2014:
  39440. * const result = addMonths(new Date(2014, 8, 1), 5)
  39441. * //=> Sun Feb 01 2015 00:00:00
  39442. */
  39443. function addMonths(dirtyDate, dirtyAmount) {
  39444. requiredArgs(2, arguments);
  39445. var date = toDate(dirtyDate);
  39446. var amount = toInteger(dirtyAmount);
  39447. if (isNaN(amount)) {
  39448. return new Date(NaN);
  39449. }
  39450. if (!amount) {
  39451. // If 0 months, no-op to avoid changing times in the hour before end of DST
  39452. return date;
  39453. }
  39454. var dayOfMonth = date.getDate(); // The JS Date object supports date math by accepting out-of-bounds values for
  39455. // month, day, etc. For example, new Date(2020, 0, 0) returns 31 Dec 2019 and
  39456. // new Date(2020, 13, 1) returns 1 Feb 2021. This is *almost* the behavior we
  39457. // want except that dates will wrap around the end of a month, meaning that
  39458. // new Date(2020, 13, 31) will return 3 Mar 2021 not 28 Feb 2021 as desired. So
  39459. // we'll default to the end of the desired month by adding 1 to the desired
  39460. // month and using a date of 0 to back up one day to the end of the desired
  39461. // month.
  39462. var endOfDesiredMonth = new Date(date.getTime());
  39463. endOfDesiredMonth.setMonth(date.getMonth() + amount + 1, 0);
  39464. var daysInMonth = endOfDesiredMonth.getDate();
  39465. if (dayOfMonth >= daysInMonth) {
  39466. // If we're already at the end of the month, then this is the correct date
  39467. // and we're done.
  39468. return endOfDesiredMonth;
  39469. } else {
  39470. // Otherwise, we now know that setting the original day-of-month value won't
  39471. // cause an overflow, so set the desired day-of-month. Note that we can't
  39472. // just set the date of `endOfDesiredMonth` because that object may have had
  39473. // its time changed in the unusual case where where a DST transition was on
  39474. // the last day of the month and its local time was in the hour skipped or
  39475. // repeated next to a DST transition. So we use `date` instead which is
  39476. // guaranteed to still have the original time.
  39477. date.setFullYear(endOfDesiredMonth.getFullYear(), endOfDesiredMonth.getMonth(), dayOfMonth);
  39478. return date;
  39479. }
  39480. }
  39481. var index_es_defaultOptions = {};
  39482. function getDefaultOptions() {
  39483. return index_es_defaultOptions;
  39484. }
  39485. /**
  39486. * @name startOfWeek
  39487. * @category Week Helpers
  39488. * @summary Return the start of a week for the given date.
  39489. *
  39490. * @description
  39491. * Return the start of a week for the given date.
  39492. * The result will be in the local timezone.
  39493. *
  39494. * @param {Date|Number} date - the original date
  39495. * @param {Object} [options] - an object with options.
  39496. * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
  39497. * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
  39498. * @returns {Date} the start of a week
  39499. * @throws {TypeError} 1 argument required
  39500. * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
  39501. *
  39502. * @example
  39503. * // The start of a week for 2 September 2014 11:55:00:
  39504. * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))
  39505. * //=> Sun Aug 31 2014 00:00:00
  39506. *
  39507. * @example
  39508. * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:
  39509. * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
  39510. * //=> Mon Sep 01 2014 00:00:00
  39511. */
  39512. function startOfWeek(dirtyDate, options) {
  39513. var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
  39514. requiredArgs(1, arguments);
  39515. var defaultOptions = getDefaultOptions();
  39516. var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
  39517. if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
  39518. throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
  39519. }
  39520. var date = toDate(dirtyDate);
  39521. var day = date.getDay();
  39522. var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
  39523. date.setDate(date.getDate() - diff);
  39524. date.setHours(0, 0, 0, 0);
  39525. return date;
  39526. }
  39527. /**
  39528. * @name startOfDay
  39529. * @category Day Helpers
  39530. * @summary Return the start of a day for the given date.
  39531. *
  39532. * @description
  39533. * Return the start of a day for the given date.
  39534. * The result will be in the local timezone.
  39535. *
  39536. * @param {Date|Number} date - the original date
  39537. * @returns {Date} the start of a day
  39538. * @throws {TypeError} 1 argument required
  39539. *
  39540. * @example
  39541. * // The start of a day for 2 September 2014 11:55:00:
  39542. * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
  39543. * //=> Tue Sep 02 2014 00:00:00
  39544. */
  39545. function startOfDay(dirtyDate) {
  39546. requiredArgs(1, arguments);
  39547. var date = toDate(dirtyDate);
  39548. date.setHours(0, 0, 0, 0);
  39549. return date;
  39550. }
  39551. /**
  39552. * @name addWeeks
  39553. * @category Week Helpers
  39554. * @summary Add the specified number of weeks to the given date.
  39555. *
  39556. * @description
  39557. * Add the specified number of week to the given date.
  39558. *
  39559. * @param {Date|Number} date - the date to be changed
  39560. * @param {Number} amount - the amount of weeks to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
  39561. * @returns {Date} the new date with the weeks added
  39562. * @throws {TypeError} 2 arguments required
  39563. *
  39564. * @example
  39565. * // Add 4 weeks to 1 September 2014:
  39566. * const result = addWeeks(new Date(2014, 8, 1), 4)
  39567. * //=> Mon Sep 29 2014 00:00:00
  39568. */
  39569. function addWeeks(dirtyDate, dirtyAmount) {
  39570. requiredArgs(2, arguments);
  39571. var amount = toInteger(dirtyAmount);
  39572. var days = amount * 7;
  39573. return addDays(dirtyDate, days);
  39574. }
  39575. /**
  39576. * @name addYears
  39577. * @category Year Helpers
  39578. * @summary Add the specified number of years to the given date.
  39579. *
  39580. * @description
  39581. * Add the specified number of years to the given date.
  39582. *
  39583. * @param {Date|Number} date - the date to be changed
  39584. * @param {Number} amount - the amount of years to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
  39585. * @returns {Date} the new date with the years added
  39586. * @throws {TypeError} 2 arguments required
  39587. *
  39588. * @example
  39589. * // Add 5 years to 1 September 2014:
  39590. * const result = addYears(new Date(2014, 8, 1), 5)
  39591. * //=> Sun Sep 01 2019 00:00:00
  39592. */
  39593. function addYears(dirtyDate, dirtyAmount) {
  39594. requiredArgs(2, arguments);
  39595. var amount = toInteger(dirtyAmount);
  39596. return addMonths(dirtyDate, amount * 12);
  39597. }
  39598. /**
  39599. * @name endOfMonth
  39600. * @category Month Helpers
  39601. * @summary Return the end of a month for the given date.
  39602. *
  39603. * @description
  39604. * Return the end of a month for the given date.
  39605. * The result will be in the local timezone.
  39606. *
  39607. * @param {Date|Number} date - the original date
  39608. * @returns {Date} the end of a month
  39609. * @throws {TypeError} 1 argument required
  39610. *
  39611. * @example
  39612. * // The end of a month for 2 September 2014 11:55:00:
  39613. * const result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0))
  39614. * //=> Tue Sep 30 2014 23:59:59.999
  39615. */
  39616. function endOfMonth(dirtyDate) {
  39617. requiredArgs(1, arguments);
  39618. var date = toDate(dirtyDate);
  39619. var month = date.getMonth();
  39620. date.setFullYear(date.getFullYear(), month + 1, 0);
  39621. date.setHours(23, 59, 59, 999);
  39622. return date;
  39623. }
  39624. /**
  39625. * @name eachDayOfInterval
  39626. * @category Interval Helpers
  39627. * @summary Return the array of dates within the specified time interval.
  39628. *
  39629. * @description
  39630. * Return the array of dates within the specified time interval.
  39631. *
  39632. * @param {Interval} interval - the interval. See [Interval]{@link https://date-fns.org/docs/Interval}
  39633. * @param {Object} [options] - an object with options.
  39634. * @param {Number} [options.step=1] - the step to increment by. The value should be more than 1.
  39635. * @returns {Date[]} the array with starts of days from the day of the interval start to the day of the interval end
  39636. * @throws {TypeError} 1 argument required
  39637. * @throws {RangeError} `options.step` must be a number greater than 1
  39638. * @throws {RangeError} The start of an interval cannot be after its end
  39639. * @throws {RangeError} Date in interval cannot be `Invalid Date`
  39640. *
  39641. * @example
  39642. * // Each day between 6 October 2014 and 10 October 2014:
  39643. * const result = eachDayOfInterval({
  39644. * start: new Date(2014, 9, 6),
  39645. * end: new Date(2014, 9, 10)
  39646. * })
  39647. * //=> [
  39648. * // Mon Oct 06 2014 00:00:00,
  39649. * // Tue Oct 07 2014 00:00:00,
  39650. * // Wed Oct 08 2014 00:00:00,
  39651. * // Thu Oct 09 2014 00:00:00,
  39652. * // Fri Oct 10 2014 00:00:00
  39653. * // ]
  39654. */
  39655. function eachDayOfInterval(dirtyInterval, options) {
  39656. var _options$step;
  39657. requiredArgs(1, arguments);
  39658. var interval = dirtyInterval || {};
  39659. var startDate = toDate(interval.start);
  39660. var endDate = toDate(interval.end);
  39661. var endTime = endDate.getTime(); // Throw an exception if start date is after end date or if any date is `Invalid Date`
  39662. if (!(startDate.getTime() <= endTime)) {
  39663. throw new RangeError('Invalid interval');
  39664. }
  39665. var dates = [];
  39666. var currentDate = startDate;
  39667. currentDate.setHours(0, 0, 0, 0);
  39668. var step = Number((_options$step = options === null || options === void 0 ? void 0 : options.step) !== null && _options$step !== void 0 ? _options$step : 1);
  39669. if (step < 1 || isNaN(step)) throw new RangeError('`options.step` must be a number greater than 1');
  39670. while (currentDate.getTime() <= endTime) {
  39671. dates.push(toDate(currentDate));
  39672. currentDate.setDate(currentDate.getDate() + step);
  39673. currentDate.setHours(0, 0, 0, 0);
  39674. }
  39675. return dates;
  39676. }
  39677. /**
  39678. * @name eachMonthOfInterval
  39679. * @category Interval Helpers
  39680. * @summary Return the array of months within the specified time interval.
  39681. *
  39682. * @description
  39683. * Return the array of months within the specified time interval.
  39684. *
  39685. * @param {Interval} interval - the interval. See [Interval]{@link https://date-fns.org/docs/Interval}
  39686. * @returns {Date[]} the array with starts of months from the month of the interval start to the month of the interval end
  39687. * @throws {TypeError} 1 argument required
  39688. * @throws {RangeError} The start of an interval cannot be after its end
  39689. * @throws {RangeError} Date in interval cannot be `Invalid Date`
  39690. *
  39691. * @example
  39692. * // Each month between 6 February 2014 and 10 August 2014:
  39693. * const result = eachMonthOfInterval({
  39694. * start: new Date(2014, 1, 6),
  39695. * end: new Date(2014, 7, 10)
  39696. * })
  39697. * //=> [
  39698. * // Sat Feb 01 2014 00:00:00,
  39699. * // Sat Mar 01 2014 00:00:00,
  39700. * // Tue Apr 01 2014 00:00:00,
  39701. * // Thu May 01 2014 00:00:00,
  39702. * // Sun Jun 01 2014 00:00:00,
  39703. * // Tue Jul 01 2014 00:00:00,
  39704. * // Fri Aug 01 2014 00:00:00
  39705. * // ]
  39706. */
  39707. function eachMonthOfInterval(dirtyInterval) {
  39708. requiredArgs(1, arguments);
  39709. var interval = dirtyInterval || {};
  39710. var startDate = toDate(interval.start);
  39711. var endDate = toDate(interval.end);
  39712. var endTime = endDate.getTime();
  39713. var dates = []; // Throw an exception if start date is after end date or if any date is `Invalid Date`
  39714. if (!(startDate.getTime() <= endTime)) {
  39715. throw new RangeError('Invalid interval');
  39716. }
  39717. var currentDate = startDate;
  39718. currentDate.setHours(0, 0, 0, 0);
  39719. currentDate.setDate(1);
  39720. while (currentDate.getTime() <= endTime) {
  39721. dates.push(toDate(currentDate));
  39722. currentDate.setMonth(currentDate.getMonth() + 1);
  39723. }
  39724. return dates;
  39725. }
  39726. /**
  39727. * @name eachWeekOfInterval
  39728. * @category Interval Helpers
  39729. * @summary Return the array of weeks within the specified time interval.
  39730. *
  39731. * @description
  39732. * Return the array of weeks within the specified time interval.
  39733. *
  39734. * @param {Interval} interval - the interval. See [Interval]{@link https://date-fns.org/docs/Interval}
  39735. * @param {Object} [options] - an object with options.
  39736. * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
  39737. * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
  39738. * @returns {Date[]} the array with starts of weeks from the week of the interval start to the week of the interval end
  39739. * @throws {TypeError} 1 argument required
  39740. * @throws {RangeError} `options.weekStartsOn` must be 0, 1, ..., 6
  39741. * @throws {RangeError} The start of an interval cannot be after its end
  39742. * @throws {RangeError} Date in interval cannot be `Invalid Date`
  39743. *
  39744. * @example
  39745. * // Each week within interval 6 October 2014 - 23 November 2014:
  39746. * const result = eachWeekOfInterval({
  39747. * start: new Date(2014, 9, 6),
  39748. * end: new Date(2014, 10, 23)
  39749. * })
  39750. * //=> [
  39751. * // Sun Oct 05 2014 00:00:00,
  39752. * // Sun Oct 12 2014 00:00:00,
  39753. * // Sun Oct 19 2014 00:00:00,
  39754. * // Sun Oct 26 2014 00:00:00,
  39755. * // Sun Nov 02 2014 00:00:00,
  39756. * // Sun Nov 09 2014 00:00:00,
  39757. * // Sun Nov 16 2014 00:00:00,
  39758. * // Sun Nov 23 2014 00:00:00
  39759. * // ]
  39760. */
  39761. function eachWeekOfInterval(dirtyInterval, options) {
  39762. requiredArgs(1, arguments);
  39763. var interval = dirtyInterval || {};
  39764. var startDate = toDate(interval.start);
  39765. var endDate = toDate(interval.end);
  39766. var endTime = endDate.getTime(); // Throw an exception if start date is after end date or if any date is `Invalid Date`
  39767. if (!(startDate.getTime() <= endTime)) {
  39768. throw new RangeError('Invalid interval');
  39769. }
  39770. var startDateWeek = startOfWeek(startDate, options);
  39771. var endDateWeek = startOfWeek(endDate, options); // Some timezones switch DST at midnight, making start of day unreliable in these timezones, 3pm is a safe bet
  39772. startDateWeek.setHours(15);
  39773. endDateWeek.setHours(15);
  39774. endTime = endDateWeek.getTime();
  39775. var weeks = [];
  39776. var currentWeek = startDateWeek;
  39777. while (currentWeek.getTime() <= endTime) {
  39778. currentWeek.setHours(0);
  39779. weeks.push(toDate(currentWeek));
  39780. currentWeek = addWeeks(currentWeek, 1);
  39781. currentWeek.setHours(15);
  39782. }
  39783. return weeks;
  39784. }
  39785. /**
  39786. * @name startOfMonth
  39787. * @category Month Helpers
  39788. * @summary Return the start of a month for the given date.
  39789. *
  39790. * @description
  39791. * Return the start of a month for the given date.
  39792. * The result will be in the local timezone.
  39793. *
  39794. * @param {Date|Number} date - the original date
  39795. * @returns {Date} the start of a month
  39796. * @throws {TypeError} 1 argument required
  39797. *
  39798. * @example
  39799. * // The start of a month for 2 September 2014 11:55:00:
  39800. * const result = startOfMonth(new Date(2014, 8, 2, 11, 55, 0))
  39801. * //=> Mon Sep 01 2014 00:00:00
  39802. */
  39803. function startOfMonth(dirtyDate) {
  39804. requiredArgs(1, arguments);
  39805. var date = toDate(dirtyDate);
  39806. date.setDate(1);
  39807. date.setHours(0, 0, 0, 0);
  39808. return date;
  39809. }
  39810. /**
  39811. * @name endOfWeek
  39812. * @category Week Helpers
  39813. * @summary Return the end of a week for the given date.
  39814. *
  39815. * @description
  39816. * Return the end of a week for the given date.
  39817. * The result will be in the local timezone.
  39818. *
  39819. * @param {Date|Number} date - the original date
  39820. * @param {Object} [options] - an object with options.
  39821. * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
  39822. * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
  39823. * @returns {Date} the end of a week
  39824. * @throws {TypeError} 1 argument required
  39825. * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
  39826. *
  39827. * @example
  39828. * // The end of a week for 2 September 2014 11:55:00:
  39829. * const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0))
  39830. * //=> Sat Sep 06 2014 23:59:59.999
  39831. *
  39832. * @example
  39833. * // If the week starts on Monday, the end of the week for 2 September 2014 11:55:00:
  39834. * const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
  39835. * //=> Sun Sep 07 2014 23:59:59.999
  39836. */
  39837. function endOfWeek(dirtyDate, options) {
  39838. var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
  39839. requiredArgs(1, arguments);
  39840. var defaultOptions = getDefaultOptions();
  39841. var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
  39842. if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
  39843. throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
  39844. }
  39845. var date = toDate(dirtyDate);
  39846. var day = date.getDay();
  39847. var diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn);
  39848. date.setDate(date.getDate() + diff);
  39849. date.setHours(23, 59, 59, 999);
  39850. return date;
  39851. }
  39852. /**
  39853. * @name getDaysInMonth
  39854. * @category Month Helpers
  39855. * @summary Get the number of days in a month of the given date.
  39856. *
  39857. * @description
  39858. * Get the number of days in a month of the given date.
  39859. *
  39860. * @param {Date|Number} date - the given date
  39861. * @returns {Number} the number of days in a month
  39862. * @throws {TypeError} 1 argument required
  39863. *
  39864. * @example
  39865. * // How many days are in February 2000?
  39866. * const result = getDaysInMonth(new Date(2000, 1))
  39867. * //=> 29
  39868. */
  39869. function getDaysInMonth(dirtyDate) {
  39870. requiredArgs(1, arguments);
  39871. var date = toDate(dirtyDate);
  39872. var year = date.getFullYear();
  39873. var monthIndex = date.getMonth();
  39874. var lastDayOfMonth = new Date(0);
  39875. lastDayOfMonth.setFullYear(year, monthIndex + 1, 0);
  39876. lastDayOfMonth.setHours(0, 0, 0, 0);
  39877. return lastDayOfMonth.getDate();
  39878. }
  39879. /**
  39880. * @name isAfter
  39881. * @category Common Helpers
  39882. * @summary Is the first date after the second one?
  39883. *
  39884. * @description
  39885. * Is the first date after the second one?
  39886. *
  39887. * @param {Date|Number} date - the date that should be after the other one to return true
  39888. * @param {Date|Number} dateToCompare - the date to compare with
  39889. * @returns {Boolean} the first date is after the second date
  39890. * @throws {TypeError} 2 arguments required
  39891. *
  39892. * @example
  39893. * // Is 10 July 1989 after 11 February 1987?
  39894. * const result = isAfter(new Date(1989, 6, 10), new Date(1987, 1, 11))
  39895. * //=> true
  39896. */
  39897. function isAfter(dirtyDate, dirtyDateToCompare) {
  39898. requiredArgs(2, arguments);
  39899. var date = toDate(dirtyDate);
  39900. var dateToCompare = toDate(dirtyDateToCompare);
  39901. return date.getTime() > dateToCompare.getTime();
  39902. }
  39903. /**
  39904. * @name isBefore
  39905. * @category Common Helpers
  39906. * @summary Is the first date before the second one?
  39907. *
  39908. * @description
  39909. * Is the first date before the second one?
  39910. *
  39911. * @param {Date|Number} date - the date that should be before the other one to return true
  39912. * @param {Date|Number} dateToCompare - the date to compare with
  39913. * @returns {Boolean} the first date is before the second date
  39914. * @throws {TypeError} 2 arguments required
  39915. *
  39916. * @example
  39917. * // Is 10 July 1989 before 11 February 1987?
  39918. * const result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))
  39919. * //=> false
  39920. */
  39921. function isBefore(dirtyDate, dirtyDateToCompare) {
  39922. requiredArgs(2, arguments);
  39923. var date = toDate(dirtyDate);
  39924. var dateToCompare = toDate(dirtyDateToCompare);
  39925. return date.getTime() < dateToCompare.getTime();
  39926. }
  39927. /**
  39928. * @name isEqual
  39929. * @category Common Helpers
  39930. * @summary Are the given dates equal?
  39931. *
  39932. * @description
  39933. * Are the given dates equal?
  39934. *
  39935. * @param {Date|Number} dateLeft - the first date to compare
  39936. * @param {Date|Number} dateRight - the second date to compare
  39937. * @returns {Boolean} the dates are equal
  39938. * @throws {TypeError} 2 arguments required
  39939. *
  39940. * @example
  39941. * // Are 2 July 2014 06:30:45.000 and 2 July 2014 06:30:45.500 equal?
  39942. * const result = isEqual(
  39943. * new Date(2014, 6, 2, 6, 30, 45, 0),
  39944. * new Date(2014, 6, 2, 6, 30, 45, 500)
  39945. * )
  39946. * //=> false
  39947. */
  39948. function isEqual(dirtyLeftDate, dirtyRightDate) {
  39949. requiredArgs(2, arguments);
  39950. var dateLeft = toDate(dirtyLeftDate);
  39951. var dateRight = toDate(dirtyRightDate);
  39952. return dateLeft.getTime() === dateRight.getTime();
  39953. }
  39954. /**
  39955. * @name setMonth
  39956. * @category Month Helpers
  39957. * @summary Set the month to the given date.
  39958. *
  39959. * @description
  39960. * Set the month to the given date.
  39961. *
  39962. * @param {Date|Number} date - the date to be changed
  39963. * @param {Number} month - the month of the new date
  39964. * @returns {Date} the new date with the month set
  39965. * @throws {TypeError} 2 arguments required
  39966. *
  39967. * @example
  39968. * // Set February to 1 September 2014:
  39969. * const result = setMonth(new Date(2014, 8, 1), 1)
  39970. * //=> Sat Feb 01 2014 00:00:00
  39971. */
  39972. function setMonth(dirtyDate, dirtyMonth) {
  39973. requiredArgs(2, arguments);
  39974. var date = toDate(dirtyDate);
  39975. var month = toInteger(dirtyMonth);
  39976. var year = date.getFullYear();
  39977. var day = date.getDate();
  39978. var dateWithDesiredMonth = new Date(0);
  39979. dateWithDesiredMonth.setFullYear(year, month, 15);
  39980. dateWithDesiredMonth.setHours(0, 0, 0, 0);
  39981. var daysInMonth = getDaysInMonth(dateWithDesiredMonth); // Set the last day of the new month
  39982. // if the original date was the last day of the longer month
  39983. date.setMonth(month, Math.min(day, daysInMonth));
  39984. return date;
  39985. }
  39986. /**
  39987. * @name set
  39988. * @category Common Helpers
  39989. * @summary Set date values to a given date.
  39990. *
  39991. * @description
  39992. * Set date values to a given date.
  39993. *
  39994. * Sets time values to date from object `values`.
  39995. * A value is not set if it is undefined or null or doesn't exist in `values`.
  39996. *
  39997. * Note about bundle size: `set` does not internally use `setX` functions from date-fns but instead opts
  39998. * to use native `Date#setX` methods. If you use this function, you may not want to include the
  39999. * other `setX` functions that date-fns provides if you are concerned about the bundle size.
  40000. *
  40001. * @param {Date|Number} date - the date to be changed
  40002. * @param {Object} values - an object with options
  40003. * @param {Number} [values.year] - the number of years to be set
  40004. * @param {Number} [values.month] - the number of months to be set
  40005. * @param {Number} [values.date] - the number of days to be set
  40006. * @param {Number} [values.hours] - the number of hours to be set
  40007. * @param {Number} [values.minutes] - the number of minutes to be set
  40008. * @param {Number} [values.seconds] - the number of seconds to be set
  40009. * @param {Number} [values.milliseconds] - the number of milliseconds to be set
  40010. * @returns {Date} the new date with options set
  40011. * @throws {TypeError} 2 arguments required
  40012. * @throws {RangeError} `values` must be an object
  40013. *
  40014. * @example
  40015. * // Transform 1 September 2014 into 20 October 2015 in a single line:
  40016. * const result = set(new Date(2014, 8, 20), { year: 2015, month: 9, date: 20 })
  40017. * //=> Tue Oct 20 2015 00:00:00
  40018. *
  40019. * @example
  40020. * // Set 12 PM to 1 September 2014 01:23:45 to 1 September 2014 12:00:00:
  40021. * const result = set(new Date(2014, 8, 1, 1, 23, 45), { hours: 12 })
  40022. * //=> Mon Sep 01 2014 12:23:45
  40023. */
  40024. function set(dirtyDate, values) {
  40025. requiredArgs(2, arguments);
  40026. if (typeof values !== 'object' || values === null) {
  40027. throw new RangeError('values parameter must be an object');
  40028. }
  40029. var date = toDate(dirtyDate); // Check if date is Invalid Date because Date.prototype.setFullYear ignores the value of Invalid Date
  40030. if (isNaN(date.getTime())) {
  40031. return new Date(NaN);
  40032. }
  40033. if (values.year != null) {
  40034. date.setFullYear(values.year);
  40035. }
  40036. if (values.month != null) {
  40037. date = setMonth(date, values.month);
  40038. }
  40039. if (values.date != null) {
  40040. date.setDate(toInteger(values.date));
  40041. }
  40042. if (values.hours != null) {
  40043. date.setHours(toInteger(values.hours));
  40044. }
  40045. if (values.minutes != null) {
  40046. date.setMinutes(toInteger(values.minutes));
  40047. }
  40048. if (values.seconds != null) {
  40049. date.setSeconds(toInteger(values.seconds));
  40050. }
  40051. if (values.milliseconds != null) {
  40052. date.setMilliseconds(toInteger(values.milliseconds));
  40053. }
  40054. return date;
  40055. }
  40056. /**
  40057. * @name setYear
  40058. * @category Year Helpers
  40059. * @summary Set the year to the given date.
  40060. *
  40061. * @description
  40062. * Set the year to the given date.
  40063. *
  40064. * @param {Date|Number} date - the date to be changed
  40065. * @param {Number} year - the year of the new date
  40066. * @returns {Date} the new date with the year set
  40067. * @throws {TypeError} 2 arguments required
  40068. *
  40069. * @example
  40070. * // Set year 2013 to 1 September 2014:
  40071. * const result = setYear(new Date(2014, 8, 1), 2013)
  40072. * //=> Sun Sep 01 2013 00:00:00
  40073. */
  40074. function setYear(dirtyDate, dirtyYear) {
  40075. requiredArgs(2, arguments);
  40076. var date = toDate(dirtyDate);
  40077. var year = toInteger(dirtyYear); // Check if date is Invalid Date because Date.prototype.setFullYear ignores the value of Invalid Date
  40078. if (isNaN(date.getTime())) {
  40079. return new Date(NaN);
  40080. }
  40081. date.setFullYear(year);
  40082. return date;
  40083. }
  40084. /**
  40085. * @name startOfToday
  40086. * @category Day Helpers
  40087. * @summary Return the start of today.
  40088. * @pure false
  40089. *
  40090. * @description
  40091. * Return the start of today.
  40092. *
  40093. * > ⚠️ Please note that this function is not present in the FP submodule as
  40094. * > it uses `Date.now()` internally hence impure and can't be safely curried.
  40095. *
  40096. * @returns {Date} the start of today
  40097. *
  40098. * @example
  40099. * // If today is 6 October 2014:
  40100. * const result = startOfToday()
  40101. * //=> Mon Oct 6 2014 00:00:00
  40102. */
  40103. function startOfToday() {
  40104. return startOfDay(Date.now());
  40105. }
  40106. /**
  40107. * @name subMonths
  40108. * @category Month Helpers
  40109. * @summary Subtract the specified number of months from the given date.
  40110. *
  40111. * @description
  40112. * Subtract the specified number of months from the given date.
  40113. *
  40114. * @param {Date|Number} date - the date to be changed
  40115. * @param {Number} amount - the amount of months to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
  40116. * @returns {Date} the new date with the months subtracted
  40117. * @throws {TypeError} 2 arguments required
  40118. *
  40119. * @example
  40120. * // Subtract 5 months from 1 February 2015:
  40121. * const result = subMonths(new Date(2015, 1, 1), 5)
  40122. * //=> Mon Sep 01 2014 00:00:00
  40123. */
  40124. function subMonths(dirtyDate, dirtyAmount) {
  40125. requiredArgs(2, arguments);
  40126. var amount = toInteger(dirtyAmount);
  40127. return addMonths(dirtyDate, -amount);
  40128. }
  40129. /**
  40130. * @name subYears
  40131. * @category Year Helpers
  40132. * @summary Subtract the specified number of years from the given date.
  40133. *
  40134. * @description
  40135. * Subtract the specified number of years from the given date.
  40136. *
  40137. * @param {Date|Number} date - the date to be changed
  40138. * @param {Number} amount - the amount of years to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
  40139. * @returns {Date} the new date with the years subtracted
  40140. * @throws {TypeError} 2 arguments required
  40141. *
  40142. * @example
  40143. * // Subtract 5 years from 1 September 2014:
  40144. * const result = subYears(new Date(2014, 8, 1), 5)
  40145. * //=> Tue Sep 01 2009 00:00:00
  40146. */
  40147. function subYears(dirtyDate, dirtyAmount) {
  40148. requiredArgs(2, arguments);
  40149. var amount = toInteger(dirtyAmount);
  40150. return addYears(dirtyDate, -amount);
  40151. }
  40152. var Month;
  40153. (function (Month) {
  40154. Month[Month["JANUARY"] = 0] = "JANUARY";
  40155. Month[Month["FEBRUARY"] = 1] = "FEBRUARY";
  40156. Month[Month["MARCH"] = 2] = "MARCH";
  40157. Month[Month["APRIL"] = 3] = "APRIL";
  40158. Month[Month["MAY"] = 4] = "MAY";
  40159. Month[Month["JUNE"] = 5] = "JUNE";
  40160. Month[Month["JULY"] = 6] = "JULY";
  40161. Month[Month["AUGUST"] = 7] = "AUGUST";
  40162. Month[Month["SEPTEMBER"] = 8] = "SEPTEMBER";
  40163. Month[Month["OCTOBER"] = 9] = "OCTOBER";
  40164. Month[Month["NOVEMBER"] = 10] = "NOVEMBER";
  40165. Month[Month["DECEMBER"] = 11] = "DECEMBER";
  40166. })(Month || (Month = {}));
  40167. var Day;
  40168. (function (Day) {
  40169. Day[Day["SUNDAY"] = 0] = "SUNDAY";
  40170. Day[Day["MONDAY"] = 1] = "MONDAY";
  40171. Day[Day["TUESDAY"] = 2] = "TUESDAY";
  40172. Day[Day["WEDNESDAY"] = 3] = "WEDNESDAY";
  40173. Day[Day["THURSDAY"] = 4] = "THURSDAY";
  40174. Day[Day["FRIDAY"] = 5] = "FRIDAY";
  40175. Day[Day["SATURDAY"] = 6] = "SATURDAY";
  40176. })(Day || (Day = {}));
  40177. var inRange = function (date, min, max) {
  40178. return (isEqual(date, min) || isAfter(date, min)) && (isEqual(date, max) || isBefore(date, max));
  40179. };
  40180. var clearTime = function (date) { return set(date, { hours: 0, minutes: 0, seconds: 0, milliseconds: 0 }); };
  40181. var useLilius = function (_a) {
  40182. var _b = _a === void 0 ? {} : _a, _c = _b.weekStartsOn, weekStartsOn = _c === void 0 ? Day.SUNDAY : _c, _d = _b.viewing, initialViewing = _d === void 0 ? new Date() : _d, _e = _b.selected, initialSelected = _e === void 0 ? [] : _e, _f = _b.numberOfMonths, numberOfMonths = _f === void 0 ? 1 : _f;
  40183. var _g = (0,external_React_namespaceObject.useState)(initialViewing), viewing = _g[0], setViewing = _g[1];
  40184. var viewToday = (0,external_React_namespaceObject.useCallback)(function () { return setViewing(startOfToday()); }, [setViewing]);
  40185. var viewMonth = (0,external_React_namespaceObject.useCallback)(function (month) { return setViewing(function (v) { return setMonth(v, month); }); }, []);
  40186. var viewPreviousMonth = (0,external_React_namespaceObject.useCallback)(function () { return setViewing(function (v) { return subMonths(v, 1); }); }, []);
  40187. var viewNextMonth = (0,external_React_namespaceObject.useCallback)(function () { return setViewing(function (v) { return addMonths(v, 1); }); }, []);
  40188. var viewYear = (0,external_React_namespaceObject.useCallback)(function (year) { return setViewing(function (v) { return setYear(v, year); }); }, []);
  40189. var viewPreviousYear = (0,external_React_namespaceObject.useCallback)(function () { return setViewing(function (v) { return subYears(v, 1); }); }, []);
  40190. var viewNextYear = (0,external_React_namespaceObject.useCallback)(function () { return setViewing(function (v) { return addYears(v, 1); }); }, []);
  40191. var _h = (0,external_React_namespaceObject.useState)(initialSelected.map(clearTime)), selected = _h[0], setSelected = _h[1];
  40192. var clearSelected = function () { return setSelected([]); };
  40193. var isSelected = (0,external_React_namespaceObject.useCallback)(function (date) { return selected.findIndex(function (s) { return isEqual(s, date); }) > -1; }, [selected]);
  40194. var select = (0,external_React_namespaceObject.useCallback)(function (date, replaceExisting) {
  40195. if (replaceExisting) {
  40196. setSelected(Array.isArray(date) ? date : [date]);
  40197. }
  40198. else {
  40199. setSelected(function (selectedItems) { return selectedItems.concat(Array.isArray(date) ? date : [date]); });
  40200. }
  40201. }, []);
  40202. var deselect = (0,external_React_namespaceObject.useCallback)(function (date) {
  40203. return setSelected(function (selectedItems) {
  40204. return Array.isArray(date)
  40205. ? selectedItems.filter(function (s) { return !date.map(function (d) { return d.getTime(); }).includes(s.getTime()); })
  40206. : selectedItems.filter(function (s) { return !isEqual(s, date); });
  40207. });
  40208. }, []);
  40209. var toggle = (0,external_React_namespaceObject.useCallback)(function (date, replaceExisting) { return (isSelected(date) ? deselect(date) : select(date, replaceExisting)); }, [deselect, isSelected, select]);
  40210. var selectRange = (0,external_React_namespaceObject.useCallback)(function (start, end, replaceExisting) {
  40211. if (replaceExisting) {
  40212. setSelected(eachDayOfInterval({ start: start, end: end }));
  40213. }
  40214. else {
  40215. setSelected(function (selectedItems) { return selectedItems.concat(eachDayOfInterval({ start: start, end: end })); });
  40216. }
  40217. }, []);
  40218. var deselectRange = (0,external_React_namespaceObject.useCallback)(function (start, end) {
  40219. setSelected(function (selectedItems) {
  40220. return selectedItems.filter(function (s) {
  40221. return !eachDayOfInterval({ start: start, end: end })
  40222. .map(function (d) { return d.getTime(); })
  40223. .includes(s.getTime());
  40224. });
  40225. });
  40226. }, []);
  40227. var calendar = (0,external_React_namespaceObject.useMemo)(function () {
  40228. return eachMonthOfInterval({
  40229. start: startOfMonth(viewing),
  40230. end: endOfMonth(addMonths(viewing, numberOfMonths - 1)),
  40231. }).map(function (month) {
  40232. return eachWeekOfInterval({
  40233. start: startOfMonth(month),
  40234. end: endOfMonth(month),
  40235. }, { weekStartsOn: weekStartsOn }).map(function (week) {
  40236. return eachDayOfInterval({
  40237. start: startOfWeek(week, { weekStartsOn: weekStartsOn }),
  40238. end: endOfWeek(week, { weekStartsOn: weekStartsOn }),
  40239. });
  40240. });
  40241. });
  40242. }, [viewing, weekStartsOn, numberOfMonths]);
  40243. return {
  40244. clearTime: clearTime,
  40245. inRange: inRange,
  40246. viewing: viewing,
  40247. setViewing: setViewing,
  40248. viewToday: viewToday,
  40249. viewMonth: viewMonth,
  40250. viewPreviousMonth: viewPreviousMonth,
  40251. viewNextMonth: viewNextMonth,
  40252. viewYear: viewYear,
  40253. viewPreviousYear: viewPreviousYear,
  40254. viewNextYear: viewNextYear,
  40255. selected: selected,
  40256. setSelected: setSelected,
  40257. clearSelected: clearSelected,
  40258. isSelected: isSelected,
  40259. select: select,
  40260. deselect: deselect,
  40261. toggle: toggle,
  40262. selectRange: selectRange,
  40263. deselectRange: deselectRange,
  40264. calendar: calendar,
  40265. };
  40266. };
  40267. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/requiredArgs/index.js
  40268. function requiredArgs_requiredArgs(required, args) {
  40269. if (args.length < required) {
  40270. throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
  40271. }
  40272. }
  40273. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/toDate/index.js
  40274. function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  40275. /**
  40276. * @name toDate
  40277. * @category Common Helpers
  40278. * @summary Convert the given argument to an instance of Date.
  40279. *
  40280. * @description
  40281. * Convert the given argument to an instance of Date.
  40282. *
  40283. * If the argument is an instance of Date, the function returns its clone.
  40284. *
  40285. * If the argument is a number, it is treated as a timestamp.
  40286. *
  40287. * If the argument is none of the above, the function returns Invalid Date.
  40288. *
  40289. * **Note**: *all* Date arguments passed to any *date-fns* function is processed by `toDate`.
  40290. *
  40291. * @param {Date|Number} argument - the value to convert
  40292. * @returns {Date} the parsed date in the local time zone
  40293. * @throws {TypeError} 1 argument required
  40294. *
  40295. * @example
  40296. * // Clone the date:
  40297. * const result = toDate(new Date(2014, 1, 11, 11, 30, 30))
  40298. * //=> Tue Feb 11 2014 11:30:30
  40299. *
  40300. * @example
  40301. * // Convert the timestamp to date:
  40302. * const result = toDate(1392098430000)
  40303. * //=> Tue Feb 11 2014 11:30:30
  40304. */
  40305. function toDate_toDate(argument) {
  40306. requiredArgs_requiredArgs(1, arguments);
  40307. var argStr = Object.prototype.toString.call(argument); // Clone the date
  40308. if (argument instanceof Date || _typeof(argument) === 'object' && argStr === '[object Date]') {
  40309. // Prevent the date to lose the milliseconds when passed to new Date() in IE10
  40310. return new Date(argument.getTime());
  40311. } else if (typeof argument === 'number' || argStr === '[object Number]') {
  40312. return new Date(argument);
  40313. } else {
  40314. if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
  40315. // eslint-disable-next-line no-console
  40316. console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"); // eslint-disable-next-line no-console
  40317. console.warn(new Error().stack);
  40318. }
  40319. return new Date(NaN);
  40320. }
  40321. }
  40322. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/startOfDay/index.js
  40323. /**
  40324. * @name startOfDay
  40325. * @category Day Helpers
  40326. * @summary Return the start of a day for the given date.
  40327. *
  40328. * @description
  40329. * Return the start of a day for the given date.
  40330. * The result will be in the local timezone.
  40331. *
  40332. * @param {Date|Number} date - the original date
  40333. * @returns {Date} the start of a day
  40334. * @throws {TypeError} 1 argument required
  40335. *
  40336. * @example
  40337. * // The start of a day for 2 September 2014 11:55:00:
  40338. * const result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
  40339. * //=> Tue Sep 02 2014 00:00:00
  40340. */
  40341. function startOfDay_startOfDay(dirtyDate) {
  40342. requiredArgs_requiredArgs(1, arguments);
  40343. var date = toDate_toDate(dirtyDate);
  40344. date.setHours(0, 0, 0, 0);
  40345. return date;
  40346. }
  40347. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/toInteger/index.js
  40348. function toInteger_toInteger(dirtyNumber) {
  40349. if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
  40350. return NaN;
  40351. }
  40352. var number = Number(dirtyNumber);
  40353. if (isNaN(number)) {
  40354. return number;
  40355. }
  40356. return number < 0 ? Math.ceil(number) : Math.floor(number);
  40357. }
  40358. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/addMonths/index.js
  40359. /**
  40360. * @name addMonths
  40361. * @category Month Helpers
  40362. * @summary Add the specified number of months to the given date.
  40363. *
  40364. * @description
  40365. * Add the specified number of months to the given date.
  40366. *
  40367. * @param {Date|Number} date - the date to be changed
  40368. * @param {Number} amount - the amount of months to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
  40369. * @returns {Date} the new date with the months added
  40370. * @throws {TypeError} 2 arguments required
  40371. *
  40372. * @example
  40373. * // Add 5 months to 1 September 2014:
  40374. * const result = addMonths(new Date(2014, 8, 1), 5)
  40375. * //=> Sun Feb 01 2015 00:00:00
  40376. */
  40377. function addMonths_addMonths(dirtyDate, dirtyAmount) {
  40378. requiredArgs_requiredArgs(2, arguments);
  40379. var date = toDate_toDate(dirtyDate);
  40380. var amount = toInteger_toInteger(dirtyAmount);
  40381. if (isNaN(amount)) {
  40382. return new Date(NaN);
  40383. }
  40384. if (!amount) {
  40385. // If 0 months, no-op to avoid changing times in the hour before end of DST
  40386. return date;
  40387. }
  40388. var dayOfMonth = date.getDate(); // The JS Date object supports date math by accepting out-of-bounds values for
  40389. // month, day, etc. For example, new Date(2020, 0, 0) returns 31 Dec 2019 and
  40390. // new Date(2020, 13, 1) returns 1 Feb 2021. This is *almost* the behavior we
  40391. // want except that dates will wrap around the end of a month, meaning that
  40392. // new Date(2020, 13, 31) will return 3 Mar 2021 not 28 Feb 2021 as desired. So
  40393. // we'll default to the end of the desired month by adding 1 to the desired
  40394. // month and using a date of 0 to back up one day to the end of the desired
  40395. // month.
  40396. var endOfDesiredMonth = new Date(date.getTime());
  40397. endOfDesiredMonth.setMonth(date.getMonth() + amount + 1, 0);
  40398. var daysInMonth = endOfDesiredMonth.getDate();
  40399. if (dayOfMonth >= daysInMonth) {
  40400. // If we're already at the end of the month, then this is the correct date
  40401. // and we're done.
  40402. return endOfDesiredMonth;
  40403. } else {
  40404. // Otherwise, we now know that setting the original day-of-month value won't
  40405. // cause an overflow, so set the desired day-of-month. Note that we can't
  40406. // just set the date of `endOfDesiredMonth` because that object may have had
  40407. // its time changed in the unusual case where where a DST transition was on
  40408. // the last day of the month and its local time was in the hour skipped or
  40409. // repeated next to a DST transition. So we use `date` instead which is
  40410. // guaranteed to still have the original time.
  40411. date.setFullYear(endOfDesiredMonth.getFullYear(), endOfDesiredMonth.getMonth(), dayOfMonth);
  40412. return date;
  40413. }
  40414. }
  40415. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/subMonths/index.js
  40416. /**
  40417. * @name subMonths
  40418. * @category Month Helpers
  40419. * @summary Subtract the specified number of months from the given date.
  40420. *
  40421. * @description
  40422. * Subtract the specified number of months from the given date.
  40423. *
  40424. * @param {Date|Number} date - the date to be changed
  40425. * @param {Number} amount - the amount of months to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
  40426. * @returns {Date} the new date with the months subtracted
  40427. * @throws {TypeError} 2 arguments required
  40428. *
  40429. * @example
  40430. * // Subtract 5 months from 1 February 2015:
  40431. * const result = subMonths(new Date(2015, 1, 1), 5)
  40432. * //=> Mon Sep 01 2014 00:00:00
  40433. */
  40434. function subMonths_subMonths(dirtyDate, dirtyAmount) {
  40435. requiredArgs_requiredArgs(2, arguments);
  40436. var amount = toInteger_toInteger(dirtyAmount);
  40437. return addMonths_addMonths(dirtyDate, -amount);
  40438. }
  40439. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/isDate/index.js
  40440. function isDate_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { isDate_typeof = function _typeof(obj) { return typeof obj; }; } else { isDate_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return isDate_typeof(obj); }
  40441. /**
  40442. * @name isDate
  40443. * @category Common Helpers
  40444. * @summary Is the given value a date?
  40445. *
  40446. * @description
  40447. * Returns true if the given value is an instance of Date. The function works for dates transferred across iframes.
  40448. *
  40449. * @param {*} value - the value to check
  40450. * @returns {boolean} true if the given value is a date
  40451. * @throws {TypeError} 1 arguments required
  40452. *
  40453. * @example
  40454. * // For a valid date:
  40455. * const result = isDate(new Date())
  40456. * //=> true
  40457. *
  40458. * @example
  40459. * // For an invalid date:
  40460. * const result = isDate(new Date(NaN))
  40461. * //=> true
  40462. *
  40463. * @example
  40464. * // For some value:
  40465. * const result = isDate('2014-02-31')
  40466. * //=> false
  40467. *
  40468. * @example
  40469. * // For an object:
  40470. * const result = isDate({})
  40471. * //=> false
  40472. */
  40473. function isDate(value) {
  40474. requiredArgs_requiredArgs(1, arguments);
  40475. return value instanceof Date || isDate_typeof(value) === 'object' && Object.prototype.toString.call(value) === '[object Date]';
  40476. }
  40477. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/isValid/index.js
  40478. /**
  40479. * @name isValid
  40480. * @category Common Helpers
  40481. * @summary Is the given date valid?
  40482. *
  40483. * @description
  40484. * Returns false if argument is Invalid Date and true otherwise.
  40485. * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}
  40486. * Invalid Date is a Date, whose time value is NaN.
  40487. *
  40488. * Time value of Date: http://es5.github.io/#x15.9.1.1
  40489. *
  40490. * @param {*} date - the date to check
  40491. * @returns {Boolean} the date is valid
  40492. * @throws {TypeError} 1 argument required
  40493. *
  40494. * @example
  40495. * // For the valid date:
  40496. * const result = isValid(new Date(2014, 1, 31))
  40497. * //=> true
  40498. *
  40499. * @example
  40500. * // For the value, convertable into a date:
  40501. * const result = isValid(1393804800000)
  40502. * //=> true
  40503. *
  40504. * @example
  40505. * // For the invalid date:
  40506. * const result = isValid(new Date(''))
  40507. * //=> false
  40508. */
  40509. function isValid(dirtyDate) {
  40510. requiredArgs_requiredArgs(1, arguments);
  40511. if (!isDate(dirtyDate) && typeof dirtyDate !== 'number') {
  40512. return false;
  40513. }
  40514. var date = toDate_toDate(dirtyDate);
  40515. return !isNaN(Number(date));
  40516. }
  40517. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/addMilliseconds/index.js
  40518. /**
  40519. * @name addMilliseconds
  40520. * @category Millisecond Helpers
  40521. * @summary Add the specified number of milliseconds to the given date.
  40522. *
  40523. * @description
  40524. * Add the specified number of milliseconds to the given date.
  40525. *
  40526. * @param {Date|Number} date - the date to be changed
  40527. * @param {Number} amount - the amount of milliseconds to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
  40528. * @returns {Date} the new date with the milliseconds added
  40529. * @throws {TypeError} 2 arguments required
  40530. *
  40531. * @example
  40532. * // Add 750 milliseconds to 10 July 2014 12:45:30.000:
  40533. * const result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
  40534. * //=> Thu Jul 10 2014 12:45:30.750
  40535. */
  40536. function addMilliseconds(dirtyDate, dirtyAmount) {
  40537. requiredArgs_requiredArgs(2, arguments);
  40538. var timestamp = toDate_toDate(dirtyDate).getTime();
  40539. var amount = toInteger_toInteger(dirtyAmount);
  40540. return new Date(timestamp + amount);
  40541. }
  40542. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/subMilliseconds/index.js
  40543. /**
  40544. * @name subMilliseconds
  40545. * @category Millisecond Helpers
  40546. * @summary Subtract the specified number of milliseconds from the given date.
  40547. *
  40548. * @description
  40549. * Subtract the specified number of milliseconds from the given date.
  40550. *
  40551. * @param {Date|Number} date - the date to be changed
  40552. * @param {Number} amount - the amount of milliseconds to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
  40553. * @returns {Date} the new date with the milliseconds subtracted
  40554. * @throws {TypeError} 2 arguments required
  40555. *
  40556. * @example
  40557. * // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
  40558. * const result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
  40559. * //=> Thu Jul 10 2014 12:45:29.250
  40560. */
  40561. function subMilliseconds(dirtyDate, dirtyAmount) {
  40562. requiredArgs_requiredArgs(2, arguments);
  40563. var amount = toInteger_toInteger(dirtyAmount);
  40564. return addMilliseconds(dirtyDate, -amount);
  40565. }
  40566. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/getUTCDayOfYear/index.js
  40567. var MILLISECONDS_IN_DAY = 86400000;
  40568. function getUTCDayOfYear(dirtyDate) {
  40569. requiredArgs_requiredArgs(1, arguments);
  40570. var date = toDate_toDate(dirtyDate);
  40571. var timestamp = date.getTime();
  40572. date.setUTCMonth(0, 1);
  40573. date.setUTCHours(0, 0, 0, 0);
  40574. var startOfYearTimestamp = date.getTime();
  40575. var difference = timestamp - startOfYearTimestamp;
  40576. return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
  40577. }
  40578. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/startOfUTCISOWeek/index.js
  40579. function startOfUTCISOWeek(dirtyDate) {
  40580. requiredArgs_requiredArgs(1, arguments);
  40581. var weekStartsOn = 1;
  40582. var date = toDate_toDate(dirtyDate);
  40583. var day = date.getUTCDay();
  40584. var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
  40585. date.setUTCDate(date.getUTCDate() - diff);
  40586. date.setUTCHours(0, 0, 0, 0);
  40587. return date;
  40588. }
  40589. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/getUTCISOWeekYear/index.js
  40590. function getUTCISOWeekYear(dirtyDate) {
  40591. requiredArgs_requiredArgs(1, arguments);
  40592. var date = toDate_toDate(dirtyDate);
  40593. var year = date.getUTCFullYear();
  40594. var fourthOfJanuaryOfNextYear = new Date(0);
  40595. fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
  40596. fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
  40597. var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);
  40598. var fourthOfJanuaryOfThisYear = new Date(0);
  40599. fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
  40600. fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
  40601. var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);
  40602. if (date.getTime() >= startOfNextYear.getTime()) {
  40603. return year + 1;
  40604. } else if (date.getTime() >= startOfThisYear.getTime()) {
  40605. return year;
  40606. } else {
  40607. return year - 1;
  40608. }
  40609. }
  40610. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/startOfUTCISOWeekYear/index.js
  40611. function startOfUTCISOWeekYear(dirtyDate) {
  40612. requiredArgs_requiredArgs(1, arguments);
  40613. var year = getUTCISOWeekYear(dirtyDate);
  40614. var fourthOfJanuary = new Date(0);
  40615. fourthOfJanuary.setUTCFullYear(year, 0, 4);
  40616. fourthOfJanuary.setUTCHours(0, 0, 0, 0);
  40617. var date = startOfUTCISOWeek(fourthOfJanuary);
  40618. return date;
  40619. }
  40620. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/getUTCISOWeek/index.js
  40621. var MILLISECONDS_IN_WEEK = 604800000;
  40622. function getUTCISOWeek(dirtyDate) {
  40623. requiredArgs_requiredArgs(1, arguments);
  40624. var date = toDate_toDate(dirtyDate);
  40625. var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime(); // Round the number of days to the nearest integer
  40626. // because the number of milliseconds in a week is not constant
  40627. // (e.g. it's different in the week of the daylight saving time clock shift)
  40628. return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
  40629. }
  40630. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/defaultOptions/index.js
  40631. var defaultOptions_defaultOptions = {};
  40632. function defaultOptions_getDefaultOptions() {
  40633. return defaultOptions_defaultOptions;
  40634. }
  40635. function setDefaultOptions(newOptions) {
  40636. defaultOptions_defaultOptions = newOptions;
  40637. }
  40638. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/startOfUTCWeek/index.js
  40639. function startOfUTCWeek(dirtyDate, options) {
  40640. var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
  40641. requiredArgs_requiredArgs(1, arguments);
  40642. var defaultOptions = defaultOptions_getDefaultOptions();
  40643. var weekStartsOn = toInteger_toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
  40644. if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
  40645. throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
  40646. }
  40647. var date = toDate_toDate(dirtyDate);
  40648. var day = date.getUTCDay();
  40649. var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
  40650. date.setUTCDate(date.getUTCDate() - diff);
  40651. date.setUTCHours(0, 0, 0, 0);
  40652. return date;
  40653. }
  40654. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/getUTCWeekYear/index.js
  40655. function getUTCWeekYear(dirtyDate, options) {
  40656. var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
  40657. requiredArgs_requiredArgs(1, arguments);
  40658. var date = toDate_toDate(dirtyDate);
  40659. var year = date.getUTCFullYear();
  40660. var defaultOptions = defaultOptions_getDefaultOptions();
  40661. var firstWeekContainsDate = toInteger_toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
  40662. if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
  40663. throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
  40664. }
  40665. var firstWeekOfNextYear = new Date(0);
  40666. firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
  40667. firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
  40668. var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options);
  40669. var firstWeekOfThisYear = new Date(0);
  40670. firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
  40671. firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
  40672. var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options);
  40673. if (date.getTime() >= startOfNextYear.getTime()) {
  40674. return year + 1;
  40675. } else if (date.getTime() >= startOfThisYear.getTime()) {
  40676. return year;
  40677. } else {
  40678. return year - 1;
  40679. }
  40680. }
  40681. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/startOfUTCWeekYear/index.js
  40682. function startOfUTCWeekYear(dirtyDate, options) {
  40683. var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
  40684. requiredArgs_requiredArgs(1, arguments);
  40685. var defaultOptions = defaultOptions_getDefaultOptions();
  40686. var firstWeekContainsDate = toInteger_toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);
  40687. var year = getUTCWeekYear(dirtyDate, options);
  40688. var firstWeek = new Date(0);
  40689. firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
  40690. firstWeek.setUTCHours(0, 0, 0, 0);
  40691. var date = startOfUTCWeek(firstWeek, options);
  40692. return date;
  40693. }
  40694. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/getUTCWeek/index.js
  40695. var getUTCWeek_MILLISECONDS_IN_WEEK = 604800000;
  40696. function getUTCWeek(dirtyDate, options) {
  40697. requiredArgs_requiredArgs(1, arguments);
  40698. var date = toDate_toDate(dirtyDate);
  40699. var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime(); // Round the number of days to the nearest integer
  40700. // because the number of milliseconds in a week is not constant
  40701. // (e.g. it's different in the week of the daylight saving time clock shift)
  40702. return Math.round(diff / getUTCWeek_MILLISECONDS_IN_WEEK) + 1;
  40703. }
  40704. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/addLeadingZeros/index.js
  40705. function addLeadingZeros(number, targetLength) {
  40706. var sign = number < 0 ? '-' : '';
  40707. var output = Math.abs(number).toString();
  40708. while (output.length < targetLength) {
  40709. output = '0' + output;
  40710. }
  40711. return sign + output;
  40712. }
  40713. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/format/lightFormatters/index.js
  40714. /*
  40715. * | | Unit | | Unit |
  40716. * |-----|--------------------------------|-----|--------------------------------|
  40717. * | a | AM, PM | A* | |
  40718. * | d | Day of month | D | |
  40719. * | h | Hour [1-12] | H | Hour [0-23] |
  40720. * | m | Minute | M | Month |
  40721. * | s | Second | S | Fraction of second |
  40722. * | y | Year (abs) | Y | |
  40723. *
  40724. * Letters marked by * are not implemented but reserved by Unicode standard.
  40725. */
  40726. var formatters = {
  40727. // Year
  40728. y: function y(date, token) {
  40729. // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
  40730. // | Year | y | yy | yyy | yyyy | yyyyy |
  40731. // |----------|-------|----|-------|-------|-------|
  40732. // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
  40733. // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |
  40734. // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |
  40735. // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |
  40736. // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |
  40737. var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)
  40738. var year = signedYear > 0 ? signedYear : 1 - signedYear;
  40739. return addLeadingZeros(token === 'yy' ? year % 100 : year, token.length);
  40740. },
  40741. // Month
  40742. M: function M(date, token) {
  40743. var month = date.getUTCMonth();
  40744. return token === 'M' ? String(month + 1) : addLeadingZeros(month + 1, 2);
  40745. },
  40746. // Day of the month
  40747. d: function d(date, token) {
  40748. return addLeadingZeros(date.getUTCDate(), token.length);
  40749. },
  40750. // AM or PM
  40751. a: function a(date, token) {
  40752. var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? 'pm' : 'am';
  40753. switch (token) {
  40754. case 'a':
  40755. case 'aa':
  40756. return dayPeriodEnumValue.toUpperCase();
  40757. case 'aaa':
  40758. return dayPeriodEnumValue;
  40759. case 'aaaaa':
  40760. return dayPeriodEnumValue[0];
  40761. case 'aaaa':
  40762. default:
  40763. return dayPeriodEnumValue === 'am' ? 'a.m.' : 'p.m.';
  40764. }
  40765. },
  40766. // Hour [1-12]
  40767. h: function h(date, token) {
  40768. return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
  40769. },
  40770. // Hour [0-23]
  40771. H: function H(date, token) {
  40772. return addLeadingZeros(date.getUTCHours(), token.length);
  40773. },
  40774. // Minute
  40775. m: function m(date, token) {
  40776. return addLeadingZeros(date.getUTCMinutes(), token.length);
  40777. },
  40778. // Second
  40779. s: function s(date, token) {
  40780. return addLeadingZeros(date.getUTCSeconds(), token.length);
  40781. },
  40782. // Fraction of second
  40783. S: function S(date, token) {
  40784. var numberOfDigits = token.length;
  40785. var milliseconds = date.getUTCMilliseconds();
  40786. var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
  40787. return addLeadingZeros(fractionalSeconds, token.length);
  40788. }
  40789. };
  40790. /* harmony default export */ var lightFormatters = (formatters);
  40791. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/format/formatters/index.js
  40792. var dayPeriodEnum = {
  40793. am: 'am',
  40794. pm: 'pm',
  40795. midnight: 'midnight',
  40796. noon: 'noon',
  40797. morning: 'morning',
  40798. afternoon: 'afternoon',
  40799. evening: 'evening',
  40800. night: 'night'
  40801. };
  40802. /*
  40803. * | | Unit | | Unit |
  40804. * |-----|--------------------------------|-----|--------------------------------|
  40805. * | a | AM, PM | A* | Milliseconds in day |
  40806. * | b | AM, PM, noon, midnight | B | Flexible day period |
  40807. * | c | Stand-alone local day of week | C* | Localized hour w/ day period |
  40808. * | d | Day of month | D | Day of year |
  40809. * | e | Local day of week | E | Day of week |
  40810. * | f | | F* | Day of week in month |
  40811. * | g* | Modified Julian day | G | Era |
  40812. * | h | Hour [1-12] | H | Hour [0-23] |
  40813. * | i! | ISO day of week | I! | ISO week of year |
  40814. * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |
  40815. * | k | Hour [1-24] | K | Hour [0-11] |
  40816. * | l* | (deprecated) | L | Stand-alone month |
  40817. * | m | Minute | M | Month |
  40818. * | n | | N | |
  40819. * | o! | Ordinal number modifier | O | Timezone (GMT) |
  40820. * | p! | Long localized time | P! | Long localized date |
  40821. * | q | Stand-alone quarter | Q | Quarter |
  40822. * | r* | Related Gregorian year | R! | ISO week-numbering year |
  40823. * | s | Second | S | Fraction of second |
  40824. * | t! | Seconds timestamp | T! | Milliseconds timestamp |
  40825. * | u | Extended year | U* | Cyclic year |
  40826. * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |
  40827. * | w | Local week of year | W* | Week of month |
  40828. * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |
  40829. * | y | Year (abs) | Y | Local week-numbering year |
  40830. * | z | Timezone (specific non-locat.) | Z* | Timezone (aliases) |
  40831. *
  40832. * Letters marked by * are not implemented but reserved by Unicode standard.
  40833. *
  40834. * Letters marked by ! are non-standard, but implemented by date-fns:
  40835. * - `o` modifies the previous token to turn it into an ordinal (see `format` docs)
  40836. * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,
  40837. * i.e. 7 for Sunday, 1 for Monday, etc.
  40838. * - `I` is ISO week of year, as opposed to `w` which is local week of year.
  40839. * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.
  40840. * `R` is supposed to be used in conjunction with `I` and `i`
  40841. * for universal ISO week-numbering date, whereas
  40842. * `Y` is supposed to be used in conjunction with `w` and `e`
  40843. * for week-numbering date specific to the locale.
  40844. * - `P` is long localized date format
  40845. * - `p` is long localized time format
  40846. */
  40847. var formatters_formatters = {
  40848. // Era
  40849. G: function G(date, token, localize) {
  40850. var era = date.getUTCFullYear() > 0 ? 1 : 0;
  40851. switch (token) {
  40852. // AD, BC
  40853. case 'G':
  40854. case 'GG':
  40855. case 'GGG':
  40856. return localize.era(era, {
  40857. width: 'abbreviated'
  40858. });
  40859. // A, B
  40860. case 'GGGGG':
  40861. return localize.era(era, {
  40862. width: 'narrow'
  40863. });
  40864. // Anno Domini, Before Christ
  40865. case 'GGGG':
  40866. default:
  40867. return localize.era(era, {
  40868. width: 'wide'
  40869. });
  40870. }
  40871. },
  40872. // Year
  40873. y: function y(date, token, localize) {
  40874. // Ordinal number
  40875. if (token === 'yo') {
  40876. var signedYear = date.getUTCFullYear(); // Returns 1 for 1 BC (which is year 0 in JavaScript)
  40877. var year = signedYear > 0 ? signedYear : 1 - signedYear;
  40878. return localize.ordinalNumber(year, {
  40879. unit: 'year'
  40880. });
  40881. }
  40882. return lightFormatters.y(date, token);
  40883. },
  40884. // Local week-numbering year
  40885. Y: function Y(date, token, localize, options) {
  40886. var signedWeekYear = getUTCWeekYear(date, options); // Returns 1 for 1 BC (which is year 0 in JavaScript)
  40887. var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; // Two digit year
  40888. if (token === 'YY') {
  40889. var twoDigitYear = weekYear % 100;
  40890. return addLeadingZeros(twoDigitYear, 2);
  40891. } // Ordinal number
  40892. if (token === 'Yo') {
  40893. return localize.ordinalNumber(weekYear, {
  40894. unit: 'year'
  40895. });
  40896. } // Padding
  40897. return addLeadingZeros(weekYear, token.length);
  40898. },
  40899. // ISO week-numbering year
  40900. R: function R(date, token) {
  40901. var isoWeekYear = getUTCISOWeekYear(date); // Padding
  40902. return addLeadingZeros(isoWeekYear, token.length);
  40903. },
  40904. // Extended year. This is a single number designating the year of this calendar system.
  40905. // The main difference between `y` and `u` localizers are B.C. years:
  40906. // | Year | `y` | `u` |
  40907. // |------|-----|-----|
  40908. // | AC 1 | 1 | 1 |
  40909. // | BC 1 | 1 | 0 |
  40910. // | BC 2 | 2 | -1 |
  40911. // Also `yy` always returns the last two digits of a year,
  40912. // while `uu` pads single digit years to 2 characters and returns other years unchanged.
  40913. u: function u(date, token) {
  40914. var year = date.getUTCFullYear();
  40915. return addLeadingZeros(year, token.length);
  40916. },
  40917. // Quarter
  40918. Q: function Q(date, token, localize) {
  40919. var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
  40920. switch (token) {
  40921. // 1, 2, 3, 4
  40922. case 'Q':
  40923. return String(quarter);
  40924. // 01, 02, 03, 04
  40925. case 'QQ':
  40926. return addLeadingZeros(quarter, 2);
  40927. // 1st, 2nd, 3rd, 4th
  40928. case 'Qo':
  40929. return localize.ordinalNumber(quarter, {
  40930. unit: 'quarter'
  40931. });
  40932. // Q1, Q2, Q3, Q4
  40933. case 'QQQ':
  40934. return localize.quarter(quarter, {
  40935. width: 'abbreviated',
  40936. context: 'formatting'
  40937. });
  40938. // 1, 2, 3, 4 (narrow quarter; could be not numerical)
  40939. case 'QQQQQ':
  40940. return localize.quarter(quarter, {
  40941. width: 'narrow',
  40942. context: 'formatting'
  40943. });
  40944. // 1st quarter, 2nd quarter, ...
  40945. case 'QQQQ':
  40946. default:
  40947. return localize.quarter(quarter, {
  40948. width: 'wide',
  40949. context: 'formatting'
  40950. });
  40951. }
  40952. },
  40953. // Stand-alone quarter
  40954. q: function q(date, token, localize) {
  40955. var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
  40956. switch (token) {
  40957. // 1, 2, 3, 4
  40958. case 'q':
  40959. return String(quarter);
  40960. // 01, 02, 03, 04
  40961. case 'qq':
  40962. return addLeadingZeros(quarter, 2);
  40963. // 1st, 2nd, 3rd, 4th
  40964. case 'qo':
  40965. return localize.ordinalNumber(quarter, {
  40966. unit: 'quarter'
  40967. });
  40968. // Q1, Q2, Q3, Q4
  40969. case 'qqq':
  40970. return localize.quarter(quarter, {
  40971. width: 'abbreviated',
  40972. context: 'standalone'
  40973. });
  40974. // 1, 2, 3, 4 (narrow quarter; could be not numerical)
  40975. case 'qqqqq':
  40976. return localize.quarter(quarter, {
  40977. width: 'narrow',
  40978. context: 'standalone'
  40979. });
  40980. // 1st quarter, 2nd quarter, ...
  40981. case 'qqqq':
  40982. default:
  40983. return localize.quarter(quarter, {
  40984. width: 'wide',
  40985. context: 'standalone'
  40986. });
  40987. }
  40988. },
  40989. // Month
  40990. M: function M(date, token, localize) {
  40991. var month = date.getUTCMonth();
  40992. switch (token) {
  40993. case 'M':
  40994. case 'MM':
  40995. return lightFormatters.M(date, token);
  40996. // 1st, 2nd, ..., 12th
  40997. case 'Mo':
  40998. return localize.ordinalNumber(month + 1, {
  40999. unit: 'month'
  41000. });
  41001. // Jan, Feb, ..., Dec
  41002. case 'MMM':
  41003. return localize.month(month, {
  41004. width: 'abbreviated',
  41005. context: 'formatting'
  41006. });
  41007. // J, F, ..., D
  41008. case 'MMMMM':
  41009. return localize.month(month, {
  41010. width: 'narrow',
  41011. context: 'formatting'
  41012. });
  41013. // January, February, ..., December
  41014. case 'MMMM':
  41015. default:
  41016. return localize.month(month, {
  41017. width: 'wide',
  41018. context: 'formatting'
  41019. });
  41020. }
  41021. },
  41022. // Stand-alone month
  41023. L: function L(date, token, localize) {
  41024. var month = date.getUTCMonth();
  41025. switch (token) {
  41026. // 1, 2, ..., 12
  41027. case 'L':
  41028. return String(month + 1);
  41029. // 01, 02, ..., 12
  41030. case 'LL':
  41031. return addLeadingZeros(month + 1, 2);
  41032. // 1st, 2nd, ..., 12th
  41033. case 'Lo':
  41034. return localize.ordinalNumber(month + 1, {
  41035. unit: 'month'
  41036. });
  41037. // Jan, Feb, ..., Dec
  41038. case 'LLL':
  41039. return localize.month(month, {
  41040. width: 'abbreviated',
  41041. context: 'standalone'
  41042. });
  41043. // J, F, ..., D
  41044. case 'LLLLL':
  41045. return localize.month(month, {
  41046. width: 'narrow',
  41047. context: 'standalone'
  41048. });
  41049. // January, February, ..., December
  41050. case 'LLLL':
  41051. default:
  41052. return localize.month(month, {
  41053. width: 'wide',
  41054. context: 'standalone'
  41055. });
  41056. }
  41057. },
  41058. // Local week of year
  41059. w: function w(date, token, localize, options) {
  41060. var week = getUTCWeek(date, options);
  41061. if (token === 'wo') {
  41062. return localize.ordinalNumber(week, {
  41063. unit: 'week'
  41064. });
  41065. }
  41066. return addLeadingZeros(week, token.length);
  41067. },
  41068. // ISO week of year
  41069. I: function I(date, token, localize) {
  41070. var isoWeek = getUTCISOWeek(date);
  41071. if (token === 'Io') {
  41072. return localize.ordinalNumber(isoWeek, {
  41073. unit: 'week'
  41074. });
  41075. }
  41076. return addLeadingZeros(isoWeek, token.length);
  41077. },
  41078. // Day of the month
  41079. d: function d(date, token, localize) {
  41080. if (token === 'do') {
  41081. return localize.ordinalNumber(date.getUTCDate(), {
  41082. unit: 'date'
  41083. });
  41084. }
  41085. return lightFormatters.d(date, token);
  41086. },
  41087. // Day of year
  41088. D: function D(date, token, localize) {
  41089. var dayOfYear = getUTCDayOfYear(date);
  41090. if (token === 'Do') {
  41091. return localize.ordinalNumber(dayOfYear, {
  41092. unit: 'dayOfYear'
  41093. });
  41094. }
  41095. return addLeadingZeros(dayOfYear, token.length);
  41096. },
  41097. // Day of week
  41098. E: function E(date, token, localize) {
  41099. var dayOfWeek = date.getUTCDay();
  41100. switch (token) {
  41101. // Tue
  41102. case 'E':
  41103. case 'EE':
  41104. case 'EEE':
  41105. return localize.day(dayOfWeek, {
  41106. width: 'abbreviated',
  41107. context: 'formatting'
  41108. });
  41109. // T
  41110. case 'EEEEE':
  41111. return localize.day(dayOfWeek, {
  41112. width: 'narrow',
  41113. context: 'formatting'
  41114. });
  41115. // Tu
  41116. case 'EEEEEE':
  41117. return localize.day(dayOfWeek, {
  41118. width: 'short',
  41119. context: 'formatting'
  41120. });
  41121. // Tuesday
  41122. case 'EEEE':
  41123. default:
  41124. return localize.day(dayOfWeek, {
  41125. width: 'wide',
  41126. context: 'formatting'
  41127. });
  41128. }
  41129. },
  41130. // Local day of week
  41131. e: function e(date, token, localize, options) {
  41132. var dayOfWeek = date.getUTCDay();
  41133. var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
  41134. switch (token) {
  41135. // Numerical value (Nth day of week with current locale or weekStartsOn)
  41136. case 'e':
  41137. return String(localDayOfWeek);
  41138. // Padded numerical value
  41139. case 'ee':
  41140. return addLeadingZeros(localDayOfWeek, 2);
  41141. // 1st, 2nd, ..., 7th
  41142. case 'eo':
  41143. return localize.ordinalNumber(localDayOfWeek, {
  41144. unit: 'day'
  41145. });
  41146. case 'eee':
  41147. return localize.day(dayOfWeek, {
  41148. width: 'abbreviated',
  41149. context: 'formatting'
  41150. });
  41151. // T
  41152. case 'eeeee':
  41153. return localize.day(dayOfWeek, {
  41154. width: 'narrow',
  41155. context: 'formatting'
  41156. });
  41157. // Tu
  41158. case 'eeeeee':
  41159. return localize.day(dayOfWeek, {
  41160. width: 'short',
  41161. context: 'formatting'
  41162. });
  41163. // Tuesday
  41164. case 'eeee':
  41165. default:
  41166. return localize.day(dayOfWeek, {
  41167. width: 'wide',
  41168. context: 'formatting'
  41169. });
  41170. }
  41171. },
  41172. // Stand-alone local day of week
  41173. c: function c(date, token, localize, options) {
  41174. var dayOfWeek = date.getUTCDay();
  41175. var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
  41176. switch (token) {
  41177. // Numerical value (same as in `e`)
  41178. case 'c':
  41179. return String(localDayOfWeek);
  41180. // Padded numerical value
  41181. case 'cc':
  41182. return addLeadingZeros(localDayOfWeek, token.length);
  41183. // 1st, 2nd, ..., 7th
  41184. case 'co':
  41185. return localize.ordinalNumber(localDayOfWeek, {
  41186. unit: 'day'
  41187. });
  41188. case 'ccc':
  41189. return localize.day(dayOfWeek, {
  41190. width: 'abbreviated',
  41191. context: 'standalone'
  41192. });
  41193. // T
  41194. case 'ccccc':
  41195. return localize.day(dayOfWeek, {
  41196. width: 'narrow',
  41197. context: 'standalone'
  41198. });
  41199. // Tu
  41200. case 'cccccc':
  41201. return localize.day(dayOfWeek, {
  41202. width: 'short',
  41203. context: 'standalone'
  41204. });
  41205. // Tuesday
  41206. case 'cccc':
  41207. default:
  41208. return localize.day(dayOfWeek, {
  41209. width: 'wide',
  41210. context: 'standalone'
  41211. });
  41212. }
  41213. },
  41214. // ISO day of week
  41215. i: function i(date, token, localize) {
  41216. var dayOfWeek = date.getUTCDay();
  41217. var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
  41218. switch (token) {
  41219. // 2
  41220. case 'i':
  41221. return String(isoDayOfWeek);
  41222. // 02
  41223. case 'ii':
  41224. return addLeadingZeros(isoDayOfWeek, token.length);
  41225. // 2nd
  41226. case 'io':
  41227. return localize.ordinalNumber(isoDayOfWeek, {
  41228. unit: 'day'
  41229. });
  41230. // Tue
  41231. case 'iii':
  41232. return localize.day(dayOfWeek, {
  41233. width: 'abbreviated',
  41234. context: 'formatting'
  41235. });
  41236. // T
  41237. case 'iiiii':
  41238. return localize.day(dayOfWeek, {
  41239. width: 'narrow',
  41240. context: 'formatting'
  41241. });
  41242. // Tu
  41243. case 'iiiiii':
  41244. return localize.day(dayOfWeek, {
  41245. width: 'short',
  41246. context: 'formatting'
  41247. });
  41248. // Tuesday
  41249. case 'iiii':
  41250. default:
  41251. return localize.day(dayOfWeek, {
  41252. width: 'wide',
  41253. context: 'formatting'
  41254. });
  41255. }
  41256. },
  41257. // AM or PM
  41258. a: function a(date, token, localize) {
  41259. var hours = date.getUTCHours();
  41260. var dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
  41261. switch (token) {
  41262. case 'a':
  41263. case 'aa':
  41264. return localize.dayPeriod(dayPeriodEnumValue, {
  41265. width: 'abbreviated',
  41266. context: 'formatting'
  41267. });
  41268. case 'aaa':
  41269. return localize.dayPeriod(dayPeriodEnumValue, {
  41270. width: 'abbreviated',
  41271. context: 'formatting'
  41272. }).toLowerCase();
  41273. case 'aaaaa':
  41274. return localize.dayPeriod(dayPeriodEnumValue, {
  41275. width: 'narrow',
  41276. context: 'formatting'
  41277. });
  41278. case 'aaaa':
  41279. default:
  41280. return localize.dayPeriod(dayPeriodEnumValue, {
  41281. width: 'wide',
  41282. context: 'formatting'
  41283. });
  41284. }
  41285. },
  41286. // AM, PM, midnight, noon
  41287. b: function b(date, token, localize) {
  41288. var hours = date.getUTCHours();
  41289. var dayPeriodEnumValue;
  41290. if (hours === 12) {
  41291. dayPeriodEnumValue = dayPeriodEnum.noon;
  41292. } else if (hours === 0) {
  41293. dayPeriodEnumValue = dayPeriodEnum.midnight;
  41294. } else {
  41295. dayPeriodEnumValue = hours / 12 >= 1 ? 'pm' : 'am';
  41296. }
  41297. switch (token) {
  41298. case 'b':
  41299. case 'bb':
  41300. return localize.dayPeriod(dayPeriodEnumValue, {
  41301. width: 'abbreviated',
  41302. context: 'formatting'
  41303. });
  41304. case 'bbb':
  41305. return localize.dayPeriod(dayPeriodEnumValue, {
  41306. width: 'abbreviated',
  41307. context: 'formatting'
  41308. }).toLowerCase();
  41309. case 'bbbbb':
  41310. return localize.dayPeriod(dayPeriodEnumValue, {
  41311. width: 'narrow',
  41312. context: 'formatting'
  41313. });
  41314. case 'bbbb':
  41315. default:
  41316. return localize.dayPeriod(dayPeriodEnumValue, {
  41317. width: 'wide',
  41318. context: 'formatting'
  41319. });
  41320. }
  41321. },
  41322. // in the morning, in the afternoon, in the evening, at night
  41323. B: function B(date, token, localize) {
  41324. var hours = date.getUTCHours();
  41325. var dayPeriodEnumValue;
  41326. if (hours >= 17) {
  41327. dayPeriodEnumValue = dayPeriodEnum.evening;
  41328. } else if (hours >= 12) {
  41329. dayPeriodEnumValue = dayPeriodEnum.afternoon;
  41330. } else if (hours >= 4) {
  41331. dayPeriodEnumValue = dayPeriodEnum.morning;
  41332. } else {
  41333. dayPeriodEnumValue = dayPeriodEnum.night;
  41334. }
  41335. switch (token) {
  41336. case 'B':
  41337. case 'BB':
  41338. case 'BBB':
  41339. return localize.dayPeriod(dayPeriodEnumValue, {
  41340. width: 'abbreviated',
  41341. context: 'formatting'
  41342. });
  41343. case 'BBBBB':
  41344. return localize.dayPeriod(dayPeriodEnumValue, {
  41345. width: 'narrow',
  41346. context: 'formatting'
  41347. });
  41348. case 'BBBB':
  41349. default:
  41350. return localize.dayPeriod(dayPeriodEnumValue, {
  41351. width: 'wide',
  41352. context: 'formatting'
  41353. });
  41354. }
  41355. },
  41356. // Hour [1-12]
  41357. h: function h(date, token, localize) {
  41358. if (token === 'ho') {
  41359. var hours = date.getUTCHours() % 12;
  41360. if (hours === 0) hours = 12;
  41361. return localize.ordinalNumber(hours, {
  41362. unit: 'hour'
  41363. });
  41364. }
  41365. return lightFormatters.h(date, token);
  41366. },
  41367. // Hour [0-23]
  41368. H: function H(date, token, localize) {
  41369. if (token === 'Ho') {
  41370. return localize.ordinalNumber(date.getUTCHours(), {
  41371. unit: 'hour'
  41372. });
  41373. }
  41374. return lightFormatters.H(date, token);
  41375. },
  41376. // Hour [0-11]
  41377. K: function K(date, token, localize) {
  41378. var hours = date.getUTCHours() % 12;
  41379. if (token === 'Ko') {
  41380. return localize.ordinalNumber(hours, {
  41381. unit: 'hour'
  41382. });
  41383. }
  41384. return addLeadingZeros(hours, token.length);
  41385. },
  41386. // Hour [1-24]
  41387. k: function k(date, token, localize) {
  41388. var hours = date.getUTCHours();
  41389. if (hours === 0) hours = 24;
  41390. if (token === 'ko') {
  41391. return localize.ordinalNumber(hours, {
  41392. unit: 'hour'
  41393. });
  41394. }
  41395. return addLeadingZeros(hours, token.length);
  41396. },
  41397. // Minute
  41398. m: function m(date, token, localize) {
  41399. if (token === 'mo') {
  41400. return localize.ordinalNumber(date.getUTCMinutes(), {
  41401. unit: 'minute'
  41402. });
  41403. }
  41404. return lightFormatters.m(date, token);
  41405. },
  41406. // Second
  41407. s: function s(date, token, localize) {
  41408. if (token === 'so') {
  41409. return localize.ordinalNumber(date.getUTCSeconds(), {
  41410. unit: 'second'
  41411. });
  41412. }
  41413. return lightFormatters.s(date, token);
  41414. },
  41415. // Fraction of second
  41416. S: function S(date, token) {
  41417. return lightFormatters.S(date, token);
  41418. },
  41419. // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
  41420. X: function X(date, token, _localize, options) {
  41421. var originalDate = options._originalDate || date;
  41422. var timezoneOffset = originalDate.getTimezoneOffset();
  41423. if (timezoneOffset === 0) {
  41424. return 'Z';
  41425. }
  41426. switch (token) {
  41427. // Hours and optional minutes
  41428. case 'X':
  41429. return formatTimezoneWithOptionalMinutes(timezoneOffset);
  41430. // Hours, minutes and optional seconds without `:` delimiter
  41431. // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
  41432. // so this token always has the same output as `XX`
  41433. case 'XXXX':
  41434. case 'XX':
  41435. // Hours and minutes without `:` delimiter
  41436. return formatTimezone(timezoneOffset);
  41437. // Hours, minutes and optional seconds with `:` delimiter
  41438. // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
  41439. // so this token always has the same output as `XXX`
  41440. case 'XXXXX':
  41441. case 'XXX': // Hours and minutes with `:` delimiter
  41442. default:
  41443. return formatTimezone(timezoneOffset, ':');
  41444. }
  41445. },
  41446. // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
  41447. x: function x(date, token, _localize, options) {
  41448. var originalDate = options._originalDate || date;
  41449. var timezoneOffset = originalDate.getTimezoneOffset();
  41450. switch (token) {
  41451. // Hours and optional minutes
  41452. case 'x':
  41453. return formatTimezoneWithOptionalMinutes(timezoneOffset);
  41454. // Hours, minutes and optional seconds without `:` delimiter
  41455. // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
  41456. // so this token always has the same output as `xx`
  41457. case 'xxxx':
  41458. case 'xx':
  41459. // Hours and minutes without `:` delimiter
  41460. return formatTimezone(timezoneOffset);
  41461. // Hours, minutes and optional seconds with `:` delimiter
  41462. // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
  41463. // so this token always has the same output as `xxx`
  41464. case 'xxxxx':
  41465. case 'xxx': // Hours and minutes with `:` delimiter
  41466. default:
  41467. return formatTimezone(timezoneOffset, ':');
  41468. }
  41469. },
  41470. // Timezone (GMT)
  41471. O: function O(date, token, _localize, options) {
  41472. var originalDate = options._originalDate || date;
  41473. var timezoneOffset = originalDate.getTimezoneOffset();
  41474. switch (token) {
  41475. // Short
  41476. case 'O':
  41477. case 'OO':
  41478. case 'OOO':
  41479. return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
  41480. // Long
  41481. case 'OOOO':
  41482. default:
  41483. return 'GMT' + formatTimezone(timezoneOffset, ':');
  41484. }
  41485. },
  41486. // Timezone (specific non-location)
  41487. z: function z(date, token, _localize, options) {
  41488. var originalDate = options._originalDate || date;
  41489. var timezoneOffset = originalDate.getTimezoneOffset();
  41490. switch (token) {
  41491. // Short
  41492. case 'z':
  41493. case 'zz':
  41494. case 'zzz':
  41495. return 'GMT' + formatTimezoneShort(timezoneOffset, ':');
  41496. // Long
  41497. case 'zzzz':
  41498. default:
  41499. return 'GMT' + formatTimezone(timezoneOffset, ':');
  41500. }
  41501. },
  41502. // Seconds timestamp
  41503. t: function t(date, token, _localize, options) {
  41504. var originalDate = options._originalDate || date;
  41505. var timestamp = Math.floor(originalDate.getTime() / 1000);
  41506. return addLeadingZeros(timestamp, token.length);
  41507. },
  41508. // Milliseconds timestamp
  41509. T: function T(date, token, _localize, options) {
  41510. var originalDate = options._originalDate || date;
  41511. var timestamp = originalDate.getTime();
  41512. return addLeadingZeros(timestamp, token.length);
  41513. }
  41514. };
  41515. function formatTimezoneShort(offset, dirtyDelimiter) {
  41516. var sign = offset > 0 ? '-' : '+';
  41517. var absOffset = Math.abs(offset);
  41518. var hours = Math.floor(absOffset / 60);
  41519. var minutes = absOffset % 60;
  41520. if (minutes === 0) {
  41521. return sign + String(hours);
  41522. }
  41523. var delimiter = dirtyDelimiter || '';
  41524. return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
  41525. }
  41526. function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
  41527. if (offset % 60 === 0) {
  41528. var sign = offset > 0 ? '-' : '+';
  41529. return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
  41530. }
  41531. return formatTimezone(offset, dirtyDelimiter);
  41532. }
  41533. function formatTimezone(offset, dirtyDelimiter) {
  41534. var delimiter = dirtyDelimiter || '';
  41535. var sign = offset > 0 ? '-' : '+';
  41536. var absOffset = Math.abs(offset);
  41537. var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
  41538. var minutes = addLeadingZeros(absOffset % 60, 2);
  41539. return sign + hours + delimiter + minutes;
  41540. }
  41541. /* harmony default export */ var format_formatters = (formatters_formatters);
  41542. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/format/longFormatters/index.js
  41543. var dateLongFormatter = function dateLongFormatter(pattern, formatLong) {
  41544. switch (pattern) {
  41545. case 'P':
  41546. return formatLong.date({
  41547. width: 'short'
  41548. });
  41549. case 'PP':
  41550. return formatLong.date({
  41551. width: 'medium'
  41552. });
  41553. case 'PPP':
  41554. return formatLong.date({
  41555. width: 'long'
  41556. });
  41557. case 'PPPP':
  41558. default:
  41559. return formatLong.date({
  41560. width: 'full'
  41561. });
  41562. }
  41563. };
  41564. var timeLongFormatter = function timeLongFormatter(pattern, formatLong) {
  41565. switch (pattern) {
  41566. case 'p':
  41567. return formatLong.time({
  41568. width: 'short'
  41569. });
  41570. case 'pp':
  41571. return formatLong.time({
  41572. width: 'medium'
  41573. });
  41574. case 'ppp':
  41575. return formatLong.time({
  41576. width: 'long'
  41577. });
  41578. case 'pppp':
  41579. default:
  41580. return formatLong.time({
  41581. width: 'full'
  41582. });
  41583. }
  41584. };
  41585. var dateTimeLongFormatter = function dateTimeLongFormatter(pattern, formatLong) {
  41586. var matchResult = pattern.match(/(P+)(p+)?/) || [];
  41587. var datePattern = matchResult[1];
  41588. var timePattern = matchResult[2];
  41589. if (!timePattern) {
  41590. return dateLongFormatter(pattern, formatLong);
  41591. }
  41592. var dateTimeFormat;
  41593. switch (datePattern) {
  41594. case 'P':
  41595. dateTimeFormat = formatLong.dateTime({
  41596. width: 'short'
  41597. });
  41598. break;
  41599. case 'PP':
  41600. dateTimeFormat = formatLong.dateTime({
  41601. width: 'medium'
  41602. });
  41603. break;
  41604. case 'PPP':
  41605. dateTimeFormat = formatLong.dateTime({
  41606. width: 'long'
  41607. });
  41608. break;
  41609. case 'PPPP':
  41610. default:
  41611. dateTimeFormat = formatLong.dateTime({
  41612. width: 'full'
  41613. });
  41614. break;
  41615. }
  41616. return dateTimeFormat.replace('{{date}}', dateLongFormatter(datePattern, formatLong)).replace('{{time}}', timeLongFormatter(timePattern, formatLong));
  41617. };
  41618. var longFormatters = {
  41619. p: timeLongFormatter,
  41620. P: dateTimeLongFormatter
  41621. };
  41622. /* harmony default export */ var format_longFormatters = (longFormatters);
  41623. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js
  41624. /**
  41625. * Google Chrome as of 67.0.3396.87 introduced timezones with offset that includes seconds.
  41626. * They usually appear for dates that denote time before the timezones were introduced
  41627. * (e.g. for 'Europe/Prague' timezone the offset is GMT+00:57:44 before 1 October 1891
  41628. * and GMT+01:00:00 after that date)
  41629. *
  41630. * Date#getTimezoneOffset returns the offset in minutes and would return 57 for the example above,
  41631. * which would lead to incorrect calculations.
  41632. *
  41633. * This function returns the timezone offset in milliseconds that takes seconds in account.
  41634. */
  41635. function getTimezoneOffsetInMilliseconds(date) {
  41636. var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
  41637. utcDate.setUTCFullYear(date.getFullYear());
  41638. return date.getTime() - utcDate.getTime();
  41639. }
  41640. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/protectedTokens/index.js
  41641. var protectedDayOfYearTokens = ['D', 'DD'];
  41642. var protectedWeekYearTokens = ['YY', 'YYYY'];
  41643. function isProtectedDayOfYearToken(token) {
  41644. return protectedDayOfYearTokens.indexOf(token) !== -1;
  41645. }
  41646. function isProtectedWeekYearToken(token) {
  41647. return protectedWeekYearTokens.indexOf(token) !== -1;
  41648. }
  41649. function throwProtectedError(token, format, input) {
  41650. if (token === 'YYYY') {
  41651. throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
  41652. } else if (token === 'YY') {
  41653. throw new RangeError("Use `yy` instead of `YY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
  41654. } else if (token === 'D') {
  41655. throw new RangeError("Use `d` instead of `D` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
  41656. } else if (token === 'DD') {
  41657. throw new RangeError("Use `dd` instead of `DD` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
  41658. }
  41659. }
  41660. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/locale/en-US/_lib/formatDistance/index.js
  41661. var formatDistanceLocale = {
  41662. lessThanXSeconds: {
  41663. one: 'less than a second',
  41664. other: 'less than {{count}} seconds'
  41665. },
  41666. xSeconds: {
  41667. one: '1 second',
  41668. other: '{{count}} seconds'
  41669. },
  41670. halfAMinute: 'half a minute',
  41671. lessThanXMinutes: {
  41672. one: 'less than a minute',
  41673. other: 'less than {{count}} minutes'
  41674. },
  41675. xMinutes: {
  41676. one: '1 minute',
  41677. other: '{{count}} minutes'
  41678. },
  41679. aboutXHours: {
  41680. one: 'about 1 hour',
  41681. other: 'about {{count}} hours'
  41682. },
  41683. xHours: {
  41684. one: '1 hour',
  41685. other: '{{count}} hours'
  41686. },
  41687. xDays: {
  41688. one: '1 day',
  41689. other: '{{count}} days'
  41690. },
  41691. aboutXWeeks: {
  41692. one: 'about 1 week',
  41693. other: 'about {{count}} weeks'
  41694. },
  41695. xWeeks: {
  41696. one: '1 week',
  41697. other: '{{count}} weeks'
  41698. },
  41699. aboutXMonths: {
  41700. one: 'about 1 month',
  41701. other: 'about {{count}} months'
  41702. },
  41703. xMonths: {
  41704. one: '1 month',
  41705. other: '{{count}} months'
  41706. },
  41707. aboutXYears: {
  41708. one: 'about 1 year',
  41709. other: 'about {{count}} years'
  41710. },
  41711. xYears: {
  41712. one: '1 year',
  41713. other: '{{count}} years'
  41714. },
  41715. overXYears: {
  41716. one: 'over 1 year',
  41717. other: 'over {{count}} years'
  41718. },
  41719. almostXYears: {
  41720. one: 'almost 1 year',
  41721. other: 'almost {{count}} years'
  41722. }
  41723. };
  41724. var formatDistance = function formatDistance(token, count, options) {
  41725. var result;
  41726. var tokenValue = formatDistanceLocale[token];
  41727. if (typeof tokenValue === 'string') {
  41728. result = tokenValue;
  41729. } else if (count === 1) {
  41730. result = tokenValue.one;
  41731. } else {
  41732. result = tokenValue.other.replace('{{count}}', count.toString());
  41733. }
  41734. if (options !== null && options !== void 0 && options.addSuffix) {
  41735. if (options.comparison && options.comparison > 0) {
  41736. return 'in ' + result;
  41737. } else {
  41738. return result + ' ago';
  41739. }
  41740. }
  41741. return result;
  41742. };
  41743. /* harmony default export */ var _lib_formatDistance = (formatDistance);
  41744. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/locale/_lib/buildFormatLongFn/index.js
  41745. function buildFormatLongFn(args) {
  41746. return function () {
  41747. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  41748. // TODO: Remove String()
  41749. var width = options.width ? String(options.width) : args.defaultWidth;
  41750. var format = args.formats[width] || args.formats[args.defaultWidth];
  41751. return format;
  41752. };
  41753. }
  41754. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/locale/en-US/_lib/formatLong/index.js
  41755. var dateFormats = {
  41756. full: 'EEEE, MMMM do, y',
  41757. long: 'MMMM do, y',
  41758. medium: 'MMM d, y',
  41759. short: 'MM/dd/yyyy'
  41760. };
  41761. var timeFormats = {
  41762. full: 'h:mm:ss a zzzz',
  41763. long: 'h:mm:ss a z',
  41764. medium: 'h:mm:ss a',
  41765. short: 'h:mm a'
  41766. };
  41767. var dateTimeFormats = {
  41768. full: "{{date}} 'at' {{time}}",
  41769. long: "{{date}} 'at' {{time}}",
  41770. medium: '{{date}}, {{time}}',
  41771. short: '{{date}}, {{time}}'
  41772. };
  41773. var formatLong = {
  41774. date: buildFormatLongFn({
  41775. formats: dateFormats,
  41776. defaultWidth: 'full'
  41777. }),
  41778. time: buildFormatLongFn({
  41779. formats: timeFormats,
  41780. defaultWidth: 'full'
  41781. }),
  41782. dateTime: buildFormatLongFn({
  41783. formats: dateTimeFormats,
  41784. defaultWidth: 'full'
  41785. })
  41786. };
  41787. /* harmony default export */ var _lib_formatLong = (formatLong);
  41788. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/locale/en-US/_lib/formatRelative/index.js
  41789. var formatRelativeLocale = {
  41790. lastWeek: "'last' eeee 'at' p",
  41791. yesterday: "'yesterday at' p",
  41792. today: "'today at' p",
  41793. tomorrow: "'tomorrow at' p",
  41794. nextWeek: "eeee 'at' p",
  41795. other: 'P'
  41796. };
  41797. var formatRelative = function formatRelative(token, _date, _baseDate, _options) {
  41798. return formatRelativeLocale[token];
  41799. };
  41800. /* harmony default export */ var _lib_formatRelative = (formatRelative);
  41801. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/locale/_lib/buildLocalizeFn/index.js
  41802. function buildLocalizeFn(args) {
  41803. return function (dirtyIndex, options) {
  41804. var context = options !== null && options !== void 0 && options.context ? String(options.context) : 'standalone';
  41805. var valuesArray;
  41806. if (context === 'formatting' && args.formattingValues) {
  41807. var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
  41808. var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
  41809. valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
  41810. } else {
  41811. var _defaultWidth = args.defaultWidth;
  41812. var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
  41813. valuesArray = args.values[_width] || args.values[_defaultWidth];
  41814. }
  41815. var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex; // @ts-ignore: For some reason TypeScript just don't want to match it, no matter how hard we try. I challenge you to try to remove it!
  41816. return valuesArray[index];
  41817. };
  41818. }
  41819. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/locale/en-US/_lib/localize/index.js
  41820. var eraValues = {
  41821. narrow: ['B', 'A'],
  41822. abbreviated: ['BC', 'AD'],
  41823. wide: ['Before Christ', 'Anno Domini']
  41824. };
  41825. var quarterValues = {
  41826. narrow: ['1', '2', '3', '4'],
  41827. abbreviated: ['Q1', 'Q2', 'Q3', 'Q4'],
  41828. wide: ['1st quarter', '2nd quarter', '3rd quarter', '4th quarter']
  41829. }; // Note: in English, the names of days of the week and months are capitalized.
  41830. // If you are making a new locale based on this one, check if the same is true for the language you're working on.
  41831. // Generally, formatted dates should look like they are in the middle of a sentence,
  41832. // e.g. in Spanish language the weekdays and months should be in the lowercase.
  41833. var monthValues = {
  41834. narrow: ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
  41835. abbreviated: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
  41836. wide: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  41837. };
  41838. var dayValues = {
  41839. narrow: ['S', 'M', 'T', 'W', 'T', 'F', 'S'],
  41840. short: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
  41841. abbreviated: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
  41842. wide: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
  41843. };
  41844. var dayPeriodValues = {
  41845. narrow: {
  41846. am: 'a',
  41847. pm: 'p',
  41848. midnight: 'mi',
  41849. noon: 'n',
  41850. morning: 'morning',
  41851. afternoon: 'afternoon',
  41852. evening: 'evening',
  41853. night: 'night'
  41854. },
  41855. abbreviated: {
  41856. am: 'AM',
  41857. pm: 'PM',
  41858. midnight: 'midnight',
  41859. noon: 'noon',
  41860. morning: 'morning',
  41861. afternoon: 'afternoon',
  41862. evening: 'evening',
  41863. night: 'night'
  41864. },
  41865. wide: {
  41866. am: 'a.m.',
  41867. pm: 'p.m.',
  41868. midnight: 'midnight',
  41869. noon: 'noon',
  41870. morning: 'morning',
  41871. afternoon: 'afternoon',
  41872. evening: 'evening',
  41873. night: 'night'
  41874. }
  41875. };
  41876. var formattingDayPeriodValues = {
  41877. narrow: {
  41878. am: 'a',
  41879. pm: 'p',
  41880. midnight: 'mi',
  41881. noon: 'n',
  41882. morning: 'in the morning',
  41883. afternoon: 'in the afternoon',
  41884. evening: 'in the evening',
  41885. night: 'at night'
  41886. },
  41887. abbreviated: {
  41888. am: 'AM',
  41889. pm: 'PM',
  41890. midnight: 'midnight',
  41891. noon: 'noon',
  41892. morning: 'in the morning',
  41893. afternoon: 'in the afternoon',
  41894. evening: 'in the evening',
  41895. night: 'at night'
  41896. },
  41897. wide: {
  41898. am: 'a.m.',
  41899. pm: 'p.m.',
  41900. midnight: 'midnight',
  41901. noon: 'noon',
  41902. morning: 'in the morning',
  41903. afternoon: 'in the afternoon',
  41904. evening: 'in the evening',
  41905. night: 'at night'
  41906. }
  41907. };
  41908. var ordinalNumber = function ordinalNumber(dirtyNumber, _options) {
  41909. var number = Number(dirtyNumber); // If ordinal numbers depend on context, for example,
  41910. // if they are different for different grammatical genders,
  41911. // use `options.unit`.
  41912. //
  41913. // `unit` can be 'year', 'quarter', 'month', 'week', 'date', 'dayOfYear',
  41914. // 'day', 'hour', 'minute', 'second'.
  41915. var rem100 = number % 100;
  41916. if (rem100 > 20 || rem100 < 10) {
  41917. switch (rem100 % 10) {
  41918. case 1:
  41919. return number + 'st';
  41920. case 2:
  41921. return number + 'nd';
  41922. case 3:
  41923. return number + 'rd';
  41924. }
  41925. }
  41926. return number + 'th';
  41927. };
  41928. var localize = {
  41929. ordinalNumber: ordinalNumber,
  41930. era: buildLocalizeFn({
  41931. values: eraValues,
  41932. defaultWidth: 'wide'
  41933. }),
  41934. quarter: buildLocalizeFn({
  41935. values: quarterValues,
  41936. defaultWidth: 'wide',
  41937. argumentCallback: function argumentCallback(quarter) {
  41938. return quarter - 1;
  41939. }
  41940. }),
  41941. month: buildLocalizeFn({
  41942. values: monthValues,
  41943. defaultWidth: 'wide'
  41944. }),
  41945. day: buildLocalizeFn({
  41946. values: dayValues,
  41947. defaultWidth: 'wide'
  41948. }),
  41949. dayPeriod: buildLocalizeFn({
  41950. values: dayPeriodValues,
  41951. defaultWidth: 'wide',
  41952. formattingValues: formattingDayPeriodValues,
  41953. defaultFormattingWidth: 'wide'
  41954. })
  41955. };
  41956. /* harmony default export */ var _lib_localize = (localize);
  41957. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/locale/_lib/buildMatchFn/index.js
  41958. function buildMatchFn(args) {
  41959. return function (string) {
  41960. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  41961. var width = options.width;
  41962. var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
  41963. var matchResult = string.match(matchPattern);
  41964. if (!matchResult) {
  41965. return null;
  41966. }
  41967. var matchedString = matchResult[0];
  41968. var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
  41969. var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function (pattern) {
  41970. return pattern.test(matchedString);
  41971. }) : findKey(parsePatterns, function (pattern) {
  41972. return pattern.test(matchedString);
  41973. });
  41974. var value;
  41975. value = args.valueCallback ? args.valueCallback(key) : key;
  41976. value = options.valueCallback ? options.valueCallback(value) : value;
  41977. var rest = string.slice(matchedString.length);
  41978. return {
  41979. value: value,
  41980. rest: rest
  41981. };
  41982. };
  41983. }
  41984. function findKey(object, predicate) {
  41985. for (var key in object) {
  41986. if (object.hasOwnProperty(key) && predicate(object[key])) {
  41987. return key;
  41988. }
  41989. }
  41990. return undefined;
  41991. }
  41992. function findIndex(array, predicate) {
  41993. for (var key = 0; key < array.length; key++) {
  41994. if (predicate(array[key])) {
  41995. return key;
  41996. }
  41997. }
  41998. return undefined;
  41999. }
  42000. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/locale/_lib/buildMatchPatternFn/index.js
  42001. function buildMatchPatternFn(args) {
  42002. return function (string) {
  42003. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  42004. var matchResult = string.match(args.matchPattern);
  42005. if (!matchResult) return null;
  42006. var matchedString = matchResult[0];
  42007. var parseResult = string.match(args.parsePattern);
  42008. if (!parseResult) return null;
  42009. var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
  42010. value = options.valueCallback ? options.valueCallback(value) : value;
  42011. var rest = string.slice(matchedString.length);
  42012. return {
  42013. value: value,
  42014. rest: rest
  42015. };
  42016. };
  42017. }
  42018. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/locale/en-US/_lib/match/index.js
  42019. var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
  42020. var parseOrdinalNumberPattern = /\d+/i;
  42021. var matchEraPatterns = {
  42022. narrow: /^(b|a)/i,
  42023. abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
  42024. wide: /^(before christ|before common era|anno domini|common era)/i
  42025. };
  42026. var parseEraPatterns = {
  42027. any: [/^b/i, /^(a|c)/i]
  42028. };
  42029. var matchQuarterPatterns = {
  42030. narrow: /^[1234]/i,
  42031. abbreviated: /^q[1234]/i,
  42032. wide: /^[1234](th|st|nd|rd)? quarter/i
  42033. };
  42034. var parseQuarterPatterns = {
  42035. any: [/1/i, /2/i, /3/i, /4/i]
  42036. };
  42037. var matchMonthPatterns = {
  42038. narrow: /^[jfmasond]/i,
  42039. abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
  42040. wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
  42041. };
  42042. var parseMonthPatterns = {
  42043. narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],
  42044. any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]
  42045. };
  42046. var matchDayPatterns = {
  42047. narrow: /^[smtwf]/i,
  42048. short: /^(su|mo|tu|we|th|fr|sa)/i,
  42049. abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
  42050. wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
  42051. };
  42052. var parseDayPatterns = {
  42053. narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
  42054. any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
  42055. };
  42056. var matchDayPeriodPatterns = {
  42057. narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
  42058. any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
  42059. };
  42060. var parseDayPeriodPatterns = {
  42061. any: {
  42062. am: /^a/i,
  42063. pm: /^p/i,
  42064. midnight: /^mi/i,
  42065. noon: /^no/i,
  42066. morning: /morning/i,
  42067. afternoon: /afternoon/i,
  42068. evening: /evening/i,
  42069. night: /night/i
  42070. }
  42071. };
  42072. var match_match = {
  42073. ordinalNumber: buildMatchPatternFn({
  42074. matchPattern: matchOrdinalNumberPattern,
  42075. parsePattern: parseOrdinalNumberPattern,
  42076. valueCallback: function valueCallback(value) {
  42077. return parseInt(value, 10);
  42078. }
  42079. }),
  42080. era: buildMatchFn({
  42081. matchPatterns: matchEraPatterns,
  42082. defaultMatchWidth: 'wide',
  42083. parsePatterns: parseEraPatterns,
  42084. defaultParseWidth: 'any'
  42085. }),
  42086. quarter: buildMatchFn({
  42087. matchPatterns: matchQuarterPatterns,
  42088. defaultMatchWidth: 'wide',
  42089. parsePatterns: parseQuarterPatterns,
  42090. defaultParseWidth: 'any',
  42091. valueCallback: function valueCallback(index) {
  42092. return index + 1;
  42093. }
  42094. }),
  42095. month: buildMatchFn({
  42096. matchPatterns: matchMonthPatterns,
  42097. defaultMatchWidth: 'wide',
  42098. parsePatterns: parseMonthPatterns,
  42099. defaultParseWidth: 'any'
  42100. }),
  42101. day: buildMatchFn({
  42102. matchPatterns: matchDayPatterns,
  42103. defaultMatchWidth: 'wide',
  42104. parsePatterns: parseDayPatterns,
  42105. defaultParseWidth: 'any'
  42106. }),
  42107. dayPeriod: buildMatchFn({
  42108. matchPatterns: matchDayPeriodPatterns,
  42109. defaultMatchWidth: 'any',
  42110. parsePatterns: parseDayPeriodPatterns,
  42111. defaultParseWidth: 'any'
  42112. })
  42113. };
  42114. /* harmony default export */ var _lib_match = (match_match);
  42115. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/locale/en-US/index.js
  42116. /**
  42117. * @type {Locale}
  42118. * @category Locales
  42119. * @summary English locale (United States).
  42120. * @language English
  42121. * @iso-639-2 eng
  42122. * @author Sasha Koss [@kossnocorp]{@link https://github.com/kossnocorp}
  42123. * @author Lesha Koss [@leshakoss]{@link https://github.com/leshakoss}
  42124. */
  42125. var locale = {
  42126. code: 'en-US',
  42127. formatDistance: _lib_formatDistance,
  42128. formatLong: _lib_formatLong,
  42129. formatRelative: _lib_formatRelative,
  42130. localize: _lib_localize,
  42131. match: _lib_match,
  42132. options: {
  42133. weekStartsOn: 0
  42134. /* Sunday */
  42135. ,
  42136. firstWeekContainsDate: 1
  42137. }
  42138. };
  42139. /* harmony default export */ var en_US = (locale);
  42140. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/_lib/defaultLocale/index.js
  42141. /* harmony default export */ var defaultLocale = (en_US);
  42142. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/format/index.js
  42143. // This RegExp consists of three parts separated by `|`:
  42144. // - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token
  42145. // (one of the certain letters followed by `o`)
  42146. // - (\w)\1* matches any sequences of the same letter
  42147. // - '' matches two quote characters in a row
  42148. // - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),
  42149. // except a single quote symbol, which ends the sequence.
  42150. // Two quote characters do not end the sequence.
  42151. // If there is no matching single quote
  42152. // then the sequence will continue until the end of the string.
  42153. // - . matches any single character unmatched by previous parts of the RegExps
  42154. var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; // This RegExp catches symbols escaped by quotes, and also
  42155. // sequences of symbols P, p, and the combinations like `PPPPPPPppppp`
  42156. var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
  42157. var escapedStringRegExp = /^'([^]*?)'?$/;
  42158. var doubleQuoteRegExp = /''/g;
  42159. var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
  42160. /**
  42161. * @name format
  42162. * @category Common Helpers
  42163. * @summary Format the date.
  42164. *
  42165. * @description
  42166. * Return the formatted date string in the given format. The result may vary by locale.
  42167. *
  42168. * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
  42169. * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
  42170. *
  42171. * The characters wrapped between two single quotes characters (') are escaped.
  42172. * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
  42173. * (see the last example)
  42174. *
  42175. * Format of the string is based on Unicode Technical Standard #35:
  42176. * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
  42177. * with a few additions (see note 7 below the table).
  42178. *
  42179. * Accepted patterns:
  42180. * | Unit | Pattern | Result examples | Notes |
  42181. * |---------------------------------|---------|-----------------------------------|-------|
  42182. * | Era | G..GGG | AD, BC | |
  42183. * | | GGGG | Anno Domini, Before Christ | 2 |
  42184. * | | GGGGG | A, B | |
  42185. * | Calendar year | y | 44, 1, 1900, 2017 | 5 |
  42186. * | | yo | 44th, 1st, 0th, 17th | 5,7 |
  42187. * | | yy | 44, 01, 00, 17 | 5 |
  42188. * | | yyy | 044, 001, 1900, 2017 | 5 |
  42189. * | | yyyy | 0044, 0001, 1900, 2017 | 5 |
  42190. * | | yyyyy | ... | 3,5 |
  42191. * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |
  42192. * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |
  42193. * | | YY | 44, 01, 00, 17 | 5,8 |
  42194. * | | YYY | 044, 001, 1900, 2017 | 5 |
  42195. * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |
  42196. * | | YYYYY | ... | 3,5 |
  42197. * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |
  42198. * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |
  42199. * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |
  42200. * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |
  42201. * | | RRRRR | ... | 3,5,7 |
  42202. * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |
  42203. * | | uu | -43, 01, 1900, 2017 | 5 |
  42204. * | | uuu | -043, 001, 1900, 2017 | 5 |
  42205. * | | uuuu | -0043, 0001, 1900, 2017 | 5 |
  42206. * | | uuuuu | ... | 3,5 |
  42207. * | Quarter (formatting) | Q | 1, 2, 3, 4 | |
  42208. * | | Qo | 1st, 2nd, 3rd, 4th | 7 |
  42209. * | | QQ | 01, 02, 03, 04 | |
  42210. * | | QQQ | Q1, Q2, Q3, Q4 | |
  42211. * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
  42212. * | | QQQQQ | 1, 2, 3, 4 | 4 |
  42213. * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |
  42214. * | | qo | 1st, 2nd, 3rd, 4th | 7 |
  42215. * | | qq | 01, 02, 03, 04 | |
  42216. * | | qqq | Q1, Q2, Q3, Q4 | |
  42217. * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
  42218. * | | qqqqq | 1, 2, 3, 4 | 4 |
  42219. * | Month (formatting) | M | 1, 2, ..., 12 | |
  42220. * | | Mo | 1st, 2nd, ..., 12th | 7 |
  42221. * | | MM | 01, 02, ..., 12 | |
  42222. * | | MMM | Jan, Feb, ..., Dec | |
  42223. * | | MMMM | January, February, ..., December | 2 |
  42224. * | | MMMMM | J, F, ..., D | |
  42225. * | Month (stand-alone) | L | 1, 2, ..., 12 | |
  42226. * | | Lo | 1st, 2nd, ..., 12th | 7 |
  42227. * | | LL | 01, 02, ..., 12 | |
  42228. * | | LLL | Jan, Feb, ..., Dec | |
  42229. * | | LLLL | January, February, ..., December | 2 |
  42230. * | | LLLLL | J, F, ..., D | |
  42231. * | Local week of year | w | 1, 2, ..., 53 | |
  42232. * | | wo | 1st, 2nd, ..., 53th | 7 |
  42233. * | | ww | 01, 02, ..., 53 | |
  42234. * | ISO week of year | I | 1, 2, ..., 53 | 7 |
  42235. * | | Io | 1st, 2nd, ..., 53th | 7 |
  42236. * | | II | 01, 02, ..., 53 | 7 |
  42237. * | Day of month | d | 1, 2, ..., 31 | |
  42238. * | | do | 1st, 2nd, ..., 31st | 7 |
  42239. * | | dd | 01, 02, ..., 31 | |
  42240. * | Day of year | D | 1, 2, ..., 365, 366 | 9 |
  42241. * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |
  42242. * | | DD | 01, 02, ..., 365, 366 | 9 |
  42243. * | | DDD | 001, 002, ..., 365, 366 | |
  42244. * | | DDDD | ... | 3 |
  42245. * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |
  42246. * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
  42247. * | | EEEEE | M, T, W, T, F, S, S | |
  42248. * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
  42249. * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |
  42250. * | | io | 1st, 2nd, ..., 7th | 7 |
  42251. * | | ii | 01, 02, ..., 07 | 7 |
  42252. * | | iii | Mon, Tue, Wed, ..., Sun | 7 |
  42253. * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |
  42254. * | | iiiii | M, T, W, T, F, S, S | 7 |
  42255. * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |
  42256. * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |
  42257. * | | eo | 2nd, 3rd, ..., 1st | 7 |
  42258. * | | ee | 02, 03, ..., 01 | |
  42259. * | | eee | Mon, Tue, Wed, ..., Sun | |
  42260. * | | eeee | Monday, Tuesday, ..., Sunday | 2 |
  42261. * | | eeeee | M, T, W, T, F, S, S | |
  42262. * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
  42263. * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |
  42264. * | | co | 2nd, 3rd, ..., 1st | 7 |
  42265. * | | cc | 02, 03, ..., 01 | |
  42266. * | | ccc | Mon, Tue, Wed, ..., Sun | |
  42267. * | | cccc | Monday, Tuesday, ..., Sunday | 2 |
  42268. * | | ccccc | M, T, W, T, F, S, S | |
  42269. * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
  42270. * | AM, PM | a..aa | AM, PM | |
  42271. * | | aaa | am, pm | |
  42272. * | | aaaa | a.m., p.m. | 2 |
  42273. * | | aaaaa | a, p | |
  42274. * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |
  42275. * | | bbb | am, pm, noon, midnight | |
  42276. * | | bbbb | a.m., p.m., noon, midnight | 2 |
  42277. * | | bbbbb | a, p, n, mi | |
  42278. * | Flexible day period | B..BBB | at night, in the morning, ... | |
  42279. * | | BBBB | at night, in the morning, ... | 2 |
  42280. * | | BBBBB | at night, in the morning, ... | |
  42281. * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |
  42282. * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |
  42283. * | | hh | 01, 02, ..., 11, 12 | |
  42284. * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |
  42285. * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |
  42286. * | | HH | 00, 01, 02, ..., 23 | |
  42287. * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |
  42288. * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |
  42289. * | | KK | 01, 02, ..., 11, 00 | |
  42290. * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |
  42291. * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |
  42292. * | | kk | 24, 01, 02, ..., 23 | |
  42293. * | Minute | m | 0, 1, ..., 59 | |
  42294. * | | mo | 0th, 1st, ..., 59th | 7 |
  42295. * | | mm | 00, 01, ..., 59 | |
  42296. * | Second | s | 0, 1, ..., 59 | |
  42297. * | | so | 0th, 1st, ..., 59th | 7 |
  42298. * | | ss | 00, 01, ..., 59 | |
  42299. * | Fraction of second | S | 0, 1, ..., 9 | |
  42300. * | | SS | 00, 01, ..., 99 | |
  42301. * | | SSS | 000, 001, ..., 999 | |
  42302. * | | SSSS | ... | 3 |
  42303. * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |
  42304. * | | XX | -0800, +0530, Z | |
  42305. * | | XXX | -08:00, +05:30, Z | |
  42306. * | | XXXX | -0800, +0530, Z, +123456 | 2 |
  42307. * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
  42308. * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |
  42309. * | | xx | -0800, +0530, +0000 | |
  42310. * | | xxx | -08:00, +05:30, +00:00 | 2 |
  42311. * | | xxxx | -0800, +0530, +0000, +123456 | |
  42312. * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
  42313. * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |
  42314. * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |
  42315. * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |
  42316. * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |
  42317. * | Seconds timestamp | t | 512969520 | 7 |
  42318. * | | tt | ... | 3,7 |
  42319. * | Milliseconds timestamp | T | 512969520900 | 7 |
  42320. * | | TT | ... | 3,7 |
  42321. * | Long localized date | P | 04/29/1453 | 7 |
  42322. * | | PP | Apr 29, 1453 | 7 |
  42323. * | | PPP | April 29th, 1453 | 7 |
  42324. * | | PPPP | Friday, April 29th, 1453 | 2,7 |
  42325. * | Long localized time | p | 12:00 AM | 7 |
  42326. * | | pp | 12:00:00 AM | 7 |
  42327. * | | ppp | 12:00:00 AM GMT+2 | 7 |
  42328. * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |
  42329. * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |
  42330. * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |
  42331. * | | PPPppp | April 29th, 1453 at ... | 7 |
  42332. * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |
  42333. * Notes:
  42334. * 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
  42335. * are the same as "stand-alone" units, but are different in some languages.
  42336. * "Formatting" units are declined according to the rules of the language
  42337. * in the context of a date. "Stand-alone" units are always nominative singular:
  42338. *
  42339. * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
  42340. *
  42341. * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
  42342. *
  42343. * 2. Any sequence of the identical letters is a pattern, unless it is escaped by
  42344. * the single quote characters (see below).
  42345. * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)
  42346. * the output will be the same as default pattern for this unit, usually
  42347. * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units
  42348. * are marked with "2" in the last column of the table.
  42349. *
  42350. * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`
  42351. *
  42352. * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`
  42353. *
  42354. * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`
  42355. *
  42356. * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`
  42357. *
  42358. * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`
  42359. *
  42360. * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).
  42361. * The output will be padded with zeros to match the length of the pattern.
  42362. *
  42363. * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`
  42364. *
  42365. * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
  42366. * These tokens represent the shortest form of the quarter.
  42367. *
  42368. * 5. The main difference between `y` and `u` patterns are B.C. years:
  42369. *
  42370. * | Year | `y` | `u` |
  42371. * |------|-----|-----|
  42372. * | AC 1 | 1 | 1 |
  42373. * | BC 1 | 1 | 0 |
  42374. * | BC 2 | 2 | -1 |
  42375. *
  42376. * Also `yy` always returns the last two digits of a year,
  42377. * while `uu` pads single digit years to 2 characters and returns other years unchanged:
  42378. *
  42379. * | Year | `yy` | `uu` |
  42380. * |------|------|------|
  42381. * | 1 | 01 | 01 |
  42382. * | 14 | 14 | 14 |
  42383. * | 376 | 76 | 376 |
  42384. * | 1453 | 53 | 1453 |
  42385. *
  42386. * The same difference is true for local and ISO week-numbering years (`Y` and `R`),
  42387. * except local week-numbering years are dependent on `options.weekStartsOn`
  42388. * and `options.firstWeekContainsDate` (compare [getISOWeekYear]{@link https://date-fns.org/docs/getISOWeekYear}
  42389. * and [getWeekYear]{@link https://date-fns.org/docs/getWeekYear}).
  42390. *
  42391. * 6. Specific non-location timezones are currently unavailable in `date-fns`,
  42392. * so right now these tokens fall back to GMT timezones.
  42393. *
  42394. * 7. These patterns are not in the Unicode Technical Standard #35:
  42395. * - `i`: ISO day of week
  42396. * - `I`: ISO week of year
  42397. * - `R`: ISO week-numbering year
  42398. * - `t`: seconds timestamp
  42399. * - `T`: milliseconds timestamp
  42400. * - `o`: ordinal number modifier
  42401. * - `P`: long localized date
  42402. * - `p`: long localized time
  42403. *
  42404. * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
  42405. * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
  42406. *
  42407. * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
  42408. * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
  42409. *
  42410. * @param {Date|Number} date - the original date
  42411. * @param {String} format - the string of tokens
  42412. * @param {Object} [options] - an object with options.
  42413. * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
  42414. * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
  42415. * @param {Number} [options.firstWeekContainsDate=1] - the day of January, which is
  42416. * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;
  42417. * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
  42418. * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;
  42419. * see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
  42420. * @returns {String} the formatted date string
  42421. * @throws {TypeError} 2 arguments required
  42422. * @throws {RangeError} `date` must not be Invalid Date
  42423. * @throws {RangeError} `options.locale` must contain `localize` property
  42424. * @throws {RangeError} `options.locale` must contain `formatLong` property
  42425. * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
  42426. * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7
  42427. * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
  42428. * @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
  42429. * @throws {RangeError} use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
  42430. * @throws {RangeError} use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
  42431. * @throws {RangeError} format string contains an unescaped latin alphabet character
  42432. *
  42433. * @example
  42434. * // Represent 11 February 2014 in middle-endian format:
  42435. * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')
  42436. * //=> '02/11/2014'
  42437. *
  42438. * @example
  42439. * // Represent 2 July 2014 in Esperanto:
  42440. * import { eoLocale } from 'date-fns/locale/eo'
  42441. * const result = format(new Date(2014, 6, 2), "do 'de' MMMM yyyy", {
  42442. * locale: eoLocale
  42443. * })
  42444. * //=> '2-a de julio 2014'
  42445. *
  42446. * @example
  42447. * // Escape string by single quote characters:
  42448. * const result = format(new Date(2014, 6, 2, 15), "h 'o''clock'")
  42449. * //=> "3 o'clock"
  42450. */
  42451. function format(dirtyDate, dirtyFormatStr, options) {
  42452. var _ref, _options$locale, _ref2, _ref3, _ref4, _options$firstWeekCon, _options$locale2, _options$locale2$opti, _defaultOptions$local, _defaultOptions$local2, _ref5, _ref6, _ref7, _options$weekStartsOn, _options$locale3, _options$locale3$opti, _defaultOptions$local3, _defaultOptions$local4;
  42453. requiredArgs_requiredArgs(2, arguments);
  42454. var formatStr = String(dirtyFormatStr);
  42455. var defaultOptions = defaultOptions_getDefaultOptions();
  42456. var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : defaultLocale;
  42457. var firstWeekContainsDate = toInteger_toInteger((_ref2 = (_ref3 = (_ref4 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale2 = options.locale) === null || _options$locale2 === void 0 ? void 0 : (_options$locale2$opti = _options$locale2.options) === null || _options$locale2$opti === void 0 ? void 0 : _options$locale2$opti.firstWeekContainsDate) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : 1); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN
  42458. if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
  42459. throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');
  42460. }
  42461. var weekStartsOn = toInteger_toInteger((_ref5 = (_ref6 = (_ref7 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale3 = options.locale) === null || _options$locale3 === void 0 ? void 0 : (_options$locale3$opti = _options$locale3.options) === null || _options$locale3$opti === void 0 ? void 0 : _options$locale3$opti.weekStartsOn) !== null && _ref7 !== void 0 ? _ref7 : defaultOptions.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : (_defaultOptions$local3 = defaultOptions.locale) === null || _defaultOptions$local3 === void 0 ? void 0 : (_defaultOptions$local4 = _defaultOptions$local3.options) === null || _defaultOptions$local4 === void 0 ? void 0 : _defaultOptions$local4.weekStartsOn) !== null && _ref5 !== void 0 ? _ref5 : 0); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
  42462. if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
  42463. throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
  42464. }
  42465. if (!locale.localize) {
  42466. throw new RangeError('locale must contain localize property');
  42467. }
  42468. if (!locale.formatLong) {
  42469. throw new RangeError('locale must contain formatLong property');
  42470. }
  42471. var originalDate = toDate_toDate(dirtyDate);
  42472. if (!isValid(originalDate)) {
  42473. throw new RangeError('Invalid time value');
  42474. } // Convert the date in system timezone to the same date in UTC+00:00 timezone.
  42475. // This ensures that when UTC functions will be implemented, locales will be compatible with them.
  42476. // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/376
  42477. var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
  42478. var utcDate = subMilliseconds(originalDate, timezoneOffset);
  42479. var formatterOptions = {
  42480. firstWeekContainsDate: firstWeekContainsDate,
  42481. weekStartsOn: weekStartsOn,
  42482. locale: locale,
  42483. _originalDate: originalDate
  42484. };
  42485. var result = formatStr.match(longFormattingTokensRegExp).map(function (substring) {
  42486. var firstCharacter = substring[0];
  42487. if (firstCharacter === 'p' || firstCharacter === 'P') {
  42488. var longFormatter = format_longFormatters[firstCharacter];
  42489. return longFormatter(substring, locale.formatLong);
  42490. }
  42491. return substring;
  42492. }).join('').match(formattingTokensRegExp).map(function (substring) {
  42493. // Replace two single quote characters with one single quote character
  42494. if (substring === "''") {
  42495. return "'";
  42496. }
  42497. var firstCharacter = substring[0];
  42498. if (firstCharacter === "'") {
  42499. return cleanEscapedString(substring);
  42500. }
  42501. var formatter = format_formatters[firstCharacter];
  42502. if (formatter) {
  42503. if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(substring)) {
  42504. throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
  42505. }
  42506. if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(substring)) {
  42507. throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
  42508. }
  42509. return formatter(utcDate, substring, locale.localize, formatterOptions);
  42510. }
  42511. if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
  42512. throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');
  42513. }
  42514. return substring;
  42515. }).join('');
  42516. return result;
  42517. }
  42518. function cleanEscapedString(input) {
  42519. var matched = input.match(escapedStringRegExp);
  42520. if (!matched) {
  42521. return input;
  42522. }
  42523. return matched[1].replace(doubleQuoteRegExp, "'");
  42524. }
  42525. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/isSameMonth/index.js
  42526. /**
  42527. * @name isSameMonth
  42528. * @category Month Helpers
  42529. * @summary Are the given dates in the same month (and year)?
  42530. *
  42531. * @description
  42532. * Are the given dates in the same month (and year)?
  42533. *
  42534. * @param {Date|Number} dateLeft - the first date to check
  42535. * @param {Date|Number} dateRight - the second date to check
  42536. * @returns {Boolean} the dates are in the same month (and year)
  42537. * @throws {TypeError} 2 arguments required
  42538. *
  42539. * @example
  42540. * // Are 2 September 2014 and 25 September 2014 in the same month?
  42541. * const result = isSameMonth(new Date(2014, 8, 2), new Date(2014, 8, 25))
  42542. * //=> true
  42543. *
  42544. * @example
  42545. * // Are 2 September 2014 and 25 September 2015 in the same month?
  42546. * const result = isSameMonth(new Date(2014, 8, 2), new Date(2015, 8, 25))
  42547. * //=> false
  42548. */
  42549. function isSameMonth(dirtyDateLeft, dirtyDateRight) {
  42550. requiredArgs_requiredArgs(2, arguments);
  42551. var dateLeft = toDate_toDate(dirtyDateLeft);
  42552. var dateRight = toDate_toDate(dirtyDateRight);
  42553. return dateLeft.getFullYear() === dateRight.getFullYear() && dateLeft.getMonth() === dateRight.getMonth();
  42554. }
  42555. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/isEqual/index.js
  42556. /**
  42557. * @name isEqual
  42558. * @category Common Helpers
  42559. * @summary Are the given dates equal?
  42560. *
  42561. * @description
  42562. * Are the given dates equal?
  42563. *
  42564. * @param {Date|Number} dateLeft - the first date to compare
  42565. * @param {Date|Number} dateRight - the second date to compare
  42566. * @returns {Boolean} the dates are equal
  42567. * @throws {TypeError} 2 arguments required
  42568. *
  42569. * @example
  42570. * // Are 2 July 2014 06:30:45.000 and 2 July 2014 06:30:45.500 equal?
  42571. * const result = isEqual(
  42572. * new Date(2014, 6, 2, 6, 30, 45, 0),
  42573. * new Date(2014, 6, 2, 6, 30, 45, 500)
  42574. * )
  42575. * //=> false
  42576. */
  42577. function isEqual_isEqual(dirtyLeftDate, dirtyRightDate) {
  42578. requiredArgs_requiredArgs(2, arguments);
  42579. var dateLeft = toDate_toDate(dirtyLeftDate);
  42580. var dateRight = toDate_toDate(dirtyRightDate);
  42581. return dateLeft.getTime() === dateRight.getTime();
  42582. }
  42583. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/isSameDay/index.js
  42584. /**
  42585. * @name isSameDay
  42586. * @category Day Helpers
  42587. * @summary Are the given dates in the same day (and year and month)?
  42588. *
  42589. * @description
  42590. * Are the given dates in the same day (and year and month)?
  42591. *
  42592. * @param {Date|Number} dateLeft - the first date to check
  42593. * @param {Date|Number} dateRight - the second date to check
  42594. * @returns {Boolean} the dates are in the same day (and year and month)
  42595. * @throws {TypeError} 2 arguments required
  42596. *
  42597. * @example
  42598. * // Are 4 September 06:00:00 and 4 September 18:00:00 in the same day?
  42599. * const result = isSameDay(new Date(2014, 8, 4, 6, 0), new Date(2014, 8, 4, 18, 0))
  42600. * //=> true
  42601. *
  42602. * @example
  42603. * // Are 4 September and 4 October in the same day?
  42604. * const result = isSameDay(new Date(2014, 8, 4), new Date(2014, 9, 4))
  42605. * //=> false
  42606. *
  42607. * @example
  42608. * // Are 4 September, 2014 and 4 September, 2015 in the same day?
  42609. * const result = isSameDay(new Date(2014, 8, 4), new Date(2015, 8, 4))
  42610. * //=> false
  42611. */
  42612. function isSameDay(dirtyDateLeft, dirtyDateRight) {
  42613. requiredArgs_requiredArgs(2, arguments);
  42614. var dateLeftStartOfDay = startOfDay_startOfDay(dirtyDateLeft);
  42615. var dateRightStartOfDay = startOfDay_startOfDay(dirtyDateRight);
  42616. return dateLeftStartOfDay.getTime() === dateRightStartOfDay.getTime();
  42617. }
  42618. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/addDays/index.js
  42619. /**
  42620. * @name addDays
  42621. * @category Day Helpers
  42622. * @summary Add the specified number of days to the given date.
  42623. *
  42624. * @description
  42625. * Add the specified number of days to the given date.
  42626. *
  42627. * @param {Date|Number} date - the date to be changed
  42628. * @param {Number} amount - the amount of days to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
  42629. * @returns {Date} - the new date with the days added
  42630. * @throws {TypeError} - 2 arguments required
  42631. *
  42632. * @example
  42633. * // Add 10 days to 1 September 2014:
  42634. * const result = addDays(new Date(2014, 8, 1), 10)
  42635. * //=> Thu Sep 11 2014 00:00:00
  42636. */
  42637. function addDays_addDays(dirtyDate, dirtyAmount) {
  42638. requiredArgs_requiredArgs(2, arguments);
  42639. var date = toDate_toDate(dirtyDate);
  42640. var amount = toInteger_toInteger(dirtyAmount);
  42641. if (isNaN(amount)) {
  42642. return new Date(NaN);
  42643. }
  42644. if (!amount) {
  42645. // If 0 days, no-op to avoid changing times in the hour before end of DST
  42646. return date;
  42647. }
  42648. date.setDate(date.getDate() + amount);
  42649. return date;
  42650. }
  42651. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/addWeeks/index.js
  42652. /**
  42653. * @name addWeeks
  42654. * @category Week Helpers
  42655. * @summary Add the specified number of weeks to the given date.
  42656. *
  42657. * @description
  42658. * Add the specified number of week to the given date.
  42659. *
  42660. * @param {Date|Number} date - the date to be changed
  42661. * @param {Number} amount - the amount of weeks to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
  42662. * @returns {Date} the new date with the weeks added
  42663. * @throws {TypeError} 2 arguments required
  42664. *
  42665. * @example
  42666. * // Add 4 weeks to 1 September 2014:
  42667. * const result = addWeeks(new Date(2014, 8, 1), 4)
  42668. * //=> Mon Sep 29 2014 00:00:00
  42669. */
  42670. function addWeeks_addWeeks(dirtyDate, dirtyAmount) {
  42671. requiredArgs_requiredArgs(2, arguments);
  42672. var amount = toInteger_toInteger(dirtyAmount);
  42673. var days = amount * 7;
  42674. return addDays_addDays(dirtyDate, days);
  42675. }
  42676. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/subWeeks/index.js
  42677. /**
  42678. * @name subWeeks
  42679. * @category Week Helpers
  42680. * @summary Subtract the specified number of weeks from the given date.
  42681. *
  42682. * @description
  42683. * Subtract the specified number of weeks from the given date.
  42684. *
  42685. * @param {Date|Number} date - the date to be changed
  42686. * @param {Number} amount - the amount of weeks to be subtracted. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.
  42687. * @returns {Date} the new date with the weeks subtracted
  42688. * @throws {TypeError} 2 arguments required
  42689. *
  42690. * @example
  42691. * // Subtract 4 weeks from 1 September 2014:
  42692. * const result = subWeeks(new Date(2014, 8, 1), 4)
  42693. * //=> Mon Aug 04 2014 00:00:00
  42694. */
  42695. function subWeeks(dirtyDate, dirtyAmount) {
  42696. requiredArgs_requiredArgs(2, arguments);
  42697. var amount = toInteger_toInteger(dirtyAmount);
  42698. return addWeeks_addWeeks(dirtyDate, -amount);
  42699. }
  42700. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/startOfWeek/index.js
  42701. /**
  42702. * @name startOfWeek
  42703. * @category Week Helpers
  42704. * @summary Return the start of a week for the given date.
  42705. *
  42706. * @description
  42707. * Return the start of a week for the given date.
  42708. * The result will be in the local timezone.
  42709. *
  42710. * @param {Date|Number} date - the original date
  42711. * @param {Object} [options] - an object with options.
  42712. * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
  42713. * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
  42714. * @returns {Date} the start of a week
  42715. * @throws {TypeError} 1 argument required
  42716. * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
  42717. *
  42718. * @example
  42719. * // The start of a week for 2 September 2014 11:55:00:
  42720. * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))
  42721. * //=> Sun Aug 31 2014 00:00:00
  42722. *
  42723. * @example
  42724. * // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:
  42725. * const result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
  42726. * //=> Mon Sep 01 2014 00:00:00
  42727. */
  42728. function startOfWeek_startOfWeek(dirtyDate, options) {
  42729. var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
  42730. requiredArgs_requiredArgs(1, arguments);
  42731. var defaultOptions = defaultOptions_getDefaultOptions();
  42732. var weekStartsOn = toInteger_toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
  42733. if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
  42734. throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
  42735. }
  42736. var date = toDate_toDate(dirtyDate);
  42737. var day = date.getDay();
  42738. var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
  42739. date.setDate(date.getDate() - diff);
  42740. date.setHours(0, 0, 0, 0);
  42741. return date;
  42742. }
  42743. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/endOfWeek/index.js
  42744. /**
  42745. * @name endOfWeek
  42746. * @category Week Helpers
  42747. * @summary Return the end of a week for the given date.
  42748. *
  42749. * @description
  42750. * Return the end of a week for the given date.
  42751. * The result will be in the local timezone.
  42752. *
  42753. * @param {Date|Number} date - the original date
  42754. * @param {Object} [options] - an object with options.
  42755. * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
  42756. * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
  42757. * @returns {Date} the end of a week
  42758. * @throws {TypeError} 1 argument required
  42759. * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
  42760. *
  42761. * @example
  42762. * // The end of a week for 2 September 2014 11:55:00:
  42763. * const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0))
  42764. * //=> Sat Sep 06 2014 23:59:59.999
  42765. *
  42766. * @example
  42767. * // If the week starts on Monday, the end of the week for 2 September 2014 11:55:00:
  42768. * const result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0), { weekStartsOn: 1 })
  42769. * //=> Sun Sep 07 2014 23:59:59.999
  42770. */
  42771. function endOfWeek_endOfWeek(dirtyDate, options) {
  42772. var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
  42773. requiredArgs_requiredArgs(1, arguments);
  42774. var defaultOptions = defaultOptions_getDefaultOptions();
  42775. var weekStartsOn = toInteger_toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN
  42776. if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
  42777. throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');
  42778. }
  42779. var date = toDate_toDate(dirtyDate);
  42780. var day = date.getDay();
  42781. var diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn);
  42782. date.setDate(date.getDate() + diff);
  42783. date.setHours(23, 59, 59, 999);
  42784. return date;
  42785. }
  42786. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/arrow-right.js
  42787. /**
  42788. * WordPress dependencies
  42789. */
  42790. const arrowRight = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  42791. xmlns: "http://www.w3.org/2000/svg",
  42792. viewBox: "0 0 24 24"
  42793. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  42794. d: "M14.3 6.7l-1.1 1.1 4 4H4v1.5h13.3l-4.1 4.4 1.1 1.1 5.8-6.3z"
  42795. }));
  42796. /* harmony default export */ var arrow_right = (arrowRight);
  42797. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/arrow-left.js
  42798. /**
  42799. * WordPress dependencies
  42800. */
  42801. const arrowLeft = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  42802. xmlns: "http://www.w3.org/2000/svg",
  42803. viewBox: "0 0 24 24"
  42804. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  42805. d: "M20 10.8H6.7l4.1-4.5-1.1-1.1-5.8 6.3 5.8 5.8 1.1-1.1-4-3.9H20z"
  42806. }));
  42807. /* harmony default export */ var arrow_left = (arrowLeft);
  42808. ;// CONCATENATED MODULE: external ["wp","date"]
  42809. var external_wp_date_namespaceObject = window["wp"]["date"];
  42810. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/date-time/date/styles.js
  42811. function date_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)."; }
  42812. /**
  42813. * External dependencies
  42814. */
  42815. /**
  42816. * Internal dependencies
  42817. */
  42818. const styles_Wrapper = emotion_styled_base_browser_esm("div", true ? {
  42819. target: "e105ri6r5"
  42820. } : 0)( true ? {
  42821. name: "1khn195",
  42822. styles: "box-sizing:border-box"
  42823. } : 0);
  42824. const Navigator = /*#__PURE__*/emotion_styled_base_browser_esm(h_stack_component, true ? {
  42825. target: "e105ri6r4"
  42826. } : 0)("margin-bottom:", space(4), ";" + ( true ? "" : 0));
  42827. const NavigatorHeading = /*#__PURE__*/emotion_styled_base_browser_esm(heading_component, true ? {
  42828. target: "e105ri6r3"
  42829. } : 0)("font-size:", config_values.fontSize, ";font-weight:", config_values.fontWeight, ";strong{font-weight:", config_values.fontWeightHeading, ";}" + ( true ? "" : 0));
  42830. const Calendar = emotion_styled_base_browser_esm("div", true ? {
  42831. target: "e105ri6r2"
  42832. } : 0)("column-gap:", space(2), ";display:grid;grid-template-columns:0.5fr repeat( 5, 1fr ) 0.5fr;justify-items:center;row-gap:", space(2), ";" + ( true ? "" : 0));
  42833. const DayOfWeek = emotion_styled_base_browser_esm("div", true ? {
  42834. target: "e105ri6r1"
  42835. } : 0)("color:", COLORS.gray[700], ";font-size:", config_values.fontSize, ";line-height:", config_values.fontLineHeightBase, ";&:nth-of-type( 1 ){justify-self:start;}&:nth-of-type( 7 ){justify-self:end;}" + ( true ? "" : 0));
  42836. const DayButton = /*#__PURE__*/emotion_styled_base_browser_esm(build_module_button, true ? {
  42837. shouldForwardProp: prop => !['column', 'isSelected', 'isToday', 'hasEvents'].includes(prop),
  42838. target: "e105ri6r0"
  42839. } : 0)("grid-column:", props => props.column, ";position:relative;justify-content:center;", props => props.column === 1 && `
  42840. justify-self: start;
  42841. `, " ", props => props.column === 7 && `
  42842. justify-self: end;
  42843. `, " ", props => props.disabled && `
  42844. pointer-events: none;
  42845. `, " &&&{border-radius:100%;height:", space(7), ";width:", space(7), ";", props => props.isSelected && `
  42846. background: ${COLORS.ui.theme};
  42847. color: ${COLORS.white};
  42848. `, " ", props => !props.isSelected && props.isToday && `
  42849. background: ${COLORS.gray[200]};
  42850. `, ";}", props => props.hasEvents && `
  42851. ::before {
  42852. background: ${props.isSelected ? COLORS.white : COLORS.ui.theme};
  42853. border-radius: 2px;
  42854. bottom: 0;
  42855. content: " ";
  42856. height: 4px;
  42857. left: 50%;
  42858. margin-left: -2px;
  42859. position: absolute;
  42860. width: 4px;
  42861. }
  42862. `, ";" + ( true ? "" : 0));
  42863. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/date-time/utils.js
  42864. /**
  42865. * External dependencies
  42866. */
  42867. /**
  42868. * Like date-fn's toDate, but tries to guess the format when a string is
  42869. * given.
  42870. *
  42871. * @param input Value to turn into a date.
  42872. */
  42873. function inputToDate(input) {
  42874. if (typeof input === 'string') {
  42875. return new Date(input);
  42876. }
  42877. return toDate_toDate(input);
  42878. }
  42879. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/date-time/constants.js
  42880. const TIMEZONELESS_FORMAT = "yyyy-MM-dd'T'HH:mm:ss";
  42881. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/date-time/date/index.js
  42882. /**
  42883. * External dependencies
  42884. */
  42885. /**
  42886. * WordPress dependencies
  42887. */
  42888. /**
  42889. * Internal dependencies
  42890. */
  42891. /**
  42892. * DatePicker is a React component that renders a calendar for date selection.
  42893. *
  42894. * ```jsx
  42895. * import { DatePicker } from '@wordpress/components';
  42896. * import { useState } from '@wordpress/element';
  42897. *
  42898. * const MyDatePicker = () => {
  42899. * const [ date, setDate ] = useState( new Date() );
  42900. *
  42901. * return (
  42902. * <DatePicker
  42903. * currentDate={ date }
  42904. * onChange={ ( newDate ) => setDate( newDate ) }
  42905. * />
  42906. * );
  42907. * };
  42908. * ```
  42909. */
  42910. function DatePicker(_ref) {
  42911. let {
  42912. currentDate,
  42913. onChange,
  42914. events = [],
  42915. isInvalidDate,
  42916. onMonthPreviewed,
  42917. startOfWeek: weekStartsOn = 0
  42918. } = _ref;
  42919. const date = currentDate ? inputToDate(currentDate) : new Date();
  42920. const {
  42921. calendar,
  42922. viewing,
  42923. setSelected,
  42924. setViewing,
  42925. isSelected,
  42926. viewPreviousMonth,
  42927. viewNextMonth
  42928. } = useLilius({
  42929. selected: [startOfDay_startOfDay(date)],
  42930. viewing: startOfDay_startOfDay(date),
  42931. weekStartsOn
  42932. }); // Used to implement a roving tab index. Tracks the day that receives focus
  42933. // when the user tabs into the calendar.
  42934. const [focusable, setFocusable] = (0,external_wp_element_namespaceObject.useState)(startOfDay_startOfDay(date)); // Allows us to only programmatically focus() a day when focus was already
  42935. // within the calendar. This stops us stealing focus from e.g. a TimePicker
  42936. // input.
  42937. const [isFocusWithinCalendar, setIsFocusWithinCalendar] = (0,external_wp_element_namespaceObject.useState)(false); // Update internal state when currentDate prop changes.
  42938. const [prevCurrentDate, setPrevCurrentDate] = (0,external_wp_element_namespaceObject.useState)(currentDate);
  42939. if (currentDate !== prevCurrentDate) {
  42940. setPrevCurrentDate(currentDate);
  42941. setSelected([startOfDay_startOfDay(date)]);
  42942. setViewing(startOfDay_startOfDay(date));
  42943. setFocusable(startOfDay_startOfDay(date));
  42944. }
  42945. return (0,external_wp_element_namespaceObject.createElement)(styles_Wrapper, {
  42946. className: "components-datetime__date",
  42947. role: "application",
  42948. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Calendar')
  42949. }, (0,external_wp_element_namespaceObject.createElement)(Navigator, null, (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  42950. icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? arrow_right : arrow_left,
  42951. variant: "tertiary",
  42952. "aria-label": (0,external_wp_i18n_namespaceObject.__)('View previous month'),
  42953. onClick: () => {
  42954. viewPreviousMonth();
  42955. setFocusable(subMonths_subMonths(focusable, 1));
  42956. onMonthPreviewed === null || onMonthPreviewed === void 0 ? void 0 : onMonthPreviewed(format(subMonths_subMonths(viewing, 1), TIMEZONELESS_FORMAT));
  42957. }
  42958. }), (0,external_wp_element_namespaceObject.createElement)(NavigatorHeading, {
  42959. level: 3
  42960. }, (0,external_wp_element_namespaceObject.createElement)("strong", null, (0,external_wp_date_namespaceObject.dateI18n)('F', viewing, -viewing.getTimezoneOffset())), ' ', (0,external_wp_date_namespaceObject.dateI18n)('Y', viewing, -viewing.getTimezoneOffset())), (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  42961. icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? arrow_left : arrow_right,
  42962. variant: "tertiary",
  42963. "aria-label": (0,external_wp_i18n_namespaceObject.__)('View next month'),
  42964. onClick: () => {
  42965. viewNextMonth();
  42966. setFocusable(addMonths_addMonths(focusable, 1));
  42967. onMonthPreviewed === null || onMonthPreviewed === void 0 ? void 0 : onMonthPreviewed(format(addMonths_addMonths(viewing, 1), TIMEZONELESS_FORMAT));
  42968. }
  42969. })), (0,external_wp_element_namespaceObject.createElement)(Calendar, {
  42970. onFocus: () => setIsFocusWithinCalendar(true),
  42971. onBlur: () => setIsFocusWithinCalendar(false)
  42972. }, calendar[0][0].map(day => (0,external_wp_element_namespaceObject.createElement)(DayOfWeek, {
  42973. key: day.toString()
  42974. }, (0,external_wp_date_namespaceObject.dateI18n)('D', day, -day.getTimezoneOffset()))), calendar[0].map(week => week.map((day, index) => {
  42975. if (!isSameMonth(day, viewing)) {
  42976. return null;
  42977. }
  42978. return (0,external_wp_element_namespaceObject.createElement)(date_Day, {
  42979. key: day.toString(),
  42980. day: day,
  42981. column: index + 1,
  42982. isSelected: isSelected(day),
  42983. isFocusable: isEqual_isEqual(day, focusable),
  42984. isFocusAllowed: isFocusWithinCalendar,
  42985. isToday: isSameDay(day, new Date()),
  42986. isInvalid: isInvalidDate ? isInvalidDate(day) : false,
  42987. numEvents: events.filter(event => isSameDay(event.date, day)).length,
  42988. onClick: () => {
  42989. setSelected([day]);
  42990. setFocusable(day);
  42991. onChange === null || onChange === void 0 ? void 0 : onChange(format( // Don't change the selected date's time fields.
  42992. new Date(day.getFullYear(), day.getMonth(), day.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()), TIMEZONELESS_FORMAT));
  42993. },
  42994. onKeyDown: event => {
  42995. let nextFocusable;
  42996. if (event.key === 'ArrowLeft') {
  42997. nextFocusable = addDays_addDays(day, (0,external_wp_i18n_namespaceObject.isRTL)() ? 1 : -1);
  42998. }
  42999. if (event.key === 'ArrowRight') {
  43000. nextFocusable = addDays_addDays(day, (0,external_wp_i18n_namespaceObject.isRTL)() ? -1 : 1);
  43001. }
  43002. if (event.key === 'ArrowUp') {
  43003. nextFocusable = subWeeks(day, 1);
  43004. }
  43005. if (event.key === 'ArrowDown') {
  43006. nextFocusable = addWeeks_addWeeks(day, 1);
  43007. }
  43008. if (event.key === 'PageUp') {
  43009. nextFocusable = subMonths_subMonths(day, 1);
  43010. }
  43011. if (event.key === 'PageDown') {
  43012. nextFocusable = addMonths_addMonths(day, 1);
  43013. }
  43014. if (event.key === 'Home') {
  43015. nextFocusable = startOfWeek_startOfWeek(day);
  43016. }
  43017. if (event.key === 'End') {
  43018. nextFocusable = startOfDay_startOfDay(endOfWeek_endOfWeek(day));
  43019. }
  43020. if (nextFocusable) {
  43021. event.preventDefault();
  43022. setFocusable(nextFocusable);
  43023. if (!isSameMonth(nextFocusable, viewing)) {
  43024. setViewing(nextFocusable);
  43025. onMonthPreviewed === null || onMonthPreviewed === void 0 ? void 0 : onMonthPreviewed(format(nextFocusable, TIMEZONELESS_FORMAT));
  43026. }
  43027. }
  43028. }
  43029. });
  43030. }))));
  43031. }
  43032. function date_Day(_ref2) {
  43033. let {
  43034. day,
  43035. column,
  43036. isSelected,
  43037. isFocusable,
  43038. isFocusAllowed,
  43039. isToday,
  43040. isInvalid,
  43041. numEvents,
  43042. onClick,
  43043. onKeyDown
  43044. } = _ref2;
  43045. const ref = (0,external_wp_element_namespaceObject.useRef)(); // Focus the day when it becomes focusable, e.g. because an arrow key is
  43046. // pressed. Only do this if focus is allowed - this stops us stealing focus
  43047. // from e.g. a TimePicker input.
  43048. (0,external_wp_element_namespaceObject.useEffect)(() => {
  43049. if (ref.current && isFocusable && isFocusAllowed) {
  43050. ref.current.focus();
  43051. } // isFocusAllowed is not a dep as there is no point calling focus() on
  43052. // an already focused element.
  43053. // eslint-disable-next-line react-hooks/exhaustive-deps
  43054. }, [isFocusable]);
  43055. return (0,external_wp_element_namespaceObject.createElement)(DayButton, {
  43056. ref: ref,
  43057. className: "components-datetime__date__day" // Unused, for backwards compatibility.
  43058. ,
  43059. disabled: isInvalid,
  43060. tabIndex: isFocusable ? 0 : -1,
  43061. "aria-label": getDayLabel(day, isSelected, numEvents),
  43062. column: column,
  43063. isSelected: isSelected,
  43064. isToday: isToday,
  43065. hasEvents: numEvents > 0,
  43066. onClick: onClick,
  43067. onKeyDown: onKeyDown
  43068. }, (0,external_wp_date_namespaceObject.dateI18n)('j', day, -day.getTimezoneOffset()));
  43069. }
  43070. function getDayLabel(date, isSelected, numEvents) {
  43071. const {
  43072. formats
  43073. } = (0,external_wp_date_namespaceObject.getSettings)();
  43074. const localizedDate = (0,external_wp_date_namespaceObject.dateI18n)(formats.date, date, -date.getTimezoneOffset());
  43075. if (isSelected && numEvents > 0) {
  43076. return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: The calendar date. 2: Number of events on the calendar date.
  43077. (0,external_wp_i18n_namespaceObject._n)('%1$s. Selected. There is %2$d event', '%1$s. Selected. There are %2$d events', numEvents), localizedDate, numEvents);
  43078. } else if (isSelected) {
  43079. return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The calendar date.
  43080. (0,external_wp_i18n_namespaceObject.__)('%1$s. Selected'), localizedDate);
  43081. } else if (numEvents > 0) {
  43082. return (0,external_wp_i18n_namespaceObject.sprintf)( // translators: 1: The calendar date. 2: Number of events on the calendar date.
  43083. (0,external_wp_i18n_namespaceObject._n)('%1$s. There is %2$d event', '%1$s. There are %2$d events', numEvents), localizedDate, numEvents);
  43084. }
  43085. return localizedDate;
  43086. }
  43087. /* harmony default export */ var date = (DatePicker);
  43088. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/startOfMinute/index.js
  43089. /**
  43090. * @name startOfMinute
  43091. * @category Minute Helpers
  43092. * @summary Return the start of a minute for the given date.
  43093. *
  43094. * @description
  43095. * Return the start of a minute for the given date.
  43096. * The result will be in the local timezone.
  43097. *
  43098. * @param {Date|Number} date - the original date
  43099. * @returns {Date} the start of a minute
  43100. * @throws {TypeError} 1 argument required
  43101. *
  43102. * @example
  43103. * // The start of a minute for 1 December 2014 22:15:45.400:
  43104. * const result = startOfMinute(new Date(2014, 11, 1, 22, 15, 45, 400))
  43105. * //=> Mon Dec 01 2014 22:15:00
  43106. */
  43107. function startOfMinute(dirtyDate) {
  43108. requiredArgs_requiredArgs(1, arguments);
  43109. var date = toDate_toDate(dirtyDate);
  43110. date.setSeconds(0, 0);
  43111. return date;
  43112. }
  43113. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/getDaysInMonth/index.js
  43114. /**
  43115. * @name getDaysInMonth
  43116. * @category Month Helpers
  43117. * @summary Get the number of days in a month of the given date.
  43118. *
  43119. * @description
  43120. * Get the number of days in a month of the given date.
  43121. *
  43122. * @param {Date|Number} date - the given date
  43123. * @returns {Number} the number of days in a month
  43124. * @throws {TypeError} 1 argument required
  43125. *
  43126. * @example
  43127. * // How many days are in February 2000?
  43128. * const result = getDaysInMonth(new Date(2000, 1))
  43129. * //=> 29
  43130. */
  43131. function getDaysInMonth_getDaysInMonth(dirtyDate) {
  43132. requiredArgs_requiredArgs(1, arguments);
  43133. var date = toDate_toDate(dirtyDate);
  43134. var year = date.getFullYear();
  43135. var monthIndex = date.getMonth();
  43136. var lastDayOfMonth = new Date(0);
  43137. lastDayOfMonth.setFullYear(year, monthIndex + 1, 0);
  43138. lastDayOfMonth.setHours(0, 0, 0, 0);
  43139. return lastDayOfMonth.getDate();
  43140. }
  43141. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/setMonth/index.js
  43142. /**
  43143. * @name setMonth
  43144. * @category Month Helpers
  43145. * @summary Set the month to the given date.
  43146. *
  43147. * @description
  43148. * Set the month to the given date.
  43149. *
  43150. * @param {Date|Number} date - the date to be changed
  43151. * @param {Number} month - the month of the new date
  43152. * @returns {Date} the new date with the month set
  43153. * @throws {TypeError} 2 arguments required
  43154. *
  43155. * @example
  43156. * // Set February to 1 September 2014:
  43157. * const result = setMonth(new Date(2014, 8, 1), 1)
  43158. * //=> Sat Feb 01 2014 00:00:00
  43159. */
  43160. function setMonth_setMonth(dirtyDate, dirtyMonth) {
  43161. requiredArgs_requiredArgs(2, arguments);
  43162. var date = toDate_toDate(dirtyDate);
  43163. var month = toInteger_toInteger(dirtyMonth);
  43164. var year = date.getFullYear();
  43165. var day = date.getDate();
  43166. var dateWithDesiredMonth = new Date(0);
  43167. dateWithDesiredMonth.setFullYear(year, month, 15);
  43168. dateWithDesiredMonth.setHours(0, 0, 0, 0);
  43169. var daysInMonth = getDaysInMonth_getDaysInMonth(dateWithDesiredMonth); // Set the last day of the new month
  43170. // if the original date was the last day of the longer month
  43171. date.setMonth(month, Math.min(day, daysInMonth));
  43172. return date;
  43173. }
  43174. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/set/index.js
  43175. function set_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { set_typeof = function _typeof(obj) { return typeof obj; }; } else { set_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return set_typeof(obj); }
  43176. /**
  43177. * @name set
  43178. * @category Common Helpers
  43179. * @summary Set date values to a given date.
  43180. *
  43181. * @description
  43182. * Set date values to a given date.
  43183. *
  43184. * Sets time values to date from object `values`.
  43185. * A value is not set if it is undefined or null or doesn't exist in `values`.
  43186. *
  43187. * Note about bundle size: `set` does not internally use `setX` functions from date-fns but instead opts
  43188. * to use native `Date#setX` methods. If you use this function, you may not want to include the
  43189. * other `setX` functions that date-fns provides if you are concerned about the bundle size.
  43190. *
  43191. * @param {Date|Number} date - the date to be changed
  43192. * @param {Object} values - an object with options
  43193. * @param {Number} [values.year] - the number of years to be set
  43194. * @param {Number} [values.month] - the number of months to be set
  43195. * @param {Number} [values.date] - the number of days to be set
  43196. * @param {Number} [values.hours] - the number of hours to be set
  43197. * @param {Number} [values.minutes] - the number of minutes to be set
  43198. * @param {Number} [values.seconds] - the number of seconds to be set
  43199. * @param {Number} [values.milliseconds] - the number of milliseconds to be set
  43200. * @returns {Date} the new date with options set
  43201. * @throws {TypeError} 2 arguments required
  43202. * @throws {RangeError} `values` must be an object
  43203. *
  43204. * @example
  43205. * // Transform 1 September 2014 into 20 October 2015 in a single line:
  43206. * const result = set(new Date(2014, 8, 20), { year: 2015, month: 9, date: 20 })
  43207. * //=> Tue Oct 20 2015 00:00:00
  43208. *
  43209. * @example
  43210. * // Set 12 PM to 1 September 2014 01:23:45 to 1 September 2014 12:00:00:
  43211. * const result = set(new Date(2014, 8, 1, 1, 23, 45), { hours: 12 })
  43212. * //=> Mon Sep 01 2014 12:23:45
  43213. */
  43214. function set_set(dirtyDate, values) {
  43215. requiredArgs_requiredArgs(2, arguments);
  43216. if (set_typeof(values) !== 'object' || values === null) {
  43217. throw new RangeError('values parameter must be an object');
  43218. }
  43219. var date = toDate_toDate(dirtyDate); // Check if date is Invalid Date because Date.prototype.setFullYear ignores the value of Invalid Date
  43220. if (isNaN(date.getTime())) {
  43221. return new Date(NaN);
  43222. }
  43223. if (values.year != null) {
  43224. date.setFullYear(values.year);
  43225. }
  43226. if (values.month != null) {
  43227. date = setMonth_setMonth(date, values.month);
  43228. }
  43229. if (values.date != null) {
  43230. date.setDate(toInteger_toInteger(values.date));
  43231. }
  43232. if (values.hours != null) {
  43233. date.setHours(toInteger_toInteger(values.hours));
  43234. }
  43235. if (values.minutes != null) {
  43236. date.setMinutes(toInteger_toInteger(values.minutes));
  43237. }
  43238. if (values.seconds != null) {
  43239. date.setSeconds(toInteger_toInteger(values.seconds));
  43240. }
  43241. if (values.milliseconds != null) {
  43242. date.setMilliseconds(toInteger_toInteger(values.milliseconds));
  43243. }
  43244. return date;
  43245. }
  43246. ;// CONCATENATED MODULE: ./node_modules/date-fns/esm/setHours/index.js
  43247. /**
  43248. * @name setHours
  43249. * @category Hour Helpers
  43250. * @summary Set the hours to the given date.
  43251. *
  43252. * @description
  43253. * Set the hours to the given date.
  43254. *
  43255. * @param {Date|Number} date - the date to be changed
  43256. * @param {Number} hours - the hours of the new date
  43257. * @returns {Date} the new date with the hours set
  43258. * @throws {TypeError} 2 arguments required
  43259. *
  43260. * @example
  43261. * // Set 4 hours to 1 September 2014 11:30:00:
  43262. * const result = setHours(new Date(2014, 8, 1, 11, 30), 4)
  43263. * //=> Mon Sep 01 2014 04:30:00
  43264. */
  43265. function setHours(dirtyDate, dirtyHours) {
  43266. requiredArgs_requiredArgs(2, arguments);
  43267. var date = toDate_toDate(dirtyDate);
  43268. var hours = toInteger_toInteger(dirtyHours);
  43269. date.setHours(hours);
  43270. return date;
  43271. }
  43272. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/date-time/time/styles.js
  43273. function time_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)."; }
  43274. /**
  43275. * External dependencies
  43276. */
  43277. /**
  43278. * Internal dependencies
  43279. */
  43280. const time_styles_Wrapper = emotion_styled_base_browser_esm("div", true ? {
  43281. target: "evcr23110"
  43282. } : 0)("box-sizing:border-box;font-size:", config_values.fontSize, ";" + ( true ? "" : 0));
  43283. const Fieldset = emotion_styled_base_browser_esm("fieldset", true ? {
  43284. target: "evcr2319"
  43285. } : 0)("border:0;margin:0 0 ", space(2 * 2), " 0;padding:0;&:last-child{margin-bottom:0;}" + ( true ? "" : 0));
  43286. const TimeWrapper = emotion_styled_base_browser_esm("div", true ? {
  43287. target: "evcr2318"
  43288. } : 0)( true ? {
  43289. name: "pd0mhc",
  43290. styles: "direction:ltr;display:flex"
  43291. } : 0);
  43292. const baseInput = /*#__PURE__*/emotion_react_browser_esm_css("&&& ", Input, "{padding-left:", space(2), ";padding-right:", space(2), ";text-align:center;}" + ( true ? "" : 0), true ? "" : 0);
  43293. const HoursInput = /*#__PURE__*/emotion_styled_base_browser_esm(number_control, true ? {
  43294. target: "evcr2317"
  43295. } : 0)(baseInput, " width:", space(9), ";&&& ", Input, "{padding-right:0;}&&& ", BackdropUI, "{border-right:0;border-top-right-radius:0;border-bottom-right-radius:0;}" + ( true ? "" : 0));
  43296. const TimeSeparator = emotion_styled_base_browser_esm("span", true ? {
  43297. target: "evcr2316"
  43298. } : 0)("border-top:", config_values.borderWidth, " solid ", COLORS.gray[700], ";border-bottom:", config_values.borderWidth, " solid ", COLORS.gray[700], ";line-height:calc(\n\t\t", config_values.controlHeight, " - ", config_values.borderWidth, " * 2\n\t);display:inline-block;" + ( true ? "" : 0));
  43299. const MinutesInput = /*#__PURE__*/emotion_styled_base_browser_esm(number_control, true ? {
  43300. target: "evcr2315"
  43301. } : 0)(baseInput, " width:", space(9), ";&&& ", Input, "{padding-left:0;}&&& ", BackdropUI, "{border-left:0;border-top-left-radius:0;border-bottom-left-radius:0;}" + ( true ? "" : 0)); // Ideally we wouldn't need a wrapper, but can't otherwise target the
  43302. // <BaseControl> in <SelectControl>
  43303. const MonthSelectWrapper = emotion_styled_base_browser_esm("div", true ? {
  43304. target: "evcr2314"
  43305. } : 0)( true ? {
  43306. name: "1ff36h2",
  43307. styles: "flex-grow:1"
  43308. } : 0);
  43309. const MonthSelect = /*#__PURE__*/emotion_styled_base_browser_esm(select_control, true ? {
  43310. target: "evcr2313"
  43311. } : 0)("height:36px;", Select, "{line-height:30px;}" + ( true ? "" : 0));
  43312. const DayInput = /*#__PURE__*/emotion_styled_base_browser_esm(number_control, true ? {
  43313. target: "evcr2312"
  43314. } : 0)(baseInput, " width:", space(9), ";" + ( true ? "" : 0));
  43315. const YearInput = /*#__PURE__*/emotion_styled_base_browser_esm(number_control, true ? {
  43316. target: "evcr2311"
  43317. } : 0)(baseInput, " width:", space(14), ";" + ( true ? "" : 0));
  43318. const TimeZone = emotion_styled_base_browser_esm("div", true ? {
  43319. target: "evcr2310"
  43320. } : 0)( true ? {
  43321. name: "ebu3jh",
  43322. styles: "text-decoration:underline dotted"
  43323. } : 0);
  43324. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/date-time/time/timezone.js
  43325. /**
  43326. * WordPress dependencies
  43327. */
  43328. /**
  43329. * Internal dependencies
  43330. */
  43331. /**
  43332. * Displays timezone information when user timezone is different from site
  43333. * timezone.
  43334. */
  43335. const timezone_TimeZone = () => {
  43336. const {
  43337. timezone
  43338. } = (0,external_wp_date_namespaceObject.getSettings)(); // Convert timezone offset to hours.
  43339. const userTimezoneOffset = -1 * (new Date().getTimezoneOffset() / 60); // System timezone and user timezone match, nothing needed.
  43340. // Compare as numbers because it comes over as string.
  43341. if (Number(timezone.offset) === userTimezoneOffset) {
  43342. return null;
  43343. }
  43344. const offsetSymbol = Number(timezone.offset) >= 0 ? '+' : '';
  43345. const zoneAbbr = '' !== timezone.abbr && isNaN(Number(timezone.abbr)) ? timezone.abbr : `UTC${offsetSymbol}${timezone.offset}`;
  43346. const timezoneDetail = 'UTC' === timezone.string ? (0,external_wp_i18n_namespaceObject.__)('Coordinated Universal Time') : `(${zoneAbbr}) ${timezone.string.replace('_', ' ')}`;
  43347. return (0,external_wp_element_namespaceObject.createElement)(tooltip, {
  43348. position: "top center",
  43349. text: timezoneDetail
  43350. }, (0,external_wp_element_namespaceObject.createElement)(TimeZone, {
  43351. className: "components-datetime__timezone"
  43352. }, zoneAbbr));
  43353. };
  43354. /* harmony default export */ var timezone = (timezone_TimeZone);
  43355. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/date-time/time/index.js
  43356. /**
  43357. * External dependencies
  43358. */
  43359. /**
  43360. * WordPress dependencies
  43361. */
  43362. /**
  43363. * Internal dependencies
  43364. */
  43365. function from12hTo24h(hours, isPm) {
  43366. return isPm ? (hours % 12 + 12) % 24 : hours % 12;
  43367. }
  43368. /**
  43369. * Creates an InputControl reducer used to pad an input so that it is always a
  43370. * given width. For example, the hours and minutes inputs are padded to 2 so
  43371. * that '4' appears as '04'.
  43372. *
  43373. * @param pad How many digits the value should be.
  43374. */
  43375. function buildPadInputStateReducer(pad) {
  43376. return (state, action) => {
  43377. const nextState = { ...state
  43378. };
  43379. if (action.type === COMMIT || action.type === PRESS_UP || action.type === PRESS_DOWN) {
  43380. if (nextState.value !== undefined) {
  43381. nextState.value = nextState.value.toString().padStart(pad, '0');
  43382. }
  43383. }
  43384. return nextState;
  43385. };
  43386. }
  43387. /**
  43388. * TimePicker is a React component that renders a clock for time selection.
  43389. *
  43390. * ```jsx
  43391. * import { TimePicker } from '@wordpress/components';
  43392. * import { useState } from '@wordpress/element';
  43393. *
  43394. * const MyTimePicker = () => {
  43395. * const [ time, setTime ] = useState( new Date() );
  43396. *
  43397. * return (
  43398. * <TimePicker
  43399. * currentTime={ date }
  43400. * onChange={ ( newTime ) => setTime( newTime ) }
  43401. * is12Hour
  43402. * />
  43403. * );
  43404. * };
  43405. * ```
  43406. */
  43407. function TimePicker(_ref) {
  43408. let {
  43409. is12Hour,
  43410. currentTime,
  43411. onChange
  43412. } = _ref;
  43413. const [date, setDate] = (0,external_wp_element_namespaceObject.useState)(() => // Truncate the date at the minutes, see: #15495.
  43414. currentTime ? startOfMinute(inputToDate(currentTime)) : new Date()); // Reset the state when currentTime changed.
  43415. // TODO: useEffect() shouldn't be used like this, causes an unnecessary render
  43416. (0,external_wp_element_namespaceObject.useEffect)(() => {
  43417. setDate(currentTime ? startOfMinute(inputToDate(currentTime)) : new Date());
  43418. }, [currentTime]);
  43419. const {
  43420. day,
  43421. month,
  43422. year,
  43423. minutes,
  43424. hours,
  43425. am
  43426. } = (0,external_wp_element_namespaceObject.useMemo)(() => ({
  43427. day: format(date, 'dd'),
  43428. month: format(date, 'MM'),
  43429. year: format(date, 'yyyy'),
  43430. minutes: format(date, 'mm'),
  43431. hours: format(date, is12Hour ? 'hh' : 'HH'),
  43432. am: format(date, 'a')
  43433. }), [date, is12Hour]);
  43434. const buildNumberControlChangeCallback = method => {
  43435. const callback = (value, _ref2) => {
  43436. let {
  43437. event
  43438. } = _ref2;
  43439. if (!(event.target instanceof HTMLInputElement)) {
  43440. return;
  43441. }
  43442. if (!event.target.validity.valid) {
  43443. return;
  43444. } // We can safely assume value is a number if target is valid.
  43445. let numberValue = Number(value); // If the 12-hour format is being used and the 'PM' period is
  43446. // selected, then the incoming value (which ranges 1-12) should be
  43447. // increased by 12 to match the expected 24-hour format.
  43448. if (method === 'hours' && is12Hour) {
  43449. numberValue = from12hTo24h(numberValue, am === 'PM');
  43450. }
  43451. const newDate = set_set(date, {
  43452. [method]: numberValue
  43453. });
  43454. setDate(newDate);
  43455. onChange === null || onChange === void 0 ? void 0 : onChange(format(newDate, TIMEZONELESS_FORMAT));
  43456. };
  43457. return callback;
  43458. };
  43459. function buildAmPmChangeCallback(value) {
  43460. return () => {
  43461. if (am === value) {
  43462. return;
  43463. }
  43464. const parsedHours = parseInt(hours, 10);
  43465. const newDate = setHours(date, from12hTo24h(parsedHours, value === 'PM'));
  43466. setDate(newDate);
  43467. onChange === null || onChange === void 0 ? void 0 : onChange(format(newDate, TIMEZONELESS_FORMAT));
  43468. };
  43469. }
  43470. const dayField = (0,external_wp_element_namespaceObject.createElement)(DayInput, {
  43471. className: "components-datetime__time-field components-datetime__time-field-day" // Unused, for backwards compatibility.
  43472. ,
  43473. label: (0,external_wp_i18n_namespaceObject.__)('Day'),
  43474. hideLabelFromVision: true,
  43475. __next36pxDefaultSize: true,
  43476. value: day,
  43477. step: 1,
  43478. min: 1,
  43479. max: 31,
  43480. required: true,
  43481. hideHTMLArrows: true,
  43482. isPressEnterToChange: true,
  43483. isDragEnabled: false,
  43484. isShiftStepEnabled: false,
  43485. onChange: buildNumberControlChangeCallback('date')
  43486. });
  43487. const monthField = (0,external_wp_element_namespaceObject.createElement)(MonthSelectWrapper, null, (0,external_wp_element_namespaceObject.createElement)(MonthSelect, {
  43488. className: "components-datetime__time-field components-datetime__time-field-month" // Unused, for backwards compatibility.
  43489. ,
  43490. label: (0,external_wp_i18n_namespaceObject.__)('Month'),
  43491. hideLabelFromVision: true,
  43492. __nextHasNoMarginBottom: true,
  43493. value: month,
  43494. options: [{
  43495. value: '01',
  43496. label: (0,external_wp_i18n_namespaceObject.__)('January')
  43497. }, {
  43498. value: '02',
  43499. label: (0,external_wp_i18n_namespaceObject.__)('February')
  43500. }, {
  43501. value: '03',
  43502. label: (0,external_wp_i18n_namespaceObject.__)('March')
  43503. }, {
  43504. value: '04',
  43505. label: (0,external_wp_i18n_namespaceObject.__)('April')
  43506. }, {
  43507. value: '05',
  43508. label: (0,external_wp_i18n_namespaceObject.__)('May')
  43509. }, {
  43510. value: '06',
  43511. label: (0,external_wp_i18n_namespaceObject.__)('June')
  43512. }, {
  43513. value: '07',
  43514. label: (0,external_wp_i18n_namespaceObject.__)('July')
  43515. }, {
  43516. value: '08',
  43517. label: (0,external_wp_i18n_namespaceObject.__)('August')
  43518. }, {
  43519. value: '09',
  43520. label: (0,external_wp_i18n_namespaceObject.__)('September')
  43521. }, {
  43522. value: '10',
  43523. label: (0,external_wp_i18n_namespaceObject.__)('October')
  43524. }, {
  43525. value: '11',
  43526. label: (0,external_wp_i18n_namespaceObject.__)('November')
  43527. }, {
  43528. value: '12',
  43529. label: (0,external_wp_i18n_namespaceObject.__)('December')
  43530. }],
  43531. onChange: value => {
  43532. const newDate = setMonth_setMonth(date, Number(value) - 1);
  43533. setDate(newDate);
  43534. onChange === null || onChange === void 0 ? void 0 : onChange(format(newDate, TIMEZONELESS_FORMAT));
  43535. }
  43536. }));
  43537. return (0,external_wp_element_namespaceObject.createElement)(time_styles_Wrapper, {
  43538. className: "components-datetime__time" // Unused, for backwards compatibility.
  43539. }, (0,external_wp_element_namespaceObject.createElement)(Fieldset, null, (0,external_wp_element_namespaceObject.createElement)(base_control.VisualLabel, {
  43540. as: "legend",
  43541. className: "components-datetime__time-legend" // Unused, for backwards compatibility.
  43542. }, (0,external_wp_i18n_namespaceObject.__)('Time')), (0,external_wp_element_namespaceObject.createElement)(h_stack_component, {
  43543. className: "components-datetime__time-wrapper" // Unused, for backwards compatibility.
  43544. }, (0,external_wp_element_namespaceObject.createElement)(TimeWrapper, {
  43545. className: "components-datetime__time-field components-datetime__time-field-time" // Unused, for backwards compatibility.
  43546. }, (0,external_wp_element_namespaceObject.createElement)(HoursInput, {
  43547. className: "components-datetime__time-field-hours-input" // Unused, for backwards compatibility.
  43548. ,
  43549. label: (0,external_wp_i18n_namespaceObject.__)('Hours'),
  43550. hideLabelFromVision: true,
  43551. __next36pxDefaultSize: true,
  43552. value: hours,
  43553. step: 1,
  43554. min: is12Hour ? 1 : 0,
  43555. max: is12Hour ? 12 : 23,
  43556. required: true,
  43557. hideHTMLArrows: true,
  43558. isPressEnterToChange: true,
  43559. isDragEnabled: false,
  43560. isShiftStepEnabled: false,
  43561. onChange: buildNumberControlChangeCallback('hours'),
  43562. __unstableStateReducer: buildPadInputStateReducer(2)
  43563. }), (0,external_wp_element_namespaceObject.createElement)(TimeSeparator, {
  43564. className: "components-datetime__time-separator" // Unused, for backwards compatibility.
  43565. ,
  43566. "aria-hidden": "true"
  43567. }, ":"), (0,external_wp_element_namespaceObject.createElement)(MinutesInput, {
  43568. className: "components-datetime__time-field-minutes-input" // Unused, for backwards compatibility.
  43569. ,
  43570. label: (0,external_wp_i18n_namespaceObject.__)('Minutes'),
  43571. hideLabelFromVision: true,
  43572. __next36pxDefaultSize: true,
  43573. value: minutes,
  43574. step: 1,
  43575. min: 0,
  43576. max: 59,
  43577. required: true,
  43578. hideHTMLArrows: true,
  43579. isPressEnterToChange: true,
  43580. isDragEnabled: false,
  43581. isShiftStepEnabled: false,
  43582. onChange: buildNumberControlChangeCallback('minutes'),
  43583. __unstableStateReducer: buildPadInputStateReducer(2)
  43584. })), is12Hour && (0,external_wp_element_namespaceObject.createElement)(button_group, {
  43585. className: "components-datetime__time-field components-datetime__time-field-am-pm" // Unused, for backwards compatibility.
  43586. }, (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  43587. className: "components-datetime__time-am-button" // Unused, for backwards compatibility.
  43588. ,
  43589. variant: am === 'AM' ? 'primary' : 'secondary',
  43590. onClick: buildAmPmChangeCallback('AM')
  43591. }, (0,external_wp_i18n_namespaceObject.__)('AM')), (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  43592. className: "components-datetime__time-pm-button" // Unused, for backwards compatibility.
  43593. ,
  43594. variant: am === 'PM' ? 'primary' : 'secondary',
  43595. onClick: buildAmPmChangeCallback('PM')
  43596. }, (0,external_wp_i18n_namespaceObject.__)('PM'))), (0,external_wp_element_namespaceObject.createElement)(spacer_component, null), (0,external_wp_element_namespaceObject.createElement)(timezone, null))), (0,external_wp_element_namespaceObject.createElement)(Fieldset, null, (0,external_wp_element_namespaceObject.createElement)(base_control.VisualLabel, {
  43597. as: "legend",
  43598. className: "components-datetime__time-legend" // Unused, for backwards compatibility.
  43599. }, (0,external_wp_i18n_namespaceObject.__)('Date')), (0,external_wp_element_namespaceObject.createElement)(h_stack_component, {
  43600. className: "components-datetime__time-wrapper" // Unused, for backwards compatibility.
  43601. }, is12Hour ? (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, monthField, dayField) : (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, dayField, monthField), (0,external_wp_element_namespaceObject.createElement)(YearInput, {
  43602. className: "components-datetime__time-field components-datetime__time-field-year" // Unused, for backwards compatibility.
  43603. ,
  43604. label: (0,external_wp_i18n_namespaceObject.__)('Year'),
  43605. hideLabelFromVision: true,
  43606. __next36pxDefaultSize: true,
  43607. value: year,
  43608. step: 1,
  43609. min: 1,
  43610. max: 9999,
  43611. required: true,
  43612. hideHTMLArrows: true,
  43613. isPressEnterToChange: true,
  43614. isDragEnabled: false,
  43615. isShiftStepEnabled: false,
  43616. onChange: buildNumberControlChangeCallback('year'),
  43617. __unstableStateReducer: buildPadInputStateReducer(4)
  43618. }))));
  43619. }
  43620. /* harmony default export */ var time = (TimePicker);
  43621. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/date-time/date-time/styles.js
  43622. function date_time_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)."; }
  43623. /**
  43624. * External dependencies
  43625. */
  43626. /**
  43627. * Internal dependencies
  43628. */
  43629. const date_time_styles_Wrapper = /*#__PURE__*/emotion_styled_base_browser_esm(v_stack_component, true ? {
  43630. target: "e1p5onf01"
  43631. } : 0)( true ? {
  43632. name: "1khn195",
  43633. styles: "box-sizing:border-box"
  43634. } : 0);
  43635. const CalendarHelp = emotion_styled_base_browser_esm("div", true ? {
  43636. target: "e1p5onf00"
  43637. } : 0)( true ? {
  43638. name: "l0rwn2",
  43639. styles: "min-width:260px"
  43640. } : 0);
  43641. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/date-time/date-time/index.js
  43642. /**
  43643. * External dependencies
  43644. */
  43645. /**
  43646. * WordPress dependencies
  43647. */
  43648. /**
  43649. * Internal dependencies
  43650. */
  43651. const date_time_noop = () => {};
  43652. function UnforwardedDateTimePicker(_ref, ref) {
  43653. let {
  43654. currentDate,
  43655. is12Hour,
  43656. isInvalidDate,
  43657. onMonthPreviewed = date_time_noop,
  43658. onChange,
  43659. events,
  43660. startOfWeek,
  43661. __nextRemoveHelpButton = false,
  43662. __nextRemoveResetButton = false
  43663. } = _ref;
  43664. if (!__nextRemoveHelpButton) {
  43665. external_wp_deprecated_default()('Help button in wp.components.DateTimePicker', {
  43666. since: '13.4',
  43667. version: '14.6',
  43668. // Six months of plugin releases.
  43669. hint: 'Set the `__nextRemoveHelpButton` prop to `true` to remove this warning and opt in to the new behaviour, which will become the default in a future version.'
  43670. });
  43671. }
  43672. if (!__nextRemoveResetButton) {
  43673. external_wp_deprecated_default()('Reset button in wp.components.DateTimePicker', {
  43674. since: '13.4',
  43675. version: '14.6',
  43676. // Six months of plugin releases.
  43677. hint: 'Set the `__nextRemoveResetButton` prop to `true` to remove this warning and opt in to the new behaviour, which will become the default in a future version.'
  43678. });
  43679. }
  43680. const [calendarHelpIsVisible, setCalendarHelpIsVisible] = (0,external_wp_element_namespaceObject.useState)(false);
  43681. function onClickDescriptionToggle() {
  43682. setCalendarHelpIsVisible(!calendarHelpIsVisible);
  43683. }
  43684. return (0,external_wp_element_namespaceObject.createElement)(date_time_styles_Wrapper, {
  43685. ref: ref,
  43686. className: "components-datetime",
  43687. spacing: 4
  43688. }, !calendarHelpIsVisible && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(time, {
  43689. currentTime: currentDate,
  43690. onChange: onChange,
  43691. is12Hour: is12Hour
  43692. }), (0,external_wp_element_namespaceObject.createElement)(date, {
  43693. currentDate: currentDate,
  43694. onChange: onChange,
  43695. isInvalidDate: isInvalidDate,
  43696. events: events,
  43697. onMonthPreviewed: onMonthPreviewed,
  43698. startOfWeek: startOfWeek
  43699. })), calendarHelpIsVisible && (0,external_wp_element_namespaceObject.createElement)(CalendarHelp, {
  43700. className: "components-datetime__calendar-help" // Unused, for backwards compatibility.
  43701. }, (0,external_wp_element_namespaceObject.createElement)(heading_component, {
  43702. level: 4
  43703. }, (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)(heading_component, {
  43704. level: 4
  43705. }, (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", {
  43706. "aria-label": (0,external_wp_i18n_namespaceObject._x)('Enter', 'keyboard button')
  43707. }, "\u21B5"), ' '
  43708. /* JSX removes whitespace, but a space is required for screen readers. */
  43709. , (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", {
  43710. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Left and Right Arrows')
  43711. }, "\u2190/\u2192"), ' '
  43712. /* JSX removes whitespace, but a space is required for screen readers. */
  43713. , (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", {
  43714. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Up and Down Arrows')
  43715. }, "\u2191/\u2193"), ' '
  43716. /* JSX removes whitespace, but a space is required for screen readers. */
  43717. , (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", {
  43718. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Page Up and Page Down')
  43719. }, (0,external_wp_i18n_namespaceObject.__)('PgUp/PgDn')), ' '
  43720. /* JSX removes whitespace, but a space is required for screen readers. */
  43721. , (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", {
  43722. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Home and End')
  43723. }, (0,external_wp_i18n_namespaceObject.__)('Home/End')), ' '
  43724. /* JSX removes whitespace, but a space is required for screen readers. */
  43725. , (0,external_wp_i18n_namespaceObject.__)('Go to the first (Home) or last (End) day of a week.')))), (!__nextRemoveResetButton || !__nextRemoveHelpButton) && (0,external_wp_element_namespaceObject.createElement)(h_stack_component, {
  43726. className: "components-datetime__buttons" // Unused, for backwards compatibility.
  43727. }, !__nextRemoveResetButton && !calendarHelpIsVisible && currentDate && (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  43728. className: "components-datetime__date-reset-button" // Unused, for backwards compatibility.
  43729. ,
  43730. variant: "link",
  43731. onClick: () => onChange === null || onChange === void 0 ? void 0 : onChange(null)
  43732. }, (0,external_wp_i18n_namespaceObject.__)('Reset')), (0,external_wp_element_namespaceObject.createElement)(spacer_component, null), !__nextRemoveHelpButton && (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  43733. className: "components-datetime__date-help-toggle" // Unused, for backwards compatibility.
  43734. ,
  43735. variant: "link",
  43736. onClick: onClickDescriptionToggle
  43737. }, calendarHelpIsVisible ? (0,external_wp_i18n_namespaceObject.__)('Close') : (0,external_wp_i18n_namespaceObject.__)('Calendar Help'))));
  43738. }
  43739. /**
  43740. * DateTimePicker is a React component that renders a calendar and clock for
  43741. * date and time selection. The calendar and clock components can be accessed
  43742. * individually using the `DatePicker` and `TimePicker` components respectively.
  43743. *
  43744. * ```jsx
  43745. * import { DateTimePicker } from '@wordpress/components';
  43746. * import { useState } from '@wordpress/element';
  43747. *
  43748. * const MyDateTimePicker = () => {
  43749. * const [ date, setDate ] = useState( new Date() );
  43750. *
  43751. * return (
  43752. * <DateTimePicker
  43753. * currentDate={ date }
  43754. * onChange={ ( newDate ) => setDate( newDate ) }
  43755. * is12Hour
  43756. * />
  43757. * );
  43758. * };
  43759. * ```
  43760. */
  43761. const DateTimePicker = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedDateTimePicker);
  43762. /* harmony default export */ var date_time = (DateTimePicker);
  43763. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/date-time/index.js
  43764. /**
  43765. * Internal dependencies
  43766. */
  43767. /* harmony default export */ var build_module_date_time = (date_time);
  43768. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/dimension-control/sizes.js
  43769. /**
  43770. * Sizes
  43771. *
  43772. * defines the sizes used in dimension controls
  43773. * all hardcoded `size` values are based on the value of
  43774. * the Sass variable `$block-padding` from
  43775. * `packages/block-editor/src/components/dimension-control/sizes.js`.
  43776. */
  43777. /**
  43778. * WordPress dependencies
  43779. */
  43780. /**
  43781. * Finds the correct size object from the provided sizes
  43782. * table by size slug (eg: `medium`)
  43783. *
  43784. * @param {Array} sizes containing objects for each size definition.
  43785. * @param {string} slug a string representation of the size (eg: `medium`).
  43786. *
  43787. * @return {Object} the matching size definition.
  43788. */
  43789. const findSizeBySlug = (sizes, slug) => sizes.find(size => slug === size.slug);
  43790. /* harmony default export */ var dimension_control_sizes = ([{
  43791. name: (0,external_wp_i18n_namespaceObject._x)('None', 'Size of a UI element'),
  43792. slug: 'none'
  43793. }, {
  43794. name: (0,external_wp_i18n_namespaceObject._x)('Small', 'Size of a UI element'),
  43795. slug: 'small'
  43796. }, {
  43797. name: (0,external_wp_i18n_namespaceObject._x)('Medium', 'Size of a UI element'),
  43798. slug: 'medium'
  43799. }, {
  43800. name: (0,external_wp_i18n_namespaceObject._x)('Large', 'Size of a UI element'),
  43801. slug: 'large'
  43802. }, {
  43803. name: (0,external_wp_i18n_namespaceObject._x)('Extra Large', 'Size of a UI element'),
  43804. slug: 'xlarge'
  43805. }]);
  43806. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/dimension-control/index.js
  43807. /**
  43808. * External dependencies
  43809. */
  43810. /**
  43811. * WordPress dependencies
  43812. */
  43813. /**
  43814. * Internal dependencies
  43815. */
  43816. function DimensionControl(props) {
  43817. const {
  43818. label,
  43819. value,
  43820. sizes = dimension_control_sizes,
  43821. icon,
  43822. onChange,
  43823. className = ''
  43824. } = props;
  43825. const onChangeSpacingSize = val => {
  43826. const theSize = findSizeBySlug(sizes, val);
  43827. if (!theSize || value === theSize.slug) {
  43828. onChange(undefined);
  43829. } else if (typeof onChange === 'function') {
  43830. onChange(theSize.slug);
  43831. }
  43832. };
  43833. const formatSizesAsOptions = theSizes => {
  43834. const options = theSizes.map(_ref => {
  43835. let {
  43836. name,
  43837. slug
  43838. } = _ref;
  43839. return {
  43840. label: name,
  43841. value: slug
  43842. };
  43843. });
  43844. return [{
  43845. label: (0,external_wp_i18n_namespaceObject.__)('Default'),
  43846. value: ''
  43847. }].concat(options);
  43848. };
  43849. const selectLabel = (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, icon && (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
  43850. icon: icon
  43851. }), label);
  43852. return (0,external_wp_element_namespaceObject.createElement)(select_control, {
  43853. className: classnames_default()(className, 'block-editor-dimension-control'),
  43854. label: selectLabel,
  43855. hideLabelFromVision: false,
  43856. value: value,
  43857. onChange: onChangeSpacingSize,
  43858. options: formatSizesAsOptions(sizes)
  43859. });
  43860. }
  43861. /* harmony default export */ var dimension_control = (DimensionControl);
  43862. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/disabled/styles/disabled-styles.js
  43863. 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)."; }
  43864. /**
  43865. * External dependencies
  43866. */
  43867. const disabled_styles_disabledStyles = true ? {
  43868. name: "u2jump",
  43869. styles: "position:relative;pointer-events:none;&::after{content:'';position:absolute;top:0;right:0;bottom:0;left:0;}*{pointer-events:none;}"
  43870. } : 0;
  43871. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/disabled/index.js
  43872. /**
  43873. * External dependencies
  43874. */
  43875. /**
  43876. * WordPress dependencies
  43877. */
  43878. /**
  43879. * Internal dependencies
  43880. */
  43881. const Context = (0,external_wp_element_namespaceObject.createContext)(false);
  43882. const {
  43883. Consumer,
  43884. Provider: disabled_Provider
  43885. } = Context; // Extracting this ContentWrapper component in order to make it more explicit
  43886. // the same 'ContentWrapper' component is needed so that React can reconcile
  43887. // the dom correctly when switching between disabled/non-disabled (instead
  43888. // of thrashing the previous DOM and therefore losing the form fields values).
  43889. const ContentWrapper = (0,external_wp_element_namespaceObject.forwardRef)((props, ref) => (0,external_wp_element_namespaceObject.createElement)("div", extends_extends({}, props, {
  43890. ref: ref
  43891. })));
  43892. /**
  43893. * `Disabled` is a component which disables descendant tabbable elements and prevents pointer interaction.
  43894. *
  43895. * ```jsx
  43896. * import { Button, Disabled, TextControl } from '@wordpress/components';
  43897. * import { useState } from '@wordpress/element';
  43898. *
  43899. * const MyDisabled = () => {
  43900. * const [ isDisabled, setIsDisabled ] = useState( true );
  43901. *
  43902. * let input = <TextControl label="Input" onChange={ () => {} } />;
  43903. * if ( isDisabled ) {
  43904. * input = <Disabled>{ input }</Disabled>;
  43905. * }
  43906. *
  43907. * const toggleDisabled = () => {
  43908. * setIsDisabled( ( state ) => ! state );
  43909. * };
  43910. *
  43911. * return (
  43912. * <div>
  43913. * { input }
  43914. * <Button variant="primary" onClick={ toggleDisabled }>
  43915. * Toggle Disabled
  43916. * </Button>
  43917. * </div>
  43918. * );
  43919. * };
  43920. * ```
  43921. */
  43922. function Disabled(_ref) {
  43923. let {
  43924. className,
  43925. children,
  43926. isDisabled = true,
  43927. ...props
  43928. } = _ref;
  43929. const ref = (0,external_wp_compose_namespaceObject.useDisabled)();
  43930. const cx = useCx();
  43931. if (!isDisabled) {
  43932. return (0,external_wp_element_namespaceObject.createElement)(disabled_Provider, {
  43933. value: false
  43934. }, (0,external_wp_element_namespaceObject.createElement)(ContentWrapper, null, children));
  43935. }
  43936. return (0,external_wp_element_namespaceObject.createElement)(disabled_Provider, {
  43937. value: true
  43938. }, (0,external_wp_element_namespaceObject.createElement)(ContentWrapper, extends_extends({
  43939. ref: ref,
  43940. className: cx(disabled_styles_disabledStyles, className, 'components-disabled')
  43941. }, props), children));
  43942. }
  43943. Disabled.Context = Context;
  43944. Disabled.Consumer = Consumer;
  43945. /* harmony default export */ var disabled = (Disabled);
  43946. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/draggable/index.js
  43947. /**
  43948. * WordPress dependencies
  43949. */
  43950. /**
  43951. * External dependencies
  43952. */
  43953. const dragImageClass = 'components-draggable__invisible-drag-image';
  43954. const cloneWrapperClass = 'components-draggable__clone';
  43955. const clonePadding = 0;
  43956. const bodyClass = 'is-dragging-components-draggable';
  43957. /**
  43958. * @typedef RenderProp
  43959. * @property {(event: import('react').DragEvent) => void} onDraggableStart `onDragStart` handler.
  43960. * @property {(event: import('react').DragEvent) => void} onDraggableEnd `onDragEnd` handler.
  43961. */
  43962. /**
  43963. * @typedef Props
  43964. * @property {(props: RenderProp) => JSX.Element | null} children Children.
  43965. * @property {(event: import('react').DragEvent) => void} [onDragStart] Callback when dragging starts.
  43966. * @property {(event: import('react').DragEvent) => void} [onDragOver] Callback when dragging happens over the document.
  43967. * @property {(event: import('react').DragEvent) => void} [onDragEnd] Callback when dragging ends.
  43968. * @property {string} [cloneClassname] Classname for the cloned element.
  43969. * @property {string} [elementId] ID for the element.
  43970. * @property {any} [transferData] Transfer data for the drag event.
  43971. * @property {string} [__experimentalTransferDataType] The transfer data type to set.
  43972. * @property {import('react').ReactNode} __experimentalDragComponent Component to show when dragging.
  43973. */
  43974. /**
  43975. * @param {Props} props
  43976. * @return {JSX.Element} A draggable component.
  43977. */
  43978. function Draggable(_ref) {
  43979. let {
  43980. children,
  43981. onDragStart,
  43982. onDragOver,
  43983. onDragEnd,
  43984. cloneClassname,
  43985. elementId,
  43986. transferData,
  43987. __experimentalTransferDataType: transferDataType = 'text',
  43988. __experimentalDragComponent: dragComponent
  43989. } = _ref;
  43990. /** @type {import('react').MutableRefObject<HTMLDivElement | null>} */
  43991. const dragComponentRef = (0,external_wp_element_namespaceObject.useRef)(null);
  43992. const cleanup = (0,external_wp_element_namespaceObject.useRef)(() => {});
  43993. /**
  43994. * Removes the element clone, resets cursor, and removes drag listener.
  43995. *
  43996. * @param {import('react').DragEvent} event The non-custom DragEvent.
  43997. */
  43998. function end(event) {
  43999. event.preventDefault();
  44000. cleanup.current();
  44001. if (onDragEnd) {
  44002. onDragEnd(event);
  44003. }
  44004. }
  44005. /**
  44006. * This method does a couple of things:
  44007. *
  44008. * - Clones the current element and spawns clone over original element.
  44009. * - Adds a fake temporary drag image to avoid browser defaults.
  44010. * - Sets transfer data.
  44011. * - Adds dragover listener.
  44012. *
  44013. * @param {import('react').DragEvent} event The non-custom DragEvent.
  44014. */
  44015. function start(event) {
  44016. // @ts-ignore We know that ownerDocument does exist on an Element
  44017. const {
  44018. ownerDocument
  44019. } = event.target;
  44020. event.dataTransfer.setData(transferDataType, JSON.stringify(transferData));
  44021. const cloneWrapper = ownerDocument.createElement('div'); // Reset position to 0,0. Natural stacking order will position this lower, even with a transform otherwise.
  44022. cloneWrapper.style.top = 0;
  44023. cloneWrapper.style.left = 0;
  44024. const dragImage = ownerDocument.createElement('div'); // Set a fake drag image to avoid browser defaults. Remove from DOM
  44025. // right after. event.dataTransfer.setDragImage is not supported yet in
  44026. // IE, we need to check for its existence first.
  44027. if ('function' === typeof event.dataTransfer.setDragImage) {
  44028. dragImage.classList.add(dragImageClass);
  44029. ownerDocument.body.appendChild(dragImage);
  44030. event.dataTransfer.setDragImage(dragImage, 0, 0);
  44031. }
  44032. cloneWrapper.classList.add(cloneWrapperClass);
  44033. if (cloneClassname) {
  44034. cloneWrapper.classList.add(cloneClassname);
  44035. }
  44036. let x = 0;
  44037. let y = 0; // If a dragComponent is defined, the following logic will clone the
  44038. // HTML node and inject it into the cloneWrapper.
  44039. if (dragComponentRef.current) {
  44040. // Position dragComponent at the same position as the cursor.
  44041. x = event.clientX;
  44042. y = event.clientY;
  44043. cloneWrapper.style.transform = `translate( ${x}px, ${y}px )`;
  44044. const clonedDragComponent = ownerDocument.createElement('div');
  44045. clonedDragComponent.innerHTML = dragComponentRef.current.innerHTML;
  44046. cloneWrapper.appendChild(clonedDragComponent); // Inject the cloneWrapper into the DOM.
  44047. ownerDocument.body.appendChild(cloneWrapper);
  44048. } else {
  44049. const element = ownerDocument.getElementById(elementId); // Prepare element clone and append to element wrapper.
  44050. const elementRect = element.getBoundingClientRect();
  44051. const elementWrapper = element.parentNode;
  44052. const elementTopOffset = parseInt(elementRect.top, 10);
  44053. const elementLeftOffset = parseInt(elementRect.left, 10);
  44054. cloneWrapper.style.width = `${elementRect.width + clonePadding * 2}px`;
  44055. const clone = element.cloneNode(true);
  44056. clone.id = `clone-${elementId}`; // Position clone right over the original element (20px padding).
  44057. x = elementLeftOffset - clonePadding;
  44058. y = elementTopOffset - clonePadding;
  44059. cloneWrapper.style.transform = `translate( ${x}px, ${y}px )`; // Hack: Remove iFrames as it's causing the embeds drag clone to freeze.
  44060. Array.from(clone.querySelectorAll('iframe')).forEach(child => child.parentNode.removeChild(child));
  44061. cloneWrapper.appendChild(clone); // Inject the cloneWrapper into the DOM.
  44062. elementWrapper.appendChild(cloneWrapper);
  44063. } // Mark the current cursor coordinates.
  44064. let cursorLeft = event.clientX;
  44065. let cursorTop = event.clientY;
  44066. /**
  44067. * @param {import('react').DragEvent<Element>} e
  44068. */
  44069. function over(e) {
  44070. // Skip doing any work if mouse has not moved.
  44071. if (cursorLeft === e.clientX && cursorTop === e.clientY) {
  44072. return;
  44073. }
  44074. const nextX = x + e.clientX - cursorLeft;
  44075. const nextY = y + e.clientY - cursorTop;
  44076. cloneWrapper.style.transform = `translate( ${nextX}px, ${nextY}px )`;
  44077. cursorLeft = e.clientX;
  44078. cursorTop = e.clientY;
  44079. x = nextX;
  44080. y = nextY;
  44081. if (onDragOver) {
  44082. onDragOver(e);
  44083. }
  44084. } // Aim for 60fps (16 ms per frame) for now. We can potentially use requestAnimationFrame (raf) instead,
  44085. // note that browsers may throttle raf below 60fps in certain conditions.
  44086. const throttledDragOver = (0,external_lodash_namespaceObject.throttle)(over, 16);
  44087. ownerDocument.addEventListener('dragover', throttledDragOver); // Update cursor to 'grabbing', document wide.
  44088. ownerDocument.body.classList.add(bodyClass); // Allow the Synthetic Event to be accessed from asynchronous code.
  44089. // https://reactjs.org/docs/events.html#event-pooling
  44090. event.persist();
  44091. /** @type {number | undefined} */
  44092. let timerId;
  44093. if (onDragStart) {
  44094. timerId = setTimeout(() => onDragStart(event));
  44095. }
  44096. cleanup.current = () => {
  44097. // Remove drag clone.
  44098. if (cloneWrapper && cloneWrapper.parentNode) {
  44099. cloneWrapper.parentNode.removeChild(cloneWrapper);
  44100. }
  44101. if (dragImage && dragImage.parentNode) {
  44102. dragImage.parentNode.removeChild(dragImage);
  44103. } // Reset cursor.
  44104. ownerDocument.body.classList.remove(bodyClass);
  44105. ownerDocument.removeEventListener('dragover', throttledDragOver);
  44106. clearTimeout(timerId);
  44107. };
  44108. }
  44109. (0,external_wp_element_namespaceObject.useEffect)(() => () => {
  44110. cleanup.current();
  44111. }, []);
  44112. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, children({
  44113. onDraggableStart: start,
  44114. onDraggableEnd: end
  44115. }), dragComponent && (0,external_wp_element_namespaceObject.createElement)("div", {
  44116. className: "components-draggable-drag-component-root",
  44117. style: {
  44118. display: 'none'
  44119. },
  44120. ref: dragComponentRef
  44121. }, dragComponent));
  44122. }
  44123. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/upload.js
  44124. /**
  44125. * WordPress dependencies
  44126. */
  44127. const upload = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  44128. xmlns: "http://www.w3.org/2000/svg",
  44129. viewBox: "0 0 24 24"
  44130. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  44131. 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"
  44132. }));
  44133. /* harmony default export */ var library_upload = (upload);
  44134. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/use-is-mounted.mjs
  44135. function useIsMounted() {
  44136. var isMounted = (0,external_React_namespaceObject.useRef)(false);
  44137. useIsomorphicLayoutEffect(function () {
  44138. isMounted.current = true;
  44139. return function () {
  44140. isMounted.current = false;
  44141. };
  44142. }, []);
  44143. return isMounted;
  44144. }
  44145. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/utils/use-force-update.mjs
  44146. function use_force_update_useForceUpdate() {
  44147. var isMounted = useIsMounted();
  44148. var _a = tslib_es6_read((0,external_React_namespaceObject.useState)(0), 2), forcedRenderCount = _a[0], setForcedRenderCount = _a[1];
  44149. var forceRender = (0,external_React_namespaceObject.useCallback)(function () {
  44150. isMounted.current && setForcedRenderCount(forcedRenderCount + 1);
  44151. }, [forcedRenderCount]);
  44152. /**
  44153. * Defer this to the end of the next animation frame in case there are multiple
  44154. * synchronous calls.
  44155. */
  44156. var deferredForceRender = (0,external_React_namespaceObject.useCallback)(function () { return es.postRender(forceRender); }, [forceRender]);
  44157. return [deferredForceRender, forcedRenderCount];
  44158. }
  44159. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs
  44160. var PresenceChild = function (_a) {
  44161. var children = _a.children, initial = _a.initial, isPresent = _a.isPresent, onExitComplete = _a.onExitComplete, custom = _a.custom, presenceAffectsLayout = _a.presenceAffectsLayout;
  44162. var presenceChildren = useConstant(newChildrenMap);
  44163. var id = useId();
  44164. var context = (0,external_React_namespaceObject.useMemo)(function () { return ({
  44165. id: id,
  44166. initial: initial,
  44167. isPresent: isPresent,
  44168. custom: custom,
  44169. onExitComplete: function (childId) {
  44170. var e_1, _a;
  44171. presenceChildren.set(childId, true);
  44172. try {
  44173. for (var _b = __values(presenceChildren.values()), _c = _b.next(); !_c.done; _c = _b.next()) {
  44174. var isComplete = _c.value;
  44175. if (!isComplete)
  44176. return; // can stop searching when any is incomplete
  44177. }
  44178. }
  44179. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  44180. finally {
  44181. try {
  44182. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  44183. }
  44184. finally { if (e_1) throw e_1.error; }
  44185. }
  44186. onExitComplete === null || onExitComplete === void 0 ? void 0 : onExitComplete();
  44187. },
  44188. register: function (childId) {
  44189. presenceChildren.set(childId, false);
  44190. return function () { return presenceChildren.delete(childId); };
  44191. },
  44192. }); },
  44193. /**
  44194. * If the presence of a child affects the layout of the components around it,
  44195. * we want to make a new context value to ensure they get re-rendered
  44196. * so they can detect that layout change.
  44197. */
  44198. presenceAffectsLayout ? undefined : [isPresent]);
  44199. (0,external_React_namespaceObject.useMemo)(function () {
  44200. presenceChildren.forEach(function (_, key) { return presenceChildren.set(key, false); });
  44201. }, [isPresent]);
  44202. /**
  44203. * If there's no `motion` components to fire exit animations, we want to remove this
  44204. * component immediately.
  44205. */
  44206. external_React_namespaceObject.useEffect(function () {
  44207. !isPresent && !presenceChildren.size && (onExitComplete === null || onExitComplete === void 0 ? void 0 : onExitComplete());
  44208. }, [isPresent]);
  44209. return (external_React_namespaceObject.createElement(PresenceContext_PresenceContext.Provider, { value: context }, children));
  44210. };
  44211. function newChildrenMap() {
  44212. return new Map();
  44213. }
  44214. ;// CONCATENATED MODULE: ./node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs
  44215. var getChildKey = function (child) { return child.key || ""; };
  44216. function updateChildLookup(children, allChildren) {
  44217. children.forEach(function (child) {
  44218. var key = getChildKey(child);
  44219. allChildren.set(key, child);
  44220. });
  44221. }
  44222. function onlyElements(children) {
  44223. var filtered = [];
  44224. // We use forEach here instead of map as map mutates the component key by preprending `.$`
  44225. external_React_namespaceObject.Children.forEach(children, function (child) {
  44226. if ((0,external_React_namespaceObject.isValidElement)(child))
  44227. filtered.push(child);
  44228. });
  44229. return filtered;
  44230. }
  44231. /**
  44232. * `AnimatePresence` enables the animation of components that have been removed from the tree.
  44233. *
  44234. * When adding/removing more than a single child, every child **must** be given a unique `key` prop.
  44235. *
  44236. * Any `motion` components that have an `exit` property defined will animate out when removed from
  44237. * the tree.
  44238. *
  44239. * ```jsx
  44240. * import { motion, AnimatePresence } from 'framer-motion'
  44241. *
  44242. * export const Items = ({ items }) => (
  44243. * <AnimatePresence>
  44244. * {items.map(item => (
  44245. * <motion.div
  44246. * key={item.id}
  44247. * initial={{ opacity: 0 }}
  44248. * animate={{ opacity: 1 }}
  44249. * exit={{ opacity: 0 }}
  44250. * />
  44251. * ))}
  44252. * </AnimatePresence>
  44253. * )
  44254. * ```
  44255. *
  44256. * You can sequence exit animations throughout a tree using variants.
  44257. *
  44258. * If a child contains multiple `motion` components with `exit` props, it will only unmount the child
  44259. * once all `motion` components have finished animating out. Likewise, any components using
  44260. * `usePresence` all need to call `safeToRemove`.
  44261. *
  44262. * @public
  44263. */
  44264. var AnimatePresence = function (_a) {
  44265. 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;
  44266. // We want to force a re-render once all exiting animations have finished. We
  44267. // either use a local forceRender function, or one from a parent context if it exists.
  44268. var _d = tslib_es6_read(use_force_update_useForceUpdate(), 1), forceRender = _d[0];
  44269. var forceRenderLayoutGroup = (0,external_React_namespaceObject.useContext)(LayoutGroupContext).forceRender;
  44270. if (forceRenderLayoutGroup)
  44271. forceRender = forceRenderLayoutGroup;
  44272. var isMounted = useIsMounted();
  44273. // Filter out any children that aren't ReactElements. We can only track ReactElements with a props.key
  44274. var filteredChildren = onlyElements(children);
  44275. var childrenToRender = filteredChildren;
  44276. var exiting = new Set();
  44277. // Keep a living record of the children we're actually rendering so we
  44278. // can diff to figure out which are entering and exiting
  44279. var presentChildren = (0,external_React_namespaceObject.useRef)(childrenToRender);
  44280. // A lookup table to quickly reference components by key
  44281. var allChildren = (0,external_React_namespaceObject.useRef)(new Map()).current;
  44282. // If this is the initial component render, just deal with logic surrounding whether
  44283. // we play onMount animations or not.
  44284. var isInitialRender = (0,external_React_namespaceObject.useRef)(true);
  44285. useIsomorphicLayoutEffect(function () {
  44286. isInitialRender.current = false;
  44287. updateChildLookup(filteredChildren, allChildren);
  44288. presentChildren.current = childrenToRender;
  44289. });
  44290. useUnmountEffect(function () {
  44291. isInitialRender.current = true;
  44292. allChildren.clear();
  44293. exiting.clear();
  44294. });
  44295. if (isInitialRender.current) {
  44296. return (external_React_namespaceObject.createElement(external_React_namespaceObject.Fragment, null, childrenToRender.map(function (child) { return (external_React_namespaceObject.createElement(PresenceChild, { key: getChildKey(child), isPresent: true, initial: initial ? undefined : false, presenceAffectsLayout: presenceAffectsLayout }, child)); })));
  44297. }
  44298. // If this is a subsequent render, deal with entering and exiting children
  44299. childrenToRender = tslib_es6_spreadArray([], tslib_es6_read(childrenToRender), false);
  44300. // Diff the keys of the currently-present and target children to update our
  44301. // exiting list.
  44302. var presentKeys = presentChildren.current.map(getChildKey);
  44303. var targetKeys = filteredChildren.map(getChildKey);
  44304. // Diff the present children with our target children and mark those that are exiting
  44305. var numPresent = presentKeys.length;
  44306. for (var i = 0; i < numPresent; i++) {
  44307. var key = presentKeys[i];
  44308. if (targetKeys.indexOf(key) === -1) {
  44309. exiting.add(key);
  44310. }
  44311. }
  44312. // If we currently have exiting children, and we're deferring rendering incoming children
  44313. // until after all current children have exiting, empty the childrenToRender array
  44314. if (exitBeforeEnter && exiting.size) {
  44315. childrenToRender = [];
  44316. }
  44317. // Loop through all currently exiting components and clone them to overwrite `animate`
  44318. // with any `exit` prop they might have defined.
  44319. exiting.forEach(function (key) {
  44320. // If this component is actually entering again, early return
  44321. if (targetKeys.indexOf(key) !== -1)
  44322. return;
  44323. var child = allChildren.get(key);
  44324. if (!child)
  44325. return;
  44326. var insertionIndex = presentKeys.indexOf(key);
  44327. var onExit = function () {
  44328. allChildren.delete(key);
  44329. exiting.delete(key);
  44330. // Remove this child from the present children
  44331. var removeIndex = presentChildren.current.findIndex(function (presentChild) { return presentChild.key === key; });
  44332. presentChildren.current.splice(removeIndex, 1);
  44333. // Defer re-rendering until all exiting children have indeed left
  44334. if (!exiting.size) {
  44335. presentChildren.current = filteredChildren;
  44336. if (isMounted.current === false)
  44337. return;
  44338. forceRender();
  44339. onExitComplete && onExitComplete();
  44340. }
  44341. };
  44342. childrenToRender.splice(insertionIndex, 0, external_React_namespaceObject.createElement(PresenceChild, { key: getChildKey(child), isPresent: false, onExitComplete: onExit, custom: custom, presenceAffectsLayout: presenceAffectsLayout }, child));
  44343. });
  44344. // Add `MotionContext` even to children that don't need it to ensure we're rendering
  44345. // the same tree between renders
  44346. childrenToRender = childrenToRender.map(function (child) {
  44347. var key = child.key;
  44348. return exiting.has(key) ? (child) : (external_React_namespaceObject.createElement(PresenceChild, { key: getChildKey(child), isPresent: true, presenceAffectsLayout: presenceAffectsLayout }, child));
  44349. });
  44350. if (env !== "production" &&
  44351. exitBeforeEnter &&
  44352. childrenToRender.length > 1) {
  44353. console.warn("You're attempting to animate multiple children within AnimatePresence, but its exitBeforeEnter prop is set to true. This will lead to odd visual behaviour.");
  44354. }
  44355. return (external_React_namespaceObject.createElement(external_React_namespaceObject.Fragment, null, exiting.size
  44356. ? childrenToRender
  44357. : childrenToRender.map(function (child) { return (0,external_React_namespaceObject.cloneElement)(child); })));
  44358. };
  44359. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/drop-zone/index.js
  44360. /**
  44361. * External dependencies
  44362. */
  44363. /**
  44364. * WordPress dependencies
  44365. */
  44366. /**
  44367. * Internal dependencies
  44368. */
  44369. /**
  44370. * `DropZone` is a component creating a drop zone area taking the full size of its parent element. It supports dropping files, HTML content or any other HTML drop event.
  44371. *
  44372. * ```jsx
  44373. * import { DropZone } from '@wordpress/components';
  44374. * import { useState } from '@wordpress/element';
  44375. *
  44376. * const MyDropZone = () => {
  44377. * const [ hasDropped, setHasDropped ] = useState( false );
  44378. *
  44379. * return (
  44380. * <div>
  44381. * { hasDropped ? 'Dropped!' : 'Drop something here' }
  44382. * <DropZone
  44383. * onFilesDrop={ () => setHasDropped( true ) }
  44384. * onHTMLDrop={ () => setHasDropped( true ) }
  44385. * onDrop={ () => setHasDropped( true ) }
  44386. * />
  44387. * </div>
  44388. * );
  44389. * }
  44390. * ```
  44391. */
  44392. function DropZoneComponent(_ref) {
  44393. let {
  44394. className,
  44395. label,
  44396. onFilesDrop,
  44397. onHTMLDrop,
  44398. onDrop,
  44399. ...restProps
  44400. } = _ref;
  44401. const [isDraggingOverDocument, setIsDraggingOverDocument] = (0,external_wp_element_namespaceObject.useState)();
  44402. const [isDraggingOverElement, setIsDraggingOverElement] = (0,external_wp_element_namespaceObject.useState)();
  44403. const [type, setType] = (0,external_wp_element_namespaceObject.useState)();
  44404. const ref = (0,external_wp_compose_namespaceObject.__experimentalUseDropZone)({
  44405. onDrop(event) {
  44406. var _event$dataTransfer;
  44407. const files = event.dataTransfer ? (0,external_wp_dom_namespaceObject.getFilesFromDataTransfer)(event.dataTransfer) : [];
  44408. const html = (_event$dataTransfer = event.dataTransfer) === null || _event$dataTransfer === void 0 ? void 0 : _event$dataTransfer.getData('text/html');
  44409. /**
  44410. * From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.
  44411. * The order of the checks is important to recognise the HTML drop.
  44412. */
  44413. if (html && onHTMLDrop) {
  44414. onHTMLDrop(html);
  44415. } else if (files.length && onFilesDrop) {
  44416. onFilesDrop(files);
  44417. } else if (onDrop) {
  44418. onDrop(event);
  44419. }
  44420. },
  44421. onDragStart(event) {
  44422. var _event$dataTransfer2, _event$dataTransfer3;
  44423. setIsDraggingOverDocument(true);
  44424. let _type = 'default';
  44425. /**
  44426. * From Windows Chrome 96, the `event.dataTransfer` returns both file object and HTML.
  44427. * The order of the checks is important to recognise the HTML drop.
  44428. */
  44429. if ((_event$dataTransfer2 = event.dataTransfer) !== null && _event$dataTransfer2 !== void 0 && _event$dataTransfer2.types.includes('text/html')) {
  44430. _type = 'html';
  44431. } else if ( // Check for the types because sometimes the files themselves
  44432. // are only available on drop.
  44433. (_event$dataTransfer3 = event.dataTransfer) !== null && _event$dataTransfer3 !== void 0 && _event$dataTransfer3.types.includes('Files') || (event.dataTransfer ? (0,external_wp_dom_namespaceObject.getFilesFromDataTransfer)(event.dataTransfer) : []).length > 0) {
  44434. _type = 'file';
  44435. }
  44436. setType(_type);
  44437. },
  44438. onDragEnd() {
  44439. setIsDraggingOverDocument(false);
  44440. setType(undefined);
  44441. },
  44442. onDragEnter() {
  44443. setIsDraggingOverElement(true);
  44444. },
  44445. onDragLeave() {
  44446. setIsDraggingOverElement(false);
  44447. }
  44448. });
  44449. const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
  44450. let children;
  44451. const backdrop = {
  44452. hidden: {
  44453. scaleY: 0,
  44454. opacity: 0
  44455. },
  44456. show: {
  44457. scaleY: 1,
  44458. opacity: 1,
  44459. transition: {
  44460. type: 'tween',
  44461. duration: 0.2,
  44462. delay: 0.1,
  44463. delayChildren: 0.2
  44464. }
  44465. },
  44466. exit: {
  44467. scaleY: 1,
  44468. opacity: 0,
  44469. transition: {
  44470. duration: 0.3,
  44471. delayChildren: 0
  44472. }
  44473. }
  44474. };
  44475. const foreground = {
  44476. hidden: {
  44477. opacity: 0,
  44478. scale: 0.75
  44479. },
  44480. show: {
  44481. opacity: 1,
  44482. scale: 1
  44483. },
  44484. exit: {
  44485. opacity: 0,
  44486. scale: 0.9
  44487. }
  44488. };
  44489. if (isDraggingOverElement) {
  44490. children = (0,external_wp_element_namespaceObject.createElement)(motion.div, {
  44491. variants: backdrop,
  44492. initial: disableMotion ? 'show' : 'hidden',
  44493. animate: "show",
  44494. exit: disableMotion ? 'show' : 'exit',
  44495. className: "components-drop-zone__content"
  44496. }, (0,external_wp_element_namespaceObject.createElement)(motion.div, {
  44497. variants: foreground
  44498. }, (0,external_wp_element_namespaceObject.createElement)(icons_build_module_icon, {
  44499. icon: library_upload,
  44500. className: "components-drop-zone__content-icon"
  44501. }), (0,external_wp_element_namespaceObject.createElement)("span", {
  44502. className: "components-drop-zone__content-text"
  44503. }, label ? label : (0,external_wp_i18n_namespaceObject.__)('Drop files to upload'))));
  44504. }
  44505. const classes = classnames_default()('components-drop-zone', className, {
  44506. 'is-active': (isDraggingOverDocument || isDraggingOverElement) && (type === 'file' && onFilesDrop || type === 'html' && onHTMLDrop || type === 'default' && onDrop),
  44507. 'is-dragging-over-document': isDraggingOverDocument,
  44508. 'is-dragging-over-element': isDraggingOverElement,
  44509. [`is-dragging-${type}`]: !!type
  44510. });
  44511. return (0,external_wp_element_namespaceObject.createElement)("div", extends_extends({}, restProps, {
  44512. ref: ref,
  44513. className: classes
  44514. }), disableMotion ? children : (0,external_wp_element_namespaceObject.createElement)(AnimatePresence, null, children));
  44515. }
  44516. /* harmony default export */ var drop_zone = (DropZoneComponent);
  44517. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/drop-zone/provider.js
  44518. /**
  44519. * WordPress dependencies
  44520. */
  44521. function DropZoneProvider(_ref) {
  44522. let {
  44523. children
  44524. } = _ref;
  44525. external_wp_deprecated_default()('wp.components.DropZoneProvider', {
  44526. since: '5.8',
  44527. hint: 'wp.component.DropZone no longer needs a provider. wp.components.DropZoneProvider is safe to remove from your code.'
  44528. });
  44529. return children;
  44530. }
  44531. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/swatch.js
  44532. /**
  44533. * WordPress dependencies
  44534. */
  44535. const swatch = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  44536. xmlns: "http://www.w3.org/2000/svg",
  44537. viewBox: "0 0 24 24"
  44538. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  44539. 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"
  44540. }));
  44541. /* harmony default export */ var library_swatch = (swatch);
  44542. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/duotone-picker/utils.js
  44543. /**
  44544. * External dependencies
  44545. */
  44546. colord_k([plugins_names]);
  44547. /**
  44548. * Object representation for a color.
  44549. *
  44550. * @typedef {Object} RGBColor
  44551. * @property {number} r Red component of the color in the range [0,1].
  44552. * @property {number} g Green component of the color in the range [0,1].
  44553. * @property {number} b Blue component of the color in the range [0,1].
  44554. */
  44555. /**
  44556. * Calculate the brightest and darkest values from a color palette.
  44557. *
  44558. * @param {Object[]} palette Color palette for the theme.
  44559. *
  44560. * @return {string[]} Tuple of the darkest color and brightest color.
  44561. */
  44562. function getDefaultColors(palette) {
  44563. // A default dark and light color are required.
  44564. if (!palette || palette.length < 2) return ['#000', '#fff'];
  44565. return palette.map(_ref => {
  44566. let {
  44567. color
  44568. } = _ref;
  44569. return {
  44570. color,
  44571. brightness: colord_w(color).brightness()
  44572. };
  44573. }).reduce((_ref2, current) => {
  44574. let [min, max] = _ref2;
  44575. return [current.brightness <= min.brightness ? current : min, current.brightness >= max.brightness ? current : max];
  44576. }, [{
  44577. brightness: 1
  44578. }, {
  44579. brightness: 0
  44580. }]).map(_ref3 => {
  44581. let {
  44582. color
  44583. } = _ref3;
  44584. return color;
  44585. });
  44586. }
  44587. /**
  44588. * Generate a duotone gradient from a list of colors.
  44589. *
  44590. * @param {string[]} colors CSS color strings.
  44591. * @param {string} angle CSS gradient angle.
  44592. *
  44593. * @return {string} CSS gradient string for the duotone swatch.
  44594. */
  44595. function getGradientFromCSSColors() {
  44596. let colors = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  44597. let angle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '90deg';
  44598. const l = 100 / colors.length;
  44599. const stops = colors.map((c, i) => `${c} ${i * l}%, ${c} ${(i + 1) * l}%`).join(', ');
  44600. return `linear-gradient( ${angle}, ${stops} )`;
  44601. }
  44602. /**
  44603. * Convert a color array to an array of color stops.
  44604. *
  44605. * @param {string[]} colors CSS colors array
  44606. *
  44607. * @return {Object[]} Color stop information.
  44608. */
  44609. function getColorStopsFromColors(colors) {
  44610. return colors.map((color, i) => ({
  44611. position: i * 100 / (colors.length - 1),
  44612. color
  44613. }));
  44614. }
  44615. /**
  44616. * Convert a color stop array to an array colors.
  44617. *
  44618. * @param {Object[]} colorStops Color stop information.
  44619. *
  44620. * @return {string[]} CSS colors array.
  44621. */
  44622. function getColorsFromColorStops() {
  44623. let colorStops = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  44624. return colorStops.map(_ref4 => {
  44625. let {
  44626. color
  44627. } = _ref4;
  44628. return color;
  44629. });
  44630. }
  44631. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/duotone-picker/duotone-swatch.js
  44632. /**
  44633. * WordPress dependencies
  44634. */
  44635. /**
  44636. * Internal dependencies
  44637. */
  44638. function DuotoneSwatch(_ref) {
  44639. let {
  44640. values
  44641. } = _ref;
  44642. return values ? (0,external_wp_element_namespaceObject.createElement)(color_indicator, {
  44643. colorValue: getGradientFromCSSColors(values, '135deg')
  44644. }) : (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
  44645. icon: library_swatch
  44646. });
  44647. }
  44648. /* harmony default export */ var duotone_swatch = (DuotoneSwatch);
  44649. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-list-picker/index.js
  44650. /**
  44651. * WordPress dependencies
  44652. */
  44653. /**
  44654. * Internal dependencies
  44655. */
  44656. function ColorOption(_ref) {
  44657. let {
  44658. label,
  44659. value,
  44660. colors,
  44661. disableCustomColors,
  44662. enableAlpha,
  44663. onChange
  44664. } = _ref;
  44665. const [isOpen, setIsOpen] = (0,external_wp_element_namespaceObject.useState)(false);
  44666. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  44667. className: "components-color-list-picker__swatch-button",
  44668. onClick: () => setIsOpen(prev => !prev)
  44669. }, (0,external_wp_element_namespaceObject.createElement)(h_stack_component, {
  44670. justify: "flex-start",
  44671. spacing: 2
  44672. }, value ? (0,external_wp_element_namespaceObject.createElement)(color_indicator, {
  44673. colorValue: value,
  44674. className: "components-color-list-picker__swatch-color"
  44675. }) : (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
  44676. icon: library_swatch
  44677. }), (0,external_wp_element_namespaceObject.createElement)("span", null, label))), isOpen && (0,external_wp_element_namespaceObject.createElement)(color_palette, {
  44678. className: "components-color-list-picker__color-picker",
  44679. colors: colors,
  44680. value: value,
  44681. clearable: false,
  44682. onChange: onChange,
  44683. disableCustomColors: disableCustomColors,
  44684. enableAlpha: enableAlpha
  44685. }));
  44686. }
  44687. function ColorListPicker(_ref2) {
  44688. let {
  44689. colors,
  44690. labels,
  44691. value = [],
  44692. disableCustomColors,
  44693. enableAlpha,
  44694. onChange
  44695. } = _ref2;
  44696. return (0,external_wp_element_namespaceObject.createElement)("div", {
  44697. className: "components-color-list-picker"
  44698. }, labels.map((label, index) => (0,external_wp_element_namespaceObject.createElement)(ColorOption, {
  44699. key: index,
  44700. label: label,
  44701. value: value[index],
  44702. colors: colors,
  44703. disableCustomColors: disableCustomColors,
  44704. enableAlpha: enableAlpha,
  44705. onChange: newColor => {
  44706. const newColors = value.slice();
  44707. newColors[index] = newColor;
  44708. onChange(newColors);
  44709. }
  44710. })));
  44711. }
  44712. /* harmony default export */ var color_list_picker = (ColorListPicker);
  44713. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/duotone-picker/custom-duotone-bar.js
  44714. /**
  44715. * Internal dependencies
  44716. */
  44717. const PLACEHOLDER_VALUES = ['#333', '#CCC'];
  44718. function CustomDuotoneBar(_ref) {
  44719. let {
  44720. value,
  44721. onChange
  44722. } = _ref;
  44723. const hasGradient = !!value;
  44724. const values = hasGradient ? value : PLACEHOLDER_VALUES;
  44725. const background = getGradientFromCSSColors(values);
  44726. const controlPoints = getColorStopsFromColors(values);
  44727. return (0,external_wp_element_namespaceObject.createElement)(CustomGradientBar, {
  44728. disableInserter: true,
  44729. background: background,
  44730. hasGradient: hasGradient,
  44731. value: controlPoints,
  44732. onChange: newColorStops => {
  44733. const newValue = getColorsFromColorStops(newColorStops);
  44734. onChange(newValue);
  44735. }
  44736. });
  44737. }
  44738. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/duotone-picker/duotone-picker.js
  44739. /**
  44740. * External dependencies
  44741. */
  44742. /**
  44743. * WordPress dependencies
  44744. */
  44745. /**
  44746. * Internal dependencies
  44747. */
  44748. function DuotonePicker(_ref) {
  44749. let {
  44750. clearable = true,
  44751. unsetable = true,
  44752. colorPalette,
  44753. duotonePalette,
  44754. disableCustomColors,
  44755. disableCustomDuotone,
  44756. value,
  44757. onChange
  44758. } = _ref;
  44759. const [defaultDark, defaultLight] = (0,external_wp_element_namespaceObject.useMemo)(() => getDefaultColors(colorPalette), [colorPalette]);
  44760. const isUnset = value === 'unset';
  44761. const unsetOption = (0,external_wp_element_namespaceObject.createElement)(CircularOptionPicker.Option, {
  44762. key: "unset",
  44763. value: "unset",
  44764. isSelected: isUnset,
  44765. tooltipText: (0,external_wp_i18n_namespaceObject.__)('Unset'),
  44766. className: "components-duotone-picker__color-indicator",
  44767. onClick: () => {
  44768. onChange(isUnset ? undefined : 'unset');
  44769. }
  44770. });
  44771. const options = duotonePalette.map(_ref2 => {
  44772. let {
  44773. colors,
  44774. slug,
  44775. name
  44776. } = _ref2;
  44777. const style = {
  44778. background: getGradientFromCSSColors(colors, '135deg'),
  44779. color: 'transparent'
  44780. };
  44781. 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".
  44782. (0,external_wp_i18n_namespaceObject.__)('Duotone code: %s'), slug);
  44783. const label = name ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The name of the option e.g: "Dark grayscale".
  44784. (0,external_wp_i18n_namespaceObject.__)('Duotone: %s'), name) : tooltipText;
  44785. const isSelected = (0,external_lodash_namespaceObject.isEqual)(colors, value);
  44786. return (0,external_wp_element_namespaceObject.createElement)(CircularOptionPicker.Option, {
  44787. key: slug,
  44788. value: colors,
  44789. isSelected: isSelected,
  44790. "aria-label": label,
  44791. tooltipText: tooltipText,
  44792. style: style,
  44793. onClick: () => {
  44794. onChange(isSelected ? undefined : colors);
  44795. }
  44796. });
  44797. });
  44798. return (0,external_wp_element_namespaceObject.createElement)(CircularOptionPicker, {
  44799. options: unsetable ? [unsetOption, ...options] : options,
  44800. actions: !!clearable && (0,external_wp_element_namespaceObject.createElement)(CircularOptionPicker.ButtonAction, {
  44801. onClick: () => onChange(undefined)
  44802. }, (0,external_wp_i18n_namespaceObject.__)('Clear'))
  44803. }, (0,external_wp_element_namespaceObject.createElement)(spacer_component, {
  44804. paddingTop: 4
  44805. }, (0,external_wp_element_namespaceObject.createElement)(v_stack_component, {
  44806. spacing: 3
  44807. }, !disableCustomColors && !disableCustomDuotone && (0,external_wp_element_namespaceObject.createElement)(CustomDuotoneBar, {
  44808. value: isUnset ? undefined : value,
  44809. onChange: onChange
  44810. }), !disableCustomDuotone && (0,external_wp_element_namespaceObject.createElement)(color_list_picker, {
  44811. labels: [(0,external_wp_i18n_namespaceObject.__)('Shadows'), (0,external_wp_i18n_namespaceObject.__)('Highlights')],
  44812. colors: colorPalette,
  44813. value: isUnset ? undefined : value,
  44814. disableCustomColors: disableCustomColors,
  44815. enableAlpha: true,
  44816. onChange: newColors => {
  44817. if (!newColors[0]) {
  44818. newColors[0] = defaultDark;
  44819. }
  44820. if (!newColors[1]) {
  44821. newColors[1] = defaultLight;
  44822. }
  44823. const newValue = newColors.length >= 2 ? newColors : undefined;
  44824. onChange(newValue);
  44825. }
  44826. }))));
  44827. }
  44828. /* harmony default export */ var duotone_picker = (DuotonePicker);
  44829. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/external.js
  44830. /**
  44831. * WordPress dependencies
  44832. */
  44833. const external = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  44834. xmlns: "http://www.w3.org/2000/svg",
  44835. viewBox: "0 0 24 24"
  44836. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  44837. 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"
  44838. }));
  44839. /* harmony default export */ var library_external = (external);
  44840. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/external-link/styles/external-link-styles.js
  44841. 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)."; }
  44842. /**
  44843. * External dependencies
  44844. */
  44845. /**
  44846. * WordPress dependencies
  44847. */
  44848. const StyledIcon = /*#__PURE__*/emotion_styled_base_browser_esm(icons_build_module_icon, true ? {
  44849. target: "esh4a730"
  44850. } : 0)( true ? {
  44851. name: "rvs7bx",
  44852. styles: "width:1em;height:1em;margin:0;vertical-align:middle;fill:currentColor"
  44853. } : 0);
  44854. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/external-link/index.js
  44855. /**
  44856. * External dependencies
  44857. */
  44858. /**
  44859. * WordPress dependencies
  44860. */
  44861. /**
  44862. * Internal dependencies
  44863. */
  44864. function UnforwardedExternalLink(props, ref) {
  44865. const {
  44866. href,
  44867. children,
  44868. className,
  44869. rel = '',
  44870. ...additionalProps
  44871. } = props;
  44872. const optimizedRel = [...new Set([...rel.split(' '), 'external', 'noreferrer', 'noopener'].filter(Boolean))].join(' ');
  44873. const classes = classnames_default()('components-external-link', className);
  44874. /* Anchor links are percieved as external links.
  44875. This constant helps check for on page anchor links,
  44876. to prevent them from being opened in the editor. */
  44877. const isInternalAnchor = !!(href !== null && href !== void 0 && href.startsWith('#'));
  44878. return (
  44879. /* eslint-disable react/jsx-no-target-blank */
  44880. (0,external_wp_element_namespaceObject.createElement)("a", extends_extends({}, additionalProps, {
  44881. className: classes,
  44882. href: href,
  44883. onClick: isInternalAnchor ? event => event.preventDefault() : undefined,
  44884. target: "_blank",
  44885. rel: optimizedRel,
  44886. ref: ref
  44887. }), children, (0,external_wp_element_namespaceObject.createElement)(visually_hidden_component, {
  44888. as: "span"
  44889. },
  44890. /* translators: accessibility text */
  44891. (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)')), (0,external_wp_element_namespaceObject.createElement)(StyledIcon, {
  44892. icon: library_external,
  44893. className: "components-external-link__icon"
  44894. }))
  44895. /* eslint-enable react/jsx-no-target-blank */
  44896. );
  44897. }
  44898. /**
  44899. * Link to an external resource.
  44900. *
  44901. * ```jsx
  44902. * import { ExternalLink } from '@wordpress/components';
  44903. *
  44904. * const MyExternalLink = () => (
  44905. * <ExternalLink href="https://wordpress.org">WordPress.org</ExternalLink>
  44906. * );
  44907. * ```
  44908. */
  44909. const ExternalLink = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedExternalLink);
  44910. /* harmony default export */ var external_link = (ExternalLink);
  44911. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focal-point-picker/utils.js
  44912. const INITIAL_BOUNDS = {
  44913. width: 200,
  44914. height: 170
  44915. };
  44916. const VIDEO_EXTENSIONS = ['avi', 'mpg', 'mpeg', 'mov', 'mp4', 'm4v', 'ogg', 'ogv', 'webm', 'wmv'];
  44917. /**
  44918. * Gets the extension of a file name.
  44919. *
  44920. * @param filename The file name.
  44921. * @return The extension of the file name.
  44922. */
  44923. function getExtension() {
  44924. let filename = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  44925. const parts = filename.split('.');
  44926. return parts[parts.length - 1];
  44927. }
  44928. /**
  44929. * Checks if a file is a video.
  44930. *
  44931. * @param filename The file name.
  44932. * @return Whether the file is a video.
  44933. */
  44934. function isVideoType() {
  44935. let filename = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  44936. if (!filename) return false;
  44937. return VIDEO_EXTENSIONS.includes(getExtension(filename));
  44938. }
  44939. /**
  44940. * Transforms a fraction value to a percentage value.
  44941. *
  44942. * @param fraction The fraction value.
  44943. * @return A percentage value.
  44944. */
  44945. function fractionToPercentage(fraction) {
  44946. return Math.round(fraction * 100);
  44947. }
  44948. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focal-point-picker/styles/focal-point-picker-style.js
  44949. 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)."; }
  44950. /**
  44951. * External dependencies
  44952. */
  44953. /**
  44954. * Internal dependencies
  44955. */
  44956. const MediaWrapper = emotion_styled_base_browser_esm("div", true ? {
  44957. target: "eeew7dm8"
  44958. } : 0)( true ? {
  44959. name: "w0nf6b",
  44960. styles: "background-color:transparent;text-align:center;width:100%"
  44961. } : 0);
  44962. const MediaContainer = emotion_styled_base_browser_esm("div", true ? {
  44963. target: "eeew7dm7"
  44964. } : 0)( true ? {
  44965. name: "megach",
  44966. styles: "align-items:center;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;}"
  44967. } : 0);
  44968. const MediaPlaceholder = emotion_styled_base_browser_esm("div", true ? {
  44969. target: "eeew7dm6"
  44970. } : 0)("background:", COLORS.gray[100], ";box-sizing:border-box;height:", INITIAL_BOUNDS.height, "px;max-width:280px;min-width:", INITIAL_BOUNDS.width, "px;width:100%;" + ( true ? "" : 0));
  44971. const StyledUnitControl = /*#__PURE__*/emotion_styled_base_browser_esm(unit_control, true ? {
  44972. target: "eeew7dm5"
  44973. } : 0)( true ? {
  44974. name: "1pzk433",
  44975. styles: "width:100px"
  44976. } : 0);
  44977. var focal_point_picker_style_ref2 = true ? {
  44978. name: "1mn7kwb",
  44979. styles: "padding-bottom:1em"
  44980. } : 0;
  44981. const focal_point_picker_style_deprecatedBottomMargin = _ref3 => {
  44982. let {
  44983. __nextHasNoMarginBottom
  44984. } = _ref3;
  44985. return !__nextHasNoMarginBottom ? focal_point_picker_style_ref2 : undefined;
  44986. };
  44987. var focal_point_picker_style_ref = true ? {
  44988. name: "1mn7kwb",
  44989. styles: "padding-bottom:1em"
  44990. } : 0;
  44991. const extraHelpTextMargin = _ref4 => {
  44992. let {
  44993. hasHelpText = false
  44994. } = _ref4;
  44995. return hasHelpText ? focal_point_picker_style_ref : undefined;
  44996. };
  44997. const ControlWrapper = /*#__PURE__*/emotion_styled_base_browser_esm(flex_component, true ? {
  44998. target: "eeew7dm4"
  44999. } : 0)("max-width:320px;padding-top:1em;", extraHelpTextMargin, " ", focal_point_picker_style_deprecatedBottomMargin, ";" + ( true ? "" : 0));
  45000. const GridView = emotion_styled_base_browser_esm("div", true ? {
  45001. target: "eeew7dm3"
  45002. } : 0)("left:50%;overflow:hidden;pointer-events:none;position:absolute;top:50%;transform:translate3d( -50%, -50%, 0 );transition:opacity 120ms linear;z-index:1;opacity:", _ref5 => {
  45003. let {
  45004. showOverlay
  45005. } = _ref5;
  45006. return showOverlay ? 1 : 0;
  45007. }, ";" + ( true ? "" : 0));
  45008. const GridLine = emotion_styled_base_browser_esm("div", true ? {
  45009. target: "eeew7dm2"
  45010. } : 0)( true ? {
  45011. name: "1d42i6k",
  45012. styles: "background:white;box-shadow:0 0 2px rgba( 0, 0, 0, 0.6 );position:absolute;opacity:0.4;transform:translateZ( 0 )"
  45013. } : 0);
  45014. const GridLineX = /*#__PURE__*/emotion_styled_base_browser_esm(GridLine, true ? {
  45015. target: "eeew7dm1"
  45016. } : 0)( true ? {
  45017. name: "1qp910y",
  45018. styles: "height:1px;left:0;right:0"
  45019. } : 0);
  45020. const GridLineY = /*#__PURE__*/emotion_styled_base_browser_esm(GridLine, true ? {
  45021. target: "eeew7dm0"
  45022. } : 0)( true ? {
  45023. name: "1oz3zka",
  45024. styles: "width:1px;top:0;bottom:0"
  45025. } : 0);
  45026. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focal-point-picker/controls.js
  45027. /**
  45028. * WordPress dependencies
  45029. */
  45030. /**
  45031. * Internal dependencies
  45032. */
  45033. const TEXTCONTROL_MIN = 0;
  45034. const TEXTCONTROL_MAX = 100;
  45035. const controls_noop = () => {};
  45036. function FocalPointPickerControls(_ref) {
  45037. let {
  45038. __nextHasNoMarginBottom,
  45039. hasHelpText,
  45040. onChange = controls_noop,
  45041. point = {
  45042. x: 0.5,
  45043. y: 0.5
  45044. }
  45045. } = _ref;
  45046. const valueX = fractionToPercentage(point.x);
  45047. const valueY = fractionToPercentage(point.y);
  45048. const handleChange = (value, axis) => {
  45049. if (value === undefined) return;
  45050. const num = parseInt(value, 10);
  45051. if (!isNaN(num)) {
  45052. onChange({ ...point,
  45053. [axis]: num / 100
  45054. });
  45055. }
  45056. };
  45057. return (0,external_wp_element_namespaceObject.createElement)(ControlWrapper, {
  45058. className: "focal-point-picker__controls",
  45059. __nextHasNoMarginBottom: __nextHasNoMarginBottom,
  45060. hasHelpText: hasHelpText
  45061. }, (0,external_wp_element_namespaceObject.createElement)(FocalPointUnitControl, {
  45062. label: (0,external_wp_i18n_namespaceObject.__)('Left'),
  45063. value: [valueX, '%'].join(''),
  45064. onChange: next => handleChange(next, 'x'),
  45065. dragDirection: "e"
  45066. }), (0,external_wp_element_namespaceObject.createElement)(FocalPointUnitControl, {
  45067. label: (0,external_wp_i18n_namespaceObject.__)('Top'),
  45068. value: [valueY, '%'].join(''),
  45069. onChange: next => handleChange(next, 'y'),
  45070. dragDirection: "s"
  45071. }));
  45072. }
  45073. function FocalPointUnitControl(props) {
  45074. return (0,external_wp_element_namespaceObject.createElement)(StyledUnitControl, extends_extends({
  45075. className: "focal-point-picker__controls-position-unit-control",
  45076. labelPosition: "top",
  45077. max: TEXTCONTROL_MAX,
  45078. min: TEXTCONTROL_MIN,
  45079. units: [{
  45080. value: '%',
  45081. label: '%'
  45082. }]
  45083. }, props));
  45084. }
  45085. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focal-point-picker/styles/focal-point-style.js
  45086. 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)."; }
  45087. /**
  45088. * External dependencies
  45089. */
  45090. /**
  45091. * WordPress dependencies
  45092. */
  45093. /**
  45094. * Internal dependencies
  45095. */
  45096. const FocalPointWrapper = emotion_styled_base_browser_esm("div", true ? {
  45097. target: "e19snlhg3"
  45098. } : 0)("background-color:transparent;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 => {
  45099. let {
  45100. isDragging
  45101. } = _ref;
  45102. return isDragging && 'cursor: grabbing;';
  45103. }, ";" + ( true ? "" : 0));
  45104. const PointerIconSVG = /*#__PURE__*/emotion_styled_base_browser_esm(external_wp_primitives_namespaceObject.SVG, true ? {
  45105. target: "e19snlhg2"
  45106. } : 0)( true ? {
  45107. name: "qkx60y",
  45108. styles: "display:block;height:100%;left:0;position:absolute;top:0;width:100%"
  45109. } : 0);
  45110. const PointerIconPathOutline = /*#__PURE__*/emotion_styled_base_browser_esm(external_wp_primitives_namespaceObject.Path, true ? {
  45111. target: "e19snlhg1"
  45112. } : 0)( true ? {
  45113. name: "1b3qpiw",
  45114. styles: "fill:white"
  45115. } : 0);
  45116. const PointerIconPathFill = /*#__PURE__*/emotion_styled_base_browser_esm(external_wp_primitives_namespaceObject.Path, true ? {
  45117. target: "e19snlhg0"
  45118. } : 0)("fill:", COLORS.ui.theme, ";" + ( true ? "" : 0));
  45119. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focal-point-picker/focal-point.js
  45120. /**
  45121. * Internal dependencies
  45122. */
  45123. /**
  45124. * External dependencies
  45125. */
  45126. function FocalPoint(_ref) {
  45127. let {
  45128. left = '50%',
  45129. top = '50%',
  45130. ...props
  45131. } = _ref;
  45132. const classes = classnames_default()('components-focal-point-picker__icon_container');
  45133. const style = {
  45134. left,
  45135. top
  45136. };
  45137. return (0,external_wp_element_namespaceObject.createElement)(FocalPointWrapper, extends_extends({}, props, {
  45138. className: classes,
  45139. style: style
  45140. }), (0,external_wp_element_namespaceObject.createElement)(PointerIconSVG, {
  45141. className: "components-focal-point-picker__icon",
  45142. xmlns: "http://www.w3.org/2000/svg",
  45143. viewBox: "0 0 30 30"
  45144. }, (0,external_wp_element_namespaceObject.createElement)(PointerIconPathOutline, {
  45145. className: "components-focal-point-picker__icon-outline",
  45146. 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"
  45147. }), (0,external_wp_element_namespaceObject.createElement)(PointerIconPathFill, {
  45148. className: "components-focal-point-picker__icon-fill",
  45149. 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"
  45150. })));
  45151. }
  45152. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focal-point-picker/grid.js
  45153. /**
  45154. * Internal dependencies
  45155. */
  45156. function FocalPointPickerGrid(_ref) {
  45157. let {
  45158. bounds,
  45159. ...props
  45160. } = _ref;
  45161. return (0,external_wp_element_namespaceObject.createElement)(GridView, extends_extends({}, props, {
  45162. className: "components-focal-point-picker__grid",
  45163. style: {
  45164. width: bounds.width,
  45165. height: bounds.height
  45166. }
  45167. }), (0,external_wp_element_namespaceObject.createElement)(GridLineX, {
  45168. style: {
  45169. top: '33%'
  45170. }
  45171. }), (0,external_wp_element_namespaceObject.createElement)(GridLineX, {
  45172. style: {
  45173. top: '66%'
  45174. }
  45175. }), (0,external_wp_element_namespaceObject.createElement)(GridLineY, {
  45176. style: {
  45177. left: '33%'
  45178. }
  45179. }), (0,external_wp_element_namespaceObject.createElement)(GridLineY, {
  45180. style: {
  45181. left: '66%'
  45182. }
  45183. }));
  45184. }
  45185. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focal-point-picker/media.js
  45186. /**
  45187. * External dependencies
  45188. */
  45189. /**
  45190. * Internal dependencies
  45191. */
  45192. function media_Media(_ref) {
  45193. let {
  45194. alt,
  45195. autoPlay,
  45196. src,
  45197. onLoad,
  45198. mediaRef,
  45199. // Exposing muted prop for test rendering purposes
  45200. // https://github.com/testing-library/react-testing-library/issues/470
  45201. muted = true,
  45202. ...props
  45203. } = _ref;
  45204. if (!src) {
  45205. return (0,external_wp_element_namespaceObject.createElement)(MediaPlaceholder, extends_extends({
  45206. className: "components-focal-point-picker__media components-focal-point-picker__media--placeholder",
  45207. ref: mediaRef
  45208. }, props));
  45209. }
  45210. const isVideo = isVideoType(src);
  45211. return isVideo ? (0,external_wp_element_namespaceObject.createElement)("video", extends_extends({}, props, {
  45212. autoPlay: autoPlay,
  45213. className: "components-focal-point-picker__media components-focal-point-picker__media--video",
  45214. loop: true,
  45215. muted: muted,
  45216. onLoadedData: onLoad,
  45217. ref: mediaRef,
  45218. src: src
  45219. })) : (0,external_wp_element_namespaceObject.createElement)("img", extends_extends({}, props, {
  45220. alt: alt,
  45221. className: "components-focal-point-picker__media components-focal-point-picker__media--image",
  45222. onLoad: onLoad,
  45223. ref: mediaRef,
  45224. src: src
  45225. }));
  45226. }
  45227. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/hooks/use-update-effect.js
  45228. /**
  45229. * WordPress dependencies
  45230. */
  45231. /**
  45232. * A `React.useEffect` that will not run on the first render.
  45233. * Source:
  45234. * https://github.com/reakit/reakit/blob/HEAD/packages/reakit-utils/src/useUpdateEffect.ts
  45235. *
  45236. * @param {import('react').EffectCallback} effect
  45237. * @param {import('react').DependencyList} deps
  45238. */
  45239. function use_update_effect_useUpdateEffect(effect, deps) {
  45240. const mounted = (0,external_wp_element_namespaceObject.useRef)(false);
  45241. (0,external_wp_element_namespaceObject.useEffect)(() => {
  45242. if (mounted.current) {
  45243. return effect();
  45244. }
  45245. mounted.current = true;
  45246. return undefined;
  45247. }, deps);
  45248. }
  45249. /* harmony default export */ var use_update_effect = (use_update_effect_useUpdateEffect);
  45250. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focal-point-picker/index.js
  45251. /**
  45252. * External dependencies
  45253. */
  45254. /**
  45255. * WordPress dependencies
  45256. */
  45257. /**
  45258. * Internal dependencies
  45259. */
  45260. const GRID_OVERLAY_TIMEOUT = 600;
  45261. /**
  45262. * Focal Point Picker is a component which creates a UI for identifying the most important visual point of an image.
  45263. *
  45264. * This component addresses a specific problem: with large background images it is common to see undesirable crops,
  45265. * especially when viewing on smaller viewports such as mobile phones. This component allows the selection of
  45266. * the point with the most important visual information and returns it as a pair of numbers between 0 and 1.
  45267. * This value can be easily converted into the CSS `background-position` attribute, and will ensure that the
  45268. * focal point is never cropped out, regardless of viewport.
  45269. *
  45270. * - Example focal point picker value: `{ x: 0.5, y: 0.1 }`
  45271. * - Corresponding CSS: `background-position: 50% 10%;`
  45272. *
  45273. * ```jsx
  45274. * import { FocalPointPicker } from '@wordpress/components';
  45275. * import { useState } from '@wordpress/element';
  45276. *
  45277. * const Example = () => {
  45278. * const [ focalPoint, setFocalPoint ] = useState( {
  45279. * x: 0.5,
  45280. * y: 0.5,
  45281. * } );
  45282. *
  45283. * const url = '/path/to/image';
  45284. *
  45285. * // Example function to render the CSS styles based on Focal Point Picker value
  45286. * const style = {
  45287. * backgroundImage: `url(${ url })`,
  45288. * backgroundPosition: `${ focalPoint.x * 100 }% ${ focalPoint.y * 100 }%`,
  45289. * };
  45290. *
  45291. * return (
  45292. * <>
  45293. * <FocalPointPicker
  45294. * url={ url }
  45295. * value={ focalPoint }
  45296. * onDragStart={ setFocalPoint }
  45297. * onDrag={ setFocalPoint }
  45298. * onChange={ setFocalPoint }
  45299. * />
  45300. * <div style={ style } />
  45301. * </>
  45302. * );
  45303. * };
  45304. * ```
  45305. */
  45306. function FocalPointPicker(_ref) {
  45307. let {
  45308. __nextHasNoMarginBottom,
  45309. autoPlay = true,
  45310. className,
  45311. help,
  45312. label,
  45313. onChange,
  45314. onDrag,
  45315. onDragEnd,
  45316. onDragStart,
  45317. resolvePoint,
  45318. url,
  45319. value: valueProp = {
  45320. x: 0.5,
  45321. y: 0.5
  45322. },
  45323. ...restProps
  45324. } = _ref;
  45325. const [point, setPoint] = (0,external_wp_element_namespaceObject.useState)(valueProp);
  45326. const [showGridOverlay, setShowGridOverlay] = (0,external_wp_element_namespaceObject.useState)(false);
  45327. const {
  45328. startDrag,
  45329. endDrag,
  45330. isDragging
  45331. } = (0,external_wp_compose_namespaceObject.__experimentalUseDragging)({
  45332. onDragStart: event => {
  45333. var _dragAreaRef$current;
  45334. (_dragAreaRef$current = dragAreaRef.current) === null || _dragAreaRef$current === void 0 ? void 0 : _dragAreaRef$current.focus();
  45335. const value = getValueWithinDragArea(event); // `value` can technically be undefined if getValueWithinDragArea() is
  45336. // called before dragAreaRef is set, but this shouldn't happen in reality.
  45337. if (!value) return;
  45338. onDragStart === null || onDragStart === void 0 ? void 0 : onDragStart(value, event);
  45339. setPoint(value);
  45340. },
  45341. onDragMove: event => {
  45342. // Prevents text-selection when dragging.
  45343. event.preventDefault();
  45344. const value = getValueWithinDragArea(event);
  45345. if (!value) return;
  45346. onDrag === null || onDrag === void 0 ? void 0 : onDrag(value, event);
  45347. setPoint(value);
  45348. },
  45349. onDragEnd: () => {
  45350. onDragEnd === null || onDragEnd === void 0 ? void 0 : onDragEnd();
  45351. onChange === null || onChange === void 0 ? void 0 : onChange(point);
  45352. }
  45353. }); // Uses the internal point while dragging or else the value from props.
  45354. const {
  45355. x,
  45356. y
  45357. } = isDragging ? point : valueProp;
  45358. const dragAreaRef = (0,external_wp_element_namespaceObject.useRef)(null);
  45359. const [bounds, setBounds] = (0,external_wp_element_namespaceObject.useState)(INITIAL_BOUNDS);
  45360. const refUpdateBounds = (0,external_wp_element_namespaceObject.useRef)(() => {
  45361. if (!dragAreaRef.current) return;
  45362. const {
  45363. clientWidth: width,
  45364. clientHeight: height
  45365. } = dragAreaRef.current; // Falls back to initial bounds if the ref has no size. Since styles
  45366. // give the drag area dimensions even when the media has not loaded
  45367. // this should only happen in unit tests (jsdom).
  45368. setBounds(width > 0 && height > 0 ? {
  45369. width,
  45370. height
  45371. } : { ...INITIAL_BOUNDS
  45372. });
  45373. });
  45374. (0,external_wp_element_namespaceObject.useEffect)(() => {
  45375. const updateBounds = refUpdateBounds.current;
  45376. if (!dragAreaRef.current) return;
  45377. const {
  45378. defaultView
  45379. } = dragAreaRef.current.ownerDocument;
  45380. defaultView === null || defaultView === void 0 ? void 0 : defaultView.addEventListener('resize', updateBounds);
  45381. return () => defaultView === null || defaultView === void 0 ? void 0 : defaultView.removeEventListener('resize', updateBounds);
  45382. }, []); // Updates the bounds to cover cases of unspecified media or load failures.
  45383. (0,external_wp_compose_namespaceObject.useIsomorphicLayoutEffect)(() => void refUpdateBounds.current(), []); // TODO: Consider refactoring getValueWithinDragArea() into a pure function.
  45384. // https://github.com/WordPress/gutenberg/pull/43872#discussion_r963455173
  45385. const getValueWithinDragArea = _ref2 => {
  45386. let {
  45387. clientX,
  45388. clientY,
  45389. shiftKey
  45390. } = _ref2;
  45391. if (!dragAreaRef.current) return;
  45392. const {
  45393. top,
  45394. left
  45395. } = dragAreaRef.current.getBoundingClientRect();
  45396. let nextX = (clientX - left) / bounds.width;
  45397. let nextY = (clientY - top) / bounds.height; // Enables holding shift to jump values by 10%.
  45398. if (shiftKey) {
  45399. nextX = Math.round(nextX / 0.1) * 0.1;
  45400. nextY = Math.round(nextY / 0.1) * 0.1;
  45401. }
  45402. return getFinalValue({
  45403. x: nextX,
  45404. y: nextY
  45405. });
  45406. };
  45407. const getFinalValue = value => {
  45408. var _resolvePoint;
  45409. const resolvedValue = (_resolvePoint = resolvePoint === null || resolvePoint === void 0 ? void 0 : resolvePoint(value)) !== null && _resolvePoint !== void 0 ? _resolvePoint : value;
  45410. resolvedValue.x = Math.max(0, Math.min(resolvedValue.x, 1));
  45411. resolvedValue.y = Math.max(0, Math.min(resolvedValue.y, 1));
  45412. const roundToTwoDecimalPlaces = n => Math.round(n * 1e2) / 1e2;
  45413. return {
  45414. x: roundToTwoDecimalPlaces(resolvedValue.x),
  45415. y: roundToTwoDecimalPlaces(resolvedValue.y)
  45416. };
  45417. };
  45418. const arrowKeyStep = event => {
  45419. const {
  45420. code,
  45421. shiftKey
  45422. } = event;
  45423. if (!['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(code)) return;
  45424. event.preventDefault();
  45425. const value = {
  45426. x,
  45427. y
  45428. };
  45429. const step = shiftKey ? 0.1 : 0.01;
  45430. const delta = code === 'ArrowUp' || code === 'ArrowLeft' ? -1 * step : step;
  45431. const axis = code === 'ArrowUp' || code === 'ArrowDown' ? 'y' : 'x';
  45432. value[axis] = value[axis] + delta;
  45433. onChange === null || onChange === void 0 ? void 0 : onChange(getFinalValue(value));
  45434. };
  45435. const focalPointPosition = {
  45436. left: x * bounds.width,
  45437. top: y * bounds.height
  45438. };
  45439. const classes = classnames_default()('components-focal-point-picker-control', className);
  45440. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(FocalPointPicker);
  45441. const id = `inspector-focal-point-picker-control-${instanceId}`;
  45442. use_update_effect(() => {
  45443. setShowGridOverlay(true);
  45444. const timeout = window.setTimeout(() => {
  45445. setShowGridOverlay(false);
  45446. }, GRID_OVERLAY_TIMEOUT);
  45447. return () => window.clearTimeout(timeout);
  45448. }, [x, y]);
  45449. return (0,external_wp_element_namespaceObject.createElement)(base_control, extends_extends({}, restProps, {
  45450. __nextHasNoMarginBottom: __nextHasNoMarginBottom,
  45451. label: label,
  45452. id: id,
  45453. help: help,
  45454. className: classes
  45455. }), (0,external_wp_element_namespaceObject.createElement)(MediaWrapper, {
  45456. className: "components-focal-point-picker-wrapper"
  45457. }, (0,external_wp_element_namespaceObject.createElement)(MediaContainer, {
  45458. className: "components-focal-point-picker",
  45459. onKeyDown: arrowKeyStep,
  45460. onMouseDown: startDrag,
  45461. onBlur: () => {
  45462. if (isDragging) endDrag();
  45463. },
  45464. ref: dragAreaRef,
  45465. role: "button",
  45466. tabIndex: -1
  45467. }, (0,external_wp_element_namespaceObject.createElement)(FocalPointPickerGrid, {
  45468. bounds: bounds,
  45469. showOverlay: showGridOverlay
  45470. }), (0,external_wp_element_namespaceObject.createElement)(media_Media, {
  45471. alt: (0,external_wp_i18n_namespaceObject.__)('Media preview'),
  45472. autoPlay: autoPlay,
  45473. onLoad: refUpdateBounds.current,
  45474. src: url
  45475. }), (0,external_wp_element_namespaceObject.createElement)(FocalPoint, extends_extends({}, focalPointPosition, {
  45476. isDragging: isDragging
  45477. })))), (0,external_wp_element_namespaceObject.createElement)(FocalPointPickerControls, {
  45478. __nextHasNoMarginBottom: __nextHasNoMarginBottom,
  45479. hasHelpText: !!help,
  45480. point: {
  45481. x,
  45482. y
  45483. },
  45484. onChange: value => {
  45485. onChange === null || onChange === void 0 ? void 0 : onChange(getFinalValue(value));
  45486. }
  45487. }));
  45488. }
  45489. /* harmony default export */ var focal_point_picker = (FocalPointPicker);
  45490. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focusable-iframe/index.js
  45491. /**
  45492. * WordPress dependencies
  45493. */
  45494. /**
  45495. * @param {Object} props
  45496. * @param {import('react').Ref<HTMLIFrameElement>} props.iframeRef
  45497. */
  45498. function FocusableIframe(_ref) {
  45499. let {
  45500. iframeRef,
  45501. ...props
  45502. } = _ref;
  45503. // @ts-expect-error: Return type for useFocusableIframe() is incorrect.
  45504. const ref = (0,external_wp_compose_namespaceObject.useMergeRefs)([iframeRef, (0,external_wp_compose_namespaceObject.useFocusableIframe)()]);
  45505. external_wp_deprecated_default()('wp.components.FocusableIframe', {
  45506. since: '5.9',
  45507. alternative: 'wp.compose.useFocusableIframe'
  45508. }); // Disable reason: The rendered iframe is a pass-through component,
  45509. // assigning props inherited from the rendering parent. It's the
  45510. // responsibility of the parent to assign a title.
  45511. // eslint-disable-next-line jsx-a11y/iframe-has-title
  45512. return (0,external_wp_element_namespaceObject.createElement)("iframe", extends_extends({
  45513. ref: ref
  45514. }, props));
  45515. }
  45516. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/settings.js
  45517. /**
  45518. * WordPress dependencies
  45519. */
  45520. const settings = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  45521. xmlns: "http://www.w3.org/2000/svg",
  45522. viewBox: "0 0 24 24"
  45523. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  45524. 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"
  45525. }));
  45526. /* harmony default export */ var library_settings = (settings);
  45527. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Radio/RadioState.js
  45528. function useRadioState(initialState) {
  45529. if (initialState === void 0) {
  45530. initialState = {};
  45531. }
  45532. var _useSealedState = useSealedState(initialState),
  45533. initialValue = _useSealedState.state,
  45534. _useSealedState$loop = _useSealedState.loop,
  45535. loop = _useSealedState$loop === void 0 ? true : _useSealedState$loop,
  45536. sealed = _objectWithoutPropertiesLoose(_useSealedState, ["state", "loop"]);
  45537. var _React$useState = (0,external_React_namespaceObject.useState)(initialValue),
  45538. state = _React$useState[0],
  45539. setState = _React$useState[1];
  45540. var composite = useCompositeState(_objectSpread2(_objectSpread2({}, sealed), {}, {
  45541. loop: loop
  45542. }));
  45543. return _objectSpread2(_objectSpread2({}, composite), {}, {
  45544. state: state,
  45545. setState: setState
  45546. });
  45547. }
  45548. ;// CONCATENATED MODULE: ./node_modules/reakit/es/__keys-d251e56b.js
  45549. // Automatically generated
  45550. 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"];
  45551. var RADIO_KEYS = [].concat(RADIO_STATE_KEYS, ["value", "checked", "unstable_checkOnFocus"]);
  45552. var RADIO_GROUP_KEYS = RADIO_STATE_KEYS;
  45553. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Radio/RadioGroup.js
  45554. var useRadioGroup = createHook({
  45555. name: "RadioGroup",
  45556. compose: useComposite,
  45557. keys: RADIO_GROUP_KEYS,
  45558. useProps: function useProps(_, htmlProps) {
  45559. return _objectSpread2({
  45560. role: "radiogroup"
  45561. }, htmlProps);
  45562. }
  45563. });
  45564. var RadioGroup = createComponent({
  45565. as: "div",
  45566. useHook: useRadioGroup,
  45567. useCreateElement: function useCreateElement$1(type, props, children) {
  45568. false ? 0 : void 0;
  45569. return useCreateElement(type, props, children);
  45570. }
  45571. });
  45572. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control/styles.js
  45573. 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)."; }
  45574. /**
  45575. * External dependencies
  45576. */
  45577. /**
  45578. * Internal dependencies
  45579. */
  45580. const ToggleGroupControl = _ref => {
  45581. let {
  45582. size
  45583. } = _ref;
  45584. return /*#__PURE__*/emotion_react_browser_esm_css("background:", COLORS.ui.background, ";border:1px solid transparent;border-radius:", config_values.controlBorderRadius, ";display:inline-flex;min-width:0;padding:2px;position:relative;transition:transform ", config_values.transitionDurationFastest, " linear;", reduceMotion('transition'), " ", toggleGroupControlSize(size), " &:focus-within{border-color:", COLORS.ui.borderFocus, ";box-shadow:", config_values.controlBoxShadowFocus, ";outline:none;z-index:1;}" + ( true ? "" : 0), true ? "" : 0);
  45585. };
  45586. const border = /*#__PURE__*/emotion_react_browser_esm_css("border-color:", COLORS.ui.border, ";&:hover{border-color:", COLORS.ui.borderHover, ";}" + ( true ? "" : 0), true ? "" : 0);
  45587. const toggleGroupControlSize = size => {
  45588. const heights = {
  45589. default: '36px',
  45590. '__unstable-large': '40px'
  45591. };
  45592. return /*#__PURE__*/emotion_react_browser_esm_css("min-height:", heights[size], ";" + ( true ? "" : 0), true ? "" : 0);
  45593. };
  45594. const toggle_group_control_styles_block = true ? {
  45595. name: "7whenc",
  45596. styles: "display:flex;width:100%"
  45597. } : 0;
  45598. const BackdropView = emotion_styled_base_browser_esm("div", true ? {
  45599. target: "eakva831"
  45600. } : 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));
  45601. const VisualLabelWrapper = emotion_styled_base_browser_esm("div", true ? {
  45602. target: "eakva830"
  45603. } : 0)( true ? {
  45604. name: "zjik7",
  45605. styles: "display:flex"
  45606. } : 0);
  45607. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js
  45608. /**
  45609. * WordPress dependencies
  45610. */
  45611. /**
  45612. * Internal dependencies
  45613. */
  45614. function ToggleGroupControlBackdrop(_ref) {
  45615. let {
  45616. containerRef,
  45617. containerWidth,
  45618. isAdaptiveWidth,
  45619. state
  45620. } = _ref;
  45621. const [left, setLeft] = (0,external_wp_element_namespaceObject.useState)(0);
  45622. const [width, setWidth] = (0,external_wp_element_namespaceObject.useState)(0);
  45623. const [canAnimate, setCanAnimate] = (0,external_wp_element_namespaceObject.useState)(false);
  45624. const [renderBackdrop, setRenderBackdrop] = (0,external_wp_element_namespaceObject.useState)(false);
  45625. (0,external_wp_element_namespaceObject.useEffect)(() => {
  45626. const containerNode = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current;
  45627. if (!containerNode) return;
  45628. /**
  45629. * Workaround for Reakit
  45630. */
  45631. const targetNode = containerNode.querySelector(`[data-value="${state}"]`);
  45632. setRenderBackdrop(!!targetNode);
  45633. if (!targetNode) {
  45634. return;
  45635. }
  45636. const computeDimensions = () => {
  45637. const {
  45638. width: offsetWidth,
  45639. x
  45640. } = targetNode.getBoundingClientRect();
  45641. const {
  45642. x: parentX
  45643. } = containerNode.getBoundingClientRect();
  45644. const borderWidth = 1;
  45645. const offsetLeft = x - parentX - borderWidth;
  45646. setLeft(offsetLeft);
  45647. setWidth(offsetWidth);
  45648. }; // Fix to make the component appear as expected inside popovers.
  45649. // If the targetNode width is 0 it means the element was not yet rendered we should allow
  45650. // some time for the render to happen.
  45651. // requestAnimationFrame instead of setTimeout with a small time does not seems to work.
  45652. const dimensionsRequestId = window.setTimeout(computeDimensions, 100);
  45653. let animationRequestId;
  45654. if (!canAnimate) {
  45655. animationRequestId = window.requestAnimationFrame(() => {
  45656. setCanAnimate(true);
  45657. });
  45658. }
  45659. return () => {
  45660. window.clearTimeout(dimensionsRequestId);
  45661. window.cancelAnimationFrame(animationRequestId);
  45662. };
  45663. }, [canAnimate, containerRef, containerWidth, state, isAdaptiveWidth]);
  45664. if (!renderBackdrop) {
  45665. return null;
  45666. }
  45667. return (0,external_wp_element_namespaceObject.createElement)(BackdropView, {
  45668. role: "presentation",
  45669. style: {
  45670. transform: `translateX(${left}px)`,
  45671. transition: canAnimate ? undefined : 'none',
  45672. width
  45673. }
  45674. });
  45675. }
  45676. /* harmony default export */ var toggle_group_control_backdrop = ((0,external_wp_element_namespaceObject.memo)(ToggleGroupControlBackdrop));
  45677. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toggle-group-control/context.js
  45678. /**
  45679. * WordPress dependencies
  45680. */
  45681. /**
  45682. * Internal dependencies
  45683. */
  45684. const ToggleGroupControlContext = (0,external_wp_element_namespaceObject.createContext)({});
  45685. const useToggleGroupControlContext = () => (0,external_wp_element_namespaceObject.useContext)(ToggleGroupControlContext);
  45686. /* harmony default export */ var toggle_group_control_context = (ToggleGroupControlContext);
  45687. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control/component.js
  45688. /**
  45689. * External dependencies
  45690. */
  45691. // eslint-disable-next-line no-restricted-imports
  45692. /**
  45693. * WordPress dependencies
  45694. */
  45695. /**
  45696. * Internal dependencies
  45697. */
  45698. const toggle_group_control_component_noop = () => {};
  45699. function UnconnectedToggleGroupControl(props, forwardedRef) {
  45700. const {
  45701. __nextHasNoMarginBottom = false,
  45702. className,
  45703. isAdaptiveWidth = false,
  45704. isBlock = false,
  45705. __experimentalIsBorderless = false,
  45706. label,
  45707. hideLabelFromVision = false,
  45708. help,
  45709. onChange = toggle_group_control_component_noop,
  45710. size = 'default',
  45711. value,
  45712. children,
  45713. ...otherProps
  45714. } = useContextSystem(props, 'ToggleGroupControl');
  45715. const cx = useCx();
  45716. const containerRef = (0,external_wp_element_namespaceObject.useRef)();
  45717. const [resizeListener, sizes] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
  45718. const baseId = (0,external_wp_compose_namespaceObject.useInstanceId)(component_ToggleGroupControl, 'toggle-group-control').toString();
  45719. const radio = useRadioState({
  45720. baseId,
  45721. state: value
  45722. });
  45723. const previousValue = (0,external_wp_compose_namespaceObject.usePrevious)(value); // Propagate radio.state change.
  45724. use_update_effect(() => {
  45725. // Avoid calling onChange if radio state changed
  45726. // from incoming value.
  45727. if (previousValue !== radio.state) {
  45728. onChange(radio.state);
  45729. }
  45730. }, [radio.state]); // Sync incoming value with radio.state.
  45731. use_update_effect(() => {
  45732. if (value !== radio.state) {
  45733. radio.setState(value);
  45734. }
  45735. }, [value]);
  45736. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(ToggleGroupControl({
  45737. size
  45738. }), !__experimentalIsBorderless && border, isBlock && toggle_group_control_styles_block, className), [className, cx, isBlock, __experimentalIsBorderless, size]);
  45739. return (0,external_wp_element_namespaceObject.createElement)(base_control, {
  45740. help: help,
  45741. __nextHasNoMarginBottom: __nextHasNoMarginBottom
  45742. }, (0,external_wp_element_namespaceObject.createElement)(toggle_group_control_context.Provider, {
  45743. value: { ...radio,
  45744. isBlock: !isAdaptiveWidth,
  45745. size
  45746. }
  45747. }, !hideLabelFromVision && (0,external_wp_element_namespaceObject.createElement)(VisualLabelWrapper, null, (0,external_wp_element_namespaceObject.createElement)(base_control.VisualLabel, null, label)), (0,external_wp_element_namespaceObject.createElement)(RadioGroup, extends_extends({}, radio, {
  45748. "aria-label": label,
  45749. as: component,
  45750. className: classes
  45751. }, otherProps, {
  45752. ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([containerRef, forwardedRef])
  45753. }), resizeListener, (0,external_wp_element_namespaceObject.createElement)(toggle_group_control_backdrop, extends_extends({}, radio, {
  45754. containerRef: containerRef,
  45755. containerWidth: sizes.width,
  45756. isAdaptiveWidth: isAdaptiveWidth
  45757. })), children)));
  45758. }
  45759. /**
  45760. * `ToggleGroupControl` is a form component that lets users choose options
  45761. * represented in horizontal segments. To render options for this control use
  45762. * `ToggleGroupControlOption` component.
  45763. *
  45764. * This component is intended for selecting a single persistent value from a set of options,
  45765. * similar to a how a radio button group would work. If you simply want a toggle to switch between views,
  45766. * use a `TabPanel` instead.
  45767. *
  45768. * Only use this control when you know for sure the labels of items inside won't
  45769. * wrap. For items with longer labels, you can consider a `SelectControl` or a
  45770. * `CustomSelectControl` component instead.
  45771. *
  45772. * ```jsx
  45773. * import {
  45774. * __experimentalToggleGroupControl as ToggleGroupControl,
  45775. * __experimentalToggleGroupControlOption as ToggleGroupControlOption,
  45776. * } from '@wordpress/components';
  45777. *
  45778. * function Example() {
  45779. * return (
  45780. * <ToggleGroupControl label="my label" value="vertical" isBlock>
  45781. * <ToggleGroupControlOption value="horizontal" label="Horizontal" />
  45782. * <ToggleGroupControlOption value="vertical" label="Vertical" />
  45783. * </ToggleGroupControl>
  45784. * );
  45785. * }
  45786. * ```
  45787. */
  45788. const component_ToggleGroupControl = contextConnect(UnconnectedToggleGroupControl, 'ToggleGroupControl');
  45789. /* harmony default export */ var toggle_group_control_component = (component_ToggleGroupControl);
  45790. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Radio/Radio.js
  45791. function getChecked(options) {
  45792. if (typeof options.checked !== "undefined") {
  45793. return options.checked;
  45794. }
  45795. return typeof options.value !== "undefined" && options.state === options.value;
  45796. }
  45797. function useInitialChecked(options) {
  45798. var _React$useState = (0,external_React_namespaceObject.useState)(function () {
  45799. return getChecked(options);
  45800. }),
  45801. initialChecked = _React$useState[0];
  45802. var _React$useState2 = (0,external_React_namespaceObject.useState)(options.currentId),
  45803. initialCurrentId = _React$useState2[0];
  45804. var id = options.id,
  45805. setCurrentId = options.setCurrentId;
  45806. (0,external_React_namespaceObject.useEffect)(function () {
  45807. if (initialChecked && id && initialCurrentId !== id) {
  45808. setCurrentId === null || setCurrentId === void 0 ? void 0 : setCurrentId(id);
  45809. }
  45810. }, [initialChecked, id, setCurrentId, initialCurrentId]);
  45811. }
  45812. function fireChange(element, onChange) {
  45813. var event = createEvent(element, "change");
  45814. Object.defineProperties(event, {
  45815. type: {
  45816. value: "change"
  45817. },
  45818. target: {
  45819. value: element
  45820. },
  45821. currentTarget: {
  45822. value: element
  45823. }
  45824. });
  45825. onChange === null || onChange === void 0 ? void 0 : onChange(event);
  45826. }
  45827. var useRadio = createHook({
  45828. name: "Radio",
  45829. compose: useCompositeItem,
  45830. keys: RADIO_KEYS,
  45831. useOptions: function useOptions(_ref, _ref2) {
  45832. var _options$value;
  45833. var value = _ref2.value,
  45834. checked = _ref2.checked;
  45835. var _ref$unstable_clickOn = _ref.unstable_clickOnEnter,
  45836. unstable_clickOnEnter = _ref$unstable_clickOn === void 0 ? false : _ref$unstable_clickOn,
  45837. _ref$unstable_checkOn = _ref.unstable_checkOnFocus,
  45838. unstable_checkOnFocus = _ref$unstable_checkOn === void 0 ? true : _ref$unstable_checkOn,
  45839. options = _objectWithoutPropertiesLoose(_ref, ["unstable_clickOnEnter", "unstable_checkOnFocus"]);
  45840. return _objectSpread2(_objectSpread2({
  45841. checked: checked,
  45842. unstable_clickOnEnter: unstable_clickOnEnter,
  45843. unstable_checkOnFocus: unstable_checkOnFocus
  45844. }, options), {}, {
  45845. value: (_options$value = options.value) != null ? _options$value : value
  45846. });
  45847. },
  45848. useProps: function useProps(options, _ref3) {
  45849. var htmlRef = _ref3.ref,
  45850. htmlOnChange = _ref3.onChange,
  45851. htmlOnClick = _ref3.onClick,
  45852. htmlProps = _objectWithoutPropertiesLoose(_ref3, ["ref", "onChange", "onClick"]);
  45853. var ref = (0,external_React_namespaceObject.useRef)(null);
  45854. var _React$useState3 = (0,external_React_namespaceObject.useState)(true),
  45855. isNativeRadio = _React$useState3[0],
  45856. setIsNativeRadio = _React$useState3[1];
  45857. var checked = getChecked(options);
  45858. var isCurrentItemRef = useLiveRef(options.currentId === options.id);
  45859. var onChangeRef = useLiveRef(htmlOnChange);
  45860. var onClickRef = useLiveRef(htmlOnClick);
  45861. useInitialChecked(options);
  45862. (0,external_React_namespaceObject.useEffect)(function () {
  45863. var element = ref.current;
  45864. if (!element) {
  45865. false ? 0 : void 0;
  45866. return;
  45867. }
  45868. if (element.tagName !== "INPUT" || element.type !== "radio") {
  45869. setIsNativeRadio(false);
  45870. }
  45871. }, []);
  45872. var onChange = (0,external_React_namespaceObject.useCallback)(function (event) {
  45873. var _onChangeRef$current, _options$setState;
  45874. (_onChangeRef$current = onChangeRef.current) === null || _onChangeRef$current === void 0 ? void 0 : _onChangeRef$current.call(onChangeRef, event);
  45875. if (event.defaultPrevented) return;
  45876. if (options.disabled) return;
  45877. (_options$setState = options.setState) === null || _options$setState === void 0 ? void 0 : _options$setState.call(options, options.value);
  45878. }, [options.disabled, options.setState, options.value]);
  45879. var onClick = (0,external_React_namespaceObject.useCallback)(function (event) {
  45880. var _onClickRef$current;
  45881. (_onClickRef$current = onClickRef.current) === null || _onClickRef$current === void 0 ? void 0 : _onClickRef$current.call(onClickRef, event);
  45882. if (event.defaultPrevented) return;
  45883. if (isNativeRadio) return;
  45884. fireChange(event.currentTarget, onChange);
  45885. }, [onChange, isNativeRadio]);
  45886. (0,external_React_namespaceObject.useEffect)(function () {
  45887. var element = ref.current;
  45888. if (!element) return;
  45889. if (options.unstable_moves && isCurrentItemRef.current && options.unstable_checkOnFocus) {
  45890. fireChange(element, onChange);
  45891. }
  45892. }, [options.unstable_moves, options.unstable_checkOnFocus, onChange]);
  45893. return _objectSpread2({
  45894. ref: useForkRef(ref, htmlRef),
  45895. role: !isNativeRadio ? "radio" : undefined,
  45896. type: isNativeRadio ? "radio" : undefined,
  45897. value: isNativeRadio ? options.value : undefined,
  45898. name: isNativeRadio ? options.baseId : undefined,
  45899. "aria-checked": checked,
  45900. checked: checked,
  45901. onChange: onChange,
  45902. onClick: onClick
  45903. }, htmlProps);
  45904. }
  45905. });
  45906. var Radio = createComponent({
  45907. as: "input",
  45908. memo: true,
  45909. useHook: useRadio
  45910. });
  45911. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control-option-base/styles.js
  45912. 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)."; }
  45913. /**
  45914. * External dependencies
  45915. */
  45916. /**
  45917. * Internal dependencies
  45918. */
  45919. const LabelView = emotion_styled_base_browser_esm("div", true ? {
  45920. target: "et6ln9s1"
  45921. } : 0)( true ? {
  45922. name: "sln1fl",
  45923. styles: "display:inline-flex;max-width:100%;min-width:0;position:relative"
  45924. } : 0);
  45925. const labelBlock = true ? {
  45926. name: "82a6rk",
  45927. styles: "flex:1"
  45928. } : 0;
  45929. 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);
  45930. const ButtonContentView = emotion_styled_base_browser_esm("div", true ? {
  45931. target: "et6ln9s0"
  45932. } : 0)("font-size:", config_values.fontSize, ";line-height:1;" + ( true ? "" : 0));
  45933. const separatorActive = true ? {
  45934. name: "1qsuvl4",
  45935. styles: "background:transparent"
  45936. } : 0;
  45937. const styles_isIcon = _ref => {
  45938. let {
  45939. size
  45940. } = _ref;
  45941. const iconButtonSizes = {
  45942. default: '30px',
  45943. '__unstable-large': '34px'
  45944. };
  45945. return /*#__PURE__*/emotion_react_browser_esm_css("color:", COLORS.gray[900], ";width:", iconButtonSizes[size], ";padding-left:0;padding-right:0;" + ( true ? "" : 0), true ? "" : 0);
  45946. };
  45947. const buttonActive = /*#__PURE__*/emotion_react_browser_esm_css("color:", COLORS.white, ";&:active{background:transparent;}" + ( true ? "" : 0), true ? "" : 0);
  45948. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control-option-base/component.js
  45949. /**
  45950. * External dependencies
  45951. */
  45952. // eslint-disable-next-line no-restricted-imports
  45953. /**
  45954. * WordPress dependencies
  45955. */
  45956. /**
  45957. * Internal dependencies
  45958. */
  45959. const {
  45960. ButtonContentView: component_ButtonContentView,
  45961. LabelView: component_LabelView
  45962. } = toggle_group_control_option_base_styles_namespaceObject;
  45963. const WithToolTip = _ref => {
  45964. let {
  45965. showTooltip,
  45966. text,
  45967. children
  45968. } = _ref;
  45969. if (showTooltip && text) {
  45970. return (0,external_wp_element_namespaceObject.createElement)(tooltip, {
  45971. text: text,
  45972. position: "top center"
  45973. }, children);
  45974. }
  45975. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, children);
  45976. };
  45977. function ToggleGroupControlOptionBase(props, forwardedRef) {
  45978. const toggleGroupControlContext = useToggleGroupControlContext();
  45979. const id = (0,external_wp_compose_namespaceObject.useInstanceId)(ToggleGroupControlOptionBase, toggleGroupControlContext.baseId || 'toggle-group-control-option-base');
  45980. const buttonProps = useContextSystem({ ...props,
  45981. id
  45982. }, 'ToggleGroupControlOptionBase');
  45983. const {
  45984. className,
  45985. isBlock = false,
  45986. isIcon = false,
  45987. value,
  45988. children,
  45989. size = 'default',
  45990. showTooltip = false,
  45991. ...radioProps
  45992. } = { ...toggleGroupControlContext,
  45993. ...buttonProps
  45994. };
  45995. const isActive = radioProps.state === value;
  45996. const cx = useCx();
  45997. const labelViewClasses = cx(isBlock && labelBlock);
  45998. const classes = cx(buttonView, isIcon && styles_isIcon({
  45999. size
  46000. }), className, isActive && buttonActive);
  46001. return (0,external_wp_element_namespaceObject.createElement)(component_LabelView, {
  46002. className: labelViewClasses,
  46003. "data-active": isActive
  46004. }, (0,external_wp_element_namespaceObject.createElement)(WithToolTip, {
  46005. showTooltip: showTooltip,
  46006. text: radioProps['aria-label']
  46007. }, (0,external_wp_element_namespaceObject.createElement)(Radio, extends_extends({}, radioProps, {
  46008. as: "button",
  46009. "aria-label": radioProps['aria-label'],
  46010. className: classes,
  46011. "data-value": value,
  46012. ref: forwardedRef,
  46013. value: value
  46014. }), (0,external_wp_element_namespaceObject.createElement)(component_ButtonContentView, null, children))));
  46015. }
  46016. /**
  46017. * `ToggleGroupControlOptionBase` is a form component and is meant to be used as an internal,
  46018. * generic component for any children of `ToggleGroupControl`.
  46019. *
  46020. * @example
  46021. * ```jsx
  46022. * import {
  46023. * __experimentalToggleGroupControl as ToggleGroupControl,
  46024. * __experimentalToggleGroupControlOptionBase as ToggleGroupControlOptionBase,
  46025. * } from '@wordpress/components';
  46026. *
  46027. * function Example() {
  46028. * return (
  46029. * <ToggleGroupControl label="my label" value="vertical" isBlock>
  46030. * <ToggleGroupControlOption value="horizontal" label="Horizontal" />
  46031. * <ToggleGroupControlOption value="vertical" label="Vertical" />
  46032. * </ToggleGroupControl>
  46033. * );
  46034. * }
  46035. * ```
  46036. */
  46037. const ConnectedToggleGroupControlOptionBase = contextConnect(ToggleGroupControlOptionBase, 'ToggleGroupControlOptionBase');
  46038. /* harmony default export */ var toggle_group_control_option_base_component = (ConnectedToggleGroupControlOptionBase);
  46039. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control-option/component.js
  46040. /**
  46041. * External dependencies
  46042. */
  46043. /**
  46044. * WordPress dependencies
  46045. */
  46046. /**
  46047. * Internal dependencies
  46048. */
  46049. function UnforwardedToggleGroupControlOption(props, ref) {
  46050. const {
  46051. label,
  46052. ...restProps
  46053. } = props;
  46054. const optionLabel = restProps['aria-label'] || label;
  46055. return (0,external_wp_element_namespaceObject.createElement)(toggle_group_control_option_base_component, extends_extends({}, restProps, {
  46056. "aria-label": optionLabel,
  46057. ref: ref
  46058. }), label);
  46059. }
  46060. /**
  46061. * `ToggleGroupControlOption` is a form component and is meant to be used as a
  46062. * child of `ToggleGroupControl`.
  46063. *
  46064. * ```jsx
  46065. * import {
  46066. * __experimentalToggleGroupControl as ToggleGroupControl,
  46067. * __experimentalToggleGroupControlOption as ToggleGroupControlOption,
  46068. * } from '@wordpress/components';
  46069. *
  46070. * function Example() {
  46071. * return (
  46072. * <ToggleGroupControl label="my label" value="vertical" isBlock>
  46073. * <ToggleGroupControlOption value="horizontal" label="Horizontal" />
  46074. * <ToggleGroupControlOption value="vertical" label="Vertical" />
  46075. * </ToggleGroupControl>
  46076. * );
  46077. * }
  46078. * ```
  46079. */
  46080. const ToggleGroupControlOption = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedToggleGroupControlOption);
  46081. /* harmony default export */ var toggle_group_control_option_component = (ToggleGroupControlOption);
  46082. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/font-size-picker/utils.js
  46083. /**
  46084. * WordPress dependencies
  46085. */
  46086. const DEFAULT_FONT_SIZE = 'default';
  46087. const DEFAULT_FONT_SIZE_OPTION = {
  46088. slug: DEFAULT_FONT_SIZE,
  46089. name: (0,external_wp_i18n_namespaceObject.__)('Default')
  46090. };
  46091. const CUSTOM_FONT_SIZE = 'custom';
  46092. const CUSTOM_FONT_SIZE_OPTION = {
  46093. slug: CUSTOM_FONT_SIZE,
  46094. name: (0,external_wp_i18n_namespaceObject.__)('Custom')
  46095. };
  46096. /**
  46097. * In case we have at most five font sizes, show a `T-shirt size`
  46098. * alias as a label of the font size. The label assumes that the font sizes
  46099. * are ordered accordingly - from smallest to largest.
  46100. */
  46101. const FONT_SIZES_ALIASES = [
  46102. /* translators: S stands for 'small' and is a size label. */
  46103. (0,external_wp_i18n_namespaceObject.__)('S'),
  46104. /* translators: M stands for 'medium' and is a size label. */
  46105. (0,external_wp_i18n_namespaceObject.__)('M'),
  46106. /* translators: L stands for 'large' and is a size label. */
  46107. (0,external_wp_i18n_namespaceObject.__)('L'),
  46108. /* translators: XL stands for 'extra large' and is a size label. */
  46109. (0,external_wp_i18n_namespaceObject.__)('XL'),
  46110. /* translators: XXL stands for 'extra extra large' and is a size label. */
  46111. (0,external_wp_i18n_namespaceObject.__)('XXL')];
  46112. /**
  46113. * Helper util to split a font size to its numeric value
  46114. * and its `unit`, if exists.
  46115. *
  46116. * @param {string|number} size Font size.
  46117. * @return {[number, string]} An array with the numeric value and the unit if exists.
  46118. */
  46119. function splitValueAndUnitFromSize(size) {
  46120. const [numericValue, unit] = `${size}`.match(/[\d\.]+|\D+/g);
  46121. if (!isNaN(parseFloat(numericValue)) && isFinite(numericValue)) {
  46122. return [numericValue, unit];
  46123. }
  46124. return [];
  46125. }
  46126. /**
  46127. * Some themes use css vars for their font sizes, so until we
  46128. * have the way of calculating them don't display them.
  46129. *
  46130. * @param {string|number} value The value that is checked.
  46131. * @return {boolean} Whether the value is a simple css value.
  46132. */
  46133. function isSimpleCssValue(value) {
  46134. const sizeRegex = /^[\d\.]+(px|em|rem|vw|vh|%)?$/i;
  46135. return sizeRegex.test(value);
  46136. }
  46137. /**
  46138. * Return font size options in the proper format depending
  46139. * on the currently used control (select, toggle group).
  46140. *
  46141. * @param {boolean} useSelectControl Whether to use a select control.
  46142. * @param {Object[]} optionsArray Array of available font sizes objects.
  46143. * @param {boolean} disableCustomFontSizes Flag that indicates if custom font sizes are disabled.
  46144. * @return {Object[]|null} Array of font sizes in proper format for the used control.
  46145. */
  46146. function getFontSizeOptions(useSelectControl, optionsArray, disableCustomFontSizes) {
  46147. if (disableCustomFontSizes && !optionsArray.length) {
  46148. return null;
  46149. }
  46150. return useSelectControl ? getSelectOptions(optionsArray, disableCustomFontSizes) : getToggleGroupOptions(optionsArray);
  46151. }
  46152. function getSelectOptions(optionsArray, disableCustomFontSizes) {
  46153. const options = [DEFAULT_FONT_SIZE_OPTION, ...optionsArray, ...(disableCustomFontSizes ? [] : [CUSTOM_FONT_SIZE_OPTION])];
  46154. return options.map(_ref => {
  46155. let {
  46156. slug,
  46157. name,
  46158. size
  46159. } = _ref;
  46160. return {
  46161. key: slug,
  46162. name: name || slug,
  46163. size,
  46164. __experimentalHint: size && isSimpleCssValue(size) && parseFloat(size)
  46165. };
  46166. });
  46167. }
  46168. /**
  46169. * Build options for the toggle group options.
  46170. *
  46171. * @param {Array} optionsArray An array of font size options.
  46172. * @param {string[]} labelAliases An array of alternative labels.
  46173. * @return {Array} Remapped optionsArray.
  46174. */
  46175. function getToggleGroupOptions(optionsArray) {
  46176. let labelAliases = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : FONT_SIZES_ALIASES;
  46177. return optionsArray.map((_ref2, index) => {
  46178. let {
  46179. slug,
  46180. size,
  46181. name
  46182. } = _ref2;
  46183. return {
  46184. key: slug,
  46185. value: size,
  46186. label: labelAliases[index],
  46187. name: name || labelAliases[index]
  46188. };
  46189. });
  46190. }
  46191. function getSelectedOption(fontSizes, value) {
  46192. if (!value) {
  46193. return DEFAULT_FONT_SIZE_OPTION;
  46194. }
  46195. return fontSizes.find(font => font.size === value) || CUSTOM_FONT_SIZE_OPTION;
  46196. }
  46197. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/font-size-picker/index.js
  46198. /**
  46199. * External dependencies
  46200. */
  46201. /**
  46202. * WordPress dependencies
  46203. */
  46204. /**
  46205. * Internal dependencies
  46206. */
  46207. // This conditional is needed to maintain the spacing before the slider in the `withSlider` case.
  46208. const MaybeVStack = _ref => {
  46209. let {
  46210. __nextHasNoMarginBottom,
  46211. children
  46212. } = _ref;
  46213. return !__nextHasNoMarginBottom ? children : (0,external_wp_element_namespaceObject.createElement)(v_stack_component, {
  46214. spacing: 6,
  46215. children: children
  46216. });
  46217. };
  46218. function FontSizePicker(_ref2, ref) {
  46219. var _fontSizes$, _value$endsWith;
  46220. let {
  46221. /** Start opting into the new margin-free styles that will become the default in a future version. */
  46222. __nextHasNoMarginBottom = false,
  46223. fallbackFontSize,
  46224. fontSizes = [],
  46225. disableCustomFontSizes = false,
  46226. onChange,
  46227. /** @type {'default' | '__unstable-large'} */
  46228. size = 'default',
  46229. value,
  46230. withSlider = false,
  46231. withReset = true
  46232. } = _ref2;
  46233. if (!__nextHasNoMarginBottom) {
  46234. external_wp_deprecated_default()('Bottom margin styles for wp.components.FontSizePicker', {
  46235. since: '6.1',
  46236. version: '6.4',
  46237. hint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version.'
  46238. });
  46239. }
  46240. 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');
  46241. const noUnitsValue = !hasUnits ? value : parseInt(value);
  46242. 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'));
  46243. const units = useCustomUnits({
  46244. availableUnits: ['px', 'em', 'rem']
  46245. });
  46246. /**
  46247. * The main font size UI displays a toggle group when the presets are less
  46248. * than six and a select control when they are more.
  46249. */
  46250. const fontSizesContainComplexValues = fontSizes.some(_ref3 => {
  46251. let {
  46252. size: sizeArg
  46253. } = _ref3;
  46254. return !isSimpleCssValue(sizeArg);
  46255. });
  46256. const shouldUseSelectControl = fontSizes.length > 5;
  46257. const options = (0,external_wp_element_namespaceObject.useMemo)(() => getFontSizeOptions(shouldUseSelectControl, fontSizes, disableCustomFontSizes), [shouldUseSelectControl, fontSizes, disableCustomFontSizes]);
  46258. const selectedOption = getSelectedOption(fontSizes, value);
  46259. const isCustomValue = selectedOption.slug === CUSTOM_FONT_SIZE;
  46260. const [showCustomValueControl, setShowCustomValueControl] = (0,external_wp_element_namespaceObject.useState)(!disableCustomFontSizes && isCustomValue);
  46261. const headerHint = (0,external_wp_element_namespaceObject.useMemo)(() => {
  46262. if (showCustomValueControl) {
  46263. return `(${(0,external_wp_i18n_namespaceObject.__)('Custom')})`;
  46264. } // If we have a custom value that is not available in the font sizes,
  46265. // show it as a hint as long as it's a simple CSS value.
  46266. if (isCustomValue) {
  46267. return isSimpleCssValue(value) && `(${value})`;
  46268. }
  46269. if (shouldUseSelectControl) {
  46270. return isSimpleCssValue(selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.size) && `(${selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.size})`;
  46271. } // Calculate the `hint` for toggle group control.
  46272. let hint = (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.name) || selectedOption.slug;
  46273. if (!fontSizesContainComplexValues && typeof selectedOption.size === 'string') {
  46274. const [, unit] = splitValueAndUnitFromSize(selectedOption.size);
  46275. hint += `(${unit})`;
  46276. }
  46277. return hint;
  46278. }, [showCustomValueControl, selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.name, selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.size, value, isCustomValue, shouldUseSelectControl, fontSizesContainComplexValues]);
  46279. if (!options) {
  46280. return null;
  46281. } // This is used for select control only. We need to add support
  46282. // for ToggleGroupControl.
  46283. const currentFontSizeSR = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: Currently selected font size.
  46284. (0,external_wp_i18n_namespaceObject.__)('Currently selected font size: %s'), selectedOption.name);
  46285. const baseClassName = 'components-font-size-picker';
  46286. return (0,external_wp_element_namespaceObject.createElement)("fieldset", extends_extends({
  46287. className: baseClassName
  46288. }, ref ? {} : {
  46289. ref
  46290. }), (0,external_wp_element_namespaceObject.createElement)(visually_hidden_component, {
  46291. as: "legend"
  46292. }, (0,external_wp_i18n_namespaceObject.__)('Font size')), (0,external_wp_element_namespaceObject.createElement)(h_stack_component, {
  46293. className: `${baseClassName}__header`
  46294. }, (0,external_wp_element_namespaceObject.createElement)(BaseControl.VisualLabel, null, (0,external_wp_i18n_namespaceObject.__)('Size'), headerHint && (0,external_wp_element_namespaceObject.createElement)("span", {
  46295. className: `${baseClassName}__header__hint`
  46296. }, headerHint)), !disableCustomFontSizes && (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  46297. label: showCustomValueControl ? (0,external_wp_i18n_namespaceObject.__)('Use size preset') : (0,external_wp_i18n_namespaceObject.__)('Set custom size'),
  46298. icon: library_settings,
  46299. onClick: () => {
  46300. setShowCustomValueControl(!showCustomValueControl);
  46301. },
  46302. isPressed: showCustomValueControl,
  46303. isSmall: true
  46304. })), (0,external_wp_element_namespaceObject.createElement)(MaybeVStack, {
  46305. __nextHasNoMarginBottom: __nextHasNoMarginBottom
  46306. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  46307. className: classnames_default()(`${baseClassName}__controls`, {
  46308. 'is-next-has-no-margin-bottom': __nextHasNoMarginBottom
  46309. })
  46310. }, !!fontSizes.length && shouldUseSelectControl && !showCustomValueControl && (0,external_wp_element_namespaceObject.createElement)(CustomSelectControl, {
  46311. __nextUnconstrainedWidth: true,
  46312. className: `${baseClassName}__select`,
  46313. label: (0,external_wp_i18n_namespaceObject.__)('Font size'),
  46314. hideLabelFromVision: true,
  46315. describedBy: currentFontSizeSR,
  46316. options: options,
  46317. value: options.find(option => option.key === selectedOption.slug),
  46318. onChange: _ref4 => {
  46319. let {
  46320. selectedItem
  46321. } = _ref4;
  46322. onChange(hasUnits ? selectedItem.size : Number(selectedItem.size));
  46323. if (selectedItem.key === CUSTOM_FONT_SIZE) {
  46324. setShowCustomValueControl(true);
  46325. }
  46326. },
  46327. size: size
  46328. }), !shouldUseSelectControl && !showCustomValueControl && (0,external_wp_element_namespaceObject.createElement)(toggle_group_control_component, {
  46329. __nextHasNoMarginBottom: __nextHasNoMarginBottom,
  46330. label: (0,external_wp_i18n_namespaceObject.__)('Font size'),
  46331. hideLabelFromVision: true,
  46332. value: value,
  46333. onChange: newValue => {
  46334. onChange(hasUnits ? newValue : Number(newValue));
  46335. },
  46336. isBlock: true,
  46337. size: size
  46338. }, options.map(option => (0,external_wp_element_namespaceObject.createElement)(toggle_group_control_option_component, {
  46339. key: option.key,
  46340. value: option.value,
  46341. label: option.label,
  46342. "aria-label": option.name,
  46343. showTooltip: true
  46344. }))), !withSlider && !disableCustomFontSizes && showCustomValueControl && (0,external_wp_element_namespaceObject.createElement)(flex_component, {
  46345. justify: "space-between",
  46346. className: `${baseClassName}__custom-size-control`
  46347. }, (0,external_wp_element_namespaceObject.createElement)(flex_item_component, {
  46348. isBlock: true
  46349. }, (0,external_wp_element_namespaceObject.createElement)(unit_control, {
  46350. label: (0,external_wp_i18n_namespaceObject.__)('Custom'),
  46351. labelPosition: "top",
  46352. hideLabelFromVision: true,
  46353. value: value,
  46354. onChange: nextSize => {
  46355. if (0 === parseFloat(nextSize) || !nextSize) {
  46356. onChange(undefined);
  46357. } else {
  46358. onChange(hasUnits ? nextSize : parseInt(nextSize, 10));
  46359. }
  46360. },
  46361. size: size,
  46362. units: hasUnits ? units : []
  46363. })), withReset && (0,external_wp_element_namespaceObject.createElement)(flex_item_component, {
  46364. isBlock: true
  46365. }, (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  46366. className: "components-color-palette__clear",
  46367. disabled: value === undefined,
  46368. onClick: () => {
  46369. onChange(undefined);
  46370. },
  46371. isSmall: true,
  46372. variant: "secondary"
  46373. }, (0,external_wp_i18n_namespaceObject.__)('Reset'))))), withSlider && (0,external_wp_element_namespaceObject.createElement)(range_control, {
  46374. __nextHasNoMarginBottom: __nextHasNoMarginBottom,
  46375. className: `${baseClassName}__custom-input`,
  46376. label: (0,external_wp_i18n_namespaceObject.__)('Custom Size'),
  46377. value: isPixelValue && noUnitsValue || '',
  46378. initialPosition: fallbackFontSize,
  46379. onChange: newValue => {
  46380. onChange(hasUnits ? newValue + 'px' : newValue);
  46381. },
  46382. min: 12,
  46383. max: 100
  46384. })));
  46385. }
  46386. /* harmony default export */ var font_size_picker = ((0,external_wp_element_namespaceObject.forwardRef)(FontSizePicker));
  46387. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/form-file-upload/index.js
  46388. /**
  46389. * WordPress dependencies
  46390. */
  46391. /**
  46392. * Internal dependencies
  46393. */
  46394. /**
  46395. * FormFileUpload is a component that allows users to select files from their local device.
  46396. *
  46397. * ```jsx
  46398. * import { FormFileUpload } from '@wordpress/components';
  46399. *
  46400. * const MyFormFileUpload = () => (
  46401. * <FormFileUpload
  46402. * accept="image/*"
  46403. * onChange={ ( event ) => console.log( event.currentTarget.files ) }
  46404. * >
  46405. * Upload
  46406. * </FormFileUpload>
  46407. * );
  46408. * ```
  46409. */
  46410. function FormFileUpload(_ref) {
  46411. let {
  46412. accept,
  46413. children,
  46414. multiple = false,
  46415. onChange,
  46416. onClick,
  46417. render,
  46418. ...props
  46419. } = _ref;
  46420. const ref = (0,external_wp_element_namespaceObject.useRef)(null);
  46421. const openFileDialog = () => {
  46422. var _ref$current;
  46423. (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.click();
  46424. };
  46425. const ui = render ? render({
  46426. openFileDialog
  46427. }) : (0,external_wp_element_namespaceObject.createElement)(build_module_button, extends_extends({
  46428. onClick: openFileDialog
  46429. }, props), children);
  46430. return (0,external_wp_element_namespaceObject.createElement)("div", {
  46431. className: "components-form-file-upload"
  46432. }, ui, (0,external_wp_element_namespaceObject.createElement)("input", {
  46433. type: "file",
  46434. ref: ref,
  46435. multiple: multiple,
  46436. style: {
  46437. display: 'none'
  46438. },
  46439. accept: accept,
  46440. onChange: onChange,
  46441. onClick: onClick,
  46442. "data-testid": "form-file-upload-input"
  46443. }));
  46444. }
  46445. /* harmony default export */ var form_file_upload = (FormFileUpload);
  46446. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/form-toggle/index.js
  46447. /**
  46448. * External dependencies
  46449. */
  46450. /**
  46451. * Internal dependencies
  46452. */
  46453. const form_toggle_noop = () => {};
  46454. /**
  46455. * FormToggle switches a single setting on or off.
  46456. *
  46457. * ```jsx
  46458. * import { FormToggle } from '@wordpress/components';
  46459. * import { useState } from '@wordpress/element';
  46460. *
  46461. * const MyFormToggle = () => {
  46462. * const [ isChecked, setChecked ] = useState( true );
  46463. *
  46464. * return (
  46465. * <FormToggle
  46466. * checked={ isChecked }
  46467. * onChange={ () => setChecked( ( state ) => ! state ) }
  46468. * />
  46469. * );
  46470. * };
  46471. * ```
  46472. */
  46473. function FormToggle(props) {
  46474. const {
  46475. className,
  46476. checked,
  46477. id,
  46478. disabled,
  46479. onChange = form_toggle_noop,
  46480. ...additionalProps
  46481. } = props;
  46482. const wrapperClasses = classnames_default()('components-form-toggle', className, {
  46483. 'is-checked': checked,
  46484. 'is-disabled': disabled
  46485. });
  46486. return (0,external_wp_element_namespaceObject.createElement)("span", {
  46487. className: wrapperClasses
  46488. }, (0,external_wp_element_namespaceObject.createElement)("input", extends_extends({
  46489. className: "components-form-toggle__input",
  46490. id: id,
  46491. type: "checkbox",
  46492. checked: checked,
  46493. onChange: onChange,
  46494. disabled: disabled
  46495. }, additionalProps)), (0,external_wp_element_namespaceObject.createElement)("span", {
  46496. className: "components-form-toggle__track"
  46497. }), (0,external_wp_element_namespaceObject.createElement)("span", {
  46498. className: "components-form-toggle__thumb"
  46499. }));
  46500. }
  46501. /* harmony default export */ var form_toggle = (FormToggle);
  46502. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/form-token-field/token.js
  46503. /**
  46504. * External dependencies
  46505. */
  46506. /**
  46507. * WordPress dependencies
  46508. */
  46509. /**
  46510. * Internal dependencies
  46511. */
  46512. const token_noop = () => {};
  46513. function Token(_ref) {
  46514. let {
  46515. value,
  46516. status,
  46517. title,
  46518. displayTransform,
  46519. isBorderless = false,
  46520. disabled = false,
  46521. onClickRemove = token_noop,
  46522. onMouseEnter,
  46523. onMouseLeave,
  46524. messages,
  46525. termPosition,
  46526. termsCount
  46527. } = _ref;
  46528. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(Token);
  46529. const tokenClasses = classnames_default()('components-form-token-field__token', {
  46530. 'is-error': 'error' === status,
  46531. 'is-success': 'success' === status,
  46532. 'is-validating': 'validating' === status,
  46533. 'is-borderless': isBorderless,
  46534. 'is-disabled': disabled
  46535. });
  46536. const onClick = () => onClickRemove({
  46537. value
  46538. });
  46539. const transformedValue = displayTransform(value);
  46540. const termPositionAndCount = (0,external_wp_i18n_namespaceObject.sprintf)(
  46541. /* translators: 1: term name, 2: term position in a set of terms, 3: total term set count. */
  46542. (0,external_wp_i18n_namespaceObject.__)('%1$s (%2$s of %3$s)'), transformedValue, termPosition, termsCount);
  46543. return (0,external_wp_element_namespaceObject.createElement)("span", {
  46544. className: tokenClasses,
  46545. onMouseEnter: onMouseEnter,
  46546. onMouseLeave: onMouseLeave,
  46547. title: title
  46548. }, (0,external_wp_element_namespaceObject.createElement)("span", {
  46549. className: "components-form-token-field__token-text",
  46550. id: `components-form-token-field__token-text-${instanceId}`
  46551. }, (0,external_wp_element_namespaceObject.createElement)(visually_hidden_component, {
  46552. as: "span"
  46553. }, termPositionAndCount), (0,external_wp_element_namespaceObject.createElement)("span", {
  46554. "aria-hidden": "true"
  46555. }, transformedValue)), (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  46556. className: "components-form-token-field__remove-token",
  46557. icon: close_small,
  46558. onClick: !disabled && onClick,
  46559. label: messages.remove,
  46560. "aria-describedby": `components-form-token-field__token-text-${instanceId}`
  46561. }));
  46562. }
  46563. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/form-token-field/styles.js
  46564. /**
  46565. * External dependencies
  46566. */
  46567. /**
  46568. * Internal dependencies
  46569. */
  46570. const deprecatedPaddings = _ref => {
  46571. let {
  46572. __next36pxDefaultSize,
  46573. hasTokens
  46574. } = _ref;
  46575. return !__next36pxDefaultSize && /*#__PURE__*/emotion_react_browser_esm_css("padding-top:", space(hasTokens ? 1 : 0.5), ";padding-bottom:", space(hasTokens ? 1 : 0.5), ";" + ( true ? "" : 0), true ? "" : 0);
  46576. };
  46577. const TokensAndInputWrapperFlex = /*#__PURE__*/emotion_styled_base_browser_esm(flex_component, true ? {
  46578. target: "ehq8nmi0"
  46579. } : 0)("padding:5px ", space(1), ";", deprecatedPaddings, ";" + ( true ? "" : 0));
  46580. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/form-token-field/index.js
  46581. /**
  46582. * External dependencies
  46583. */
  46584. /**
  46585. * WordPress dependencies
  46586. */
  46587. /**
  46588. * Internal dependencies
  46589. */
  46590. const form_token_field_identity = value => value;
  46591. /**
  46592. * A `FormTokenField` is a field similar to the tags and categories fields in the interim editor chrome,
  46593. * or the "to" field in Mail on OS X. Tokens can be entered by typing them or selecting them from a list of suggested tokens.
  46594. *
  46595. * Up to one hundred suggestions that match what the user has typed so far will be shown from which the user can pick from (auto-complete).
  46596. * Tokens are separated by the "," character. Suggestions can be selected with the up or down arrows and added with the tab or enter key.
  46597. *
  46598. * The `value` property is handled in a manner similar to controlled form components.
  46599. * See [Forms](http://facebook.github.io/react/docs/forms.html) in the React Documentation for more information.
  46600. */
  46601. function FormTokenField(props) {
  46602. const {
  46603. autoCapitalize,
  46604. autoComplete,
  46605. maxLength,
  46606. placeholder,
  46607. label = (0,external_wp_i18n_namespaceObject.__)('Add item'),
  46608. className,
  46609. suggestions = [],
  46610. maxSuggestions = 100,
  46611. value = [],
  46612. displayTransform = form_token_field_identity,
  46613. saveTransform = token => token.trim(),
  46614. onChange = () => {},
  46615. onInputChange = () => {},
  46616. onFocus = undefined,
  46617. isBorderless = false,
  46618. disabled = false,
  46619. tokenizeOnSpace = false,
  46620. messages = {
  46621. added: (0,external_wp_i18n_namespaceObject.__)('Item added.'),
  46622. removed: (0,external_wp_i18n_namespaceObject.__)('Item removed.'),
  46623. remove: (0,external_wp_i18n_namespaceObject.__)('Remove item'),
  46624. __experimentalInvalid: (0,external_wp_i18n_namespaceObject.__)('Invalid item')
  46625. },
  46626. __experimentalRenderItem,
  46627. __experimentalExpandOnFocus = false,
  46628. __experimentalValidateInput = () => true,
  46629. __experimentalShowHowTo = true,
  46630. __next36pxDefaultSize = false,
  46631. __experimentalAutoSelectFirstMatch = false
  46632. } = props;
  46633. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(FormTokenField); // We reset to these initial values again in the onBlur
  46634. const [incompleteTokenValue, setIncompleteTokenValue] = (0,external_wp_element_namespaceObject.useState)('');
  46635. const [inputOffsetFromEnd, setInputOffsetFromEnd] = (0,external_wp_element_namespaceObject.useState)(0);
  46636. const [isActive, setIsActive] = (0,external_wp_element_namespaceObject.useState)(false);
  46637. const [isExpanded, setIsExpanded] = (0,external_wp_element_namespaceObject.useState)(false);
  46638. const [selectedSuggestionIndex, setSelectedSuggestionIndex] = (0,external_wp_element_namespaceObject.useState)(-1);
  46639. const [selectedSuggestionScroll, setSelectedSuggestionScroll] = (0,external_wp_element_namespaceObject.useState)(false);
  46640. const prevSuggestions = (0,external_wp_compose_namespaceObject.usePrevious)(suggestions);
  46641. const prevValue = (0,external_wp_compose_namespaceObject.usePrevious)(value);
  46642. const input = (0,external_wp_element_namespaceObject.useRef)(null);
  46643. const tokensAndInput = (0,external_wp_element_namespaceObject.useRef)(null);
  46644. const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500);
  46645. (0,external_wp_element_namespaceObject.useEffect)(() => {
  46646. // Make sure to focus the input when the isActive state is true.
  46647. if (isActive && !hasFocus()) {
  46648. focus();
  46649. }
  46650. }, [isActive]);
  46651. (0,external_wp_element_namespaceObject.useEffect)(() => {
  46652. const suggestionsDidUpdate = !external_wp_isShallowEqual_default()(suggestions, prevSuggestions || []);
  46653. if (suggestionsDidUpdate || value !== prevValue) {
  46654. updateSuggestions(suggestionsDidUpdate);
  46655. } // TODO: updateSuggestions() should first be refactored so its actual deps are clearer.
  46656. // eslint-disable-next-line react-hooks/exhaustive-deps
  46657. }, [suggestions, prevSuggestions, value, prevValue]);
  46658. (0,external_wp_element_namespaceObject.useEffect)(() => {
  46659. updateSuggestions(); // eslint-disable-next-line react-hooks/exhaustive-deps
  46660. }, [incompleteTokenValue]);
  46661. (0,external_wp_element_namespaceObject.useEffect)(() => {
  46662. updateSuggestions(); // eslint-disable-next-line react-hooks/exhaustive-deps
  46663. }, [__experimentalAutoSelectFirstMatch]);
  46664. if (disabled && isActive) {
  46665. setIsActive(false);
  46666. setIncompleteTokenValue('');
  46667. }
  46668. function focus() {
  46669. var _input$current;
  46670. (_input$current = input.current) === null || _input$current === void 0 ? void 0 : _input$current.focus();
  46671. }
  46672. function hasFocus() {
  46673. var _input$current2;
  46674. return input.current === ((_input$current2 = input.current) === null || _input$current2 === void 0 ? void 0 : _input$current2.ownerDocument.activeElement);
  46675. }
  46676. function onFocusHandler(event) {
  46677. // If focus is on the input or on the container, set the isActive state to true.
  46678. if (hasFocus() || event.target === tokensAndInput.current) {
  46679. setIsActive(true);
  46680. setIsExpanded(__experimentalExpandOnFocus || isExpanded);
  46681. } else {
  46682. /*
  46683. * Otherwise, focus is on one of the token "remove" buttons and we
  46684. * set the isActive state to false to prevent the input to be
  46685. * re-focused, see componentDidUpdate().
  46686. */
  46687. setIsActive(false);
  46688. }
  46689. if ('function' === typeof onFocus) {
  46690. onFocus(event);
  46691. }
  46692. }
  46693. function onBlur() {
  46694. if (inputHasValidValue()) {
  46695. setIsActive(false);
  46696. } else {
  46697. // Reset to initial state
  46698. setIncompleteTokenValue('');
  46699. setInputOffsetFromEnd(0);
  46700. setIsActive(false);
  46701. setIsExpanded(false);
  46702. setSelectedSuggestionIndex(-1);
  46703. setSelectedSuggestionScroll(false);
  46704. }
  46705. }
  46706. function onKeyDown(event) {
  46707. let preventDefault = false;
  46708. if (event.defaultPrevented) {
  46709. return;
  46710. }
  46711. switch (event.keyCode) {
  46712. case external_wp_keycodes_namespaceObject.BACKSPACE:
  46713. preventDefault = handleDeleteKey(deleteTokenBeforeInput);
  46714. break;
  46715. case external_wp_keycodes_namespaceObject.ENTER:
  46716. preventDefault = addCurrentToken();
  46717. break;
  46718. case external_wp_keycodes_namespaceObject.LEFT:
  46719. preventDefault = handleLeftArrowKey();
  46720. break;
  46721. case external_wp_keycodes_namespaceObject.UP:
  46722. preventDefault = handleUpArrowKey();
  46723. break;
  46724. case external_wp_keycodes_namespaceObject.RIGHT:
  46725. preventDefault = handleRightArrowKey();
  46726. break;
  46727. case external_wp_keycodes_namespaceObject.DOWN:
  46728. preventDefault = handleDownArrowKey();
  46729. break;
  46730. case external_wp_keycodes_namespaceObject.DELETE:
  46731. preventDefault = handleDeleteKey(deleteTokenAfterInput);
  46732. break;
  46733. case external_wp_keycodes_namespaceObject.SPACE:
  46734. if (tokenizeOnSpace) {
  46735. preventDefault = addCurrentToken();
  46736. }
  46737. break;
  46738. case external_wp_keycodes_namespaceObject.ESCAPE:
  46739. preventDefault = handleEscapeKey(event);
  46740. break;
  46741. default:
  46742. break;
  46743. }
  46744. if (preventDefault) {
  46745. event.preventDefault();
  46746. }
  46747. }
  46748. function onKeyPress(event) {
  46749. let preventDefault = false; // TODO: replace to event.code;
  46750. switch (event.charCode) {
  46751. case 44:
  46752. // Comma.
  46753. preventDefault = handleCommaKey();
  46754. break;
  46755. default:
  46756. break;
  46757. }
  46758. if (preventDefault) {
  46759. event.preventDefault();
  46760. }
  46761. }
  46762. function onContainerTouched(event) {
  46763. // Prevent clicking/touching the tokensAndInput container from blurring
  46764. // the input and adding the current token.
  46765. if (event.target === tokensAndInput.current && isActive) {
  46766. event.preventDefault();
  46767. }
  46768. }
  46769. function onTokenClickRemove(event) {
  46770. deleteToken(event.value);
  46771. focus();
  46772. }
  46773. function onSuggestionHovered(suggestion) {
  46774. const index = getMatchingSuggestions().indexOf(suggestion);
  46775. if (index >= 0) {
  46776. setSelectedSuggestionIndex(index);
  46777. setSelectedSuggestionScroll(false);
  46778. }
  46779. }
  46780. function onSuggestionSelected(suggestion) {
  46781. addNewToken(suggestion);
  46782. }
  46783. function onInputChangeHandler(event) {
  46784. const text = event.value;
  46785. const separator = tokenizeOnSpace ? /[ ,\t]+/ : /[,\t]+/;
  46786. const items = text.split(separator);
  46787. const tokenValue = items[items.length - 1] || '';
  46788. if (items.length > 1) {
  46789. addNewTokens(items.slice(0, -1));
  46790. }
  46791. setIncompleteTokenValue(tokenValue);
  46792. onInputChange(tokenValue);
  46793. }
  46794. function handleDeleteKey(_deleteToken) {
  46795. let preventDefault = false;
  46796. if (hasFocus() && isInputEmpty()) {
  46797. _deleteToken();
  46798. preventDefault = true;
  46799. }
  46800. return preventDefault;
  46801. }
  46802. function handleLeftArrowKey() {
  46803. let preventDefault = false;
  46804. if (isInputEmpty()) {
  46805. moveInputBeforePreviousToken();
  46806. preventDefault = true;
  46807. }
  46808. return preventDefault;
  46809. }
  46810. function handleRightArrowKey() {
  46811. let preventDefault = false;
  46812. if (isInputEmpty()) {
  46813. moveInputAfterNextToken();
  46814. preventDefault = true;
  46815. }
  46816. return preventDefault;
  46817. }
  46818. function handleUpArrowKey() {
  46819. setSelectedSuggestionIndex(index => {
  46820. return (index === 0 ? getMatchingSuggestions(incompleteTokenValue, suggestions, value, maxSuggestions, saveTransform).length : index) - 1;
  46821. });
  46822. setSelectedSuggestionScroll(true);
  46823. return true; // PreventDefault.
  46824. }
  46825. function handleDownArrowKey() {
  46826. setSelectedSuggestionIndex(index => {
  46827. return (index + 1) % getMatchingSuggestions(incompleteTokenValue, suggestions, value, maxSuggestions, saveTransform).length;
  46828. });
  46829. setSelectedSuggestionScroll(true);
  46830. return true; // PreventDefault.
  46831. }
  46832. function handleEscapeKey(event) {
  46833. if (event.target instanceof HTMLInputElement) {
  46834. setIncompleteTokenValue(event.target.value);
  46835. setIsExpanded(false);
  46836. setSelectedSuggestionIndex(-1);
  46837. setSelectedSuggestionScroll(false);
  46838. }
  46839. return true; // PreventDefault.
  46840. }
  46841. function handleCommaKey() {
  46842. if (inputHasValidValue()) {
  46843. addNewToken(incompleteTokenValue);
  46844. }
  46845. return true; // PreventDefault.
  46846. }
  46847. function moveInputToIndex(index) {
  46848. setInputOffsetFromEnd(value.length - Math.max(index, -1) - 1);
  46849. }
  46850. function moveInputBeforePreviousToken() {
  46851. setInputOffsetFromEnd(prevInputOffsetFromEnd => {
  46852. return Math.min(prevInputOffsetFromEnd + 1, value.length);
  46853. });
  46854. }
  46855. function moveInputAfterNextToken() {
  46856. setInputOffsetFromEnd(prevInputOffsetFromEnd => {
  46857. return Math.max(prevInputOffsetFromEnd - 1, 0);
  46858. });
  46859. }
  46860. function deleteTokenBeforeInput() {
  46861. const index = getIndexOfInput() - 1;
  46862. if (index > -1) {
  46863. deleteToken(value[index]);
  46864. }
  46865. }
  46866. function deleteTokenAfterInput() {
  46867. const index = getIndexOfInput();
  46868. if (index < value.length) {
  46869. deleteToken(value[index]); // Update input offset since it's the offset from the last token.
  46870. moveInputToIndex(index);
  46871. }
  46872. }
  46873. function addCurrentToken() {
  46874. let preventDefault = false;
  46875. const selectedSuggestion = getSelectedSuggestion();
  46876. if (selectedSuggestion) {
  46877. addNewToken(selectedSuggestion);
  46878. preventDefault = true;
  46879. } else if (inputHasValidValue()) {
  46880. addNewToken(incompleteTokenValue);
  46881. preventDefault = true;
  46882. }
  46883. return preventDefault;
  46884. }
  46885. function addNewTokens(tokens) {
  46886. const tokensToAdd = [...new Set(tokens.map(saveTransform).filter(Boolean).filter(token => !valueContainsToken(token)))];
  46887. if (tokensToAdd.length > 0) {
  46888. const newValue = [...value];
  46889. newValue.splice(getIndexOfInput(), 0, ...tokensToAdd);
  46890. onChange(newValue);
  46891. }
  46892. }
  46893. function addNewToken(token) {
  46894. if (!__experimentalValidateInput(token)) {
  46895. (0,external_wp_a11y_namespaceObject.speak)(messages.__experimentalInvalid, 'assertive');
  46896. return;
  46897. }
  46898. addNewTokens([token]);
  46899. (0,external_wp_a11y_namespaceObject.speak)(messages.added, 'assertive');
  46900. setIncompleteTokenValue('');
  46901. setSelectedSuggestionIndex(-1);
  46902. setSelectedSuggestionScroll(false);
  46903. setIsExpanded(!__experimentalExpandOnFocus);
  46904. if (isActive) {
  46905. focus();
  46906. }
  46907. }
  46908. function deleteToken(token) {
  46909. const newTokens = value.filter(item => {
  46910. return getTokenValue(item) !== getTokenValue(token);
  46911. });
  46912. onChange(newTokens);
  46913. (0,external_wp_a11y_namespaceObject.speak)(messages.removed, 'assertive');
  46914. }
  46915. function getTokenValue(token) {
  46916. if ('object' === typeof token) {
  46917. return token.value;
  46918. }
  46919. return token;
  46920. }
  46921. function getMatchingSuggestions() {
  46922. let searchValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : incompleteTokenValue;
  46923. let _suggestions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : suggestions;
  46924. let _value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : value;
  46925. let _maxSuggestions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : maxSuggestions;
  46926. let _saveTransform = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : saveTransform;
  46927. let match = _saveTransform(searchValue);
  46928. const startsWithMatch = [];
  46929. const containsMatch = [];
  46930. const normalizedValue = _value.map(item => {
  46931. if (typeof item === 'string') {
  46932. return item;
  46933. }
  46934. return item.value;
  46935. });
  46936. if (match.length === 0) {
  46937. _suggestions = _suggestions.filter(suggestion => !normalizedValue.includes(suggestion));
  46938. } else {
  46939. match = match.toLocaleLowerCase();
  46940. _suggestions.forEach(suggestion => {
  46941. const index = suggestion.toLocaleLowerCase().indexOf(match);
  46942. if (normalizedValue.indexOf(suggestion) === -1) {
  46943. if (index === 0) {
  46944. startsWithMatch.push(suggestion);
  46945. } else if (index > 0) {
  46946. containsMatch.push(suggestion);
  46947. }
  46948. }
  46949. });
  46950. _suggestions = startsWithMatch.concat(containsMatch);
  46951. }
  46952. return _suggestions.slice(0, _maxSuggestions);
  46953. }
  46954. function getSelectedSuggestion() {
  46955. if (selectedSuggestionIndex !== -1) {
  46956. return getMatchingSuggestions()[selectedSuggestionIndex];
  46957. }
  46958. return undefined;
  46959. }
  46960. function valueContainsToken(token) {
  46961. return value.some(item => {
  46962. return getTokenValue(token) === getTokenValue(item);
  46963. });
  46964. }
  46965. function getIndexOfInput() {
  46966. return value.length - inputOffsetFromEnd;
  46967. }
  46968. function isInputEmpty() {
  46969. return incompleteTokenValue.length === 0;
  46970. }
  46971. function inputHasValidValue() {
  46972. return saveTransform(incompleteTokenValue).length > 0;
  46973. }
  46974. function updateSuggestions() {
  46975. let resetSelectedSuggestion = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
  46976. const inputHasMinimumChars = incompleteTokenValue.trim().length > 1;
  46977. const matchingSuggestions = getMatchingSuggestions(incompleteTokenValue);
  46978. const hasMatchingSuggestions = matchingSuggestions.length > 0;
  46979. const shouldExpandIfFocuses = hasFocus() && __experimentalExpandOnFocus;
  46980. setIsExpanded(shouldExpandIfFocuses || inputHasMinimumChars && hasMatchingSuggestions);
  46981. if (resetSelectedSuggestion) {
  46982. if (__experimentalAutoSelectFirstMatch && inputHasMinimumChars && hasMatchingSuggestions) {
  46983. setSelectedSuggestionIndex(0);
  46984. setSelectedSuggestionScroll(true);
  46985. } else {
  46986. setSelectedSuggestionIndex(-1);
  46987. setSelectedSuggestionScroll(false);
  46988. }
  46989. }
  46990. if (inputHasMinimumChars) {
  46991. const message = hasMatchingSuggestions ? (0,external_wp_i18n_namespaceObject.sprintf)(
  46992. /* translators: %d: number of results. */
  46993. (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.');
  46994. debouncedSpeak(message, 'assertive');
  46995. }
  46996. }
  46997. function renderTokensAndInput() {
  46998. const components = value.map(renderToken);
  46999. components.splice(getIndexOfInput(), 0, renderInput());
  47000. return components;
  47001. }
  47002. function renderToken(token, index, tokens) {
  47003. const _value = getTokenValue(token);
  47004. const status = typeof token !== 'string' ? token.status : undefined;
  47005. const termPosition = index + 1;
  47006. const termsCount = tokens.length;
  47007. return (0,external_wp_element_namespaceObject.createElement)(flex_item_component, {
  47008. key: 'token-' + _value
  47009. }, (0,external_wp_element_namespaceObject.createElement)(Token, {
  47010. value: _value,
  47011. status: status,
  47012. title: typeof token !== 'string' ? token.title : undefined,
  47013. displayTransform: displayTransform,
  47014. onClickRemove: onTokenClickRemove,
  47015. isBorderless: typeof token !== 'string' && token.isBorderless || isBorderless,
  47016. onMouseEnter: typeof token !== 'string' ? token.onMouseEnter : undefined,
  47017. onMouseLeave: typeof token !== 'string' ? token.onMouseLeave : undefined,
  47018. disabled: 'error' !== status && disabled,
  47019. messages: messages,
  47020. termsCount: termsCount,
  47021. termPosition: termPosition
  47022. }));
  47023. }
  47024. function renderInput() {
  47025. const inputProps = {
  47026. instanceId,
  47027. autoCapitalize,
  47028. autoComplete,
  47029. placeholder: value.length === 0 ? placeholder : '',
  47030. key: 'input',
  47031. disabled,
  47032. value: incompleteTokenValue,
  47033. onBlur,
  47034. isExpanded,
  47035. selectedSuggestionIndex
  47036. };
  47037. return (0,external_wp_element_namespaceObject.createElement)(token_input, extends_extends({}, inputProps, {
  47038. onChange: !(maxLength && value.length >= maxLength) ? onInputChangeHandler : undefined,
  47039. ref: input
  47040. }));
  47041. }
  47042. const classes = classnames_default()(className, 'components-form-token-field__input-container', {
  47043. 'is-active': isActive,
  47044. 'is-disabled': disabled
  47045. });
  47046. let tokenFieldProps = {
  47047. className: 'components-form-token-field',
  47048. tabIndex: -1
  47049. };
  47050. const matchingSuggestions = getMatchingSuggestions();
  47051. if (!disabled) {
  47052. tokenFieldProps = Object.assign({}, tokenFieldProps, {
  47053. onKeyDown,
  47054. onKeyPress,
  47055. onFocus: onFocusHandler
  47056. });
  47057. } // Disable reason: There is no appropriate role which describes the
  47058. // input container intended accessible usability.
  47059. // TODO: Refactor click detection to use blur to stop propagation.
  47060. /* eslint-disable jsx-a11y/no-static-element-interactions */
  47061. return (0,external_wp_element_namespaceObject.createElement)("div", tokenFieldProps, (0,external_wp_element_namespaceObject.createElement)(StyledLabel, {
  47062. htmlFor: `components-form-token-input-${instanceId}`,
  47063. className: "components-form-token-field__label"
  47064. }, label), (0,external_wp_element_namespaceObject.createElement)("div", {
  47065. ref: tokensAndInput,
  47066. className: classes,
  47067. tabIndex: -1,
  47068. onMouseDown: onContainerTouched,
  47069. onTouchStart: onContainerTouched
  47070. }, (0,external_wp_element_namespaceObject.createElement)(TokensAndInputWrapperFlex, {
  47071. justify: "flex-start",
  47072. align: "center",
  47073. gap: 1,
  47074. wrap: true,
  47075. __next36pxDefaultSize: __next36pxDefaultSize,
  47076. hasTokens: !!value.length
  47077. }, renderTokensAndInput()), isExpanded && (0,external_wp_element_namespaceObject.createElement)(suggestions_list, {
  47078. instanceId: instanceId,
  47079. match: saveTransform(incompleteTokenValue),
  47080. displayTransform: displayTransform,
  47081. suggestions: matchingSuggestions,
  47082. selectedIndex: selectedSuggestionIndex,
  47083. scrollIntoView: selectedSuggestionScroll,
  47084. onHover: onSuggestionHovered,
  47085. onSelect: onSuggestionSelected,
  47086. __experimentalRenderItem: __experimentalRenderItem
  47087. })), __experimentalShowHowTo && (0,external_wp_element_namespaceObject.createElement)("p", {
  47088. id: `components-form-token-suggestions-howto-${instanceId}`,
  47089. className: "components-form-token-field__help"
  47090. }, 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.')));
  47091. /* eslint-enable jsx-a11y/no-static-element-interactions */
  47092. }
  47093. /* harmony default export */ var form_token_field = (FormTokenField);
  47094. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/guide/icons.js
  47095. /**
  47096. * WordPress dependencies
  47097. */
  47098. const PageControlIcon = _ref => {
  47099. let {
  47100. isSelected
  47101. } = _ref;
  47102. return (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  47103. width: "8",
  47104. height: "8",
  47105. fill: "none",
  47106. xmlns: "http://www.w3.org/2000/svg"
  47107. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Circle, {
  47108. cx: "4",
  47109. cy: "4",
  47110. r: "4",
  47111. fill: isSelected ? '#419ECD' : '#E1E3E6'
  47112. }));
  47113. };
  47114. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/guide/page-control.js
  47115. /**
  47116. * WordPress dependencies
  47117. */
  47118. /**
  47119. * Internal dependencies
  47120. */
  47121. function PageControl(_ref) {
  47122. let {
  47123. currentPage,
  47124. numberOfPages,
  47125. setCurrentPage
  47126. } = _ref;
  47127. return (0,external_wp_element_namespaceObject.createElement)("ul", {
  47128. className: "components-guide__page-control",
  47129. "aria-label": (0,external_wp_i18n_namespaceObject.__)('Guide controls')
  47130. }, Array.from({
  47131. length: numberOfPages
  47132. }).map((_, page) => (0,external_wp_element_namespaceObject.createElement)("li", {
  47133. key: page // Set aria-current="step" on the active page, see https://www.w3.org/TR/wai-aria-1.1/#aria-current
  47134. ,
  47135. "aria-current": page === currentPage ? 'step' : undefined
  47136. }, (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  47137. key: page,
  47138. icon: (0,external_wp_element_namespaceObject.createElement)(PageControlIcon, {
  47139. isSelected: page === currentPage
  47140. }),
  47141. "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)(
  47142. /* translators: 1: current page number 2: total number of pages */
  47143. (0,external_wp_i18n_namespaceObject.__)('Page %1$d of %2$d'), page + 1, numberOfPages),
  47144. onClick: () => setCurrentPage(page)
  47145. }))));
  47146. }
  47147. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/guide/index.js
  47148. /**
  47149. * External dependencies
  47150. */
  47151. /**
  47152. * WordPress dependencies
  47153. */
  47154. /**
  47155. * Internal dependencies
  47156. */
  47157. function Guide(_ref) {
  47158. let {
  47159. children,
  47160. className,
  47161. contentLabel,
  47162. finishButtonText,
  47163. onFinish,
  47164. pages = []
  47165. } = _ref;
  47166. const guideContainer = (0,external_wp_element_namespaceObject.useRef)();
  47167. const [currentPage, setCurrentPage] = (0,external_wp_element_namespaceObject.useState)(0);
  47168. (0,external_wp_element_namespaceObject.useEffect)(() => {
  47169. if (external_wp_element_namespaceObject.Children.count(children)) {
  47170. external_wp_deprecated_default()('Passing children to <Guide>', {
  47171. since: '5.5',
  47172. alternative: 'the `pages` prop'
  47173. });
  47174. }
  47175. }, [children]);
  47176. (0,external_wp_element_namespaceObject.useEffect)(() => {
  47177. // Each time we change the current page, start from the first element of the page.
  47178. // This also solves any focus loss that can happen.
  47179. if (guideContainer.current) {
  47180. var _focus$tabbable$find, _focus$tabbable$find$;
  47181. (_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();
  47182. }
  47183. }, [currentPage]);
  47184. if (external_wp_element_namespaceObject.Children.count(children)) {
  47185. pages = external_wp_element_namespaceObject.Children.map(children, child => ({
  47186. content: child
  47187. }));
  47188. }
  47189. const canGoBack = currentPage > 0;
  47190. const canGoForward = currentPage < pages.length - 1;
  47191. const goBack = () => {
  47192. if (canGoBack) {
  47193. setCurrentPage(currentPage - 1);
  47194. }
  47195. };
  47196. const goForward = () => {
  47197. if (canGoForward) {
  47198. setCurrentPage(currentPage + 1);
  47199. }
  47200. };
  47201. if (pages.length === 0) {
  47202. return null;
  47203. }
  47204. return (0,external_wp_element_namespaceObject.createElement)(modal, {
  47205. className: classnames_default()('components-guide', className),
  47206. contentLabel: contentLabel,
  47207. onRequestClose: onFinish,
  47208. onKeyDown: event => {
  47209. if (event.code === 'ArrowLeft') {
  47210. goBack(); // Do not scroll the modal's contents.
  47211. event.preventDefault();
  47212. } else if (event.code === 'ArrowRight') {
  47213. goForward(); // Do not scroll the modal's contents.
  47214. event.preventDefault();
  47215. }
  47216. },
  47217. ref: guideContainer
  47218. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  47219. className: "components-guide__container"
  47220. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  47221. className: "components-guide__page"
  47222. }, pages[currentPage].image, pages.length > 1 && (0,external_wp_element_namespaceObject.createElement)(PageControl, {
  47223. currentPage: currentPage,
  47224. numberOfPages: pages.length,
  47225. setCurrentPage: setCurrentPage
  47226. }), pages[currentPage].content), (0,external_wp_element_namespaceObject.createElement)("div", {
  47227. className: "components-guide__footer"
  47228. }, canGoBack && (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  47229. className: "components-guide__back-button",
  47230. onClick: goBack
  47231. }, (0,external_wp_i18n_namespaceObject.__)('Previous')), canGoForward && (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  47232. className: "components-guide__forward-button",
  47233. onClick: goForward
  47234. }, (0,external_wp_i18n_namespaceObject.__)('Next')), !canGoForward && (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  47235. className: "components-guide__finish-button",
  47236. onClick: onFinish
  47237. }, finishButtonText || (0,external_wp_i18n_namespaceObject.__)('Finish')))));
  47238. }
  47239. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/guide/page.js
  47240. /**
  47241. * WordPress dependencies
  47242. */
  47243. function GuidePage(props) {
  47244. (0,external_wp_element_namespaceObject.useEffect)(() => {
  47245. external_wp_deprecated_default()('<GuidePage>', {
  47246. since: '5.5',
  47247. alternative: 'the `pages` prop in <Guide>'
  47248. });
  47249. }, []);
  47250. return (0,external_wp_element_namespaceObject.createElement)("div", props);
  47251. }
  47252. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/button/deprecated.js
  47253. // @ts-nocheck
  47254. /**
  47255. * WordPress dependencies
  47256. */
  47257. /**
  47258. * Internal dependencies
  47259. */
  47260. function IconButton(_ref, ref) {
  47261. let {
  47262. labelPosition,
  47263. size,
  47264. tooltip,
  47265. label,
  47266. ...props
  47267. } = _ref;
  47268. external_wp_deprecated_default()('wp.components.IconButton', {
  47269. since: '5.4',
  47270. alternative: 'wp.components.Button',
  47271. version: '6.2'
  47272. });
  47273. return (0,external_wp_element_namespaceObject.createElement)(build_module_button, extends_extends({}, props, {
  47274. ref: ref,
  47275. tooltipPosition: labelPosition,
  47276. iconSize: size,
  47277. showTooltip: tooltip !== undefined ? !!tooltip : undefined,
  47278. label: tooltip || label
  47279. }));
  47280. }
  47281. /* harmony default export */ var deprecated = ((0,external_wp_element_namespaceObject.forwardRef)(IconButton));
  47282. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/item-group/item/hook.js
  47283. /**
  47284. * External dependencies
  47285. */
  47286. /**
  47287. * WordPress dependencies
  47288. */
  47289. /**
  47290. * Internal dependencies
  47291. */
  47292. function hook_useItem(props) {
  47293. const {
  47294. as: asProp,
  47295. className,
  47296. onClick,
  47297. role = 'listitem',
  47298. size: sizeProp,
  47299. ...otherProps
  47300. } = useContextSystem(props, 'Item');
  47301. const {
  47302. spacedAround,
  47303. size: contextSize
  47304. } = useItemGroupContext();
  47305. const size = sizeProp || contextSize;
  47306. const as = asProp || (typeof onClick !== 'undefined' ? 'button' : 'div');
  47307. const cx = useCx();
  47308. 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]);
  47309. const wrapperClassName = cx(itemWrapper);
  47310. return {
  47311. as,
  47312. className: classes,
  47313. onClick,
  47314. wrapperClassName,
  47315. role,
  47316. ...otherProps
  47317. };
  47318. }
  47319. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/item-group/item/component.js
  47320. /**
  47321. * External dependencies
  47322. */
  47323. /**
  47324. * Internal dependencies
  47325. */
  47326. function component_Item(props, forwardedRef) {
  47327. const {
  47328. role,
  47329. wrapperClassName,
  47330. ...otherProps
  47331. } = hook_useItem(props);
  47332. return (0,external_wp_element_namespaceObject.createElement)("div", {
  47333. role: role,
  47334. className: wrapperClassName
  47335. }, (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, otherProps, {
  47336. ref: forwardedRef
  47337. })));
  47338. }
  47339. /* harmony default export */ var item_component = (contextConnect(component_Item, 'Item'));
  47340. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/input-prefix-wrapper.js
  47341. /**
  47342. * External dependencies
  47343. */
  47344. /**
  47345. * Internal dependencies
  47346. */
  47347. function UnconnectedInputControlPrefixWrapper(props, forwardedRef) {
  47348. const derivedProps = useContextSystem(props, 'InputControlPrefixWrapper');
  47349. return (0,external_wp_element_namespaceObject.createElement)(spacer_component, extends_extends({
  47350. marginBottom: 0
  47351. }, derivedProps, {
  47352. ref: forwardedRef
  47353. }));
  47354. }
  47355. /**
  47356. * A convenience wrapper for the `prefix` when you want to apply
  47357. * standard padding in accordance with the size variant.
  47358. *
  47359. * ```jsx
  47360. * import {
  47361. * __experimentalInputControl as InputControl,
  47362. * __experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,
  47363. * } from '@wordpress/components';
  47364. *
  47365. * <InputControl
  47366. * prefix={<InputControlPrefixWrapper>@</InputControlPrefixWrapper>}
  47367. * />
  47368. * ```
  47369. */
  47370. const InputControlPrefixWrapper = contextConnect(UnconnectedInputControlPrefixWrapper, 'InputControlPrefixWrapper');
  47371. /* harmony default export */ var input_prefix_wrapper = (InputControlPrefixWrapper);
  47372. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/keyboard-shortcuts/index.js
  47373. /**
  47374. * External dependencies
  47375. */
  47376. /**
  47377. * WordPress dependencies
  47378. */
  47379. function KeyboardShortcut(_ref) {
  47380. let {
  47381. target,
  47382. callback,
  47383. shortcut,
  47384. bindGlobal,
  47385. eventName
  47386. } = _ref;
  47387. (0,external_wp_compose_namespaceObject.useKeyboardShortcut)(shortcut, callback, {
  47388. bindGlobal,
  47389. target,
  47390. eventName
  47391. });
  47392. return null;
  47393. }
  47394. function KeyboardShortcuts(_ref2) {
  47395. let {
  47396. children,
  47397. shortcuts,
  47398. bindGlobal,
  47399. eventName
  47400. } = _ref2;
  47401. const target = (0,external_wp_element_namespaceObject.useRef)();
  47402. const element = (0,external_lodash_namespaceObject.map)(shortcuts, (callback, shortcut) => (0,external_wp_element_namespaceObject.createElement)(KeyboardShortcut, {
  47403. key: shortcut,
  47404. shortcut: shortcut,
  47405. callback: callback,
  47406. bindGlobal: bindGlobal,
  47407. eventName: eventName,
  47408. target: target
  47409. })); // Render as non-visual if there are no children pressed. Keyboard
  47410. // events will be bound to the document instead.
  47411. if (!external_wp_element_namespaceObject.Children.count(children)) {
  47412. return element;
  47413. }
  47414. return (0,external_wp_element_namespaceObject.createElement)("div", {
  47415. ref: target
  47416. }, element, children);
  47417. }
  47418. /* harmony default export */ var keyboard_shortcuts = (KeyboardShortcuts);
  47419. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/menu-group/index.js
  47420. // @ts-nocheck
  47421. /**
  47422. * External dependencies
  47423. */
  47424. /**
  47425. * WordPress dependencies
  47426. */
  47427. function MenuGroup(props) {
  47428. const {
  47429. children,
  47430. className = '',
  47431. label,
  47432. hideSeparator
  47433. } = props;
  47434. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(MenuGroup);
  47435. if (!external_wp_element_namespaceObject.Children.count(children)) {
  47436. return null;
  47437. }
  47438. const labelId = `components-menu-group-label-${instanceId}`;
  47439. const classNames = classnames_default()(className, 'components-menu-group', {
  47440. 'has-hidden-separator': hideSeparator
  47441. });
  47442. return (0,external_wp_element_namespaceObject.createElement)("div", {
  47443. className: classNames
  47444. }, label && (0,external_wp_element_namespaceObject.createElement)("div", {
  47445. className: "components-menu-group__label",
  47446. id: labelId,
  47447. "aria-hidden": "true"
  47448. }, label), (0,external_wp_element_namespaceObject.createElement)("div", {
  47449. role: "group",
  47450. "aria-labelledby": label ? labelId : null
  47451. }, children));
  47452. }
  47453. /* harmony default export */ var menu_group = (MenuGroup);
  47454. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/menu-item/index.js
  47455. // @ts-nocheck
  47456. /**
  47457. * External dependencies
  47458. */
  47459. /**
  47460. * WordPress dependencies
  47461. */
  47462. /**
  47463. * Internal dependencies
  47464. */
  47465. function MenuItem(props, ref) {
  47466. let {
  47467. children,
  47468. info,
  47469. className,
  47470. icon,
  47471. iconPosition = 'right',
  47472. shortcut,
  47473. isSelected,
  47474. role = 'menuitem',
  47475. ...buttonProps
  47476. } = props;
  47477. className = classnames_default()('components-menu-item__button', className);
  47478. if (info) {
  47479. children = (0,external_wp_element_namespaceObject.createElement)("span", {
  47480. className: "components-menu-item__info-wrapper"
  47481. }, (0,external_wp_element_namespaceObject.createElement)("span", {
  47482. className: "components-menu-item__item"
  47483. }, children), (0,external_wp_element_namespaceObject.createElement)("span", {
  47484. className: "components-menu-item__info"
  47485. }, info));
  47486. }
  47487. if (icon && typeof icon !== 'string') {
  47488. icon = (0,external_wp_element_namespaceObject.cloneElement)(icon, {
  47489. className: classnames_default()('components-menu-items__item-icon', {
  47490. 'has-icon-right': iconPosition === 'right'
  47491. })
  47492. });
  47493. }
  47494. return (0,external_wp_element_namespaceObject.createElement)(build_module_button, extends_extends({
  47495. ref: ref // Make sure aria-checked matches spec https://www.w3.org/TR/wai-aria-1.1/#aria-checked
  47496. ,
  47497. "aria-checked": role === 'menuitemcheckbox' || role === 'menuitemradio' ? isSelected : undefined,
  47498. role: role,
  47499. icon: iconPosition === 'left' ? icon : undefined,
  47500. className: className
  47501. }, buttonProps), (0,external_wp_element_namespaceObject.createElement)("span", {
  47502. className: "components-menu-item__item"
  47503. }, children), (0,external_wp_element_namespaceObject.createElement)(build_module_shortcut, {
  47504. className: "components-menu-item__shortcut",
  47505. shortcut: shortcut
  47506. }), icon && iconPosition === 'right' && (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
  47507. icon: icon
  47508. }));
  47509. }
  47510. /* harmony default export */ var menu_item = ((0,external_wp_element_namespaceObject.forwardRef)(MenuItem));
  47511. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/menu-items-choice/index.js
  47512. /**
  47513. * WordPress dependencies
  47514. */
  47515. /**
  47516. * Internal dependencies
  47517. */
  47518. const menu_items_choice_noop = () => {};
  47519. function MenuItemsChoice(_ref) {
  47520. let {
  47521. choices = [],
  47522. onHover = menu_items_choice_noop,
  47523. onSelect,
  47524. value
  47525. } = _ref;
  47526. return choices.map(item => {
  47527. const isSelected = value === item.value;
  47528. return (0,external_wp_element_namespaceObject.createElement)(menu_item, {
  47529. key: item.value,
  47530. role: "menuitemradio",
  47531. icon: isSelected && library_check,
  47532. info: item.info,
  47533. isSelected: isSelected,
  47534. shortcut: item.shortcut,
  47535. className: "components-menu-items-choice",
  47536. onClick: () => {
  47537. if (!isSelected) {
  47538. onSelect(item.value);
  47539. }
  47540. },
  47541. onMouseEnter: () => onHover(item.value),
  47542. onMouseLeave: () => onHover(null),
  47543. "aria-label": item['aria-label']
  47544. }, item.label);
  47545. });
  47546. }
  47547. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigable-container/tabbable.js
  47548. // @ts-nocheck
  47549. /**
  47550. * WordPress dependencies
  47551. */
  47552. /**
  47553. * Internal dependencies
  47554. */
  47555. function TabbableContainer(_ref, ref) {
  47556. let {
  47557. eventToOffset,
  47558. ...props
  47559. } = _ref;
  47560. const innerEventToOffset = evt => {
  47561. const {
  47562. code,
  47563. shiftKey
  47564. } = evt;
  47565. if ('Tab' === code) {
  47566. return shiftKey ? -1 : 1;
  47567. } // Allow custom handling of keys besides Tab.
  47568. //
  47569. // By default, TabbableContainer will move focus forward on Tab and
  47570. // backward on Shift+Tab. The handler below will be used for all other
  47571. // events. The semantics for `eventToOffset`'s return
  47572. // values are the following:
  47573. //
  47574. // - +1: move focus forward
  47575. // - -1: move focus backward
  47576. // - 0: don't move focus, but acknowledge event and thus stop it
  47577. // - undefined: do nothing, let the event propagate.
  47578. if (eventToOffset) {
  47579. return eventToOffset(evt);
  47580. }
  47581. };
  47582. return (0,external_wp_element_namespaceObject.createElement)(container, extends_extends({
  47583. ref: ref,
  47584. stopNavigationEvents: true,
  47585. onlyBrowserTabstops: true,
  47586. eventToOffset: innerEventToOffset
  47587. }, props));
  47588. }
  47589. /* harmony default export */ var tabbable = ((0,external_wp_element_namespaceObject.forwardRef)(TabbableContainer));
  47590. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/constants.js
  47591. const ROOT_MENU = 'root';
  47592. const SEARCH_FOCUS_DELAY = 100;
  47593. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/context.js
  47594. /**
  47595. * WordPress dependencies
  47596. */
  47597. /**
  47598. * Internal dependencies
  47599. */
  47600. const context_noop = () => {};
  47601. const NavigationContext = (0,external_wp_element_namespaceObject.createContext)({
  47602. activeItem: undefined,
  47603. activeMenu: ROOT_MENU,
  47604. setActiveMenu: context_noop,
  47605. isMenuEmpty: context_noop,
  47606. navigationTree: {
  47607. items: {},
  47608. getItem: context_noop,
  47609. addItem: context_noop,
  47610. removeItem: context_noop,
  47611. menus: {},
  47612. getMenu: context_noop,
  47613. addMenu: context_noop,
  47614. removeMenu: context_noop,
  47615. childMenu: {},
  47616. traverseMenu: context_noop,
  47617. isMenuEmpty: context_noop
  47618. }
  47619. });
  47620. const useNavigationContext = () => (0,external_wp_element_namespaceObject.useContext)(NavigationContext);
  47621. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/search.js
  47622. /**
  47623. * WordPress dependencies
  47624. */
  47625. const search = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  47626. xmlns: "http://www.w3.org/2000/svg",
  47627. viewBox: "0 0 24 24"
  47628. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  47629. 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"
  47630. }));
  47631. /* harmony default export */ var library_search = (search);
  47632. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/search-control/index.js
  47633. /**
  47634. * External dependencies
  47635. */
  47636. /**
  47637. * WordPress dependencies
  47638. */
  47639. /**
  47640. * Internal dependencies
  47641. */
  47642. function UnforwardedSearchControl(_ref, forwardedRef) {
  47643. let {
  47644. __nextHasNoMarginBottom,
  47645. className,
  47646. onChange,
  47647. onKeyDown,
  47648. value,
  47649. label,
  47650. placeholder = (0,external_wp_i18n_namespaceObject.__)('Search'),
  47651. hideLabelFromVision = true,
  47652. help,
  47653. onClose,
  47654. ...restProps
  47655. } = _ref;
  47656. const searchRef = (0,external_wp_element_namespaceObject.useRef)();
  47657. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(SearchControl);
  47658. const id = `components-search-control-${instanceId}`;
  47659. const renderRightButton = () => {
  47660. if (onClose) {
  47661. return (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  47662. icon: close_small,
  47663. label: (0,external_wp_i18n_namespaceObject.__)('Close search'),
  47664. onClick: onClose
  47665. });
  47666. }
  47667. if (!!value) {
  47668. return (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  47669. icon: close_small,
  47670. label: (0,external_wp_i18n_namespaceObject.__)('Reset search'),
  47671. onClick: () => {
  47672. var _searchRef$current;
  47673. onChange('');
  47674. (_searchRef$current = searchRef.current) === null || _searchRef$current === void 0 ? void 0 : _searchRef$current.focus();
  47675. }
  47676. });
  47677. }
  47678. return (0,external_wp_element_namespaceObject.createElement)(icons_build_module_icon, {
  47679. icon: library_search
  47680. });
  47681. };
  47682. return (0,external_wp_element_namespaceObject.createElement)(base_control, {
  47683. __nextHasNoMarginBottom: __nextHasNoMarginBottom,
  47684. label: label,
  47685. id: id,
  47686. hideLabelFromVision: hideLabelFromVision,
  47687. help: help,
  47688. className: classnames_default()(className, 'components-search-control')
  47689. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  47690. className: "components-search-control__input-wrapper"
  47691. }, (0,external_wp_element_namespaceObject.createElement)("input", extends_extends({}, restProps, {
  47692. ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([searchRef, forwardedRef]),
  47693. className: "components-search-control__input",
  47694. id: id,
  47695. type: "search",
  47696. placeholder: placeholder,
  47697. onChange: event => onChange(event.target.value),
  47698. onKeyDown: onKeyDown,
  47699. autoComplete: "off",
  47700. value: value || ''
  47701. })), (0,external_wp_element_namespaceObject.createElement)("div", {
  47702. className: "components-search-control__icon"
  47703. }, renderRightButton())));
  47704. }
  47705. /**
  47706. * SearchControl components let users display a search control.
  47707. *
  47708. * ```jsx
  47709. * import { SearchControl } from '@wordpress/components';
  47710. * import { useState } from '@wordpress/element';
  47711. *
  47712. * function MySearchControl( { className, setState } ) {
  47713. * const [ searchInput, setSearchInput ] = useState( '' );
  47714. *
  47715. * return (
  47716. * <SearchControl
  47717. * value={ searchInput }
  47718. * onChange={ setSearchInput }
  47719. * />
  47720. * );
  47721. * }
  47722. * ```
  47723. */
  47724. const SearchControl = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedSearchControl);
  47725. /* harmony default export */ var search_control = (SearchControl);
  47726. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/styles/navigation-styles.js
  47727. 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)."; }
  47728. /**
  47729. * External dependencies
  47730. */
  47731. /**
  47732. * WordPress dependencies
  47733. */
  47734. /**
  47735. * Internal dependencies
  47736. */
  47737. const NavigationUI = emotion_styled_base_browser_esm("div", true ? {
  47738. target: "ejwewyf11"
  47739. } : 0)("width:100%;box-sizing:border-box;padding:0 ", space(4), ";overflow:hidden;" + ( true ? "" : 0));
  47740. const MenuUI = emotion_styled_base_browser_esm("div", true ? {
  47741. target: "ejwewyf10"
  47742. } : 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));
  47743. const MenuBackButtonUI = /*#__PURE__*/emotion_styled_base_browser_esm(build_module_button, true ? {
  47744. target: "ejwewyf9"
  47745. } : 0)( true ? {
  47746. name: "26l0q2",
  47747. 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;}}"
  47748. } : 0);
  47749. const MenuTitleUI = emotion_styled_base_browser_esm("div", true ? {
  47750. target: "ejwewyf8"
  47751. } : 0)( true ? {
  47752. name: "1aubja5",
  47753. styles: "overflow:hidden;width:100%"
  47754. } : 0);
  47755. const MenuTitleActionsUI = emotion_styled_base_browser_esm("span", true ? {
  47756. target: "ejwewyf7"
  47757. } : 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));
  47758. const MenuTitleSearchUI = /*#__PURE__*/emotion_styled_base_browser_esm(search_control, true ? {
  47759. target: "ejwewyf6"
  47760. } : 0)( true ? {
  47761. name: "za3n3e",
  47762. 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;}"
  47763. } : 0);
  47764. const GroupTitleUI = /*#__PURE__*/emotion_styled_base_browser_esm(heading_component, true ? {
  47765. target: "ejwewyf5"
  47766. } : 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));
  47767. const ItemBaseUI = emotion_styled_base_browser_esm("li", true ? {
  47768. target: "ejwewyf4"
  47769. } : 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({
  47770. textAlign: 'left'
  47771. }, {
  47772. textAlign: 'right'
  47773. }), " &:hover,&:focus:not( [aria-disabled='true'] ):active,&:active:not( [aria-disabled='true'] ):active{color:inherit;opacity:1;}}&.is-active{background-color:", COLORS.ui.theme, ";color:", COLORS.white, ";>button,>a{color:", COLORS.white, ";opacity:1;}}>svg path{color:", COLORS.gray[600], ";}" + ( true ? "" : 0));
  47774. const ItemUI = emotion_styled_base_browser_esm("div", true ? {
  47775. target: "ejwewyf3"
  47776. } : 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));
  47777. const ItemIconUI = emotion_styled_base_browser_esm("span", true ? {
  47778. target: "ejwewyf2"
  47779. } : 0)("display:flex;margin-right:", space(2), ";" + ( true ? "" : 0));
  47780. const ItemBadgeUI = emotion_styled_base_browser_esm("span", true ? {
  47781. target: "ejwewyf1"
  47782. } : 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));
  47783. const ItemTitleUI = /*#__PURE__*/emotion_styled_base_browser_esm(text_component, true ? {
  47784. target: "ejwewyf0"
  47785. } : 0)(() => (0,external_wp_i18n_namespaceObject.isRTL)() ? 'margin-left: auto;' : 'margin-right: auto;', " font-size:14px;line-height:20px;color:inherit;" + ( true ? "" : 0));
  47786. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/use-navigation-tree-nodes.js
  47787. /**
  47788. * WordPress dependencies
  47789. */
  47790. const useNavigationTreeNodes = () => {
  47791. const [nodes, setNodes] = (0,external_wp_element_namespaceObject.useState)({});
  47792. const getNode = key => nodes[key];
  47793. const addNode = (key, value) => {
  47794. const {
  47795. children,
  47796. ...newNode
  47797. } = value;
  47798. return setNodes(original => ({ ...original,
  47799. [key]: newNode
  47800. }));
  47801. };
  47802. const removeNode = key => {
  47803. return setNodes(original => {
  47804. const {
  47805. [key]: removedNode,
  47806. ...remainingNodes
  47807. } = original;
  47808. return remainingNodes;
  47809. });
  47810. };
  47811. return {
  47812. nodes,
  47813. getNode,
  47814. addNode,
  47815. removeNode
  47816. };
  47817. };
  47818. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/use-create-navigation-tree.js
  47819. /**
  47820. * WordPress dependencies
  47821. */
  47822. /**
  47823. * Internal dependencies
  47824. */
  47825. const useCreateNavigationTree = () => {
  47826. const {
  47827. nodes: items,
  47828. getNode: getItem,
  47829. addNode: addItem,
  47830. removeNode: removeItem
  47831. } = useNavigationTreeNodes();
  47832. const {
  47833. nodes: menus,
  47834. getNode: getMenu,
  47835. addNode: addMenu,
  47836. removeNode: removeMenu
  47837. } = useNavigationTreeNodes();
  47838. /**
  47839. * Stores direct nested menus of menus
  47840. * This makes it easy to traverse menu tree
  47841. *
  47842. * Key is the menu prop of the menu
  47843. * Value is an array of menu keys
  47844. */
  47845. const [childMenu, setChildMenu] = (0,external_wp_element_namespaceObject.useState)({});
  47846. const getChildMenu = menu => childMenu[menu] || [];
  47847. const traverseMenu = (startMenu, callback) => {
  47848. const visited = [];
  47849. let queue = [startMenu];
  47850. let current;
  47851. while (queue.length > 0) {
  47852. current = getMenu(queue.shift());
  47853. if (!current || visited.includes(current.menu)) {
  47854. continue;
  47855. }
  47856. visited.push(current.menu);
  47857. queue = [...queue, ...getChildMenu(current.menu)];
  47858. if (callback(current) === false) {
  47859. break;
  47860. }
  47861. }
  47862. };
  47863. const isMenuEmpty = menuToCheck => {
  47864. let isEmpty = true;
  47865. traverseMenu(menuToCheck, current => {
  47866. if (!current.isEmpty) {
  47867. isEmpty = false;
  47868. return false;
  47869. }
  47870. });
  47871. return isEmpty;
  47872. };
  47873. return {
  47874. items,
  47875. getItem,
  47876. addItem,
  47877. removeItem,
  47878. menus,
  47879. getMenu,
  47880. addMenu: (key, value) => {
  47881. setChildMenu(state => {
  47882. const newState = { ...state
  47883. };
  47884. if (!newState[value.parentMenu]) {
  47885. newState[value.parentMenu] = [];
  47886. }
  47887. newState[value.parentMenu].push(key);
  47888. return newState;
  47889. });
  47890. addMenu(key, value);
  47891. },
  47892. removeMenu,
  47893. childMenu,
  47894. traverseMenu,
  47895. isMenuEmpty
  47896. };
  47897. };
  47898. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/index.js
  47899. /**
  47900. * External dependencies
  47901. */
  47902. /**
  47903. * WordPress dependencies
  47904. */
  47905. /**
  47906. * Internal dependencies
  47907. */
  47908. const navigation_noop = () => {};
  47909. function Navigation(_ref) {
  47910. let {
  47911. activeItem,
  47912. activeMenu = ROOT_MENU,
  47913. children,
  47914. className,
  47915. onActivateMenu = navigation_noop
  47916. } = _ref;
  47917. const [menu, setMenu] = (0,external_wp_element_namespaceObject.useState)(activeMenu);
  47918. const [slideOrigin, setSlideOrigin] = (0,external_wp_element_namespaceObject.useState)();
  47919. const navigationTree = useCreateNavigationTree();
  47920. const defaultSlideOrigin = (0,external_wp_i18n_namespaceObject.isRTL)() ? 'right' : 'left';
  47921. const setActiveMenu = function (menuId) {
  47922. let slideInOrigin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultSlideOrigin;
  47923. if (!navigationTree.getMenu(menuId)) {
  47924. return;
  47925. }
  47926. setSlideOrigin(slideInOrigin);
  47927. setMenu(menuId);
  47928. onActivateMenu(menuId);
  47929. }; // Used to prevent the sliding animation on mount
  47930. const isMounted = (0,external_wp_element_namespaceObject.useRef)(false);
  47931. (0,external_wp_element_namespaceObject.useEffect)(() => {
  47932. if (!isMounted.current) {
  47933. isMounted.current = true;
  47934. }
  47935. }, []);
  47936. (0,external_wp_element_namespaceObject.useEffect)(() => {
  47937. if (activeMenu !== menu) {
  47938. setActiveMenu(activeMenu);
  47939. } // Ignore exhaustive-deps here, as it would require either a larger refactor or some questionable workarounds.
  47940. // See https://github.com/WordPress/gutenberg/pull/41612 for context.
  47941. // eslint-disable-next-line react-hooks/exhaustive-deps
  47942. }, [activeMenu]);
  47943. const context = {
  47944. activeItem,
  47945. activeMenu: menu,
  47946. setActiveMenu,
  47947. navigationTree
  47948. };
  47949. const classes = classnames_default()('components-navigation', className);
  47950. const animateClassName = getAnimateClassName({
  47951. type: 'slide-in',
  47952. origin: slideOrigin
  47953. });
  47954. return (0,external_wp_element_namespaceObject.createElement)(NavigationUI, {
  47955. className: classes
  47956. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  47957. key: menu,
  47958. className: classnames_default()({
  47959. [animateClassName]: isMounted.current && slideOrigin
  47960. })
  47961. }, (0,external_wp_element_namespaceObject.createElement)(NavigationContext.Provider, {
  47962. value: context
  47963. }, children)));
  47964. }
  47965. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right.js
  47966. /**
  47967. * WordPress dependencies
  47968. */
  47969. const chevronRight = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  47970. xmlns: "http://www.w3.org/2000/svg",
  47971. viewBox: "0 0 24 24"
  47972. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  47973. d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"
  47974. }));
  47975. /* harmony default export */ var chevron_right = (chevronRight);
  47976. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left.js
  47977. /**
  47978. * WordPress dependencies
  47979. */
  47980. const chevronLeft = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  47981. xmlns: "http://www.w3.org/2000/svg",
  47982. viewBox: "0 0 24 24"
  47983. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  47984. d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"
  47985. }));
  47986. /* harmony default export */ var chevron_left = (chevronLeft);
  47987. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/back-button/index.js
  47988. /**
  47989. * External dependencies
  47990. */
  47991. /**
  47992. * WordPress dependencies
  47993. */
  47994. /**
  47995. * Internal dependencies
  47996. */
  47997. function NavigationBackButton(_ref, ref) {
  47998. var _navigationTree$getMe;
  47999. let {
  48000. backButtonLabel,
  48001. className,
  48002. href,
  48003. onClick,
  48004. parentMenu
  48005. } = _ref;
  48006. const {
  48007. setActiveMenu,
  48008. navigationTree
  48009. } = useNavigationContext();
  48010. const classes = classnames_default()('components-navigation__back-button', className);
  48011. const parentMenuTitle = (_navigationTree$getMe = navigationTree.getMenu(parentMenu)) === null || _navigationTree$getMe === void 0 ? void 0 : _navigationTree$getMe.title;
  48012. const handleOnClick = event => {
  48013. if (typeof onClick === 'function') {
  48014. onClick(event);
  48015. }
  48016. const animationDirection = (0,external_wp_i18n_namespaceObject.isRTL)() ? 'left' : 'right';
  48017. if (parentMenu && !event.defaultPrevented) {
  48018. setActiveMenu(parentMenu, animationDirection);
  48019. }
  48020. };
  48021. const icon = (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left;
  48022. return (0,external_wp_element_namespaceObject.createElement)(MenuBackButtonUI, {
  48023. className: classes,
  48024. href: href,
  48025. variant: "tertiary",
  48026. ref: ref,
  48027. onClick: handleOnClick
  48028. }, (0,external_wp_element_namespaceObject.createElement)(icons_build_module_icon, {
  48029. icon: icon
  48030. }), backButtonLabel || parentMenuTitle || (0,external_wp_i18n_namespaceObject.__)('Back'));
  48031. }
  48032. /* harmony default export */ var back_button = ((0,external_wp_element_namespaceObject.forwardRef)(NavigationBackButton));
  48033. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/group/context.js
  48034. /**
  48035. * WordPress dependencies
  48036. */
  48037. const NavigationGroupContext = (0,external_wp_element_namespaceObject.createContext)({
  48038. group: undefined
  48039. });
  48040. const useNavigationGroupContext = () => (0,external_wp_element_namespaceObject.useContext)(NavigationGroupContext);
  48041. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/group/index.js
  48042. /**
  48043. * External dependencies
  48044. */
  48045. /**
  48046. * WordPress dependencies
  48047. */
  48048. /**
  48049. * Internal dependencies
  48050. */
  48051. let uniqueId = 0;
  48052. function NavigationGroup(_ref) {
  48053. let {
  48054. children,
  48055. className,
  48056. title
  48057. } = _ref;
  48058. const [groupId] = (0,external_wp_element_namespaceObject.useState)(`group-${++uniqueId}`);
  48059. const {
  48060. navigationTree: {
  48061. items
  48062. }
  48063. } = useNavigationContext();
  48064. const context = {
  48065. group: groupId
  48066. }; // Keep the children rendered to make sure invisible items are included in the navigation tree.
  48067. if (!Object.values(items).some(item => item.group === groupId && item._isVisible)) {
  48068. return (0,external_wp_element_namespaceObject.createElement)(NavigationGroupContext.Provider, {
  48069. value: context
  48070. }, children);
  48071. }
  48072. const groupTitleId = `components-navigation__group-title-${groupId}`;
  48073. const classes = classnames_default()('components-navigation__group', className);
  48074. return (0,external_wp_element_namespaceObject.createElement)(NavigationGroupContext.Provider, {
  48075. value: context
  48076. }, (0,external_wp_element_namespaceObject.createElement)("li", {
  48077. className: classes
  48078. }, title && (0,external_wp_element_namespaceObject.createElement)(GroupTitleUI, {
  48079. className: "components-navigation__group-title",
  48080. id: groupTitleId,
  48081. level: 3
  48082. }, title), (0,external_wp_element_namespaceObject.createElement)("ul", {
  48083. "aria-labelledby": groupTitleId,
  48084. role: "group"
  48085. }, children)));
  48086. }
  48087. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/item/base-content.js
  48088. /**
  48089. * Internal dependencies
  48090. */
  48091. function NavigationItemBaseContent(props) {
  48092. const {
  48093. badge,
  48094. title
  48095. } = props;
  48096. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, title && (0,external_wp_element_namespaceObject.createElement)(ItemTitleUI, {
  48097. className: "components-navigation__item-title",
  48098. variant: "body.small",
  48099. as: "span"
  48100. }, title), badge && (0,external_wp_element_namespaceObject.createElement)(ItemBadgeUI, {
  48101. className: "components-navigation__item-badge"
  48102. }, badge));
  48103. }
  48104. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/menu/context.js
  48105. /**
  48106. * WordPress dependencies
  48107. */
  48108. const NavigationMenuContext = (0,external_wp_element_namespaceObject.createContext)({
  48109. menu: undefined,
  48110. search: ''
  48111. });
  48112. const useNavigationMenuContext = () => (0,external_wp_element_namespaceObject.useContext)(NavigationMenuContext);
  48113. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/utils.js
  48114. /**
  48115. * External dependencies
  48116. */
  48117. // @see packages/block-editor/src/components/inserter/search-items.js
  48118. const normalizeInput = input => remove_accents_default()(input).replace(/^\//, '').toLowerCase();
  48119. const normalizedSearch = (title, search) => -1 !== normalizeInput(title).indexOf(normalizeInput(search));
  48120. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/item/use-navigation-tree-item.js
  48121. /**
  48122. * WordPress dependencies
  48123. */
  48124. /**
  48125. * Internal dependencies
  48126. */
  48127. const useNavigationTreeItem = (itemId, props) => {
  48128. const {
  48129. activeMenu,
  48130. navigationTree: {
  48131. addItem,
  48132. removeItem
  48133. }
  48134. } = useNavigationContext();
  48135. const {
  48136. group
  48137. } = useNavigationGroupContext();
  48138. const {
  48139. menu,
  48140. search
  48141. } = useNavigationMenuContext();
  48142. (0,external_wp_element_namespaceObject.useEffect)(() => {
  48143. const isMenuActive = activeMenu === menu;
  48144. const isItemVisible = !search || normalizedSearch(props.title, search);
  48145. addItem(itemId, { ...props,
  48146. group,
  48147. menu,
  48148. _isVisible: isMenuActive && isItemVisible
  48149. });
  48150. return () => {
  48151. removeItem(itemId);
  48152. }; // Ignore exhaustive-deps rule for now. See https://github.com/WordPress/gutenberg/pull/41639
  48153. // eslint-disable-next-line react-hooks/exhaustive-deps
  48154. }, [activeMenu, search]);
  48155. };
  48156. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/item/base.js
  48157. /**
  48158. * External dependencies
  48159. */
  48160. /**
  48161. * WordPress dependencies
  48162. */
  48163. /**
  48164. * Internal dependencies
  48165. */
  48166. let base_uniqueId = 0;
  48167. function NavigationItemBase(props) {
  48168. var _navigationTree$getIt;
  48169. // Also avoid to pass the `title` and `href` props to the ItemBaseUI styled component.
  48170. const {
  48171. children,
  48172. className,
  48173. title,
  48174. href,
  48175. ...restProps
  48176. } = props;
  48177. const [itemId] = (0,external_wp_element_namespaceObject.useState)(`item-${++base_uniqueId}`);
  48178. useNavigationTreeItem(itemId, props);
  48179. const {
  48180. navigationTree
  48181. } = useNavigationContext();
  48182. if (!((_navigationTree$getIt = navigationTree.getItem(itemId)) !== null && _navigationTree$getIt !== void 0 && _navigationTree$getIt._isVisible)) {
  48183. return null;
  48184. }
  48185. const classes = classnames_default()('components-navigation__item', className);
  48186. return (0,external_wp_element_namespaceObject.createElement)(ItemBaseUI, extends_extends({
  48187. className: classes
  48188. }, restProps), children);
  48189. }
  48190. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/item/index.js
  48191. /**
  48192. * External dependencies
  48193. */
  48194. /**
  48195. * WordPress dependencies
  48196. */
  48197. /**
  48198. * Internal dependencies
  48199. */
  48200. const item_noop = () => {};
  48201. function NavigationItem(props) {
  48202. const {
  48203. badge,
  48204. children,
  48205. className,
  48206. href,
  48207. item,
  48208. navigateToMenu,
  48209. onClick = item_noop,
  48210. title,
  48211. icon,
  48212. hideIfTargetMenuEmpty,
  48213. isText,
  48214. ...restProps
  48215. } = props;
  48216. const {
  48217. activeItem,
  48218. setActiveMenu,
  48219. navigationTree: {
  48220. isMenuEmpty
  48221. }
  48222. } = useNavigationContext(); // If hideIfTargetMenuEmpty prop is true
  48223. // And the menu we are supposed to navigate to
  48224. // Is marked as empty, then we skip rendering the item.
  48225. if (hideIfTargetMenuEmpty && navigateToMenu && isMenuEmpty(navigateToMenu)) {
  48226. return null;
  48227. }
  48228. const isActive = item && activeItem === item;
  48229. const classes = classnames_default()(className, {
  48230. 'is-active': isActive
  48231. });
  48232. const onItemClick = event => {
  48233. if (navigateToMenu) {
  48234. setActiveMenu(navigateToMenu);
  48235. }
  48236. onClick(event);
  48237. };
  48238. const navigationIcon = (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right;
  48239. const baseProps = children ? props : { ...props,
  48240. onClick: undefined
  48241. };
  48242. const itemProps = isText ? restProps : {
  48243. as: build_module_button,
  48244. href,
  48245. onClick: onItemClick,
  48246. 'aria-current': isActive ? 'page' : undefined,
  48247. ...restProps
  48248. };
  48249. return (0,external_wp_element_namespaceObject.createElement)(NavigationItemBase, extends_extends({}, baseProps, {
  48250. className: classes
  48251. }), 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, {
  48252. icon: icon
  48253. })), (0,external_wp_element_namespaceObject.createElement)(NavigationItemBaseContent, {
  48254. title: title,
  48255. badge: badge
  48256. }), navigateToMenu && (0,external_wp_element_namespaceObject.createElement)(icons_build_module_icon, {
  48257. icon: navigationIcon
  48258. })));
  48259. }
  48260. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/menu/use-navigation-tree-menu.js
  48261. /**
  48262. * WordPress dependencies
  48263. */
  48264. /**
  48265. * Internal dependencies
  48266. */
  48267. const useNavigationTreeMenu = props => {
  48268. const {
  48269. navigationTree: {
  48270. addMenu,
  48271. removeMenu
  48272. }
  48273. } = useNavigationContext();
  48274. const key = props.menu || ROOT_MENU;
  48275. (0,external_wp_element_namespaceObject.useEffect)(() => {
  48276. addMenu(key, { ...props,
  48277. menu: key
  48278. });
  48279. return () => {
  48280. removeMenu(key);
  48281. }; // Ignore exhaustive-deps rule for now. See https://github.com/WordPress/gutenberg/pull/44090
  48282. // eslint-disable-next-line react-hooks/exhaustive-deps
  48283. }, []);
  48284. };
  48285. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-spoken-messages/index.js
  48286. /**
  48287. * WordPress dependencies
  48288. */
  48289. /** @typedef {import('@wordpress/element').WPComponent} WPComponent */
  48290. /**
  48291. * A Higher Order Component used to be provide speak and debounced speak
  48292. * functions.
  48293. *
  48294. * @see https://developer.wordpress.org/block-editor/packages/packages-a11y/#speak
  48295. *
  48296. * @param {WPComponent} Component The component to be wrapped.
  48297. *
  48298. * @return {WPComponent} The wrapped component.
  48299. */
  48300. /* 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, {
  48301. speak: external_wp_a11y_namespaceObject.speak,
  48302. debouncedSpeak: (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500)
  48303. })), 'withSpokenMessages'));
  48304. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/menu/menu-title-search.js
  48305. /**
  48306. * WordPress dependencies
  48307. */
  48308. /**
  48309. * Internal dependencies
  48310. */
  48311. function MenuTitleSearch(_ref) {
  48312. let {
  48313. debouncedSpeak,
  48314. onCloseSearch,
  48315. onSearch,
  48316. search,
  48317. title
  48318. } = _ref;
  48319. const {
  48320. navigationTree: {
  48321. items
  48322. }
  48323. } = useNavigationContext();
  48324. const {
  48325. menu
  48326. } = useNavigationMenuContext();
  48327. const inputRef = (0,external_wp_element_namespaceObject.useRef)(); // Wait for the slide-in animation to complete before autofocusing the input.
  48328. // This prevents scrolling to the input during the animation.
  48329. (0,external_wp_element_namespaceObject.useEffect)(() => {
  48330. const delayedFocus = setTimeout(() => {
  48331. inputRef.current.focus();
  48332. }, SEARCH_FOCUS_DELAY);
  48333. return () => {
  48334. clearTimeout(delayedFocus);
  48335. };
  48336. }, []);
  48337. (0,external_wp_element_namespaceObject.useEffect)(() => {
  48338. if (!search) {
  48339. return;
  48340. }
  48341. const count = Object.values(items).filter(item => item._isVisible).length;
  48342. const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)(
  48343. /* translators: %d: number of results. */
  48344. (0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', count), count);
  48345. debouncedSpeak(resultsFoundMessage); // Ignore exhaustive-deps rule for now. See https://github.com/WordPress/gutenberg/pull/44090
  48346. // eslint-disable-next-line react-hooks/exhaustive-deps
  48347. }, [items, search]);
  48348. const onClose = () => {
  48349. onSearch('');
  48350. onCloseSearch();
  48351. };
  48352. function onKeyDown(event) {
  48353. if (event.code === 'Escape' && !event.defaultPrevented) {
  48354. event.preventDefault();
  48355. onClose();
  48356. }
  48357. }
  48358. const inputId = `components-navigation__menu-title-search-${menu}`;
  48359. const placeholder = (0,external_wp_i18n_namespaceObject.sprintf)(
  48360. /* translators: placeholder for menu search box. %s: menu title */
  48361. (0,external_wp_i18n_namespaceObject.__)('Search %s'), title === null || title === void 0 ? void 0 : title.toLowerCase()).trim();
  48362. return (0,external_wp_element_namespaceObject.createElement)("div", {
  48363. className: "components-navigation__menu-title-search"
  48364. }, (0,external_wp_element_namespaceObject.createElement)(MenuTitleSearchUI, {
  48365. autoComplete: "off",
  48366. className: "components-navigation__menu-search-input",
  48367. id: inputId,
  48368. onChange: value => onSearch(value),
  48369. onKeyDown: onKeyDown,
  48370. placeholder: placeholder,
  48371. onClose: onClose,
  48372. ref: inputRef,
  48373. type: "search",
  48374. value: search
  48375. }));
  48376. }
  48377. /* harmony default export */ var menu_title_search = (with_spoken_messages(MenuTitleSearch));
  48378. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/menu/menu-title.js
  48379. /**
  48380. * WordPress dependencies
  48381. */
  48382. /**
  48383. * Internal dependencies
  48384. */
  48385. function NavigationMenuTitle(_ref) {
  48386. let {
  48387. hasSearch,
  48388. onSearch,
  48389. search,
  48390. title,
  48391. titleAction
  48392. } = _ref;
  48393. const [isSearching, setIsSearching] = (0,external_wp_element_namespaceObject.useState)(false);
  48394. const {
  48395. menu
  48396. } = useNavigationMenuContext();
  48397. const searchButtonRef = (0,external_wp_element_namespaceObject.useRef)();
  48398. if (!title) {
  48399. return null;
  48400. }
  48401. const onCloseSearch = () => {
  48402. setIsSearching(false); // Wait for the slide-in animation to complete before focusing the search button.
  48403. // eslint-disable-next-line @wordpress/react-no-unsafe-timeout
  48404. setTimeout(() => {
  48405. searchButtonRef.current.focus();
  48406. }, SEARCH_FOCUS_DELAY);
  48407. };
  48408. const menuTitleId = `components-navigation__menu-title-${menu}`;
  48409. /* translators: search button label for menu search box. %s: menu title */
  48410. const searchButtonLabel = (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Search in %s'), title);
  48411. return (0,external_wp_element_namespaceObject.createElement)(MenuTitleUI, {
  48412. className: "components-navigation__menu-title"
  48413. }, !isSearching && (0,external_wp_element_namespaceObject.createElement)(GroupTitleUI, {
  48414. as: "h2",
  48415. className: "components-navigation__menu-title-heading",
  48416. level: 3
  48417. }, (0,external_wp_element_namespaceObject.createElement)("span", {
  48418. id: menuTitleId
  48419. }, title), (hasSearch || titleAction) && (0,external_wp_element_namespaceObject.createElement)(MenuTitleActionsUI, null, titleAction, hasSearch && (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  48420. isSmall: true,
  48421. variant: "tertiary",
  48422. label: searchButtonLabel,
  48423. onClick: () => setIsSearching(true),
  48424. ref: searchButtonRef
  48425. }, (0,external_wp_element_namespaceObject.createElement)(icons_build_module_icon, {
  48426. icon: library_search
  48427. })))), isSearching && (0,external_wp_element_namespaceObject.createElement)("div", {
  48428. className: getAnimateClassName({
  48429. type: 'slide-in',
  48430. origin: 'left'
  48431. })
  48432. }, (0,external_wp_element_namespaceObject.createElement)(menu_title_search, {
  48433. onCloseSearch: onCloseSearch,
  48434. onSearch: onSearch,
  48435. search: search,
  48436. title: title
  48437. })));
  48438. }
  48439. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/menu/search-no-results-found.js
  48440. /**
  48441. * WordPress dependencies
  48442. */
  48443. /**
  48444. * Internal dependencies
  48445. */
  48446. function NavigationSearchNoResultsFound(_ref) {
  48447. let {
  48448. search
  48449. } = _ref;
  48450. const {
  48451. navigationTree: {
  48452. items
  48453. }
  48454. } = useNavigationContext();
  48455. const resultsCount = Object.values(items).filter(item => item._isVisible).length;
  48456. if (!search || !!resultsCount) {
  48457. return null;
  48458. }
  48459. 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.'), " "));
  48460. }
  48461. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/menu/index.js
  48462. /**
  48463. * External dependencies
  48464. */
  48465. /**
  48466. * WordPress dependencies
  48467. */
  48468. /**
  48469. * Internal dependencies
  48470. */
  48471. function NavigationMenu(props) {
  48472. const {
  48473. backButtonLabel,
  48474. children,
  48475. className,
  48476. hasSearch,
  48477. menu = ROOT_MENU,
  48478. onBackButtonClick,
  48479. onSearch: setControlledSearch,
  48480. parentMenu,
  48481. search: controlledSearch,
  48482. isSearchDebouncing,
  48483. title,
  48484. titleAction
  48485. } = props;
  48486. const [uncontrolledSearch, setUncontrolledSearch] = (0,external_wp_element_namespaceObject.useState)('');
  48487. useNavigationTreeMenu(props);
  48488. const {
  48489. activeMenu
  48490. } = useNavigationContext();
  48491. const context = {
  48492. menu,
  48493. search: uncontrolledSearch
  48494. }; // Keep the children rendered to make sure invisible items are included in the navigation tree.
  48495. if (activeMenu !== menu) {
  48496. return (0,external_wp_element_namespaceObject.createElement)(NavigationMenuContext.Provider, {
  48497. value: context
  48498. }, children);
  48499. }
  48500. const isControlledSearch = !!setControlledSearch;
  48501. const search = isControlledSearch ? controlledSearch : uncontrolledSearch;
  48502. const onSearch = isControlledSearch ? setControlledSearch : setUncontrolledSearch;
  48503. const menuTitleId = `components-navigation__menu-title-${menu}`;
  48504. const classes = classnames_default()('components-navigation__menu', className);
  48505. return (0,external_wp_element_namespaceObject.createElement)(NavigationMenuContext.Provider, {
  48506. value: context
  48507. }, (0,external_wp_element_namespaceObject.createElement)(MenuUI, {
  48508. className: classes
  48509. }, (parentMenu || onBackButtonClick) && (0,external_wp_element_namespaceObject.createElement)(back_button, {
  48510. backButtonLabel: backButtonLabel,
  48511. parentMenu: parentMenu,
  48512. onClick: onBackButtonClick
  48513. }), title && (0,external_wp_element_namespaceObject.createElement)(NavigationMenuTitle, {
  48514. hasSearch: hasSearch,
  48515. onSearch: onSearch,
  48516. search: search,
  48517. title: title,
  48518. titleAction: titleAction
  48519. }), (0,external_wp_element_namespaceObject.createElement)(navigable_container_menu, null, (0,external_wp_element_namespaceObject.createElement)("ul", {
  48520. "aria-labelledby": menuTitleId
  48521. }, children, search && !isSearchDebouncing && (0,external_wp_element_namespaceObject.createElement)(NavigationSearchNoResultsFound, {
  48522. search: search
  48523. })))));
  48524. }
  48525. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/context.js
  48526. /**
  48527. * WordPress dependencies
  48528. */
  48529. /**
  48530. * Internal dependencies
  48531. */
  48532. const initialContextValue = {
  48533. location: {},
  48534. goTo: () => {},
  48535. goBack: () => {}
  48536. };
  48537. const NavigatorContext = (0,external_wp_element_namespaceObject.createContext)(initialContextValue);
  48538. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/navigator-provider/component.js
  48539. 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)."; }
  48540. /**
  48541. * External dependencies
  48542. */
  48543. /**
  48544. * WordPress dependencies
  48545. */
  48546. /**
  48547. * Internal dependencies
  48548. */
  48549. var component_ref = true ? {
  48550. name: "15bx5k",
  48551. styles: "overflow-x:hidden"
  48552. } : 0;
  48553. function NavigatorProvider(props, forwardedRef) {
  48554. const {
  48555. initialPath,
  48556. children,
  48557. className,
  48558. ...otherProps
  48559. } = useContextSystem(props, 'NavigatorProvider');
  48560. const [locationHistory, setLocationHistory] = (0,external_wp_element_namespaceObject.useState)([{
  48561. path: initialPath
  48562. }]);
  48563. const goTo = (0,external_wp_element_namespaceObject.useCallback)(function (path) {
  48564. let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  48565. setLocationHistory([...locationHistory, { ...options,
  48566. path,
  48567. isBack: false,
  48568. hasRestoredFocus: false
  48569. }]);
  48570. }, [locationHistory]);
  48571. const goBack = (0,external_wp_element_namespaceObject.useCallback)(() => {
  48572. if (locationHistory.length > 1) {
  48573. setLocationHistory([...locationHistory.slice(0, -2), { ...locationHistory[locationHistory.length - 2],
  48574. isBack: true,
  48575. hasRestoredFocus: false
  48576. }]);
  48577. }
  48578. }, [locationHistory]);
  48579. const navigatorContextValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({
  48580. location: { ...locationHistory[locationHistory.length - 1],
  48581. isInitial: locationHistory.length === 1
  48582. },
  48583. goTo,
  48584. goBack
  48585. }), [locationHistory, goTo, goBack]);
  48586. const cx = useCx();
  48587. const classes = (0,external_wp_element_namespaceObject.useMemo)( // Prevents horizontal overflow while animating screen transitions.
  48588. () => cx(component_ref, className), [className, cx]);
  48589. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({
  48590. ref: forwardedRef,
  48591. className: classes
  48592. }, otherProps), (0,external_wp_element_namespaceObject.createElement)(NavigatorContext.Provider, {
  48593. value: navigatorContextValue
  48594. }, children));
  48595. }
  48596. /**
  48597. * The `NavigatorProvider` component allows rendering nested views/panels/menus
  48598. * (via the `NavigatorScreen` component and navigate between these different
  48599. * view (via the `NavigatorButton` and `NavigatorBackButton` components or the
  48600. * `useNavigator` hook).
  48601. *
  48602. * @example
  48603. * ```jsx
  48604. * import {
  48605. * __experimentalNavigatorProvider as NavigatorProvider,
  48606. * __experimentalNavigatorScreen as NavigatorScreen,
  48607. * __experimentalNavigatorButton as NavigatorButton,
  48608. * __experimentalNavigatorBackButton as NavigatorBackButton,
  48609. * } from '@wordpress/components';
  48610. *
  48611. * const MyNavigation = () => (
  48612. * <NavigatorProvider initialPath="/">
  48613. * <NavigatorScreen path="/">
  48614. * <p>This is the home screen.</p>
  48615. * <NavigatorButton path="/child">
  48616. * Navigate to child screen.
  48617. * </NavigatorButton>
  48618. * </NavigatorScreen>
  48619. *
  48620. * <NavigatorScreen path="/child">
  48621. * <p>This is the child screen.</p>
  48622. * <NavigatorBackButton>
  48623. * Go back
  48624. * </NavigatorBackButton>
  48625. * </NavigatorScreen>
  48626. * </NavigatorProvider>
  48627. * );
  48628. * ```
  48629. */
  48630. const ConnectedNavigatorProvider = contextConnect(NavigatorProvider, 'NavigatorProvider');
  48631. /* harmony default export */ var navigator_provider_component = (ConnectedNavigatorProvider);
  48632. ;// CONCATENATED MODULE: external ["wp","escapeHtml"]
  48633. var external_wp_escapeHtml_namespaceObject = window["wp"]["escapeHtml"];
  48634. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/navigator-screen/component.js
  48635. 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)."; }
  48636. /**
  48637. * External dependencies
  48638. */
  48639. // eslint-disable-next-line no-restricted-imports
  48640. /**
  48641. * WordPress dependencies
  48642. */
  48643. /**
  48644. * Internal dependencies
  48645. */
  48646. const animationEnterDelay = 0;
  48647. const animationEnterDuration = 0.14;
  48648. const animationExitDuration = 0.14;
  48649. const animationExitDelay = 0; // Props specific to `framer-motion` can't be currently passed to `NavigatorScreen`,
  48650. // as some of them would overlap with HTML props (e.g. `onAnimationStart`, ...)
  48651. var navigator_screen_component_ref = true ? {
  48652. name: "14x3t6z",
  48653. styles: "overflow-x:auto;max-height:100%"
  48654. } : 0;
  48655. function NavigatorScreen(props, forwardedRef) {
  48656. const {
  48657. children,
  48658. className,
  48659. path,
  48660. ...otherProps
  48661. } = useContextSystem(props, 'NavigatorScreen');
  48662. const prefersReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
  48663. const {
  48664. location
  48665. } = (0,external_wp_element_namespaceObject.useContext)(NavigatorContext);
  48666. const isMatch = location.path === (0,external_wp_escapeHtml_namespaceObject.escapeAttribute)(path);
  48667. const wrapperRef = (0,external_wp_element_namespaceObject.useRef)(null);
  48668. const previousLocation = (0,external_wp_compose_namespaceObject.usePrevious)(location);
  48669. const cx = useCx();
  48670. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => cx(navigator_screen_component_ref, className), [className, cx]); // Focus restoration
  48671. const isInitialLocation = location.isInitial && !location.isBack;
  48672. (0,external_wp_element_namespaceObject.useEffect)(() => {
  48673. // Only attempt to restore focus:
  48674. // - if the current location is not the initial one (to avoid moving focus on page load)
  48675. // - when the screen becomes visible
  48676. // - if the wrapper ref has been assigned
  48677. // - if focus hasn't already been restored for the current location
  48678. if (isInitialLocation || !isMatch || !wrapperRef.current || location.hasRestoredFocus) {
  48679. return;
  48680. }
  48681. let elementToFocus = null; // When navigating back, if a selector is provided, use it to look for the
  48682. // target element (assumed to be a node inside the current NavigatorScreen)
  48683. if (location.isBack && previousLocation !== null && previousLocation !== void 0 && previousLocation.focusTargetSelector) {
  48684. elementToFocus = wrapperRef.current.querySelector(previousLocation.focusTargetSelector);
  48685. } // If the previous query didn't run or find any element to focus, fallback
  48686. // to the first tabbable element in the screen (or the screen itself).
  48687. if (!elementToFocus) {
  48688. const firstTabbable = external_wp_dom_namespaceObject.focus.tabbable.find(wrapperRef.current)[0];
  48689. elementToFocus = firstTabbable !== null && firstTabbable !== void 0 ? firstTabbable : wrapperRef.current;
  48690. }
  48691. location.hasRestoredFocus = true;
  48692. elementToFocus.focus();
  48693. }, [isInitialLocation, isMatch, location.hasRestoredFocus, location.isBack, previousLocation === null || previousLocation === void 0 ? void 0 : previousLocation.focusTargetSelector]);
  48694. const mergedWrapperRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([forwardedRef, wrapperRef]);
  48695. if (!isMatch) {
  48696. return null;
  48697. }
  48698. if (prefersReducedMotion) {
  48699. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({
  48700. ref: mergedWrapperRef,
  48701. className: classes
  48702. }, otherProps), children);
  48703. }
  48704. const animate = {
  48705. opacity: 1,
  48706. transition: {
  48707. delay: animationEnterDelay,
  48708. duration: animationEnterDuration,
  48709. ease: 'easeInOut'
  48710. },
  48711. x: 0
  48712. };
  48713. const initial = {
  48714. opacity: 0,
  48715. x: (0,external_wp_i18n_namespaceObject.isRTL)() && location.isBack || !(0,external_wp_i18n_namespaceObject.isRTL)() && !location.isBack ? 50 : -50
  48716. };
  48717. const exit = {
  48718. delay: animationExitDelay,
  48719. opacity: 0,
  48720. x: !(0,external_wp_i18n_namespaceObject.isRTL)() && location.isBack || (0,external_wp_i18n_namespaceObject.isRTL)() && !location.isBack ? 50 : -50,
  48721. transition: {
  48722. duration: animationExitDuration,
  48723. ease: 'easeInOut'
  48724. }
  48725. };
  48726. const animatedProps = {
  48727. animate,
  48728. exit,
  48729. initial
  48730. };
  48731. return (0,external_wp_element_namespaceObject.createElement)(motion.div, extends_extends({
  48732. ref: mergedWrapperRef,
  48733. className: classes
  48734. }, otherProps, animatedProps), children);
  48735. }
  48736. /**
  48737. * The `NavigatorScreen` component represents a single view/screen/panel and
  48738. * should be used in combination with the `NavigatorProvider`, the
  48739. * `NavigatorButton` and the `NavigatorBackButton` components (or the `useNavigator`
  48740. * hook).
  48741. *
  48742. * @example
  48743. * ```jsx
  48744. * import {
  48745. * __experimentalNavigatorProvider as NavigatorProvider,
  48746. * __experimentalNavigatorScreen as NavigatorScreen,
  48747. * __experimentalNavigatorButton as NavigatorButton,
  48748. * __experimentalNavigatorBackButton as NavigatorBackButton,
  48749. * } from '@wordpress/components';
  48750. *
  48751. * const MyNavigation = () => (
  48752. * <NavigatorProvider initialPath="/">
  48753. * <NavigatorScreen path="/">
  48754. * <p>This is the home screen.</p>
  48755. * <NavigatorButton path="/child">
  48756. * Navigate to child screen.
  48757. * </NavigatorButton>
  48758. * </NavigatorScreen>
  48759. *
  48760. * <NavigatorScreen path="/child">
  48761. * <p>This is the child screen.</p>
  48762. * <NavigatorBackButton>
  48763. * Go back
  48764. * </NavigatorBackButton>
  48765. * </NavigatorScreen>
  48766. * </NavigatorProvider>
  48767. * );
  48768. * ```
  48769. */
  48770. const ConnectedNavigatorScreen = contextConnect(NavigatorScreen, 'NavigatorScreen');
  48771. /* harmony default export */ var navigator_screen_component = (ConnectedNavigatorScreen);
  48772. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/use-navigator.js
  48773. /**
  48774. * WordPress dependencies
  48775. */
  48776. /**
  48777. * Internal dependencies
  48778. */
  48779. /**
  48780. * Retrieves a `navigator` instance.
  48781. */
  48782. function useNavigator() {
  48783. const {
  48784. location,
  48785. goTo,
  48786. goBack
  48787. } = (0,external_wp_element_namespaceObject.useContext)(NavigatorContext);
  48788. return {
  48789. location,
  48790. goTo,
  48791. goBack
  48792. };
  48793. }
  48794. /* harmony default export */ var use_navigator = (useNavigator);
  48795. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/navigator-button/hook.js
  48796. /**
  48797. * WordPress dependencies
  48798. */
  48799. /**
  48800. * Internal dependencies
  48801. */
  48802. const cssSelectorForAttribute = (attrName, attrValue) => `[${attrName}="${attrValue}"]`;
  48803. function useNavigatorButton(props) {
  48804. const {
  48805. path,
  48806. onClick,
  48807. as = build_module_button,
  48808. attributeName = 'id',
  48809. ...otherProps
  48810. } = useContextSystem(props, 'NavigatorButton');
  48811. const escapedPath = (0,external_wp_escapeHtml_namespaceObject.escapeAttribute)(path);
  48812. const {
  48813. goTo
  48814. } = use_navigator();
  48815. const handleClick = (0,external_wp_element_namespaceObject.useCallback)(e => {
  48816. e.preventDefault();
  48817. goTo(escapedPath, {
  48818. focusTargetSelector: cssSelectorForAttribute(attributeName, escapedPath)
  48819. });
  48820. onClick === null || onClick === void 0 ? void 0 : onClick(e);
  48821. }, [goTo, onClick, attributeName, escapedPath]);
  48822. return {
  48823. as,
  48824. onClick: handleClick,
  48825. ...otherProps,
  48826. [attributeName]: escapedPath
  48827. };
  48828. }
  48829. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/navigator-button/component.js
  48830. /**
  48831. * External dependencies
  48832. */
  48833. /**
  48834. * Internal dependencies
  48835. */
  48836. function NavigatorButton(props, forwardedRef) {
  48837. const navigatorButtonProps = useNavigatorButton(props);
  48838. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({
  48839. ref: forwardedRef
  48840. }, navigatorButtonProps));
  48841. }
  48842. /**
  48843. * The `NavigatorButton` component can be used to navigate to a screen and should
  48844. * be used in combination with the `NavigatorProvider`, the `NavigatorScreen`
  48845. * and the `NavigatorBackButton` components (or the `useNavigator` hook).
  48846. *
  48847. * @example
  48848. * ```jsx
  48849. * import {
  48850. * __experimentalNavigatorProvider as NavigatorProvider,
  48851. * __experimentalNavigatorScreen as NavigatorScreen,
  48852. * __experimentalNavigatorButton as NavigatorButton,
  48853. * __experimentalNavigatorBackButton as NavigatorBackButton,
  48854. * } from '@wordpress/components';
  48855. *
  48856. * const MyNavigation = () => (
  48857. * <NavigatorProvider initialPath="/">
  48858. * <NavigatorScreen path="/">
  48859. * <p>This is the home screen.</p>
  48860. * <NavigatorButton path="/child">
  48861. * Navigate to child screen.
  48862. * </NavigatorButton>
  48863. * </NavigatorScreen>
  48864. *
  48865. * <NavigatorScreen path="/child">
  48866. * <p>This is the child screen.</p>
  48867. * <NavigatorBackButton>
  48868. * Go back
  48869. * </NavigatorBackButton>
  48870. * </NavigatorScreen>
  48871. * </NavigatorProvider>
  48872. * );
  48873. * ```
  48874. */
  48875. const ConnectedNavigatorButton = contextConnect(NavigatorButton, 'NavigatorButton');
  48876. /* harmony default export */ var navigator_button_component = (ConnectedNavigatorButton);
  48877. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/navigator-back-button/hook.js
  48878. /**
  48879. * WordPress dependencies
  48880. */
  48881. /**
  48882. * Internal dependencies
  48883. */
  48884. function useNavigatorBackButton(props) {
  48885. const {
  48886. onClick,
  48887. as = build_module_button,
  48888. ...otherProps
  48889. } = useContextSystem(props, 'NavigatorBackButton');
  48890. const {
  48891. goBack
  48892. } = use_navigator();
  48893. const handleClick = (0,external_wp_element_namespaceObject.useCallback)(e => {
  48894. e.preventDefault();
  48895. goBack();
  48896. onClick === null || onClick === void 0 ? void 0 : onClick(e);
  48897. }, [goBack, onClick]);
  48898. return {
  48899. as,
  48900. onClick: handleClick,
  48901. ...otherProps
  48902. };
  48903. }
  48904. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigator/navigator-back-button/component.js
  48905. /**
  48906. * External dependencies
  48907. */
  48908. /**
  48909. * Internal dependencies
  48910. */
  48911. function NavigatorBackButton(props, forwardedRef) {
  48912. const navigatorBackButtonProps = useNavigatorBackButton(props);
  48913. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({
  48914. ref: forwardedRef
  48915. }, navigatorBackButtonProps));
  48916. }
  48917. /**
  48918. * The `NavigatorBackButton` component can be used to navigate to a screen and
  48919. * should be used in combination with the `NavigatorProvider`, the
  48920. * `NavigatorScreen` and the `NavigatorButton` components (or the `useNavigator`
  48921. * hook).
  48922. *
  48923. * @example
  48924. * ```jsx
  48925. * import {
  48926. * __experimentalNavigatorProvider as NavigatorProvider,
  48927. * __experimentalNavigatorScreen as NavigatorScreen,
  48928. * __experimentalNavigatorButton as NavigatorButton,
  48929. * __experimentalNavigatorBackButton as NavigatorBackButton,
  48930. * } from '@wordpress/components';
  48931. *
  48932. * const MyNavigation = () => (
  48933. * <NavigatorProvider initialPath="/">
  48934. * <NavigatorScreen path="/">
  48935. * <p>This is the home screen.</p>
  48936. * <NavigatorButton path="/child">
  48937. * Navigate to child screen.
  48938. * </NavigatorButton>
  48939. * </NavigatorScreen>
  48940. *
  48941. * <NavigatorScreen path="/child">
  48942. * <p>This is the child screen.</p>
  48943. * <NavigatorBackButton>
  48944. * Go back
  48945. * </NavigatorBackButton>
  48946. * </NavigatorScreen>
  48947. * </NavigatorProvider>
  48948. * );
  48949. * ```
  48950. */
  48951. const ConnectedNavigatorBackButton = contextConnect(NavigatorBackButton, 'NavigatorBackButton');
  48952. /* harmony default export */ var navigator_back_button_component = (ConnectedNavigatorBackButton);
  48953. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/notice/index.js
  48954. /**
  48955. * External dependencies
  48956. */
  48957. /**
  48958. * WordPress dependencies
  48959. */
  48960. /**
  48961. * Internal dependencies
  48962. */
  48963. /** @typedef {import('@wordpress/element').WPElement} WPElement */
  48964. const notice_noop = () => {};
  48965. /**
  48966. * Custom hook which announces the message with the given politeness, if a
  48967. * valid message is provided.
  48968. *
  48969. * @param {string|WPElement} [message] Message to announce.
  48970. * @param {'polite'|'assertive'} politeness Politeness to announce.
  48971. */
  48972. function useSpokenMessage(message, politeness) {
  48973. const spokenMessage = typeof message === 'string' ? message : (0,external_wp_element_namespaceObject.renderToString)(message);
  48974. (0,external_wp_element_namespaceObject.useEffect)(() => {
  48975. if (spokenMessage) {
  48976. (0,external_wp_a11y_namespaceObject.speak)(spokenMessage, politeness);
  48977. }
  48978. }, [spokenMessage, politeness]);
  48979. }
  48980. /**
  48981. * Given a notice status, returns an assumed default politeness for the status.
  48982. * Defaults to 'assertive'.
  48983. *
  48984. * @param {string} [status] Notice status.
  48985. *
  48986. * @return {'polite'|'assertive'} Notice politeness.
  48987. */
  48988. function getDefaultPoliteness(status) {
  48989. switch (status) {
  48990. case 'success':
  48991. case 'warning':
  48992. case 'info':
  48993. return 'polite';
  48994. case 'error':
  48995. default:
  48996. return 'assertive';
  48997. }
  48998. }
  48999. function Notice(_ref) {
  49000. let {
  49001. className,
  49002. status = 'info',
  49003. children,
  49004. spokenMessage = children,
  49005. onRemove = notice_noop,
  49006. isDismissible = true,
  49007. actions = [],
  49008. politeness = getDefaultPoliteness(status),
  49009. __unstableHTML,
  49010. // onDismiss is a callback executed when the notice is dismissed.
  49011. // It is distinct from onRemove, which _looks_ like a callback but is
  49012. // actually the function to call to remove the notice from the UI.
  49013. onDismiss = notice_noop
  49014. } = _ref;
  49015. useSpokenMessage(spokenMessage, politeness);
  49016. const classes = classnames_default()(className, 'components-notice', 'is-' + status, {
  49017. 'is-dismissible': isDismissible
  49018. });
  49019. if (__unstableHTML) {
  49020. children = (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.RawHTML, null, children);
  49021. }
  49022. const onDismissNotice = event => {
  49023. var _event$preventDefault;
  49024. event === null || event === void 0 ? void 0 : (_event$preventDefault = event.preventDefault) === null || _event$preventDefault === void 0 ? void 0 : _event$preventDefault.call(event);
  49025. onDismiss();
  49026. onRemove();
  49027. };
  49028. return (0,external_wp_element_namespaceObject.createElement)("div", {
  49029. className: classes
  49030. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  49031. className: "components-notice__content"
  49032. }, children, (0,external_wp_element_namespaceObject.createElement)("div", {
  49033. className: "components-notice__actions"
  49034. }, actions.map((_ref2, index) => {
  49035. let {
  49036. className: buttonCustomClasses,
  49037. label,
  49038. isPrimary,
  49039. variant,
  49040. noDefaultClasses = false,
  49041. onClick,
  49042. url
  49043. } = _ref2;
  49044. let computedVariant = variant;
  49045. if (variant !== 'primary' && !noDefaultClasses) {
  49046. computedVariant = !url ? 'secondary' : 'link';
  49047. }
  49048. if (typeof computedVariant === 'undefined' && isPrimary) {
  49049. computedVariant = 'primary';
  49050. }
  49051. return (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  49052. key: index,
  49053. href: url,
  49054. variant: computedVariant,
  49055. onClick: url ? undefined : onClick,
  49056. className: classnames_default()('components-notice__action', buttonCustomClasses)
  49057. }, label);
  49058. }))), isDismissible && (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  49059. className: "components-notice__dismiss",
  49060. icon: library_close,
  49061. label: (0,external_wp_i18n_namespaceObject.__)('Dismiss this notice'),
  49062. onClick: onDismissNotice,
  49063. showTooltip: false
  49064. }));
  49065. }
  49066. /* harmony default export */ var build_module_notice = (Notice);
  49067. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/notice/list.js
  49068. /**
  49069. * External dependencies
  49070. */
  49071. /**
  49072. * Internal dependencies
  49073. */
  49074. const list_noop = () => {};
  49075. /**
  49076. * Renders a list of notices.
  49077. *
  49078. * @param {Object} $0 Props passed to the component.
  49079. * @param {Array} $0.notices Array of notices to render.
  49080. * @param {Function} $0.onRemove Function called when a notice should be removed / dismissed.
  49081. * @param {Object} $0.className Name of the class used by the component.
  49082. * @param {Object} $0.children Array of children to be rendered inside the notice list.
  49083. *
  49084. * @return {Object} The rendered notices list.
  49085. */
  49086. function NoticeList(_ref) {
  49087. let {
  49088. notices,
  49089. onRemove = list_noop,
  49090. className,
  49091. children
  49092. } = _ref;
  49093. const removeNotice = id => () => onRemove(id);
  49094. className = classnames_default()('components-notice-list', className);
  49095. return (0,external_wp_element_namespaceObject.createElement)("div", {
  49096. className: className
  49097. }, children, [...notices].reverse().map(notice => {
  49098. const {
  49099. content,
  49100. ...restNotice
  49101. } = notice;
  49102. return (0,external_wp_element_namespaceObject.createElement)(build_module_notice, extends_extends({}, restNotice, {
  49103. key: notice.id,
  49104. onRemove: removeNotice(notice.id)
  49105. }), notice.content);
  49106. }));
  49107. }
  49108. /* harmony default export */ var list = (NoticeList);
  49109. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/panel/header.js
  49110. function PanelHeader(_ref) {
  49111. let {
  49112. label,
  49113. children
  49114. } = _ref;
  49115. return (0,external_wp_element_namespaceObject.createElement)("div", {
  49116. className: "components-panel__header"
  49117. }, label && (0,external_wp_element_namespaceObject.createElement)("h2", null, label), children);
  49118. }
  49119. /* harmony default export */ var panel_header = (PanelHeader);
  49120. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/panel/index.js
  49121. /**
  49122. * External dependencies
  49123. */
  49124. /**
  49125. * WordPress dependencies
  49126. */
  49127. /**
  49128. * Internal dependencies
  49129. */
  49130. function Panel(_ref, ref) {
  49131. let {
  49132. header,
  49133. className,
  49134. children
  49135. } = _ref;
  49136. const classNames = classnames_default()(className, 'components-panel');
  49137. return (0,external_wp_element_namespaceObject.createElement)("div", {
  49138. className: classNames,
  49139. ref: ref
  49140. }, header && (0,external_wp_element_namespaceObject.createElement)(panel_header, {
  49141. label: header
  49142. }), children);
  49143. }
  49144. /* harmony default export */ var panel = ((0,external_wp_element_namespaceObject.forwardRef)(Panel));
  49145. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-up.js
  49146. /**
  49147. * WordPress dependencies
  49148. */
  49149. const chevronUp = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  49150. viewBox: "0 0 24 24",
  49151. xmlns: "http://www.w3.org/2000/svg"
  49152. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  49153. d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"
  49154. }));
  49155. /* harmony default export */ var chevron_up = (chevronUp);
  49156. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/panel/body.js
  49157. /**
  49158. * External dependencies
  49159. */
  49160. /**
  49161. * WordPress dependencies
  49162. */
  49163. /**
  49164. * Internal dependencies
  49165. */
  49166. const body_noop = () => {};
  49167. function PanelBody(_ref, ref) {
  49168. let {
  49169. buttonProps = {},
  49170. children,
  49171. className,
  49172. icon,
  49173. initialOpen,
  49174. onToggle = body_noop,
  49175. opened,
  49176. title,
  49177. scrollAfterOpen = true
  49178. } = _ref;
  49179. const [isOpened, setIsOpened] = use_controlled_state(opened, {
  49180. initial: initialOpen === undefined ? true : initialOpen
  49181. });
  49182. const nodeRef = (0,external_wp_element_namespaceObject.useRef)(); // Defaults to 'smooth' scrolling
  49183. // https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
  49184. const scrollBehavior = (0,external_wp_compose_namespaceObject.useReducedMotion)() ? 'auto' : 'smooth';
  49185. const handleOnToggle = event => {
  49186. event.preventDefault();
  49187. const next = !isOpened;
  49188. setIsOpened(next);
  49189. onToggle(next);
  49190. }; // Ref is used so that the effect does not re-run upon scrollAfterOpen changing value.
  49191. const scrollAfterOpenRef = (0,external_wp_element_namespaceObject.useRef)();
  49192. scrollAfterOpenRef.current = scrollAfterOpen; // Runs after initial render.
  49193. use_update_effect(() => {
  49194. var _nodeRef$current;
  49195. if (isOpened && scrollAfterOpenRef.current && (_nodeRef$current = nodeRef.current) !== null && _nodeRef$current !== void 0 && _nodeRef$current.scrollIntoView) {
  49196. /*
  49197. * Scrolls the content into view when visible.
  49198. * This improves the UX when there are multiple stacking <PanelBody />
  49199. * components in a scrollable container.
  49200. */
  49201. nodeRef.current.scrollIntoView({
  49202. inline: 'nearest',
  49203. block: 'nearest',
  49204. behavior: scrollBehavior
  49205. });
  49206. }
  49207. }, [isOpened, scrollBehavior]);
  49208. const classes = classnames_default()('components-panel__body', className, {
  49209. 'is-opened': isOpened
  49210. });
  49211. return (0,external_wp_element_namespaceObject.createElement)("div", {
  49212. className: classes,
  49213. ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([nodeRef, ref])
  49214. }, (0,external_wp_element_namespaceObject.createElement)(PanelBodyTitle, extends_extends({
  49215. icon: icon,
  49216. isOpened: isOpened,
  49217. onClick: handleOnToggle,
  49218. title: title
  49219. }, buttonProps)), typeof children === 'function' ? children({
  49220. opened: isOpened
  49221. }) : isOpened && children);
  49222. }
  49223. const PanelBodyTitle = (0,external_wp_element_namespaceObject.forwardRef)((_ref2, ref) => {
  49224. let {
  49225. isOpened,
  49226. icon,
  49227. title,
  49228. ...props
  49229. } = _ref2;
  49230. if (!title) return null;
  49231. return (0,external_wp_element_namespaceObject.createElement)("h2", {
  49232. className: "components-panel__body-title"
  49233. }, (0,external_wp_element_namespaceObject.createElement)(build_module_button, extends_extends({
  49234. className: "components-panel__body-toggle",
  49235. "aria-expanded": isOpened,
  49236. ref: ref
  49237. }, props), (0,external_wp_element_namespaceObject.createElement)("span", {
  49238. "aria-hidden": "true"
  49239. }, (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
  49240. className: "components-panel__arrow",
  49241. icon: isOpened ? chevron_up : chevron_down
  49242. })), title, icon && (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
  49243. icon: icon,
  49244. className: "components-panel__icon",
  49245. size: 20
  49246. })));
  49247. });
  49248. const body_ForwardedComponent = (0,external_wp_element_namespaceObject.forwardRef)(PanelBody);
  49249. body_ForwardedComponent.displayName = 'PanelBody';
  49250. /* harmony default export */ var body = (body_ForwardedComponent);
  49251. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/panel/row.js
  49252. /**
  49253. * External dependencies
  49254. */
  49255. /**
  49256. * WordPress dependencies
  49257. */
  49258. const PanelRow = (0,external_wp_element_namespaceObject.forwardRef)((_ref, ref) => {
  49259. let {
  49260. className,
  49261. children
  49262. } = _ref;
  49263. return (0,external_wp_element_namespaceObject.createElement)("div", {
  49264. className: classnames_default()('components-panel__row', className),
  49265. ref: ref
  49266. }, children);
  49267. });
  49268. /* harmony default export */ var row = (PanelRow);
  49269. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/placeholder/index.js
  49270. /**
  49271. * External dependencies
  49272. */
  49273. /**
  49274. * WordPress dependencies
  49275. */
  49276. /**
  49277. * Internal dependencies
  49278. */
  49279. const PlaceholderIllustration = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  49280. className: "components-placeholder__illustration",
  49281. fill: "none",
  49282. xmlns: "http://www.w3.org/2000/svg",
  49283. viewBox: "0 0 60 60",
  49284. preserveAspectRatio: "none"
  49285. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  49286. vectorEffect: "non-scaling-stroke",
  49287. d: "M60 60 0 0"
  49288. }));
  49289. /**
  49290. * Renders a placeholder. Normally used by blocks to render their empty state.
  49291. *
  49292. * ```jsx
  49293. * import { Placeholder } from '@wordpress/components';
  49294. * import { more } from '@wordpress/icons';
  49295. *
  49296. * const MyPlaceholder = () => <Placeholder icon={ more } label="Placeholder" />;
  49297. * ```
  49298. */
  49299. function Placeholder(props) {
  49300. const {
  49301. icon,
  49302. children,
  49303. label,
  49304. instructions,
  49305. className,
  49306. notices,
  49307. preview,
  49308. isColumnLayout,
  49309. withIllustration,
  49310. ...additionalProps
  49311. } = props;
  49312. const [resizeListener, {
  49313. width
  49314. }] = (0,external_wp_compose_namespaceObject.useResizeObserver)(); // Since `useResizeObserver` will report a width of `null` until after the
  49315. // first render, avoid applying any modifier classes until width is known.
  49316. let modifierClassNames;
  49317. if (typeof width === 'number') {
  49318. modifierClassNames = {
  49319. 'is-large': width >= 480,
  49320. 'is-medium': width >= 160 && width < 480,
  49321. 'is-small': width < 160
  49322. };
  49323. }
  49324. const classes = classnames_default()('components-placeholder', className, modifierClassNames, withIllustration ? 'has-illustration' : null);
  49325. const fieldsetClasses = classnames_default()('components-placeholder__fieldset', {
  49326. 'is-column-layout': isColumnLayout
  49327. });
  49328. return (0,external_wp_element_namespaceObject.createElement)("div", extends_extends({}, additionalProps, {
  49329. className: classes
  49330. }), withIllustration ? PlaceholderIllustration : null, resizeListener, notices, preview && (0,external_wp_element_namespaceObject.createElement)("div", {
  49331. className: "components-placeholder__preview"
  49332. }, preview), (0,external_wp_element_namespaceObject.createElement)("div", {
  49333. className: "components-placeholder__label"
  49334. }, (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
  49335. icon: icon
  49336. }), label), (0,external_wp_element_namespaceObject.createElement)("fieldset", {
  49337. className: fieldsetClasses
  49338. }, !!instructions && (0,external_wp_element_namespaceObject.createElement)("legend", {
  49339. className: "components-placeholder__instructions"
  49340. }, instructions), children));
  49341. }
  49342. /* harmony default export */ var placeholder = (Placeholder);
  49343. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/query-controls/terms.js
  49344. /**
  49345. * External dependencies
  49346. */
  49347. /**
  49348. * Returns terms in a tree form.
  49349. *
  49350. * @param {Array} flatTerms Array of terms in flat format.
  49351. *
  49352. * @return {Array} Array of terms in tree format.
  49353. */
  49354. function buildTermsTree(flatTerms) {
  49355. const flatTermsWithParentAndChildren = flatTerms.map(term => {
  49356. return {
  49357. children: [],
  49358. parent: null,
  49359. ...term
  49360. };
  49361. });
  49362. const termsByParent = (0,external_lodash_namespaceObject.groupBy)(flatTermsWithParentAndChildren, 'parent');
  49363. if (termsByParent.null && termsByParent.null.length) {
  49364. return flatTermsWithParentAndChildren;
  49365. }
  49366. const fillWithChildren = terms => {
  49367. return terms.map(term => {
  49368. const children = termsByParent[term.id];
  49369. return { ...term,
  49370. children: children && children.length ? fillWithChildren(children) : []
  49371. };
  49372. });
  49373. };
  49374. return fillWithChildren(termsByParent['0'] || []);
  49375. }
  49376. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-select/index.js
  49377. /**
  49378. * External dependencies
  49379. */
  49380. /**
  49381. * WordPress dependencies
  49382. */
  49383. /**
  49384. * Internal dependencies
  49385. */
  49386. function tree_select_getSelectOptions(tree) {
  49387. let level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  49388. return tree.flatMap(treeNode => [{
  49389. value: treeNode.id,
  49390. label: '\u00A0'.repeat(level * 3) + (0,external_lodash_namespaceObject.unescape)(treeNode.name)
  49391. }, ...tree_select_getSelectOptions(treeNode.children || [], level + 1)]);
  49392. }
  49393. /**
  49394. * TreeSelect component is used to generate select input fields.
  49395. *
  49396. * @example
  49397. * ```jsx
  49398. * import { TreeSelect } from '@wordpress/components';
  49399. * import { useState } from '@wordpress/element';
  49400. *
  49401. * const MyTreeSelect = () => {
  49402. * const [ page, setPage ] = useState( 'p21' );
  49403. *
  49404. * return (
  49405. * <TreeSelect
  49406. * label="Parent page"
  49407. * noOptionLabel="No parent page"
  49408. * onChange={ ( newPage ) => setPage( newPage ) }
  49409. * selectedId={ page }
  49410. * tree={ [
  49411. * {
  49412. * name: 'Page 1',
  49413. * id: 'p1',
  49414. * children: [
  49415. * { name: 'Descend 1 of page 1', id: 'p11' },
  49416. * { name: 'Descend 2 of page 1', id: 'p12' },
  49417. * ],
  49418. * },
  49419. * {
  49420. * name: 'Page 2',
  49421. * id: 'p2',
  49422. * children: [
  49423. * {
  49424. * name: 'Descend 1 of page 2',
  49425. * id: 'p21',
  49426. * children: [
  49427. * {
  49428. * name: 'Descend 1 of Descend 1 of page 2',
  49429. * id: 'p211',
  49430. * },
  49431. * ],
  49432. * },
  49433. * ],
  49434. * },
  49435. * ] }
  49436. * />
  49437. * );
  49438. * }
  49439. * ```
  49440. */
  49441. function TreeSelect(_ref) {
  49442. let {
  49443. label,
  49444. noOptionLabel,
  49445. onChange,
  49446. selectedId,
  49447. tree = [],
  49448. ...props
  49449. } = _ref;
  49450. const options = (0,external_wp_element_namespaceObject.useMemo)(() => {
  49451. return [noOptionLabel && {
  49452. value: '',
  49453. label: noOptionLabel
  49454. }, ...tree_select_getSelectOptions(tree)].filter(option => !!option);
  49455. }, [noOptionLabel, tree]);
  49456. return (0,external_wp_element_namespaceObject.createElement)(SelectControl, extends_extends({
  49457. label,
  49458. options,
  49459. onChange,
  49460. value: selectedId
  49461. }, props));
  49462. }
  49463. /* harmony default export */ var tree_select = (TreeSelect);
  49464. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/query-controls/category-select.js
  49465. /**
  49466. * Internal dependencies
  49467. */
  49468. /**
  49469. * WordPress dependencies
  49470. */
  49471. function CategorySelect(_ref) {
  49472. let {
  49473. label,
  49474. noOptionLabel,
  49475. categoriesList,
  49476. selectedCategoryId,
  49477. onChange,
  49478. ...props
  49479. } = _ref;
  49480. const termsTree = (0,external_wp_element_namespaceObject.useMemo)(() => {
  49481. return buildTermsTree(categoriesList);
  49482. }, [categoriesList]);
  49483. return (0,external_wp_element_namespaceObject.createElement)(tree_select, extends_extends({
  49484. label,
  49485. noOptionLabel,
  49486. onChange,
  49487. tree: termsTree,
  49488. selectedId: selectedCategoryId
  49489. }, props));
  49490. }
  49491. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/query-controls/author-select.js
  49492. /**
  49493. * Internal dependencies
  49494. */
  49495. function AuthorSelect(_ref) {
  49496. let {
  49497. label,
  49498. noOptionLabel,
  49499. authorList,
  49500. selectedAuthorId,
  49501. onChange
  49502. } = _ref;
  49503. if (!authorList) return null;
  49504. const termsTree = buildTermsTree(authorList);
  49505. return (0,external_wp_element_namespaceObject.createElement)(tree_select, {
  49506. label,
  49507. noOptionLabel,
  49508. onChange,
  49509. tree: termsTree,
  49510. selectedId: selectedAuthorId
  49511. });
  49512. }
  49513. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/query-controls/index.js
  49514. /**
  49515. * WordPress dependencies
  49516. */
  49517. /**
  49518. * Internal dependencies
  49519. */
  49520. const DEFAULT_MIN_ITEMS = 1;
  49521. const DEFAULT_MAX_ITEMS = 100;
  49522. const MAX_CATEGORIES_SUGGESTIONS = 20;
  49523. function QueryControls(_ref) {
  49524. let {
  49525. authorList,
  49526. selectedAuthorId,
  49527. categoriesList,
  49528. selectedCategoryId,
  49529. categorySuggestions,
  49530. selectedCategories,
  49531. numberOfItems,
  49532. order,
  49533. orderBy,
  49534. maxItems = DEFAULT_MAX_ITEMS,
  49535. minItems = DEFAULT_MIN_ITEMS,
  49536. onCategoryChange,
  49537. onAuthorChange,
  49538. onNumberOfItemsChange,
  49539. onOrderChange,
  49540. onOrderByChange
  49541. } = _ref;
  49542. return [onOrderChange && onOrderByChange && (0,external_wp_element_namespaceObject.createElement)(select_control, {
  49543. key: "query-controls-order-select",
  49544. label: (0,external_wp_i18n_namespaceObject.__)('Order by'),
  49545. value: `${orderBy}/${order}`,
  49546. options: [{
  49547. label: (0,external_wp_i18n_namespaceObject.__)('Newest to oldest'),
  49548. value: 'date/desc'
  49549. }, {
  49550. label: (0,external_wp_i18n_namespaceObject.__)('Oldest to newest'),
  49551. value: 'date/asc'
  49552. }, {
  49553. /* translators: label for ordering posts by title in ascending order */
  49554. label: (0,external_wp_i18n_namespaceObject.__)('A → Z'),
  49555. value: 'title/asc'
  49556. }, {
  49557. /* translators: label for ordering posts by title in descending order */
  49558. label: (0,external_wp_i18n_namespaceObject.__)('Z → A'),
  49559. value: 'title/desc'
  49560. }],
  49561. onChange: value => {
  49562. const [newOrderBy, newOrder] = value.split('/');
  49563. if (newOrder !== order) {
  49564. onOrderChange(newOrder);
  49565. }
  49566. if (newOrderBy !== orderBy) {
  49567. onOrderByChange(newOrderBy);
  49568. }
  49569. }
  49570. }), categoriesList && onCategoryChange && (0,external_wp_element_namespaceObject.createElement)(CategorySelect, {
  49571. key: "query-controls-category-select",
  49572. categoriesList: categoriesList,
  49573. label: (0,external_wp_i18n_namespaceObject.__)('Category'),
  49574. noOptionLabel: (0,external_wp_i18n_namespaceObject.__)('All'),
  49575. selectedCategoryId: selectedCategoryId,
  49576. onChange: onCategoryChange
  49577. }), categorySuggestions && onCategoryChange && (0,external_wp_element_namespaceObject.createElement)(form_token_field, {
  49578. key: "query-controls-categories-select",
  49579. label: (0,external_wp_i18n_namespaceObject.__)('Categories'),
  49580. value: selectedCategories && selectedCategories.map(item => ({
  49581. id: item.id,
  49582. value: item.name || item.value
  49583. })),
  49584. suggestions: Object.keys(categorySuggestions),
  49585. onChange: onCategoryChange,
  49586. maxSuggestions: MAX_CATEGORIES_SUGGESTIONS
  49587. }), onAuthorChange && (0,external_wp_element_namespaceObject.createElement)(AuthorSelect, {
  49588. key: "query-controls-author-select",
  49589. authorList: authorList,
  49590. label: (0,external_wp_i18n_namespaceObject.__)('Author'),
  49591. noOptionLabel: (0,external_wp_i18n_namespaceObject.__)('All'),
  49592. selectedAuthorId: selectedAuthorId,
  49593. onChange: onAuthorChange
  49594. }), onNumberOfItemsChange && (0,external_wp_element_namespaceObject.createElement)(range_control, {
  49595. key: "query-controls-range-control",
  49596. label: (0,external_wp_i18n_namespaceObject.__)('Number of items'),
  49597. value: numberOfItems,
  49598. onChange: onNumberOfItemsChange,
  49599. min: minItems,
  49600. max: maxItems,
  49601. required: true
  49602. })];
  49603. }
  49604. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/radio-context/index.js
  49605. /**
  49606. * WordPress dependencies
  49607. */
  49608. const RadioContext = (0,external_wp_element_namespaceObject.createContext)({
  49609. state: null,
  49610. setState: () => {}
  49611. });
  49612. /* harmony default export */ var radio_context = (RadioContext);
  49613. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/radio/index.js
  49614. /**
  49615. * External dependencies
  49616. */
  49617. /**
  49618. * WordPress dependencies
  49619. */
  49620. /**
  49621. * Internal dependencies
  49622. */
  49623. function radio_Radio(_ref, ref) {
  49624. let {
  49625. children,
  49626. value,
  49627. ...props
  49628. } = _ref;
  49629. const radioContext = (0,external_wp_element_namespaceObject.useContext)(radio_context);
  49630. const checked = radioContext.state === value;
  49631. return (0,external_wp_element_namespaceObject.createElement)(Radio, extends_extends({
  49632. ref: ref,
  49633. as: build_module_button,
  49634. variant: checked ? 'primary' : 'secondary',
  49635. value: value
  49636. }, radioContext, props), children || value);
  49637. }
  49638. /* harmony default export */ var build_module_radio = ((0,external_wp_element_namespaceObject.forwardRef)(radio_Radio));
  49639. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/radio-group/index.js
  49640. /**
  49641. * External dependencies
  49642. */
  49643. /**
  49644. * WordPress dependencies
  49645. */
  49646. /**
  49647. * Internal dependencies
  49648. */
  49649. function radio_group_RadioGroup(_ref, ref) {
  49650. let {
  49651. label,
  49652. checked,
  49653. defaultChecked,
  49654. disabled,
  49655. onChange,
  49656. ...props
  49657. } = _ref;
  49658. const radioState = useRadioState({
  49659. state: defaultChecked,
  49660. baseId: props.id
  49661. });
  49662. const radioContext = { ...radioState,
  49663. disabled,
  49664. // Controlled or uncontrolled.
  49665. state: checked !== null && checked !== void 0 ? checked : radioState.state,
  49666. setState: onChange !== null && onChange !== void 0 ? onChange : radioState.setState
  49667. };
  49668. return (0,external_wp_element_namespaceObject.createElement)(radio_context.Provider, {
  49669. value: radioContext
  49670. }, (0,external_wp_element_namespaceObject.createElement)(RadioGroup, extends_extends({
  49671. ref: ref,
  49672. as: button_group,
  49673. "aria-label": label
  49674. }, radioState, props)));
  49675. }
  49676. /* harmony default export */ var radio_group = ((0,external_wp_element_namespaceObject.forwardRef)(radio_group_RadioGroup));
  49677. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/radio-control/index.js
  49678. /**
  49679. * External dependencies
  49680. */
  49681. /**
  49682. * WordPress dependencies
  49683. */
  49684. /**
  49685. * Internal dependencies
  49686. */
  49687. /**
  49688. * Render a user interface to select the user type using radio inputs.
  49689. *
  49690. * ```jsx
  49691. * import { RadioControl } from '@wordpress/components';
  49692. * import { useState } from '@wordpress/element';
  49693. *
  49694. * const MyRadioControl = () => {
  49695. * const [ option, setOption ] = useState( 'a' );
  49696. *
  49697. * return (
  49698. * <RadioControl
  49699. * label="User type"
  49700. * help="The type of the current user"
  49701. * selected={ option }
  49702. * options={ [
  49703. * { label: 'Author', value: 'a' },
  49704. * { label: 'Editor', value: 'e' },
  49705. * ] }
  49706. * onChange={ ( value ) => setOption( value ) }
  49707. * />
  49708. * );
  49709. * };
  49710. * ```
  49711. */
  49712. function RadioControl(props) {
  49713. const {
  49714. label,
  49715. className,
  49716. selected,
  49717. help,
  49718. onChange,
  49719. hideLabelFromVision,
  49720. options = [],
  49721. ...additionalProps
  49722. } = props;
  49723. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(RadioControl);
  49724. const id = `inspector-radio-control-${instanceId}`;
  49725. const onChangeValue = event => onChange(event.target.value);
  49726. if (!(options !== null && options !== void 0 && options.length)) {
  49727. return null;
  49728. }
  49729. return (0,external_wp_element_namespaceObject.createElement)(base_control, {
  49730. __nextHasNoMarginBottom: true,
  49731. label: label,
  49732. id: id,
  49733. hideLabelFromVision: hideLabelFromVision,
  49734. help: help,
  49735. className: classnames_default()(className, 'components-radio-control')
  49736. }, (0,external_wp_element_namespaceObject.createElement)(v_stack_component, {
  49737. spacing: 1
  49738. }, options.map((option, index) => (0,external_wp_element_namespaceObject.createElement)("div", {
  49739. key: `${id}-${index}`,
  49740. className: "components-radio-control__option"
  49741. }, (0,external_wp_element_namespaceObject.createElement)("input", extends_extends({
  49742. id: `${id}-${index}`,
  49743. className: "components-radio-control__input",
  49744. type: "radio",
  49745. name: id,
  49746. value: option.value,
  49747. onChange: onChangeValue,
  49748. checked: option.value === selected,
  49749. "aria-describedby": !!help ? `${id}__help` : undefined
  49750. }, additionalProps)), (0,external_wp_element_namespaceObject.createElement)("label", {
  49751. htmlFor: `${id}-${index}`
  49752. }, option.label)))));
  49753. }
  49754. /* harmony default export */ var radio_control = (RadioControl);
  49755. ;// CONCATENATED MODULE: ./node_modules/re-resizable/lib/resizer.js
  49756. var resizer_extends = (undefined && undefined.__extends) || (function () {
  49757. var extendStatics = function (d, b) {
  49758. extendStatics = Object.setPrototypeOf ||
  49759. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  49760. function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  49761. return extendStatics(d, b);
  49762. };
  49763. return function (d, b) {
  49764. extendStatics(d, b);
  49765. function __() { this.constructor = d; }
  49766. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  49767. };
  49768. })();
  49769. var resizer_assign = (undefined && undefined.__assign) || function () {
  49770. resizer_assign = Object.assign || function(t) {
  49771. for (var s, i = 1, n = arguments.length; i < n; i++) {
  49772. s = arguments[i];
  49773. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
  49774. t[p] = s[p];
  49775. }
  49776. return t;
  49777. };
  49778. return resizer_assign.apply(this, arguments);
  49779. };
  49780. var rowSizeBase = {
  49781. width: '100%',
  49782. height: '10px',
  49783. top: '0px',
  49784. left: '0px',
  49785. cursor: 'row-resize',
  49786. };
  49787. var colSizeBase = {
  49788. width: '10px',
  49789. height: '100%',
  49790. top: '0px',
  49791. left: '0px',
  49792. cursor: 'col-resize',
  49793. };
  49794. var edgeBase = {
  49795. width: '20px',
  49796. height: '20px',
  49797. position: 'absolute',
  49798. };
  49799. var styles = {
  49800. top: resizer_assign(resizer_assign({}, rowSizeBase), { top: '-5px' }),
  49801. right: resizer_assign(resizer_assign({}, colSizeBase), { left: undefined, right: '-5px' }),
  49802. bottom: resizer_assign(resizer_assign({}, rowSizeBase), { top: undefined, bottom: '-5px' }),
  49803. left: resizer_assign(resizer_assign({}, colSizeBase), { left: '-5px' }),
  49804. topRight: resizer_assign(resizer_assign({}, edgeBase), { right: '-10px', top: '-10px', cursor: 'ne-resize' }),
  49805. bottomRight: resizer_assign(resizer_assign({}, edgeBase), { right: '-10px', bottom: '-10px', cursor: 'se-resize' }),
  49806. bottomLeft: resizer_assign(resizer_assign({}, edgeBase), { left: '-10px', bottom: '-10px', cursor: 'sw-resize' }),
  49807. topLeft: resizer_assign(resizer_assign({}, edgeBase), { left: '-10px', top: '-10px', cursor: 'nw-resize' }),
  49808. };
  49809. var Resizer = /** @class */ (function (_super) {
  49810. resizer_extends(Resizer, _super);
  49811. function Resizer() {
  49812. var _this = _super !== null && _super.apply(this, arguments) || this;
  49813. _this.onMouseDown = function (e) {
  49814. _this.props.onResizeStart(e, _this.props.direction);
  49815. };
  49816. _this.onTouchStart = function (e) {
  49817. _this.props.onResizeStart(e, _this.props.direction);
  49818. };
  49819. return _this;
  49820. }
  49821. Resizer.prototype.render = function () {
  49822. return (external_React_namespaceObject.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));
  49823. };
  49824. return Resizer;
  49825. }(external_React_namespaceObject.PureComponent));
  49826. ;// CONCATENATED MODULE: ./node_modules/re-resizable/lib/index.js
  49827. var lib_extends = (undefined && undefined.__extends) || (function () {
  49828. var extendStatics = function (d, b) {
  49829. extendStatics = Object.setPrototypeOf ||
  49830. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  49831. function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  49832. return extendStatics(d, b);
  49833. };
  49834. return function (d, b) {
  49835. extendStatics(d, b);
  49836. function __() { this.constructor = d; }
  49837. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  49838. };
  49839. })();
  49840. var lib_assign = (undefined && undefined.__assign) || function () {
  49841. lib_assign = Object.assign || function(t) {
  49842. for (var s, i = 1, n = arguments.length; i < n; i++) {
  49843. s = arguments[i];
  49844. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
  49845. t[p] = s[p];
  49846. }
  49847. return t;
  49848. };
  49849. return lib_assign.apply(this, arguments);
  49850. };
  49851. var DEFAULT_SIZE = {
  49852. width: 'auto',
  49853. height: 'auto',
  49854. };
  49855. var lib_clamp = function (n, min, max) { return Math.max(Math.min(n, max), min); };
  49856. var snap = function (n, size) { return Math.round(n / size) * size; };
  49857. var hasDirection = function (dir, target) {
  49858. return new RegExp(dir, 'i').test(target);
  49859. };
  49860. // INFO: In case of window is a Proxy and does not porxy Events correctly, use isTouchEvent & isMouseEvent to distinguish event type instead of `instanceof`.
  49861. var lib_isTouchEvent = function (event) {
  49862. return Boolean(event.touches && event.touches.length);
  49863. };
  49864. var lib_isMouseEvent = function (event) {
  49865. return Boolean((event.clientX || event.clientX === 0) &&
  49866. (event.clientY || event.clientY === 0));
  49867. };
  49868. var findClosestSnap = function (n, snapArray, snapGap) {
  49869. if (snapGap === void 0) { snapGap = 0; }
  49870. var closestGapIndex = snapArray.reduce(function (prev, curr, index) { return (Math.abs(curr - n) < Math.abs(snapArray[prev] - n) ? index : prev); }, 0);
  49871. var gap = Math.abs(snapArray[closestGapIndex] - n);
  49872. return snapGap === 0 || gap < snapGap ? snapArray[closestGapIndex] : n;
  49873. };
  49874. var getStringSize = function (n) {
  49875. n = n.toString();
  49876. if (n === 'auto') {
  49877. return n;
  49878. }
  49879. if (n.endsWith('px')) {
  49880. return n;
  49881. }
  49882. if (n.endsWith('%')) {
  49883. return n;
  49884. }
  49885. if (n.endsWith('vh')) {
  49886. return n;
  49887. }
  49888. if (n.endsWith('vw')) {
  49889. return n;
  49890. }
  49891. if (n.endsWith('vmax')) {
  49892. return n;
  49893. }
  49894. if (n.endsWith('vmin')) {
  49895. return n;
  49896. }
  49897. return n + "px";
  49898. };
  49899. var getPixelSize = function (size, parentSize, innerWidth, innerHeight) {
  49900. if (size && typeof size === 'string') {
  49901. if (size.endsWith('px')) {
  49902. return Number(size.replace('px', ''));
  49903. }
  49904. if (size.endsWith('%')) {
  49905. var ratio = Number(size.replace('%', '')) / 100;
  49906. return parentSize * ratio;
  49907. }
  49908. if (size.endsWith('vw')) {
  49909. var ratio = Number(size.replace('vw', '')) / 100;
  49910. return innerWidth * ratio;
  49911. }
  49912. if (size.endsWith('vh')) {
  49913. var ratio = Number(size.replace('vh', '')) / 100;
  49914. return innerHeight * ratio;
  49915. }
  49916. }
  49917. return size;
  49918. };
  49919. var calculateNewMax = function (parentSize, innerWidth, innerHeight, maxWidth, maxHeight, minWidth, minHeight) {
  49920. maxWidth = getPixelSize(maxWidth, parentSize.width, innerWidth, innerHeight);
  49921. maxHeight = getPixelSize(maxHeight, parentSize.height, innerWidth, innerHeight);
  49922. minWidth = getPixelSize(minWidth, parentSize.width, innerWidth, innerHeight);
  49923. minHeight = getPixelSize(minHeight, parentSize.height, innerWidth, innerHeight);
  49924. return {
  49925. maxWidth: typeof maxWidth === 'undefined' ? undefined : Number(maxWidth),
  49926. maxHeight: typeof maxHeight === 'undefined' ? undefined : Number(maxHeight),
  49927. minWidth: typeof minWidth === 'undefined' ? undefined : Number(minWidth),
  49928. minHeight: typeof minHeight === 'undefined' ? undefined : Number(minHeight),
  49929. };
  49930. };
  49931. var definedProps = [
  49932. 'as',
  49933. 'style',
  49934. 'className',
  49935. 'grid',
  49936. 'snap',
  49937. 'bounds',
  49938. 'boundsByDirection',
  49939. 'size',
  49940. 'defaultSize',
  49941. 'minWidth',
  49942. 'minHeight',
  49943. 'maxWidth',
  49944. 'maxHeight',
  49945. 'lockAspectRatio',
  49946. 'lockAspectRatioExtraWidth',
  49947. 'lockAspectRatioExtraHeight',
  49948. 'enable',
  49949. 'handleStyles',
  49950. 'handleClasses',
  49951. 'handleWrapperStyle',
  49952. 'handleWrapperClass',
  49953. 'children',
  49954. 'onResizeStart',
  49955. 'onResize',
  49956. 'onResizeStop',
  49957. 'handleComponent',
  49958. 'scale',
  49959. 'resizeRatio',
  49960. 'snapGap',
  49961. ];
  49962. // HACK: This class is used to calculate % size.
  49963. var baseClassName = '__resizable_base__';
  49964. var Resizable = /** @class */ (function (_super) {
  49965. lib_extends(Resizable, _super);
  49966. function Resizable(props) {
  49967. var _this = _super.call(this, props) || this;
  49968. _this.ratio = 1;
  49969. _this.resizable = null;
  49970. // For parent boundary
  49971. _this.parentLeft = 0;
  49972. _this.parentTop = 0;
  49973. // For boundary
  49974. _this.resizableLeft = 0;
  49975. _this.resizableRight = 0;
  49976. _this.resizableTop = 0;
  49977. _this.resizableBottom = 0;
  49978. // For target boundary
  49979. _this.targetLeft = 0;
  49980. _this.targetTop = 0;
  49981. _this.appendBase = function () {
  49982. if (!_this.resizable || !_this.window) {
  49983. return null;
  49984. }
  49985. var parent = _this.parentNode;
  49986. if (!parent) {
  49987. return null;
  49988. }
  49989. var element = _this.window.document.createElement('div');
  49990. element.style.width = '100%';
  49991. element.style.height = '100%';
  49992. element.style.position = 'absolute';
  49993. element.style.transform = 'scale(0, 0)';
  49994. element.style.left = '0';
  49995. element.style.flex = '0 0 100%';
  49996. if (element.classList) {
  49997. element.classList.add(baseClassName);
  49998. }
  49999. else {
  50000. element.className += baseClassName;
  50001. }
  50002. parent.appendChild(element);
  50003. return element;
  50004. };
  50005. _this.removeBase = function (base) {
  50006. var parent = _this.parentNode;
  50007. if (!parent) {
  50008. return;
  50009. }
  50010. parent.removeChild(base);
  50011. };
  50012. _this.ref = function (c) {
  50013. if (c) {
  50014. _this.resizable = c;
  50015. }
  50016. };
  50017. _this.state = {
  50018. isResizing: false,
  50019. width: typeof (_this.propsSize && _this.propsSize.width) === 'undefined'
  50020. ? 'auto'
  50021. : _this.propsSize && _this.propsSize.width,
  50022. height: typeof (_this.propsSize && _this.propsSize.height) === 'undefined'
  50023. ? 'auto'
  50024. : _this.propsSize && _this.propsSize.height,
  50025. direction: 'right',
  50026. original: {
  50027. x: 0,
  50028. y: 0,
  50029. width: 0,
  50030. height: 0,
  50031. },
  50032. backgroundStyle: {
  50033. height: '100%',
  50034. width: '100%',
  50035. backgroundColor: 'rgba(0,0,0,0)',
  50036. cursor: 'auto',
  50037. opacity: 0,
  50038. position: 'fixed',
  50039. zIndex: 9999,
  50040. top: '0',
  50041. left: '0',
  50042. bottom: '0',
  50043. right: '0',
  50044. },
  50045. flexBasis: undefined,
  50046. };
  50047. _this.onResizeStart = _this.onResizeStart.bind(_this);
  50048. _this.onMouseMove = _this.onMouseMove.bind(_this);
  50049. _this.onMouseUp = _this.onMouseUp.bind(_this);
  50050. return _this;
  50051. }
  50052. Object.defineProperty(Resizable.prototype, "parentNode", {
  50053. get: function () {
  50054. if (!this.resizable) {
  50055. return null;
  50056. }
  50057. return this.resizable.parentNode;
  50058. },
  50059. enumerable: false,
  50060. configurable: true
  50061. });
  50062. Object.defineProperty(Resizable.prototype, "window", {
  50063. get: function () {
  50064. if (!this.resizable) {
  50065. return null;
  50066. }
  50067. if (!this.resizable.ownerDocument) {
  50068. return null;
  50069. }
  50070. return this.resizable.ownerDocument.defaultView;
  50071. },
  50072. enumerable: false,
  50073. configurable: true
  50074. });
  50075. Object.defineProperty(Resizable.prototype, "propsSize", {
  50076. get: function () {
  50077. return this.props.size || this.props.defaultSize || DEFAULT_SIZE;
  50078. },
  50079. enumerable: false,
  50080. configurable: true
  50081. });
  50082. Object.defineProperty(Resizable.prototype, "size", {
  50083. get: function () {
  50084. var width = 0;
  50085. var height = 0;
  50086. if (this.resizable && this.window) {
  50087. var orgWidth = this.resizable.offsetWidth;
  50088. var orgHeight = this.resizable.offsetHeight;
  50089. // HACK: Set position `relative` to get parent size.
  50090. // This is because when re-resizable set `absolute`, I can not get base width correctly.
  50091. var orgPosition = this.resizable.style.position;
  50092. if (orgPosition !== 'relative') {
  50093. this.resizable.style.position = 'relative';
  50094. }
  50095. // INFO: Use original width or height if set auto.
  50096. width = this.resizable.style.width !== 'auto' ? this.resizable.offsetWidth : orgWidth;
  50097. height = this.resizable.style.height !== 'auto' ? this.resizable.offsetHeight : orgHeight;
  50098. // Restore original position
  50099. this.resizable.style.position = orgPosition;
  50100. }
  50101. return { width: width, height: height };
  50102. },
  50103. enumerable: false,
  50104. configurable: true
  50105. });
  50106. Object.defineProperty(Resizable.prototype, "sizeStyle", {
  50107. get: function () {
  50108. var _this = this;
  50109. var size = this.props.size;
  50110. var getSize = function (key) {
  50111. if (typeof _this.state[key] === 'undefined' || _this.state[key] === 'auto') {
  50112. return 'auto';
  50113. }
  50114. if (_this.propsSize && _this.propsSize[key] && _this.propsSize[key].toString().endsWith('%')) {
  50115. if (_this.state[key].toString().endsWith('%')) {
  50116. return _this.state[key].toString();
  50117. }
  50118. var parentSize = _this.getParentSize();
  50119. var value = Number(_this.state[key].toString().replace('px', ''));
  50120. var percent = (value / parentSize[key]) * 100;
  50121. return percent + "%";
  50122. }
  50123. return getStringSize(_this.state[key]);
  50124. };
  50125. var width = size && typeof size.width !== 'undefined' && !this.state.isResizing
  50126. ? getStringSize(size.width)
  50127. : getSize('width');
  50128. var height = size && typeof size.height !== 'undefined' && !this.state.isResizing
  50129. ? getStringSize(size.height)
  50130. : getSize('height');
  50131. return { width: width, height: height };
  50132. },
  50133. enumerable: false,
  50134. configurable: true
  50135. });
  50136. Resizable.prototype.getParentSize = function () {
  50137. if (!this.parentNode) {
  50138. if (!this.window) {
  50139. return { width: 0, height: 0 };
  50140. }
  50141. return { width: this.window.innerWidth, height: this.window.innerHeight };
  50142. }
  50143. var base = this.appendBase();
  50144. if (!base) {
  50145. return { width: 0, height: 0 };
  50146. }
  50147. // INFO: To calculate parent width with flex layout
  50148. var wrapChanged = false;
  50149. var wrap = this.parentNode.style.flexWrap;
  50150. if (wrap !== 'wrap') {
  50151. wrapChanged = true;
  50152. this.parentNode.style.flexWrap = 'wrap';
  50153. // HACK: Use relative to get parent padding size
  50154. }
  50155. base.style.position = 'relative';
  50156. base.style.minWidth = '100%';
  50157. base.style.minHeight = '100%';
  50158. var size = {
  50159. width: base.offsetWidth,
  50160. height: base.offsetHeight,
  50161. };
  50162. if (wrapChanged) {
  50163. this.parentNode.style.flexWrap = wrap;
  50164. }
  50165. this.removeBase(base);
  50166. return size;
  50167. };
  50168. Resizable.prototype.bindEvents = function () {
  50169. if (this.window) {
  50170. this.window.addEventListener('mouseup', this.onMouseUp);
  50171. this.window.addEventListener('mousemove', this.onMouseMove);
  50172. this.window.addEventListener('mouseleave', this.onMouseUp);
  50173. this.window.addEventListener('touchmove', this.onMouseMove, {
  50174. capture: true,
  50175. passive: false,
  50176. });
  50177. this.window.addEventListener('touchend', this.onMouseUp);
  50178. }
  50179. };
  50180. Resizable.prototype.unbindEvents = function () {
  50181. if (this.window) {
  50182. this.window.removeEventListener('mouseup', this.onMouseUp);
  50183. this.window.removeEventListener('mousemove', this.onMouseMove);
  50184. this.window.removeEventListener('mouseleave', this.onMouseUp);
  50185. this.window.removeEventListener('touchmove', this.onMouseMove, true);
  50186. this.window.removeEventListener('touchend', this.onMouseUp);
  50187. }
  50188. };
  50189. Resizable.prototype.componentDidMount = function () {
  50190. if (!this.resizable || !this.window) {
  50191. return;
  50192. }
  50193. var computedStyle = this.window.getComputedStyle(this.resizable);
  50194. this.setState({
  50195. width: this.state.width || this.size.width,
  50196. height: this.state.height || this.size.height,
  50197. flexBasis: computedStyle.flexBasis !== 'auto' ? computedStyle.flexBasis : undefined,
  50198. });
  50199. };
  50200. Resizable.prototype.componentWillUnmount = function () {
  50201. if (this.window) {
  50202. this.unbindEvents();
  50203. }
  50204. };
  50205. Resizable.prototype.createSizeForCssProperty = function (newSize, kind) {
  50206. var propsSize = this.propsSize && this.propsSize[kind];
  50207. return this.state[kind] === 'auto' &&
  50208. this.state.original[kind] === newSize &&
  50209. (typeof propsSize === 'undefined' || propsSize === 'auto')
  50210. ? 'auto'
  50211. : newSize;
  50212. };
  50213. Resizable.prototype.calculateNewMaxFromBoundary = function (maxWidth, maxHeight) {
  50214. var boundsByDirection = this.props.boundsByDirection;
  50215. var direction = this.state.direction;
  50216. var widthByDirection = boundsByDirection && hasDirection('left', direction);
  50217. var heightByDirection = boundsByDirection && hasDirection('top', direction);
  50218. var boundWidth;
  50219. var boundHeight;
  50220. if (this.props.bounds === 'parent') {
  50221. var parent_1 = this.parentNode;
  50222. if (parent_1) {
  50223. boundWidth = widthByDirection
  50224. ? this.resizableRight - this.parentLeft
  50225. : parent_1.offsetWidth + (this.parentLeft - this.resizableLeft);
  50226. boundHeight = heightByDirection
  50227. ? this.resizableBottom - this.parentTop
  50228. : parent_1.offsetHeight + (this.parentTop - this.resizableTop);
  50229. }
  50230. }
  50231. else if (this.props.bounds === 'window') {
  50232. if (this.window) {
  50233. boundWidth = widthByDirection ? this.resizableRight : this.window.innerWidth - this.resizableLeft;
  50234. boundHeight = heightByDirection ? this.resizableBottom : this.window.innerHeight - this.resizableTop;
  50235. }
  50236. }
  50237. else if (this.props.bounds) {
  50238. boundWidth = widthByDirection
  50239. ? this.resizableRight - this.targetLeft
  50240. : this.props.bounds.offsetWidth + (this.targetLeft - this.resizableLeft);
  50241. boundHeight = heightByDirection
  50242. ? this.resizableBottom - this.targetTop
  50243. : this.props.bounds.offsetHeight + (this.targetTop - this.resizableTop);
  50244. }
  50245. if (boundWidth && Number.isFinite(boundWidth)) {
  50246. maxWidth = maxWidth && maxWidth < boundWidth ? maxWidth : boundWidth;
  50247. }
  50248. if (boundHeight && Number.isFinite(boundHeight)) {
  50249. maxHeight = maxHeight && maxHeight < boundHeight ? maxHeight : boundHeight;
  50250. }
  50251. return { maxWidth: maxWidth, maxHeight: maxHeight };
  50252. };
  50253. Resizable.prototype.calculateNewSizeFromDirection = function (clientX, clientY) {
  50254. var scale = this.props.scale || 1;
  50255. var resizeRatio = this.props.resizeRatio || 1;
  50256. var _a = this.state, direction = _a.direction, original = _a.original;
  50257. var _b = this.props, lockAspectRatio = _b.lockAspectRatio, lockAspectRatioExtraHeight = _b.lockAspectRatioExtraHeight, lockAspectRatioExtraWidth = _b.lockAspectRatioExtraWidth;
  50258. var newWidth = original.width;
  50259. var newHeight = original.height;
  50260. var extraHeight = lockAspectRatioExtraHeight || 0;
  50261. var extraWidth = lockAspectRatioExtraWidth || 0;
  50262. if (hasDirection('right', direction)) {
  50263. newWidth = original.width + ((clientX - original.x) * resizeRatio) / scale;
  50264. if (lockAspectRatio) {
  50265. newHeight = (newWidth - extraWidth) / this.ratio + extraHeight;
  50266. }
  50267. }
  50268. if (hasDirection('left', direction)) {
  50269. newWidth = original.width - ((clientX - original.x) * resizeRatio) / scale;
  50270. if (lockAspectRatio) {
  50271. newHeight = (newWidth - extraWidth) / this.ratio + extraHeight;
  50272. }
  50273. }
  50274. if (hasDirection('bottom', direction)) {
  50275. newHeight = original.height + ((clientY - original.y) * resizeRatio) / scale;
  50276. if (lockAspectRatio) {
  50277. newWidth = (newHeight - extraHeight) * this.ratio + extraWidth;
  50278. }
  50279. }
  50280. if (hasDirection('top', direction)) {
  50281. newHeight = original.height - ((clientY - original.y) * resizeRatio) / scale;
  50282. if (lockAspectRatio) {
  50283. newWidth = (newHeight - extraHeight) * this.ratio + extraWidth;
  50284. }
  50285. }
  50286. return { newWidth: newWidth, newHeight: newHeight };
  50287. };
  50288. Resizable.prototype.calculateNewSizeFromAspectRatio = function (newWidth, newHeight, max, min) {
  50289. var _a = this.props, lockAspectRatio = _a.lockAspectRatio, lockAspectRatioExtraHeight = _a.lockAspectRatioExtraHeight, lockAspectRatioExtraWidth = _a.lockAspectRatioExtraWidth;
  50290. var computedMinWidth = typeof min.width === 'undefined' ? 10 : min.width;
  50291. var computedMaxWidth = typeof max.width === 'undefined' || max.width < 0 ? newWidth : max.width;
  50292. var computedMinHeight = typeof min.height === 'undefined' ? 10 : min.height;
  50293. var computedMaxHeight = typeof max.height === 'undefined' || max.height < 0 ? newHeight : max.height;
  50294. var extraHeight = lockAspectRatioExtraHeight || 0;
  50295. var extraWidth = lockAspectRatioExtraWidth || 0;
  50296. if (lockAspectRatio) {
  50297. var extraMinWidth = (computedMinHeight - extraHeight) * this.ratio + extraWidth;
  50298. var extraMaxWidth = (computedMaxHeight - extraHeight) * this.ratio + extraWidth;
  50299. var extraMinHeight = (computedMinWidth - extraWidth) / this.ratio + extraHeight;
  50300. var extraMaxHeight = (computedMaxWidth - extraWidth) / this.ratio + extraHeight;
  50301. var lockedMinWidth = Math.max(computedMinWidth, extraMinWidth);
  50302. var lockedMaxWidth = Math.min(computedMaxWidth, extraMaxWidth);
  50303. var lockedMinHeight = Math.max(computedMinHeight, extraMinHeight);
  50304. var lockedMaxHeight = Math.min(computedMaxHeight, extraMaxHeight);
  50305. newWidth = lib_clamp(newWidth, lockedMinWidth, lockedMaxWidth);
  50306. newHeight = lib_clamp(newHeight, lockedMinHeight, lockedMaxHeight);
  50307. }
  50308. else {
  50309. newWidth = lib_clamp(newWidth, computedMinWidth, computedMaxWidth);
  50310. newHeight = lib_clamp(newHeight, computedMinHeight, computedMaxHeight);
  50311. }
  50312. return { newWidth: newWidth, newHeight: newHeight };
  50313. };
  50314. Resizable.prototype.setBoundingClientRect = function () {
  50315. // For parent boundary
  50316. if (this.props.bounds === 'parent') {
  50317. var parent_2 = this.parentNode;
  50318. if (parent_2) {
  50319. var parentRect = parent_2.getBoundingClientRect();
  50320. this.parentLeft = parentRect.left;
  50321. this.parentTop = parentRect.top;
  50322. }
  50323. }
  50324. // For target(html element) boundary
  50325. if (this.props.bounds && typeof this.props.bounds !== 'string') {
  50326. var targetRect = this.props.bounds.getBoundingClientRect();
  50327. this.targetLeft = targetRect.left;
  50328. this.targetTop = targetRect.top;
  50329. }
  50330. // For boundary
  50331. if (this.resizable) {
  50332. var _a = this.resizable.getBoundingClientRect(), left = _a.left, top_1 = _a.top, right = _a.right, bottom = _a.bottom;
  50333. this.resizableLeft = left;
  50334. this.resizableRight = right;
  50335. this.resizableTop = top_1;
  50336. this.resizableBottom = bottom;
  50337. }
  50338. };
  50339. Resizable.prototype.onResizeStart = function (event, direction) {
  50340. if (!this.resizable || !this.window) {
  50341. return;
  50342. }
  50343. var clientX = 0;
  50344. var clientY = 0;
  50345. if (event.nativeEvent && lib_isMouseEvent(event.nativeEvent)) {
  50346. clientX = event.nativeEvent.clientX;
  50347. clientY = event.nativeEvent.clientY;
  50348. }
  50349. else if (event.nativeEvent && lib_isTouchEvent(event.nativeEvent)) {
  50350. clientX = event.nativeEvent.touches[0].clientX;
  50351. clientY = event.nativeEvent.touches[0].clientY;
  50352. }
  50353. if (this.props.onResizeStart) {
  50354. if (this.resizable) {
  50355. var startResize = this.props.onResizeStart(event, direction, this.resizable);
  50356. if (startResize === false) {
  50357. return;
  50358. }
  50359. }
  50360. }
  50361. // Fix #168
  50362. if (this.props.size) {
  50363. if (typeof this.props.size.height !== 'undefined' && this.props.size.height !== this.state.height) {
  50364. this.setState({ height: this.props.size.height });
  50365. }
  50366. if (typeof this.props.size.width !== 'undefined' && this.props.size.width !== this.state.width) {
  50367. this.setState({ width: this.props.size.width });
  50368. }
  50369. }
  50370. // For lockAspectRatio case
  50371. this.ratio =
  50372. typeof this.props.lockAspectRatio === 'number' ? this.props.lockAspectRatio : this.size.width / this.size.height;
  50373. var flexBasis;
  50374. var computedStyle = this.window.getComputedStyle(this.resizable);
  50375. if (computedStyle.flexBasis !== 'auto') {
  50376. var parent_3 = this.parentNode;
  50377. if (parent_3) {
  50378. var dir = this.window.getComputedStyle(parent_3).flexDirection;
  50379. this.flexDir = dir.startsWith('row') ? 'row' : 'column';
  50380. flexBasis = computedStyle.flexBasis;
  50381. }
  50382. }
  50383. // For boundary
  50384. this.setBoundingClientRect();
  50385. this.bindEvents();
  50386. var state = {
  50387. original: {
  50388. x: clientX,
  50389. y: clientY,
  50390. width: this.size.width,
  50391. height: this.size.height,
  50392. },
  50393. isResizing: true,
  50394. backgroundStyle: lib_assign(lib_assign({}, this.state.backgroundStyle), { cursor: this.window.getComputedStyle(event.target).cursor || 'auto' }),
  50395. direction: direction,
  50396. flexBasis: flexBasis,
  50397. };
  50398. this.setState(state);
  50399. };
  50400. Resizable.prototype.onMouseMove = function (event) {
  50401. var _this = this;
  50402. if (!this.state.isResizing || !this.resizable || !this.window) {
  50403. return;
  50404. }
  50405. if (this.window.TouchEvent && lib_isTouchEvent(event)) {
  50406. try {
  50407. event.preventDefault();
  50408. event.stopPropagation();
  50409. }
  50410. catch (e) {
  50411. // Ignore on fail
  50412. }
  50413. }
  50414. var _a = this.props, maxWidth = _a.maxWidth, maxHeight = _a.maxHeight, minWidth = _a.minWidth, minHeight = _a.minHeight;
  50415. var clientX = lib_isTouchEvent(event) ? event.touches[0].clientX : event.clientX;
  50416. var clientY = lib_isTouchEvent(event) ? event.touches[0].clientY : event.clientY;
  50417. var _b = this.state, direction = _b.direction, original = _b.original, width = _b.width, height = _b.height;
  50418. var parentSize = this.getParentSize();
  50419. var max = calculateNewMax(parentSize, this.window.innerWidth, this.window.innerHeight, maxWidth, maxHeight, minWidth, minHeight);
  50420. maxWidth = max.maxWidth;
  50421. maxHeight = max.maxHeight;
  50422. minWidth = max.minWidth;
  50423. minHeight = max.minHeight;
  50424. // Calculate new size
  50425. var _c = this.calculateNewSizeFromDirection(clientX, clientY), newHeight = _c.newHeight, newWidth = _c.newWidth;
  50426. // Calculate max size from boundary settings
  50427. var boundaryMax = this.calculateNewMaxFromBoundary(maxWidth, maxHeight);
  50428. if (this.props.snap && this.props.snap.x) {
  50429. newWidth = findClosestSnap(newWidth, this.props.snap.x, this.props.snapGap);
  50430. }
  50431. if (this.props.snap && this.props.snap.y) {
  50432. newHeight = findClosestSnap(newHeight, this.props.snap.y, this.props.snapGap);
  50433. }
  50434. // Calculate new size from aspect ratio
  50435. var newSize = this.calculateNewSizeFromAspectRatio(newWidth, newHeight, { width: boundaryMax.maxWidth, height: boundaryMax.maxHeight }, { width: minWidth, height: minHeight });
  50436. newWidth = newSize.newWidth;
  50437. newHeight = newSize.newHeight;
  50438. if (this.props.grid) {
  50439. var newGridWidth = snap(newWidth, this.props.grid[0]);
  50440. var newGridHeight = snap(newHeight, this.props.grid[1]);
  50441. var gap = this.props.snapGap || 0;
  50442. newWidth = gap === 0 || Math.abs(newGridWidth - newWidth) <= gap ? newGridWidth : newWidth;
  50443. newHeight = gap === 0 || Math.abs(newGridHeight - newHeight) <= gap ? newGridHeight : newHeight;
  50444. }
  50445. var delta = {
  50446. width: newWidth - original.width,
  50447. height: newHeight - original.height,
  50448. };
  50449. if (width && typeof width === 'string') {
  50450. if (width.endsWith('%')) {
  50451. var percent = (newWidth / parentSize.width) * 100;
  50452. newWidth = percent + "%";
  50453. }
  50454. else if (width.endsWith('vw')) {
  50455. var vw = (newWidth / this.window.innerWidth) * 100;
  50456. newWidth = vw + "vw";
  50457. }
  50458. else if (width.endsWith('vh')) {
  50459. var vh = (newWidth / this.window.innerHeight) * 100;
  50460. newWidth = vh + "vh";
  50461. }
  50462. }
  50463. if (height && typeof height === 'string') {
  50464. if (height.endsWith('%')) {
  50465. var percent = (newHeight / parentSize.height) * 100;
  50466. newHeight = percent + "%";
  50467. }
  50468. else if (height.endsWith('vw')) {
  50469. var vw = (newHeight / this.window.innerWidth) * 100;
  50470. newHeight = vw + "vw";
  50471. }
  50472. else if (height.endsWith('vh')) {
  50473. var vh = (newHeight / this.window.innerHeight) * 100;
  50474. newHeight = vh + "vh";
  50475. }
  50476. }
  50477. var newState = {
  50478. width: this.createSizeForCssProperty(newWidth, 'width'),
  50479. height: this.createSizeForCssProperty(newHeight, 'height'),
  50480. };
  50481. if (this.flexDir === 'row') {
  50482. newState.flexBasis = newState.width;
  50483. }
  50484. else if (this.flexDir === 'column') {
  50485. newState.flexBasis = newState.height;
  50486. }
  50487. // For v18, update state sync
  50488. (0,external_ReactDOM_namespaceObject.flushSync)(function () {
  50489. _this.setState(newState);
  50490. });
  50491. if (this.props.onResize) {
  50492. this.props.onResize(event, direction, this.resizable, delta);
  50493. }
  50494. };
  50495. Resizable.prototype.onMouseUp = function (event) {
  50496. var _a = this.state, isResizing = _a.isResizing, direction = _a.direction, original = _a.original;
  50497. if (!isResizing || !this.resizable) {
  50498. return;
  50499. }
  50500. var delta = {
  50501. width: this.size.width - original.width,
  50502. height: this.size.height - original.height,
  50503. };
  50504. if (this.props.onResizeStop) {
  50505. this.props.onResizeStop(event, direction, this.resizable, delta);
  50506. }
  50507. if (this.props.size) {
  50508. this.setState(this.props.size);
  50509. }
  50510. this.unbindEvents();
  50511. this.setState({
  50512. isResizing: false,
  50513. backgroundStyle: lib_assign(lib_assign({}, this.state.backgroundStyle), { cursor: 'auto' }),
  50514. });
  50515. };
  50516. Resizable.prototype.updateSize = function (size) {
  50517. this.setState({ width: size.width, height: size.height });
  50518. };
  50519. Resizable.prototype.renderResizer = function () {
  50520. var _this = this;
  50521. var _a = this.props, enable = _a.enable, handleStyles = _a.handleStyles, handleClasses = _a.handleClasses, handleWrapperStyle = _a.handleWrapperStyle, handleWrapperClass = _a.handleWrapperClass, handleComponent = _a.handleComponent;
  50522. if (!enable) {
  50523. return null;
  50524. }
  50525. var resizers = Object.keys(enable).map(function (dir) {
  50526. if (enable[dir] !== false) {
  50527. return (external_React_namespaceObject.createElement(Resizer, { key: dir, direction: dir, onResizeStart: _this.onResizeStart, replaceStyles: handleStyles && handleStyles[dir], className: handleClasses && handleClasses[dir] }, handleComponent && handleComponent[dir] ? handleComponent[dir] : null));
  50528. }
  50529. return null;
  50530. });
  50531. // #93 Wrap the resize box in span (will not break 100% width/height)
  50532. return (external_React_namespaceObject.createElement("div", { className: handleWrapperClass, style: handleWrapperStyle }, resizers));
  50533. };
  50534. Resizable.prototype.render = function () {
  50535. var _this = this;
  50536. var extendsProps = Object.keys(this.props).reduce(function (acc, key) {
  50537. if (definedProps.indexOf(key) !== -1) {
  50538. return acc;
  50539. }
  50540. acc[key] = _this.props[key];
  50541. return acc;
  50542. }, {});
  50543. 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 });
  50544. if (this.state.flexBasis) {
  50545. style.flexBasis = this.state.flexBasis;
  50546. }
  50547. var Wrapper = this.props.as || 'div';
  50548. return (external_React_namespaceObject.createElement(Wrapper, lib_assign({ ref: this.ref, style: style, className: this.props.className }, extendsProps),
  50549. this.state.isResizing && external_React_namespaceObject.createElement("div", { style: this.state.backgroundStyle }),
  50550. this.props.children,
  50551. this.renderResizer()));
  50552. };
  50553. Resizable.defaultProps = {
  50554. as: 'div',
  50555. onResizeStart: function () { },
  50556. onResize: function () { },
  50557. onResizeStop: function () { },
  50558. enable: {
  50559. top: true,
  50560. right: true,
  50561. bottom: true,
  50562. left: true,
  50563. topRight: true,
  50564. bottomRight: true,
  50565. bottomLeft: true,
  50566. topLeft: true,
  50567. },
  50568. style: {},
  50569. grid: [1, 1],
  50570. lockAspectRatio: false,
  50571. lockAspectRatioExtraWidth: 0,
  50572. lockAspectRatioExtraHeight: 0,
  50573. scale: 1,
  50574. resizeRatio: 1,
  50575. snapGap: 0,
  50576. };
  50577. return Resizable;
  50578. }(external_React_namespaceObject.PureComponent));
  50579. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/resizable-box/resize-tooltip/utils.js
  50580. /**
  50581. * WordPress dependencies
  50582. */
  50583. const resize_tooltip_utils_noop = () => {};
  50584. const POSITIONS = {
  50585. bottom: 'bottom',
  50586. corner: 'corner'
  50587. };
  50588. /**
  50589. * Custom hook that manages resize listener events. It also provides a label
  50590. * based on current resize width x height values.
  50591. *
  50592. * @param props
  50593. * @param props.axis Only shows the label corresponding to the axis.
  50594. * @param props.fadeTimeout Duration (ms) before deactivating the resize label.
  50595. * @param props.onResize Callback when a resize occurs. Provides { width, height } callback.
  50596. * @param props.position Adjusts label value.
  50597. * @param props.showPx Whether to add `PX` to the label.
  50598. *
  50599. * @return Properties for hook.
  50600. */
  50601. function useResizeLabel(_ref) {
  50602. let {
  50603. axis,
  50604. fadeTimeout = 180,
  50605. onResize = resize_tooltip_utils_noop,
  50606. position = POSITIONS.bottom,
  50607. showPx = false
  50608. } = _ref;
  50609. /*
  50610. * The width/height values derive from this special useResizeObserver hook.
  50611. * This custom hook uses the ResizeObserver API to listen for resize events.
  50612. */
  50613. const [resizeListener, sizes] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
  50614. /*
  50615. * Indicates if the x/y axis is preferred.
  50616. * If set, we will avoid resetting the moveX and moveY values.
  50617. * This will allow for the preferred axis values to persist in the label.
  50618. */
  50619. const isAxisControlled = !!axis;
  50620. /*
  50621. * The moveX and moveY values are used to track whether the label should
  50622. * display width, height, or width x height.
  50623. */
  50624. const [moveX, setMoveX] = (0,external_wp_element_namespaceObject.useState)(false);
  50625. const [moveY, setMoveY] = (0,external_wp_element_namespaceObject.useState)(false);
  50626. /*
  50627. * Cached dimension values to check for width/height updates from the
  50628. * sizes property from useResizeAware()
  50629. */
  50630. const {
  50631. width,
  50632. height
  50633. } = sizes;
  50634. const heightRef = (0,external_wp_element_namespaceObject.useRef)(height);
  50635. const widthRef = (0,external_wp_element_namespaceObject.useRef)(width);
  50636. /*
  50637. * This timeout is used with setMoveX and setMoveY to determine of
  50638. * both width and height values have changed at (roughly) the same time.
  50639. */
  50640. const moveTimeoutRef = (0,external_wp_element_namespaceObject.useRef)();
  50641. const unsetMoveXY = () => {
  50642. /*
  50643. * If axis is controlled, we will avoid resetting the moveX and moveY values.
  50644. * This will allow for the preferred axis values to persist in the label.
  50645. */
  50646. if (isAxisControlled) return;
  50647. setMoveX(false);
  50648. setMoveY(false);
  50649. };
  50650. const debounceUnsetMoveXY = () => {
  50651. if (moveTimeoutRef.current) {
  50652. window.clearTimeout(moveTimeoutRef.current);
  50653. }
  50654. moveTimeoutRef.current = window.setTimeout(unsetMoveXY, fadeTimeout);
  50655. };
  50656. (0,external_wp_element_namespaceObject.useEffect)(() => {
  50657. /*
  50658. * On the initial render of useResizeAware, the height and width values are
  50659. * null. They are calculated then set using via an internal useEffect hook.
  50660. */
  50661. const isRendered = width !== null || height !== null;
  50662. if (!isRendered) return;
  50663. const didWidthChange = width !== widthRef.current;
  50664. const didHeightChange = height !== heightRef.current;
  50665. if (!didWidthChange && !didHeightChange) return;
  50666. /*
  50667. * After the initial render, the useResizeAware will set the first
  50668. * width and height values. We'll sync those values with our
  50669. * width and height refs. However, we shouldn't render our Tooltip
  50670. * label on this first cycle.
  50671. */
  50672. if (width && !widthRef.current && height && !heightRef.current) {
  50673. widthRef.current = width;
  50674. heightRef.current = height;
  50675. return;
  50676. }
  50677. /*
  50678. * After the first cycle, we can track width and height changes.
  50679. */
  50680. if (didWidthChange) {
  50681. setMoveX(true);
  50682. widthRef.current = width;
  50683. }
  50684. if (didHeightChange) {
  50685. setMoveY(true);
  50686. heightRef.current = height;
  50687. }
  50688. onResize({
  50689. width,
  50690. height
  50691. });
  50692. debounceUnsetMoveXY();
  50693. }, [width, height]);
  50694. const label = getSizeLabel({
  50695. axis,
  50696. height,
  50697. moveX,
  50698. moveY,
  50699. position,
  50700. showPx,
  50701. width
  50702. });
  50703. return {
  50704. label,
  50705. resizeListener
  50706. };
  50707. }
  50708. /**
  50709. * Gets the resize label based on width and height values (as well as recent changes).
  50710. *
  50711. * @param props
  50712. * @param props.axis Only shows the label corresponding to the axis.
  50713. * @param props.height Height value.
  50714. * @param props.moveX Recent width (x axis) changes.
  50715. * @param props.moveY Recent width (y axis) changes.
  50716. * @param props.position Adjusts label value.
  50717. * @param props.showPx Whether to add `PX` to the label.
  50718. * @param props.width Width value.
  50719. *
  50720. * @return The rendered label.
  50721. */
  50722. function getSizeLabel(_ref2) {
  50723. let {
  50724. axis,
  50725. height,
  50726. moveX = false,
  50727. moveY = false,
  50728. position = POSITIONS.bottom,
  50729. showPx = false,
  50730. width
  50731. } = _ref2;
  50732. if (!moveX && !moveY) return undefined;
  50733. /*
  50734. * Corner position...
  50735. * We want the label to appear like width x height.
  50736. */
  50737. if (position === POSITIONS.corner) {
  50738. return `${width} x ${height}`;
  50739. }
  50740. /*
  50741. * Other POSITIONS...
  50742. * The label will combine both width x height values if both
  50743. * values have recently been changed.
  50744. *
  50745. * Otherwise, only width or height will be displayed.
  50746. * The `PX` unit will be added, if specified by the `showPx` prop.
  50747. */
  50748. const labelUnit = showPx ? ' px' : '';
  50749. if (axis) {
  50750. if (axis === 'x' && moveX) {
  50751. return `${width}${labelUnit}`;
  50752. }
  50753. if (axis === 'y' && moveY) {
  50754. return `${height}${labelUnit}`;
  50755. }
  50756. }
  50757. if (moveX && moveY) {
  50758. return `${width} x ${height}`;
  50759. }
  50760. if (moveX) {
  50761. return `${width}${labelUnit}`;
  50762. }
  50763. if (moveY) {
  50764. return `${height}${labelUnit}`;
  50765. }
  50766. return undefined;
  50767. }
  50768. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js
  50769. 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)."; }
  50770. /**
  50771. * External dependencies
  50772. */
  50773. /**
  50774. * Internal dependencies
  50775. */
  50776. const resize_tooltip_styles_Root = emotion_styled_base_browser_esm("div", true ? {
  50777. target: "ekdag503"
  50778. } : 0)( true ? {
  50779. name: "1cd7zoc",
  50780. styles: "bottom:0;box-sizing:border-box;left:0;pointer-events:none;position:absolute;right:0;top:0"
  50781. } : 0);
  50782. const TooltipWrapper = emotion_styled_base_browser_esm("div", true ? {
  50783. target: "ekdag502"
  50784. } : 0)( true ? {
  50785. name: "ajymcs",
  50786. styles: "align-items:center;box-sizing:border-box;display:inline-flex;justify-content:center;opacity:0;pointer-events:none;transition:opacity 120ms linear"
  50787. } : 0);
  50788. const resize_tooltip_styles_Tooltip = emotion_styled_base_browser_esm("div", true ? {
  50789. target: "ekdag501"
  50790. } : 0)("background:", COLORS.gray[900], ";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
  50791. // https://github.com/WordPress/gutenberg/issues/18483
  50792. const LabelText = /*#__PURE__*/emotion_styled_base_browser_esm(text_component, true ? {
  50793. target: "ekdag500"
  50794. } : 0)("&&&{color:", COLORS.ui.textDark, ";display:block;font-size:13px;line-height:1.4;white-space:nowrap;}" + ( true ? "" : 0));
  50795. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/resizable-box/resize-tooltip/label.js
  50796. /**
  50797. * External dependencies
  50798. */
  50799. /**
  50800. * WordPress dependencies
  50801. */
  50802. /**
  50803. * Internal dependencies
  50804. */
  50805. const CORNER_OFFSET = 4;
  50806. const CURSOR_OFFSET_TOP = CORNER_OFFSET * 2.5;
  50807. function resize_tooltip_label_Label(_ref, ref) {
  50808. let {
  50809. label,
  50810. position = POSITIONS.corner,
  50811. zIndex = 1000,
  50812. ...props
  50813. } = _ref;
  50814. const showLabel = !!label;
  50815. const isBottom = position === POSITIONS.bottom;
  50816. const isCorner = position === POSITIONS.corner;
  50817. if (!showLabel) return null;
  50818. let style = {
  50819. opacity: showLabel ? 1 : undefined,
  50820. zIndex
  50821. };
  50822. let labelStyle = {};
  50823. if (isBottom) {
  50824. style = { ...style,
  50825. position: 'absolute',
  50826. bottom: CURSOR_OFFSET_TOP * -1,
  50827. left: '50%',
  50828. transform: 'translate(-50%, 0)'
  50829. };
  50830. labelStyle = {
  50831. transform: `translate(0, 100%)`
  50832. };
  50833. }
  50834. if (isCorner) {
  50835. style = { ...style,
  50836. position: 'absolute',
  50837. top: CORNER_OFFSET,
  50838. right: (0,external_wp_i18n_namespaceObject.isRTL)() ? undefined : CORNER_OFFSET,
  50839. left: (0,external_wp_i18n_namespaceObject.isRTL)() ? CORNER_OFFSET : undefined
  50840. };
  50841. }
  50842. return (0,external_wp_element_namespaceObject.createElement)(TooltipWrapper, extends_extends({
  50843. "aria-hidden": "true",
  50844. className: "components-resizable-tooltip__tooltip-wrapper",
  50845. ref: ref,
  50846. style: style
  50847. }, props), (0,external_wp_element_namespaceObject.createElement)(resize_tooltip_styles_Tooltip, {
  50848. className: "components-resizable-tooltip__tooltip",
  50849. style: labelStyle
  50850. }, (0,external_wp_element_namespaceObject.createElement)(LabelText, {
  50851. as: "span"
  50852. }, label)));
  50853. }
  50854. const label_ForwardedComponent = (0,external_wp_element_namespaceObject.forwardRef)(resize_tooltip_label_Label);
  50855. /* harmony default export */ var resize_tooltip_label = (label_ForwardedComponent);
  50856. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/resizable-box/resize-tooltip/index.js
  50857. /**
  50858. * External dependencies
  50859. */
  50860. /**
  50861. * WordPress dependencies
  50862. */
  50863. /**
  50864. * Internal dependencies
  50865. */
  50866. const resize_tooltip_noop = () => {};
  50867. function ResizeTooltip(_ref, ref) {
  50868. let {
  50869. axis,
  50870. className,
  50871. fadeTimeout = 180,
  50872. isVisible = true,
  50873. labelRef,
  50874. onResize = resize_tooltip_noop,
  50875. position = POSITIONS.bottom,
  50876. showPx = true,
  50877. zIndex = 1000,
  50878. ...props
  50879. } = _ref;
  50880. const {
  50881. label,
  50882. resizeListener
  50883. } = useResizeLabel({
  50884. axis,
  50885. fadeTimeout,
  50886. onResize,
  50887. showPx,
  50888. position
  50889. });
  50890. if (!isVisible) return null;
  50891. const classes = classnames_default()('components-resize-tooltip', className);
  50892. return (0,external_wp_element_namespaceObject.createElement)(resize_tooltip_styles_Root, extends_extends({
  50893. "aria-hidden": "true",
  50894. className: classes,
  50895. ref: ref
  50896. }, props), resizeListener, (0,external_wp_element_namespaceObject.createElement)(resize_tooltip_label, {
  50897. "aria-hidden": props['aria-hidden'],
  50898. label: label,
  50899. position: position,
  50900. ref: labelRef,
  50901. zIndex: zIndex
  50902. }));
  50903. }
  50904. const resize_tooltip_ForwardedComponent = (0,external_wp_element_namespaceObject.forwardRef)(ResizeTooltip);
  50905. /* harmony default export */ var resize_tooltip = (resize_tooltip_ForwardedComponent);
  50906. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/resizable-box/index.js
  50907. /**
  50908. * WordPress dependencies
  50909. */
  50910. /**
  50911. * External dependencies
  50912. */
  50913. /**
  50914. * Internal dependencies
  50915. */
  50916. const HANDLE_CLASS_NAME = 'components-resizable-box__handle';
  50917. const SIDE_HANDLE_CLASS_NAME = 'components-resizable-box__side-handle';
  50918. const CORNER_HANDLE_CLASS_NAME = 'components-resizable-box__corner-handle';
  50919. const HANDLE_CLASSES = {
  50920. top: classnames_default()(HANDLE_CLASS_NAME, SIDE_HANDLE_CLASS_NAME, 'components-resizable-box__handle-top'),
  50921. right: classnames_default()(HANDLE_CLASS_NAME, SIDE_HANDLE_CLASS_NAME, 'components-resizable-box__handle-right'),
  50922. bottom: classnames_default()(HANDLE_CLASS_NAME, SIDE_HANDLE_CLASS_NAME, 'components-resizable-box__handle-bottom'),
  50923. left: classnames_default()(HANDLE_CLASS_NAME, SIDE_HANDLE_CLASS_NAME, 'components-resizable-box__handle-left'),
  50924. topLeft: classnames_default()(HANDLE_CLASS_NAME, CORNER_HANDLE_CLASS_NAME, 'components-resizable-box__handle-top', 'components-resizable-box__handle-left'),
  50925. topRight: classnames_default()(HANDLE_CLASS_NAME, CORNER_HANDLE_CLASS_NAME, 'components-resizable-box__handle-top', 'components-resizable-box__handle-right'),
  50926. bottomRight: classnames_default()(HANDLE_CLASS_NAME, CORNER_HANDLE_CLASS_NAME, 'components-resizable-box__handle-bottom', 'components-resizable-box__handle-right'),
  50927. bottomLeft: classnames_default()(HANDLE_CLASS_NAME, CORNER_HANDLE_CLASS_NAME, 'components-resizable-box__handle-bottom', 'components-resizable-box__handle-left')
  50928. }; // Removes the inline styles in the drag handles.
  50929. const HANDLE_STYLES_OVERRIDES = {
  50930. width: undefined,
  50931. height: undefined,
  50932. top: undefined,
  50933. right: undefined,
  50934. bottom: undefined,
  50935. left: undefined
  50936. };
  50937. const HANDLE_STYLES = {
  50938. top: HANDLE_STYLES_OVERRIDES,
  50939. right: HANDLE_STYLES_OVERRIDES,
  50940. bottom: HANDLE_STYLES_OVERRIDES,
  50941. left: HANDLE_STYLES_OVERRIDES,
  50942. topLeft: HANDLE_STYLES_OVERRIDES,
  50943. topRight: HANDLE_STYLES_OVERRIDES,
  50944. bottomRight: HANDLE_STYLES_OVERRIDES,
  50945. bottomLeft: HANDLE_STYLES_OVERRIDES
  50946. };
  50947. function ResizableBox(_ref, ref) {
  50948. let {
  50949. className,
  50950. children,
  50951. showHandle = true,
  50952. __experimentalShowTooltip: showTooltip = false,
  50953. __experimentalTooltipProps: tooltipProps = {},
  50954. ...props
  50955. } = _ref;
  50956. return (0,external_wp_element_namespaceObject.createElement)(Resizable, extends_extends({
  50957. className: classnames_default()('components-resizable-box__container', showHandle && 'has-show-handle', className),
  50958. handleClasses: HANDLE_CLASSES,
  50959. handleStyles: HANDLE_STYLES,
  50960. ref: ref
  50961. }, props), children, showTooltip && (0,external_wp_element_namespaceObject.createElement)(resize_tooltip, tooltipProps));
  50962. }
  50963. /* harmony default export */ var resizable_box = ((0,external_wp_element_namespaceObject.forwardRef)(ResizableBox));
  50964. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/responsive-wrapper/index.js
  50965. /**
  50966. * External dependencies
  50967. */
  50968. /**
  50969. * WordPress dependencies
  50970. */
  50971. function ResponsiveWrapper(_ref) {
  50972. let {
  50973. naturalWidth,
  50974. naturalHeight,
  50975. children,
  50976. isInline = false
  50977. } = _ref;
  50978. const [containerResizeListener, {
  50979. width: containerWidth
  50980. }] = (0,external_wp_compose_namespaceObject.useResizeObserver)();
  50981. if (external_wp_element_namespaceObject.Children.count(children) !== 1) {
  50982. return null;
  50983. }
  50984. const imageStyle = {
  50985. paddingBottom: naturalWidth < containerWidth ? naturalHeight : naturalHeight / naturalWidth * 100 + '%'
  50986. };
  50987. const TagName = isInline ? 'span' : 'div';
  50988. return (0,external_wp_element_namespaceObject.createElement)(TagName, {
  50989. className: "components-responsive-wrapper"
  50990. }, containerResizeListener, (0,external_wp_element_namespaceObject.createElement)(TagName, {
  50991. style: imageStyle
  50992. }), (0,external_wp_element_namespaceObject.cloneElement)(children, {
  50993. className: classnames_default()('components-responsive-wrapper__content', children.props.className)
  50994. }));
  50995. }
  50996. /* harmony default export */ var responsive_wrapper = (ResponsiveWrapper);
  50997. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/sandbox/index.js
  50998. /**
  50999. * WordPress dependencies
  51000. */
  51001. const observeAndResizeJS = `
  51002. ( function() {
  51003. var observer;
  51004. if ( ! window.MutationObserver || ! document.body || ! window.parent ) {
  51005. return;
  51006. }
  51007. function sendResize() {
  51008. var clientBoundingRect = document.body.getBoundingClientRect();
  51009. window.parent.postMessage( {
  51010. action: 'resize',
  51011. width: clientBoundingRect.width,
  51012. height: clientBoundingRect.height,
  51013. }, '*' );
  51014. }
  51015. observer = new MutationObserver( sendResize );
  51016. observer.observe( document.body, {
  51017. attributes: true,
  51018. attributeOldValue: false,
  51019. characterData: true,
  51020. characterDataOldValue: false,
  51021. childList: true,
  51022. subtree: true
  51023. } );
  51024. window.addEventListener( 'load', sendResize, true );
  51025. // Hack: Remove viewport unit styles, as these are relative
  51026. // the iframe root and interfere with our mechanism for
  51027. // determining the unconstrained page bounds.
  51028. function removeViewportStyles( ruleOrNode ) {
  51029. if( ruleOrNode.style ) {
  51030. [ 'width', 'height', 'minHeight', 'maxHeight' ].forEach( function( style ) {
  51031. if ( /^\\d+(vmin|vmax|vh|vw)$/.test( ruleOrNode.style[ style ] ) ) {
  51032. ruleOrNode.style[ style ] = '';
  51033. }
  51034. } );
  51035. }
  51036. }
  51037. Array.prototype.forEach.call( document.querySelectorAll( '[style]' ), removeViewportStyles );
  51038. Array.prototype.forEach.call( document.styleSheets, function( stylesheet ) {
  51039. Array.prototype.forEach.call( stylesheet.cssRules || stylesheet.rules, removeViewportStyles );
  51040. } );
  51041. document.body.style.position = 'absolute';
  51042. document.body.style.width = '100%';
  51043. document.body.setAttribute( 'data-resizable-iframe-connected', '' );
  51044. sendResize();
  51045. // Resize events can change the width of elements with 100% width, but we don't
  51046. // get an DOM mutations for that, so do the resize when the window is resized, too.
  51047. window.addEventListener( 'resize', sendResize, true );
  51048. } )();`;
  51049. const style = `
  51050. body {
  51051. margin: 0;
  51052. }
  51053. html,
  51054. body,
  51055. body > div {
  51056. width: 100%;
  51057. }
  51058. html.wp-has-aspect-ratio,
  51059. body.wp-has-aspect-ratio,
  51060. body.wp-has-aspect-ratio > div,
  51061. body.wp-has-aspect-ratio > div iframe {
  51062. width: 100%;
  51063. height: 100%;
  51064. overflow: hidden; /* If it has an aspect ratio, it shouldn't scroll. */
  51065. }
  51066. body > div > * {
  51067. margin-top: 0 !important; /* Has to have !important to override inline styles. */
  51068. margin-bottom: 0 !important;
  51069. }
  51070. `;
  51071. function Sandbox(_ref) {
  51072. let {
  51073. html = '',
  51074. title = '',
  51075. type,
  51076. styles = [],
  51077. scripts = [],
  51078. onFocus
  51079. } = _ref;
  51080. const ref = (0,external_wp_element_namespaceObject.useRef)();
  51081. const [width, setWidth] = (0,external_wp_element_namespaceObject.useState)(0);
  51082. const [height, setHeight] = (0,external_wp_element_namespaceObject.useState)(0);
  51083. function isFrameAccessible() {
  51084. try {
  51085. return !!ref.current.contentDocument.body;
  51086. } catch (e) {
  51087. return false;
  51088. }
  51089. }
  51090. function trySandbox() {
  51091. let forceRerender = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  51092. if (!isFrameAccessible()) {
  51093. return;
  51094. }
  51095. const {
  51096. contentDocument,
  51097. ownerDocument
  51098. } = ref.current;
  51099. const {
  51100. body
  51101. } = contentDocument;
  51102. if (!forceRerender && null !== body.getAttribute('data-resizable-iframe-connected')) {
  51103. return;
  51104. } // Put the html snippet into a html document, and then write it to the iframe's document
  51105. // we can use this in the future to inject custom styles or scripts.
  51106. // Scripts go into the body rather than the head, to support embedded content such as Instagram
  51107. // that expect the scripts to be part of the body.
  51108. const htmlDoc = (0,external_wp_element_namespaceObject.createElement)("html", {
  51109. lang: ownerDocument.documentElement.lang,
  51110. className: type
  51111. }, (0,external_wp_element_namespaceObject.createElement)("head", null, (0,external_wp_element_namespaceObject.createElement)("title", null, title), (0,external_wp_element_namespaceObject.createElement)("style", {
  51112. dangerouslySetInnerHTML: {
  51113. __html: style
  51114. }
  51115. }), styles.map((rules, i) => (0,external_wp_element_namespaceObject.createElement)("style", {
  51116. key: i,
  51117. dangerouslySetInnerHTML: {
  51118. __html: rules
  51119. }
  51120. }))), (0,external_wp_element_namespaceObject.createElement)("body", {
  51121. "data-resizable-iframe-connected": "data-resizable-iframe-connected",
  51122. className: type
  51123. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  51124. dangerouslySetInnerHTML: {
  51125. __html: html
  51126. }
  51127. }), (0,external_wp_element_namespaceObject.createElement)("script", {
  51128. type: "text/javascript",
  51129. dangerouslySetInnerHTML: {
  51130. __html: observeAndResizeJS
  51131. }
  51132. }), scripts.map(src => (0,external_wp_element_namespaceObject.createElement)("script", {
  51133. key: src,
  51134. src: src
  51135. })))); // Writing the document like this makes it act in the same way as if it was
  51136. // loaded over the network, so DOM creation and mutation, script execution, etc.
  51137. // all work as expected.
  51138. contentDocument.open();
  51139. contentDocument.write('<!DOCTYPE html>' + (0,external_wp_element_namespaceObject.renderToString)(htmlDoc));
  51140. contentDocument.close();
  51141. }
  51142. (0,external_wp_element_namespaceObject.useEffect)(() => {
  51143. trySandbox();
  51144. function tryNoForceSandbox() {
  51145. trySandbox(false);
  51146. }
  51147. function checkMessageForResize(event) {
  51148. const iframe = ref.current; // Verify that the mounted element is the source of the message.
  51149. if (!iframe || iframe.contentWindow !== event.source) {
  51150. return;
  51151. } // Attempt to parse the message data as JSON if passed as string.
  51152. let data = event.data || {};
  51153. if ('string' === typeof data) {
  51154. try {
  51155. data = JSON.parse(data);
  51156. } catch (e) {}
  51157. } // Update the state only if the message is formatted as we expect,
  51158. // i.e. as an object with a 'resize' action.
  51159. if ('resize' !== data.action) {
  51160. return;
  51161. }
  51162. setWidth(data.width);
  51163. setHeight(data.height);
  51164. }
  51165. const {
  51166. ownerDocument
  51167. } = ref.current;
  51168. const {
  51169. defaultView
  51170. } = ownerDocument; // This used to be registered using <iframe onLoad={} />, but it made the iframe blank
  51171. // after reordering the containing block. See these two issues for more details:
  51172. // https://github.com/WordPress/gutenberg/issues/6146
  51173. // https://github.com/facebook/react/issues/18752
  51174. ref.current.addEventListener('load', tryNoForceSandbox, false);
  51175. defaultView.addEventListener('message', checkMessageForResize);
  51176. return () => {
  51177. var _ref$current;
  51178. (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.removeEventListener('load', tryNoForceSandbox, false);
  51179. defaultView.addEventListener('message', checkMessageForResize);
  51180. };
  51181. }, []);
  51182. (0,external_wp_element_namespaceObject.useEffect)(() => {
  51183. trySandbox();
  51184. }, [title, styles, scripts]);
  51185. (0,external_wp_element_namespaceObject.useEffect)(() => {
  51186. trySandbox(true);
  51187. }, [html, type]);
  51188. return (0,external_wp_element_namespaceObject.createElement)("iframe", {
  51189. ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, (0,external_wp_compose_namespaceObject.useFocusableIframe)()]),
  51190. title: title,
  51191. className: "components-sandbox",
  51192. sandbox: "allow-scripts allow-same-origin allow-presentation",
  51193. onFocus: onFocus,
  51194. width: Math.ceil(width),
  51195. height: Math.ceil(height)
  51196. });
  51197. }
  51198. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/snackbar/index.js
  51199. /**
  51200. * External dependencies
  51201. */
  51202. /**
  51203. * WordPress dependencies
  51204. */
  51205. /**
  51206. * Internal dependencies
  51207. */
  51208. const snackbar_noop = () => {};
  51209. const NOTICE_TIMEOUT = 10000;
  51210. /** @typedef {import('@wordpress/element').WPElement} WPElement */
  51211. /**
  51212. * Custom hook which announces the message with the given politeness, if a
  51213. * valid message is provided.
  51214. *
  51215. * @param {string|WPElement} [message] Message to announce.
  51216. * @param {'polite'|'assertive'} politeness Politeness to announce.
  51217. */
  51218. function snackbar_useSpokenMessage(message, politeness) {
  51219. const spokenMessage = typeof message === 'string' ? message : (0,external_wp_element_namespaceObject.renderToString)(message);
  51220. (0,external_wp_element_namespaceObject.useEffect)(() => {
  51221. if (spokenMessage) {
  51222. (0,external_wp_a11y_namespaceObject.speak)(spokenMessage, politeness);
  51223. }
  51224. }, [spokenMessage, politeness]);
  51225. }
  51226. function Snackbar(_ref, ref) {
  51227. let {
  51228. className,
  51229. children,
  51230. spokenMessage = children,
  51231. politeness = 'polite',
  51232. actions = [],
  51233. onRemove = snackbar_noop,
  51234. icon = null,
  51235. explicitDismiss = false,
  51236. // onDismiss is a callback executed when the snackbar is dismissed.
  51237. // It is distinct from onRemove, which _looks_ like a callback but is
  51238. // actually the function to call to remove the snackbar from the UI.
  51239. onDismiss = snackbar_noop,
  51240. listRef
  51241. } = _ref;
  51242. onDismiss = onDismiss || snackbar_noop;
  51243. function dismissMe(event) {
  51244. if (event && event.preventDefault) {
  51245. event.preventDefault();
  51246. } // Prevent focus loss by moving it to the list element.
  51247. listRef.current.focus();
  51248. onDismiss();
  51249. onRemove();
  51250. }
  51251. function onActionClick(event, onClick) {
  51252. event.stopPropagation();
  51253. onRemove();
  51254. if (onClick) {
  51255. onClick(event);
  51256. }
  51257. }
  51258. snackbar_useSpokenMessage(spokenMessage, politeness); // Only set up the timeout dismiss if we're not explicitly dismissing.
  51259. (0,external_wp_element_namespaceObject.useEffect)(() => {
  51260. const timeoutHandle = setTimeout(() => {
  51261. if (!explicitDismiss) {
  51262. onDismiss();
  51263. onRemove();
  51264. }
  51265. }, NOTICE_TIMEOUT);
  51266. return () => clearTimeout(timeoutHandle);
  51267. }, [onDismiss, onRemove]);
  51268. const classes = classnames_default()(className, 'components-snackbar', {
  51269. 'components-snackbar-explicit-dismiss': !!explicitDismiss
  51270. });
  51271. if (actions && actions.length > 1) {
  51272. // We need to inform developers that snackbar only accepts 1 action.
  51273. typeof process !== "undefined" && process.env && "production" !== "production" ? 0 : void 0; // return first element only while keeping it inside an array
  51274. actions = [actions[0]];
  51275. }
  51276. const snackbarContentClassnames = classnames_default()('components-snackbar__content', {
  51277. 'components-snackbar__content-with-icon': !!icon
  51278. });
  51279. return (0,external_wp_element_namespaceObject.createElement)("div", {
  51280. ref: ref,
  51281. className: classes,
  51282. onClick: !explicitDismiss ? dismissMe : snackbar_noop,
  51283. tabIndex: "0",
  51284. role: !explicitDismiss ? 'button' : '',
  51285. onKeyPress: !explicitDismiss ? dismissMe : snackbar_noop,
  51286. "aria-label": !explicitDismiss ? (0,external_wp_i18n_namespaceObject.__)('Dismiss this notice') : ''
  51287. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  51288. className: snackbarContentClassnames
  51289. }, icon && (0,external_wp_element_namespaceObject.createElement)("div", {
  51290. className: "components-snackbar__icon"
  51291. }, icon), children, actions.map((_ref2, index) => {
  51292. let {
  51293. label,
  51294. onClick,
  51295. url
  51296. } = _ref2;
  51297. return (0,external_wp_element_namespaceObject.createElement)(build_module_button, {
  51298. key: index,
  51299. href: url,
  51300. variant: "tertiary",
  51301. onClick: event => onActionClick(event, onClick),
  51302. className: "components-snackbar__action"
  51303. }, label);
  51304. }), explicitDismiss && (0,external_wp_element_namespaceObject.createElement)("span", {
  51305. role: "button",
  51306. "aria-label": "Dismiss this notice",
  51307. tabIndex: "0",
  51308. className: "components-snackbar__dismiss-button",
  51309. onClick: dismissMe,
  51310. onKeyPress: dismissMe
  51311. }, "\u2715")));
  51312. }
  51313. /* harmony default export */ var snackbar = ((0,external_wp_element_namespaceObject.forwardRef)(Snackbar));
  51314. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/snackbar/list.js
  51315. /**
  51316. * External dependencies
  51317. */
  51318. /**
  51319. * WordPress dependencies
  51320. */
  51321. /**
  51322. * Internal dependencies
  51323. */
  51324. const snackbar_list_noop = () => {};
  51325. const SNACKBAR_VARIANTS = {
  51326. init: {
  51327. height: 0,
  51328. opacity: 0
  51329. },
  51330. open: {
  51331. height: 'auto',
  51332. opacity: 1,
  51333. transition: {
  51334. height: {
  51335. stiffness: 1000,
  51336. velocity: -100
  51337. }
  51338. }
  51339. },
  51340. exit: {
  51341. opacity: 0,
  51342. transition: {
  51343. duration: 0.5
  51344. }
  51345. }
  51346. };
  51347. const SNACKBAR_REDUCE_MOTION_VARIANTS = {
  51348. init: false,
  51349. open: false,
  51350. exit: false
  51351. };
  51352. /**
  51353. * Renders a list of notices.
  51354. *
  51355. * @param {Object} $0 Props passed to the component.
  51356. * @param {Array} $0.notices Array of notices to render.
  51357. * @param {Function} $0.onRemove Function called when a notice should be removed / dismissed.
  51358. * @param {Object} $0.className Name of the class used by the component.
  51359. * @param {Object} $0.children Array of children to be rendered inside the notice list.
  51360. *
  51361. * @return {Object} The rendered notices list.
  51362. */
  51363. function SnackbarList(_ref) {
  51364. let {
  51365. notices,
  51366. className,
  51367. children,
  51368. onRemove = snackbar_list_noop
  51369. } = _ref;
  51370. const listRef = (0,external_wp_element_namespaceObject.useRef)();
  51371. const isReducedMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
  51372. className = classnames_default()('components-snackbar-list', className);
  51373. const removeNotice = notice => () => onRemove(notice.id);
  51374. return (0,external_wp_element_namespaceObject.createElement)("div", {
  51375. className: className,
  51376. tabIndex: -1,
  51377. ref: listRef
  51378. }, children, (0,external_wp_element_namespaceObject.createElement)(AnimatePresence, null, notices.map(notice => {
  51379. const {
  51380. content,
  51381. ...restNotice
  51382. } = notice;
  51383. return (0,external_wp_element_namespaceObject.createElement)(motion.div, {
  51384. layout: !isReducedMotion // See https://www.framer.com/docs/animation/#layout-animations
  51385. ,
  51386. initial: 'init',
  51387. animate: 'open',
  51388. exit: 'exit',
  51389. key: notice.id,
  51390. variants: isReducedMotion ? SNACKBAR_REDUCE_MOTION_VARIANTS : SNACKBAR_VARIANTS
  51391. }, (0,external_wp_element_namespaceObject.createElement)("div", {
  51392. className: "components-snackbar-list__notice-container"
  51393. }, (0,external_wp_element_namespaceObject.createElement)(snackbar, extends_extends({}, restNotice, {
  51394. onRemove: removeNotice(notice),
  51395. listRef: listRef
  51396. }), notice.content)));
  51397. })));
  51398. }
  51399. /* harmony default export */ var snackbar_list = (SnackbarList);
  51400. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/spinner/styles.js
  51401. 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)."; }
  51402. /**
  51403. * External dependencies
  51404. */
  51405. /**
  51406. * Internal dependencies
  51407. */
  51408. const spinAnimation = emotion_react_browser_esm_keyframes`
  51409. from {
  51410. transform: rotate(0deg);
  51411. }
  51412. to {
  51413. transform: rotate(360deg);
  51414. }
  51415. `;
  51416. const StyledSpinner = emotion_styled_base_browser_esm("svg", true ? {
  51417. target: "ea4tfvq2"
  51418. } : 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));
  51419. const commonPathProps = true ? {
  51420. name: "9s4963",
  51421. styles: "fill:transparent;stroke-width:1.5px"
  51422. } : 0;
  51423. const SpinnerTrack = emotion_styled_base_browser_esm("circle", true ? {
  51424. target: "ea4tfvq1"
  51425. } : 0)(commonPathProps, ";stroke:", COLORS.gray[300], ";" + ( true ? "" : 0));
  51426. const SpinnerIndicator = emotion_styled_base_browser_esm("path", true ? {
  51427. target: "ea4tfvq0"
  51428. } : 0)(commonPathProps, ";stroke:currentColor;stroke-linecap:round;transform-origin:50% 50%;animation:1.4s linear infinite both ", spinAnimation, ";" + ( true ? "" : 0));
  51429. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/spinner/index.js
  51430. /**
  51431. * External dependencies
  51432. */
  51433. /**
  51434. * Internal dependencies
  51435. */
  51436. /**
  51437. * WordPress dependencies
  51438. */
  51439. function UnforwardedSpinner(_ref, forwardedRef) {
  51440. let {
  51441. className,
  51442. ...props
  51443. } = _ref;
  51444. return (0,external_wp_element_namespaceObject.createElement)(StyledSpinner, extends_extends({
  51445. className: classnames_default()('components-spinner', className),
  51446. viewBox: "0 0 100 100",
  51447. width: "16",
  51448. height: "16",
  51449. xmlns: "http://www.w3.org/2000/svg",
  51450. role: "presentation",
  51451. focusable: "false"
  51452. }, props, {
  51453. ref: forwardedRef
  51454. }), (0,external_wp_element_namespaceObject.createElement)(SpinnerTrack, {
  51455. cx: "50",
  51456. cy: "50",
  51457. r: "50",
  51458. vectorEffect: "non-scaling-stroke"
  51459. }), (0,external_wp_element_namespaceObject.createElement)(SpinnerIndicator, {
  51460. d: "m 50 0 a 50 50 0 0 1 50 50",
  51461. vectorEffect: "non-scaling-stroke"
  51462. }));
  51463. }
  51464. /**
  51465. * `Spinner` is a component used to notify users that their action is being processed.
  51466. *
  51467. * @example
  51468. * ```js
  51469. * import { Spinner } from '@wordpress/components';
  51470. *
  51471. * function Example() {
  51472. * return <Spinner />;
  51473. * }
  51474. * ```
  51475. */
  51476. const Spinner = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedSpinner);
  51477. /* harmony default export */ var spinner = (Spinner);
  51478. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/surface/component.js
  51479. /**
  51480. * External dependencies
  51481. */
  51482. /**
  51483. * Internal dependencies
  51484. */
  51485. function UnconnectedSurface(props, forwardedRef) {
  51486. const surfaceProps = useSurface(props);
  51487. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, surfaceProps, {
  51488. ref: forwardedRef
  51489. }));
  51490. }
  51491. /**
  51492. * `Surface` is a core component that renders a primary background color.
  51493. *
  51494. * In the example below, notice how the `Surface` renders in white (or dark gray if in dark mode).
  51495. *
  51496. * ```jsx
  51497. * import {
  51498. * __experimentalSurface as Surface,
  51499. * __experimentalText as Text,
  51500. * } from '@wordpress/components';
  51501. *
  51502. * function Example() {
  51503. * return (
  51504. * <Surface>
  51505. * <Text>Code is Poetry</Text>
  51506. * </Surface>
  51507. * );
  51508. * }
  51509. * ```
  51510. */
  51511. const component_Surface = contextConnect(UnconnectedSurface, 'Surface');
  51512. /* harmony default export */ var surface_component = (component_Surface);
  51513. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tab-panel/index.js
  51514. /**
  51515. * External dependencies
  51516. */
  51517. /**
  51518. * WordPress dependencies
  51519. */
  51520. /**
  51521. * Internal dependencies
  51522. */
  51523. const TabButton = _ref => {
  51524. let {
  51525. tabId,
  51526. onClick,
  51527. children,
  51528. selected,
  51529. ...rest
  51530. } = _ref;
  51531. return (0,external_wp_element_namespaceObject.createElement)(build_module_button, extends_extends({
  51532. role: "tab",
  51533. tabIndex: selected ? null : -1,
  51534. "aria-selected": selected,
  51535. id: tabId,
  51536. onClick: onClick
  51537. }, rest), children);
  51538. };
  51539. /**
  51540. * TabPanel is an ARIA-compliant tabpanel.
  51541. *
  51542. * TabPanels organize content across different screens, data sets, and interactions.
  51543. * It has two sections: a list of tabs, and the view to show when tabs are chosen.
  51544. *
  51545. * ```jsx
  51546. * import { TabPanel } from '@wordpress/components';
  51547. *
  51548. * const onSelect = ( tabName ) => {
  51549. * console.log( 'Selecting tab', tabName );
  51550. * };
  51551. *
  51552. * const MyTabPanel = () => (
  51553. * <TabPanel
  51554. * className="my-tab-panel"
  51555. * activeClass="active-tab"
  51556. * onSelect={ onSelect }
  51557. * tabs={ [
  51558. * {
  51559. * name: 'tab1',
  51560. * title: 'Tab 1',
  51561. * className: 'tab-one',
  51562. * },
  51563. * {
  51564. * name: 'tab2',
  51565. * title: 'Tab 2',
  51566. * className: 'tab-two',
  51567. * },
  51568. * ] }
  51569. * >
  51570. * { ( tab ) => <p>{ tab.title }</p> }
  51571. * </TabPanel>
  51572. * );
  51573. * ```
  51574. */
  51575. function TabPanel(_ref2) {
  51576. var _selectedTab$name;
  51577. let {
  51578. className,
  51579. children,
  51580. tabs,
  51581. initialTabName,
  51582. orientation = 'horizontal',
  51583. activeClass = 'is-active',
  51584. onSelect
  51585. } = _ref2;
  51586. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(TabPanel, 'tab-panel');
  51587. const [selected, setSelected] = (0,external_wp_element_namespaceObject.useState)();
  51588. const handleClick = tabKey => {
  51589. setSelected(tabKey);
  51590. onSelect === null || onSelect === void 0 ? void 0 : onSelect(tabKey);
  51591. };
  51592. const onNavigate = (_childIndex, child) => {
  51593. child.click();
  51594. };
  51595. const selectedTab = (0,external_lodash_namespaceObject.find)(tabs, {
  51596. name: selected
  51597. });
  51598. const selectedId = `${instanceId}-${(_selectedTab$name = selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.name) !== null && _selectedTab$name !== void 0 ? _selectedTab$name : 'none'}`;
  51599. (0,external_wp_element_namespaceObject.useEffect)(() => {
  51600. const newSelectedTab = (0,external_lodash_namespaceObject.find)(tabs, {
  51601. name: selected
  51602. });
  51603. if (!newSelectedTab) {
  51604. setSelected(initialTabName || (tabs.length > 0 ? tabs[0].name : undefined));
  51605. }
  51606. }, [tabs]);
  51607. return (0,external_wp_element_namespaceObject.createElement)("div", {
  51608. className: className
  51609. }, (0,external_wp_element_namespaceObject.createElement)(navigable_container_menu, {
  51610. role: "tablist",
  51611. orientation: orientation,
  51612. onNavigate: onNavigate,
  51613. className: "components-tab-panel__tabs"
  51614. }, tabs.map(tab => (0,external_wp_element_namespaceObject.createElement)(TabButton, {
  51615. className: classnames_default()('components-tab-panel__tabs-item', tab.className, {
  51616. [activeClass]: tab.name === selected
  51617. }),
  51618. tabId: `${instanceId}-${tab.name}`,
  51619. "aria-controls": `${instanceId}-${tab.name}-view`,
  51620. selected: tab.name === selected,
  51621. key: tab.name,
  51622. onClick: () => handleClick(tab.name)
  51623. }, tab.title))), selectedTab && (0,external_wp_element_namespaceObject.createElement)("div", {
  51624. key: selectedId,
  51625. "aria-labelledby": selectedId,
  51626. role: "tabpanel",
  51627. id: `${selectedId}-view`,
  51628. className: "components-tab-panel__tab-content"
  51629. }, children(selectedTab)));
  51630. }
  51631. /* harmony default export */ var tab_panel = (TabPanel);
  51632. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/text-control/index.js
  51633. /**
  51634. * External dependencies
  51635. */
  51636. /**
  51637. * WordPress dependencies
  51638. */
  51639. /**
  51640. * Internal dependencies
  51641. */
  51642. function UnforwardedTextControl(props, ref) {
  51643. const {
  51644. __nextHasNoMarginBottom,
  51645. label,
  51646. hideLabelFromVision,
  51647. value,
  51648. help,
  51649. className,
  51650. onChange,
  51651. type = 'text',
  51652. ...additionalProps
  51653. } = props;
  51654. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(TextControl);
  51655. const id = `inspector-text-control-${instanceId}`;
  51656. const onChangeValue = event => onChange(event.target.value);
  51657. return (0,external_wp_element_namespaceObject.createElement)(base_control, {
  51658. __nextHasNoMarginBottom: __nextHasNoMarginBottom,
  51659. label: label,
  51660. hideLabelFromVision: hideLabelFromVision,
  51661. id: id,
  51662. help: help,
  51663. className: className
  51664. }, (0,external_wp_element_namespaceObject.createElement)("input", extends_extends({
  51665. className: "components-text-control__input",
  51666. type: type,
  51667. id: id,
  51668. value: value,
  51669. onChange: onChangeValue,
  51670. "aria-describedby": !!help ? id + '__help' : undefined,
  51671. ref: ref
  51672. }, additionalProps)));
  51673. }
  51674. /**
  51675. * TextControl components let users enter and edit text.
  51676. *
  51677. *
  51678. * @example
  51679. * ```jsx
  51680. * import { TextControl } from '@wordpress/components';
  51681. * import { useState } from '@wordpress/element';
  51682. *
  51683. * const MyTextControl = () => {
  51684. * const [ className, setClassName ] = useState( '' );
  51685. *
  51686. * return (
  51687. * <TextControl
  51688. * label="Additional CSS Class"
  51689. * value={ className }
  51690. * onChange={ ( value ) => setClassName( value ) }
  51691. * />
  51692. * );
  51693. * };
  51694. * ```
  51695. */
  51696. const TextControl = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedTextControl);
  51697. /* harmony default export */ var text_control = (TextControl);
  51698. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/input/base.js
  51699. /**
  51700. * External dependencies
  51701. */
  51702. /**
  51703. * Internal dependencies
  51704. */
  51705. 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);
  51706. 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);
  51707. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/breakpoint-values.js
  51708. /* harmony default export */ var breakpoint_values = ({
  51709. huge: '1440px',
  51710. wide: '1280px',
  51711. 'x-large': '1080px',
  51712. large: '960px',
  51713. // admin sidebar auto folds
  51714. medium: '782px',
  51715. // Adminbar goes big.
  51716. small: '600px',
  51717. mobile: '480px',
  51718. 'zoomed-in': '280px'
  51719. });
  51720. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/breakpoint.js
  51721. /**
  51722. * Internal dependencies
  51723. */
  51724. /**
  51725. * @param {keyof breakpoints} point
  51726. * @return {string} Media query declaration.
  51727. */
  51728. const breakpoint = point => `@media (min-width: ${breakpoint_values[point]})`;
  51729. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/input/input-control.js
  51730. /**
  51731. * External dependencies
  51732. */
  51733. /**
  51734. * Internal dependencies
  51735. */
  51736. 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.ui.darkGrayPlaceholder, ";}&::-moz-placeholder{opacity:1;color:", COLORS.ui.darkGrayPlaceholder, ";}&:-ms-input-placeholder{color:", COLORS.ui.darkGrayPlaceholder, ";}.is-dark-theme &{&::-webkit-input-placeholder{color:", COLORS.ui.lightGrayPlaceholder, ";}&::-moz-placeholder{opacity:1;color:", COLORS.ui.lightGrayPlaceholder, ";}&:-ms-input-placeholder{color:", COLORS.ui.lightGrayPlaceholder, ";}}" + ( true ? "" : 0), true ? "" : 0);
  51737. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/textarea-control/styles/textarea-control-styles.js
  51738. /**
  51739. * External dependencies
  51740. */
  51741. /**
  51742. * Internal dependencies
  51743. */
  51744. const StyledTextarea = emotion_styled_base_browser_esm("textarea", true ? {
  51745. target: "e1w5nnrk0"
  51746. } : 0)("width:100%;", inputControl, ";" + ( true ? "" : 0));
  51747. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/textarea-control/index.js
  51748. /**
  51749. * External dependencies
  51750. */
  51751. /**
  51752. * WordPress dependencies
  51753. */
  51754. /**
  51755. * Internal dependencies
  51756. */
  51757. /**
  51758. * TextareaControls are TextControls that allow for multiple lines of text, and
  51759. * wrap overflow text onto a new line. They are a fixed height and scroll
  51760. * vertically when the cursor reaches the bottom of the field.
  51761. *
  51762. * ```jsx
  51763. * import { TextareaControl } from '@wordpress/components';
  51764. * import { useState } from '@wordpress/element';
  51765. *
  51766. * const MyTextareaControl = () => {
  51767. * const [ text, setText ] = useState( '' );
  51768. *
  51769. * return (
  51770. * <TextareaControl
  51771. * label="Text"
  51772. * help="Enter some text"
  51773. * value={ text }
  51774. * onChange={ ( value ) => setText( value ) }
  51775. * />
  51776. * );
  51777. * };
  51778. * ```
  51779. */
  51780. function TextareaControl(props) {
  51781. const {
  51782. __nextHasNoMarginBottom,
  51783. label,
  51784. hideLabelFromVision,
  51785. value,
  51786. help,
  51787. onChange,
  51788. rows = 4,
  51789. className,
  51790. ...additionalProps
  51791. } = props;
  51792. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(TextareaControl);
  51793. const id = `inspector-textarea-control-${instanceId}`;
  51794. const onChangeValue = event => onChange(event.target.value);
  51795. return (0,external_wp_element_namespaceObject.createElement)(base_control, {
  51796. __nextHasNoMarginBottom: __nextHasNoMarginBottom,
  51797. label: label,
  51798. hideLabelFromVision: hideLabelFromVision,
  51799. id: id,
  51800. help: help,
  51801. className: className
  51802. }, (0,external_wp_element_namespaceObject.createElement)(StyledTextarea, extends_extends({
  51803. className: "components-textarea-control__input",
  51804. id: id,
  51805. rows: rows,
  51806. onChange: onChangeValue,
  51807. "aria-describedby": !!help ? id + '__help' : undefined,
  51808. value: value
  51809. }, additionalProps)));
  51810. }
  51811. /* harmony default export */ var textarea_control = (TextareaControl);
  51812. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/text-highlight/index.js
  51813. /**
  51814. * WordPress dependencies
  51815. */
  51816. /**
  51817. * Internal dependencies
  51818. */
  51819. /**
  51820. * Highlights occurrences of a given string within another string of text. Wraps
  51821. * each match with a `<mark>` tag which provides browser default styling.
  51822. *
  51823. * ```jsx
  51824. * import { TextHighlight } from '@wordpress/components';
  51825. *
  51826. * const MyTextHighlight = () => (
  51827. * <TextHighlight
  51828. * text="Why do we like Gutenberg? Because Gutenberg is the best!"
  51829. * highlight="Gutenberg"
  51830. * />
  51831. * );
  51832. * ```
  51833. */
  51834. const TextHighlight = props => {
  51835. const {
  51836. text = '',
  51837. highlight = ''
  51838. } = props;
  51839. const trimmedHighlightText = highlight.trim();
  51840. if (!trimmedHighlightText) {
  51841. return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, text);
  51842. }
  51843. const regex = new RegExp(`(${escapeRegExp(trimmedHighlightText)})`, 'gi');
  51844. return (0,external_wp_element_namespaceObject.createInterpolateElement)(text.replace(regex, '<mark>$&</mark>'), {
  51845. mark: (0,external_wp_element_namespaceObject.createElement)("mark", null)
  51846. });
  51847. };
  51848. /* harmony default export */ var text_highlight = (TextHighlight);
  51849. ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/tip.js
  51850. /**
  51851. * WordPress dependencies
  51852. */
  51853. const tip = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
  51854. xmlns: "http://www.w3.org/2000/svg",
  51855. viewBox: "0 0 24 24"
  51856. }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
  51857. 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"
  51858. }));
  51859. /* harmony default export */ var library_tip = (tip);
  51860. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tip/index.js
  51861. /**
  51862. * WordPress dependencies
  51863. */
  51864. /**
  51865. * Internal dependencies
  51866. */
  51867. function Tip(props) {
  51868. const {
  51869. children
  51870. } = props;
  51871. return (0,external_wp_element_namespaceObject.createElement)("div", {
  51872. className: "components-tip"
  51873. }, (0,external_wp_element_namespaceObject.createElement)(icons_build_module_icon, {
  51874. icon: library_tip
  51875. }), (0,external_wp_element_namespaceObject.createElement)("p", null, children));
  51876. }
  51877. /* harmony default export */ var build_module_tip = (Tip);
  51878. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toggle-control/index.js
  51879. /**
  51880. * External dependencies
  51881. */
  51882. /**
  51883. * WordPress dependencies
  51884. */
  51885. /**
  51886. * Internal dependencies
  51887. */
  51888. /**
  51889. * ToggleControl is used to generate a toggle user interface.
  51890. *
  51891. * ```jsx
  51892. * import { ToggleControl } from '@wordpress/components';
  51893. * import { useState } from '@wordpress/element';
  51894. *
  51895. * const MyToggleControl = () => {
  51896. * const [ value, setValue ] = useState( false );
  51897. *
  51898. * return (
  51899. * <ToggleControl
  51900. * label="Fixed Background"
  51901. * checked={ value }
  51902. * onChange={ () => setValue( ( state ) => ! state ) }
  51903. * />
  51904. * );
  51905. * };
  51906. * ```
  51907. */
  51908. function ToggleControl(_ref) {
  51909. let {
  51910. __nextHasNoMarginBottom,
  51911. label,
  51912. checked,
  51913. help,
  51914. className,
  51915. onChange,
  51916. disabled
  51917. } = _ref;
  51918. function onChangeToggle(event) {
  51919. onChange(event.target.checked);
  51920. }
  51921. const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ToggleControl);
  51922. const id = `inspector-toggle-control-${instanceId}`;
  51923. const cx = useCx();
  51924. const classes = cx('components-toggle-control', className, !__nextHasNoMarginBottom && /*#__PURE__*/emotion_react_browser_esm_css({
  51925. marginBottom: space(3)
  51926. }, true ? "" : 0, true ? "" : 0));
  51927. let describedBy, helpLabel;
  51928. if (help) {
  51929. describedBy = id + '__help';
  51930. helpLabel = typeof help === 'function' ? help(checked) : help;
  51931. }
  51932. return (0,external_wp_element_namespaceObject.createElement)(base_control, {
  51933. id: id,
  51934. help: helpLabel,
  51935. className: classes,
  51936. __nextHasNoMarginBottom: true
  51937. }, (0,external_wp_element_namespaceObject.createElement)(h_stack_component, {
  51938. justify: "flex-start",
  51939. spacing: 3
  51940. }, (0,external_wp_element_namespaceObject.createElement)(form_toggle, {
  51941. id: id,
  51942. checked: checked,
  51943. onChange: onChangeToggle,
  51944. "aria-describedby": describedBy,
  51945. disabled: disabled
  51946. }), (0,external_wp_element_namespaceObject.createElement)("label", {
  51947. htmlFor: id,
  51948. className: "components-toggle-control__label"
  51949. }, label)));
  51950. }
  51951. /* harmony default export */ var toggle_control = (ToggleControl);
  51952. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toggle-group-control/toggle-group-control-option-icon/component.js
  51953. /**
  51954. * External dependencies
  51955. */
  51956. /**
  51957. * WordPress dependencies
  51958. */
  51959. /**
  51960. * Internal dependencies
  51961. */
  51962. function UnforwardedToggleGroupControlOptionIcon(props, ref) {
  51963. const {
  51964. icon,
  51965. label,
  51966. ...restProps
  51967. } = props;
  51968. return (0,external_wp_element_namespaceObject.createElement)(toggle_group_control_option_base_component, extends_extends({}, restProps, {
  51969. isIcon: true,
  51970. "aria-label": label,
  51971. showTooltip: true,
  51972. ref: ref
  51973. }), (0,external_wp_element_namespaceObject.createElement)(build_module_icon, {
  51974. icon: icon
  51975. }));
  51976. }
  51977. /**
  51978. * `ToggleGroupControlOptionIcon` is a form component which is meant to be used as a
  51979. * child of `ToggleGroupControl` and displays an icon.
  51980. *
  51981. * ```jsx
  51982. *
  51983. * import {
  51984. * __experimentalToggleGroupControl as ToggleGroupControl,
  51985. * __experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,
  51986. * from '@wordpress/components';
  51987. * import { formatLowercase, formatUppercase } from '@wordpress/icons';
  51988. *
  51989. * function Example() {
  51990. * return (
  51991. * <ToggleGroupControl>
  51992. * <ToggleGroupControlOptionIcon
  51993. * value="uppercase"
  51994. * label="Uppercase"
  51995. * icon={ formatUppercase }
  51996. * />
  51997. * <ToggleGroupControlOptionIcon
  51998. * value="lowercase"
  51999. * label="Lowercase"
  52000. * icon={ formatLowercase }
  52001. * />
  52002. * </ToggleGroupControl>
  52003. * );
  52004. * }
  52005. * ```
  52006. */
  52007. const ToggleGroupControlOptionIcon = (0,external_wp_element_namespaceObject.forwardRef)(UnforwardedToggleGroupControlOptionIcon);
  52008. /* harmony default export */ var toggle_group_control_option_icon_component = (ToggleGroupControlOptionIcon);
  52009. ;// CONCATENATED MODULE: ./node_modules/reakit/es/__keys-ae468c11.js
  52010. // Automatically generated
  52011. 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"];
  52012. var TOOLBAR_KEYS = TOOLBAR_STATE_KEYS;
  52013. var TOOLBAR_ITEM_KEYS = TOOLBAR_KEYS;
  52014. var TOOLBAR_SEPARATOR_KEYS = (/* unused pure expression or super */ null && (TOOLBAR_ITEM_KEYS));
  52015. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Toolbar/ToolbarItem.js
  52016. var useToolbarItem = createHook({
  52017. name: "ToolbarItem",
  52018. compose: useCompositeItem,
  52019. keys: TOOLBAR_ITEM_KEYS
  52020. });
  52021. var ToolbarItem = createComponent({
  52022. as: "button",
  52023. memo: true,
  52024. useHook: useToolbarItem
  52025. });
  52026. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar-context/index.js
  52027. /**
  52028. * WordPress dependencies
  52029. */
  52030. const ToolbarContext = (0,external_wp_element_namespaceObject.createContext)();
  52031. /* harmony default export */ var toolbar_context = (ToolbarContext);
  52032. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar-item/index.js
  52033. /**
  52034. * External dependencies
  52035. */
  52036. /**
  52037. * WordPress dependencies
  52038. */
  52039. /**
  52040. * Internal dependencies
  52041. */
  52042. function toolbar_item_ToolbarItem(_ref, ref) {
  52043. let {
  52044. children,
  52045. as: Component,
  52046. ...props
  52047. } = _ref;
  52048. const accessibleToolbarState = (0,external_wp_element_namespaceObject.useContext)(toolbar_context);
  52049. if (typeof children !== 'function' && !Component) {
  52050. typeof process !== "undefined" && process.env && "production" !== "production" ? 0 : void 0;
  52051. return null;
  52052. }
  52053. const allProps = { ...props,
  52054. ref,
  52055. 'data-toolbar-item': true
  52056. };
  52057. if (!accessibleToolbarState) {
  52058. if (Component) {
  52059. return (0,external_wp_element_namespaceObject.createElement)(Component, allProps, children);
  52060. }
  52061. return children(allProps);
  52062. }
  52063. return (0,external_wp_element_namespaceObject.createElement)(ToolbarItem, extends_extends({}, accessibleToolbarState, allProps, {
  52064. as: Component
  52065. }), children);
  52066. }
  52067. /* harmony default export */ var toolbar_item = ((0,external_wp_element_namespaceObject.forwardRef)(toolbar_item_ToolbarItem));
  52068. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar-button/toolbar-button-container.js
  52069. const ToolbarButtonContainer = props => (0,external_wp_element_namespaceObject.createElement)("div", {
  52070. className: props.className
  52071. }, props.children);
  52072. /* harmony default export */ var toolbar_button_container = (ToolbarButtonContainer);
  52073. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar-button/index.js
  52074. /**
  52075. * External dependencies
  52076. */
  52077. /**
  52078. * WordPress dependencies
  52079. */
  52080. /**
  52081. * Internal dependencies
  52082. */
  52083. function ToolbarButton(_ref, ref) {
  52084. let {
  52085. containerClassName,
  52086. className,
  52087. extraProps,
  52088. children,
  52089. title,
  52090. isActive,
  52091. isDisabled,
  52092. ...props
  52093. } = _ref;
  52094. const accessibleToolbarState = (0,external_wp_element_namespaceObject.useContext)(toolbar_context);
  52095. if (!accessibleToolbarState) {
  52096. return (0,external_wp_element_namespaceObject.createElement)(toolbar_button_container, {
  52097. className: containerClassName
  52098. }, (0,external_wp_element_namespaceObject.createElement)(build_module_button, extends_extends({
  52099. ref: ref,
  52100. icon: props.icon,
  52101. label: title,
  52102. shortcut: props.shortcut,
  52103. "data-subscript": props.subscript,
  52104. onClick: event => {
  52105. event.stopPropagation();
  52106. if (props.onClick) {
  52107. props.onClick(event);
  52108. }
  52109. },
  52110. className: classnames_default()('components-toolbar__control', className),
  52111. isPressed: isActive,
  52112. disabled: isDisabled,
  52113. "data-toolbar-item": true
  52114. }, extraProps, props), children));
  52115. } // ToobarItem will pass all props to the render prop child, which will pass
  52116. // all props to Button. This means that ToolbarButton has the same API as
  52117. // Button.
  52118. return (0,external_wp_element_namespaceObject.createElement)(toolbar_item, extends_extends({
  52119. className: classnames_default()('components-toolbar-button', className)
  52120. }, extraProps, props, {
  52121. ref: ref
  52122. }), toolbarItemProps => (0,external_wp_element_namespaceObject.createElement)(build_module_button, extends_extends({
  52123. label: title,
  52124. isPressed: isActive,
  52125. disabled: isDisabled
  52126. }, toolbarItemProps), children));
  52127. }
  52128. /* harmony default export */ var toolbar_button = ((0,external_wp_element_namespaceObject.forwardRef)(ToolbarButton));
  52129. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar-group/toolbar-group-container.js
  52130. const ToolbarGroupContainer = _ref => {
  52131. let {
  52132. className,
  52133. children,
  52134. ...props
  52135. } = _ref;
  52136. return (0,external_wp_element_namespaceObject.createElement)("div", extends_extends({
  52137. className: className
  52138. }, props), children);
  52139. };
  52140. /* harmony default export */ var toolbar_group_container = (ToolbarGroupContainer);
  52141. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar-group/toolbar-group-collapsed.js
  52142. /**
  52143. * WordPress dependencies
  52144. */
  52145. /**
  52146. * Internal dependencies
  52147. */
  52148. function ToolbarGroupCollapsed(_ref) {
  52149. let {
  52150. controls = [],
  52151. toggleProps,
  52152. ...props
  52153. } = _ref;
  52154. // It'll contain state if `ToolbarGroup` is being used within
  52155. // `<Toolbar label="label" />`
  52156. const accessibleToolbarState = (0,external_wp_element_namespaceObject.useContext)(toolbar_context);
  52157. const renderDropdownMenu = internalToggleProps => (0,external_wp_element_namespaceObject.createElement)(dropdown_menu, extends_extends({
  52158. controls: controls,
  52159. toggleProps: { ...internalToggleProps,
  52160. 'data-toolbar-item': true
  52161. }
  52162. }, props));
  52163. if (accessibleToolbarState) {
  52164. return (0,external_wp_element_namespaceObject.createElement)(toolbar_item, toggleProps, renderDropdownMenu);
  52165. }
  52166. return renderDropdownMenu(toggleProps);
  52167. }
  52168. /* harmony default export */ var toolbar_group_collapsed = (ToolbarGroupCollapsed);
  52169. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar-group/index.js
  52170. /**
  52171. * External dependencies
  52172. */
  52173. /**
  52174. * WordPress dependencies
  52175. */
  52176. /**
  52177. * Internal dependencies
  52178. */
  52179. /**
  52180. * Renders a collapsible group of controls
  52181. *
  52182. * The `controls` prop accepts an array of sets. A set is an array of controls.
  52183. * Controls have the following shape:
  52184. *
  52185. * ```
  52186. * {
  52187. * icon: string,
  52188. * title: string,
  52189. * subscript: string,
  52190. * onClick: Function,
  52191. * isActive: boolean,
  52192. * isDisabled: boolean
  52193. * }
  52194. * ```
  52195. *
  52196. * For convenience it is also possible to pass only an array of controls. It is
  52197. * then assumed this is the only set.
  52198. *
  52199. * Either `controls` or `children` is required, otherwise this components
  52200. * renders nothing.
  52201. *
  52202. * @param {Object} props Component props.
  52203. * @param {Array} [props.controls] The controls to render in this toolbar.
  52204. * @param {WPElement} [props.children] Any other things to render inside the toolbar besides the controls.
  52205. * @param {string} [props.className] Class to set on the container div.
  52206. * @param {boolean} [props.isCollapsed] Turns ToolbarGroup into a dropdown menu.
  52207. * @param {string} [props.title] ARIA label for dropdown menu if is collapsed.
  52208. */
  52209. function ToolbarGroup(_ref) {
  52210. var _controlSets;
  52211. let {
  52212. controls = [],
  52213. children,
  52214. className,
  52215. isCollapsed,
  52216. title,
  52217. ...props
  52218. } = _ref;
  52219. // It'll contain state if `ToolbarGroup` is being used within
  52220. // `<Toolbar label="label" />`
  52221. const accessibleToolbarState = (0,external_wp_element_namespaceObject.useContext)(toolbar_context);
  52222. if ((!controls || !controls.length) && !children) {
  52223. return null;
  52224. }
  52225. const finalClassName = classnames_default()( // Unfortunately, there's legacy code referencing to `.components-toolbar`
  52226. // So we can't get rid of it
  52227. accessibleToolbarState ? 'components-toolbar-group' : 'components-toolbar', className); // Normalize controls to nested array of objects (sets of controls)
  52228. let controlSets = controls;
  52229. if (!Array.isArray(controlSets[0])) {
  52230. controlSets = [controlSets];
  52231. }
  52232. if (isCollapsed) {
  52233. return (0,external_wp_element_namespaceObject.createElement)(toolbar_group_collapsed, extends_extends({
  52234. label: title,
  52235. controls: controlSets,
  52236. className: finalClassName,
  52237. children: children
  52238. }, props));
  52239. }
  52240. return (0,external_wp_element_namespaceObject.createElement)(toolbar_group_container, extends_extends({
  52241. className: finalClassName
  52242. }, props), (_controlSets = controlSets) === null || _controlSets === void 0 ? void 0 : _controlSets.flatMap((controlSet, indexOfSet) => controlSet.map((control, indexOfControl) => (0,external_wp_element_namespaceObject.createElement)(toolbar_button, extends_extends({
  52243. key: [indexOfSet, indexOfControl].join(),
  52244. containerClassName: indexOfSet > 0 && indexOfControl === 0 ? 'has-left-divider' : null
  52245. }, control)))), children);
  52246. }
  52247. /* harmony default export */ var toolbar_group = (ToolbarGroup);
  52248. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Toolbar/ToolbarState.js
  52249. function useToolbarState(initialState) {
  52250. if (initialState === void 0) {
  52251. initialState = {};
  52252. }
  52253. var _useSealedState = useSealedState(initialState),
  52254. _useSealedState$orien = _useSealedState.orientation,
  52255. orientation = _useSealedState$orien === void 0 ? "horizontal" : _useSealedState$orien,
  52256. sealed = _objectWithoutPropertiesLoose(_useSealedState, ["orientation"]);
  52257. return useCompositeState(_objectSpread2({
  52258. orientation: orientation
  52259. }, sealed));
  52260. }
  52261. ;// CONCATENATED MODULE: ./node_modules/reakit/es/Toolbar/Toolbar.js
  52262. var useToolbar = createHook({
  52263. name: "Toolbar",
  52264. compose: useComposite,
  52265. keys: TOOLBAR_KEYS,
  52266. useProps: function useProps(options, htmlProps) {
  52267. return _objectSpread2({
  52268. role: "toolbar",
  52269. "aria-orientation": options.orientation
  52270. }, htmlProps);
  52271. }
  52272. });
  52273. var Toolbar = createComponent({
  52274. as: "div",
  52275. useHook: useToolbar,
  52276. useCreateElement: function useCreateElement$1(type, props, children) {
  52277. false ? 0 : void 0;
  52278. return useCreateElement(type, props, children);
  52279. }
  52280. });
  52281. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar/toolbar-container.js
  52282. /**
  52283. * External dependencies
  52284. */
  52285. /**
  52286. * WordPress dependencies
  52287. */
  52288. /**
  52289. * Internal dependencies
  52290. */
  52291. function ToolbarContainer(_ref, ref) {
  52292. let {
  52293. label,
  52294. ...props
  52295. } = _ref;
  52296. // https://reakit.io/docs/basic-concepts/#state-hooks
  52297. // Passing baseId for server side rendering (which includes snapshots)
  52298. // If an id prop is passed to Toolbar, toolbar items will use it as a base for their ids
  52299. const toolbarState = useToolbarState({
  52300. loop: true,
  52301. baseId: props.id,
  52302. rtl: (0,external_wp_i18n_namespaceObject.isRTL)()
  52303. });
  52304. return (// This will provide state for `ToolbarButton`'s
  52305. (0,external_wp_element_namespaceObject.createElement)(toolbar_context.Provider, {
  52306. value: toolbarState
  52307. }, (0,external_wp_element_namespaceObject.createElement)(Toolbar, extends_extends({
  52308. ref: ref,
  52309. "aria-label": label
  52310. }, toolbarState, props)))
  52311. );
  52312. }
  52313. /* harmony default export */ var toolbar_container = ((0,external_wp_element_namespaceObject.forwardRef)(ToolbarContainer));
  52314. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar/index.js
  52315. /**
  52316. * External dependencies
  52317. */
  52318. /**
  52319. * WordPress dependencies
  52320. */
  52321. /**
  52322. * Internal dependencies
  52323. */
  52324. /**
  52325. * Renders a toolbar.
  52326. *
  52327. * To add controls, simply pass `ToolbarButton` components as children.
  52328. *
  52329. * @param {Object} props Component props.
  52330. * @param {string} [props.className] Class to set on the container div.
  52331. * @param {string} [props.label] ARIA label for toolbar container.
  52332. * @param {Object} ref React Element ref.
  52333. */
  52334. function toolbar_Toolbar(_ref, ref) {
  52335. let {
  52336. className,
  52337. label,
  52338. ...props
  52339. } = _ref;
  52340. if (!label) {
  52341. external_wp_deprecated_default()('Using Toolbar without label prop', {
  52342. since: '5.6',
  52343. alternative: 'ToolbarGroup component',
  52344. link: 'https://developer.wordpress.org/block-editor/components/toolbar/'
  52345. });
  52346. return (0,external_wp_element_namespaceObject.createElement)(toolbar_group, extends_extends({}, props, {
  52347. className: className
  52348. }));
  52349. } // `ToolbarGroup` already uses components-toolbar for compatibility reasons.
  52350. const finalClassName = classnames_default()('components-accessible-toolbar', className);
  52351. return (0,external_wp_element_namespaceObject.createElement)(toolbar_container, extends_extends({
  52352. className: finalClassName,
  52353. label: label,
  52354. ref: ref
  52355. }, props));
  52356. }
  52357. /* harmony default export */ var toolbar = ((0,external_wp_element_namespaceObject.forwardRef)(toolbar_Toolbar));
  52358. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar-dropdown-menu/index.js
  52359. /**
  52360. * WordPress dependencies
  52361. */
  52362. /**
  52363. * Internal dependencies
  52364. */
  52365. function ToolbarDropdownMenu(props, ref) {
  52366. const accessibleToolbarState = (0,external_wp_element_namespaceObject.useContext)(toolbar_context);
  52367. if (!accessibleToolbarState) {
  52368. return (0,external_wp_element_namespaceObject.createElement)(dropdown_menu, props);
  52369. } // ToobarItem will pass all props to the render prop child, which will pass
  52370. // all props to the toggle of DropdownMenu. This means that ToolbarDropdownMenu
  52371. // has the same API as DropdownMenu.
  52372. return (0,external_wp_element_namespaceObject.createElement)(toolbar_item, extends_extends({
  52373. ref: ref
  52374. }, props.toggleProps), toolbarItemProps => (0,external_wp_element_namespaceObject.createElement)(dropdown_menu, extends_extends({}, props, {
  52375. popoverProps: {
  52376. isAlternate: true,
  52377. ...props.popoverProps
  52378. },
  52379. toggleProps: toolbarItemProps
  52380. })));
  52381. }
  52382. /* harmony default export */ var toolbar_dropdown_menu = ((0,external_wp_element_namespaceObject.forwardRef)(ToolbarDropdownMenu));
  52383. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tools-panel/styles.js
  52384. 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)."; }
  52385. /**
  52386. * External dependencies
  52387. */
  52388. /**
  52389. * Internal dependencies
  52390. */
  52391. const toolsPanelGrid = {
  52392. columns: columns => /*#__PURE__*/emotion_react_browser_esm_css("grid-template-columns:", `repeat( ${columns}, minmax(0, 1fr) )`, ";" + ( true ? "" : 0), true ? "" : 0),
  52393. spacing: /*#__PURE__*/emotion_react_browser_esm_css("column-gap:", space(2), ";row-gap:", space(4), ";" + ( true ? "" : 0), true ? "" : 0),
  52394. item: {
  52395. fullWidth: true ? {
  52396. name: "18iuzk9",
  52397. styles: "grid-column:1/-1"
  52398. } : 0
  52399. }
  52400. };
  52401. const ToolsPanel = columns => /*#__PURE__*/emotion_react_browser_esm_css(toolsPanelGrid.columns(columns), " ", toolsPanelGrid.spacing, " border-top:", config_values.borderWidth, " solid ", COLORS.gray[300], ";margin-top:-1px;padding:", space(4), ";" + ( true ? "" : 0), true ? "" : 0);
  52402. /**
  52403. * Items injected into a ToolsPanel via a virtual bubbling slot will require
  52404. * an inner dom element to be injected. The following rule allows for the
  52405. * CSS grid display to be re-established.
  52406. */
  52407. const ToolsPanelWithInnerWrapper = columns => {
  52408. return /*#__PURE__*/emotion_react_browser_esm_css(">div:not( :first-of-type ){display:grid;", toolsPanelGrid.columns(columns), " ", toolsPanelGrid.spacing, " ", toolsPanelGrid.item.fullWidth, ";}" + ( true ? "" : 0), true ? "" : 0);
  52409. };
  52410. const ToolsPanelHiddenInnerWrapper = true ? {
  52411. name: "huufmu",
  52412. styles: ">div:not( :first-of-type ){display:none;}"
  52413. } : 0;
  52414. 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);
  52415. const ToolsPanelHeading = true ? {
  52416. name: "1pmxm02",
  52417. styles: "font-size:inherit;font-weight:500;line-height:normal;&&{margin:0;}"
  52418. } : 0;
  52419. 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;}}" + ( true ? "" : 0), true ? "" : 0);
  52420. const ToolsPanelItemPlaceholder = true ? {
  52421. name: "eivff4",
  52422. styles: "display:none"
  52423. } : 0;
  52424. const styles_DropdownMenu = true ? {
  52425. name: "16gsvie",
  52426. styles: "min-width:200px"
  52427. } : 0;
  52428. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tools-panel/context.js
  52429. /**
  52430. * WordPress dependencies
  52431. */
  52432. /**
  52433. * Internal dependencies
  52434. */
  52435. const tools_panel_context_noop = () => undefined;
  52436. const ToolsPanelContext = (0,external_wp_element_namespaceObject.createContext)({
  52437. menuItems: {
  52438. default: {},
  52439. optional: {}
  52440. },
  52441. hasMenuItems: false,
  52442. isResetting: false,
  52443. shouldRenderPlaceholderItems: false,
  52444. registerPanelItem: tools_panel_context_noop,
  52445. deregisterPanelItem: tools_panel_context_noop,
  52446. flagItemCustomization: tools_panel_context_noop,
  52447. areAllOptionalControlsHidden: true
  52448. });
  52449. const useToolsPanelContext = () => (0,external_wp_element_namespaceObject.useContext)(ToolsPanelContext);
  52450. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tools-panel/tools-panel-header/hook.js
  52451. /**
  52452. * WordPress dependencies
  52453. */
  52454. /**
  52455. * Internal dependencies
  52456. */
  52457. function useToolsPanelHeader(props) {
  52458. const {
  52459. className,
  52460. ...otherProps
  52461. } = useContextSystem(props, 'ToolsPanelHeader');
  52462. const cx = useCx();
  52463. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  52464. return cx(ToolsPanelHeader, className);
  52465. }, [className, cx]);
  52466. const dropdownMenuClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
  52467. return cx(styles_DropdownMenu);
  52468. }, [cx]);
  52469. const headingClassName = (0,external_wp_element_namespaceObject.useMemo)(() => {
  52470. return cx(ToolsPanelHeading);
  52471. }, [cx]);
  52472. const {
  52473. menuItems,
  52474. hasMenuItems,
  52475. areAllOptionalControlsHidden
  52476. } = useToolsPanelContext();
  52477. return { ...otherProps,
  52478. areAllOptionalControlsHidden,
  52479. dropdownMenuClassName,
  52480. hasMenuItems,
  52481. headingClassName,
  52482. menuItems,
  52483. className: classes
  52484. };
  52485. }
  52486. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tools-panel/tools-panel-header/component.js
  52487. /**
  52488. * External dependencies
  52489. */
  52490. /**
  52491. * WordPress dependencies
  52492. */
  52493. /**
  52494. * Internal dependencies
  52495. */
  52496. const DefaultControlsGroup = _ref => {
  52497. let {
  52498. items,
  52499. toggleItem
  52500. } = _ref;
  52501. if (!items.length) {
  52502. return null;
  52503. }
  52504. return (0,external_wp_element_namespaceObject.createElement)(menu_group, null, items.map(_ref2 => {
  52505. let [label, hasValue] = _ref2;
  52506. if (hasValue) {
  52507. return (0,external_wp_element_namespaceObject.createElement)(menu_item, {
  52508. key: label,
  52509. role: "menuitem",
  52510. icon: library_reset,
  52511. label: (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The name of the control being reset e.g. "Padding".
  52512. (0,external_wp_i18n_namespaceObject.__)('Reset %s'), label),
  52513. onClick: () => {
  52514. toggleItem(label);
  52515. (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The name of the control being reset e.g. "Padding".
  52516. (0,external_wp_i18n_namespaceObject.__)('%s reset to default'), label), 'assertive');
  52517. }
  52518. }, label);
  52519. }
  52520. return (0,external_wp_element_namespaceObject.createElement)(menu_item, {
  52521. key: label,
  52522. role: "menuitemcheckbox",
  52523. icon: library_check,
  52524. isSelected: true,
  52525. "aria-disabled": true
  52526. }, label);
  52527. }));
  52528. };
  52529. const OptionalControlsGroup = _ref3 => {
  52530. let {
  52531. items,
  52532. toggleItem
  52533. } = _ref3;
  52534. if (!items.length) {
  52535. return null;
  52536. }
  52537. return (0,external_wp_element_namespaceObject.createElement)(menu_group, null, items.map(_ref4 => {
  52538. let [label, isSelected] = _ref4;
  52539. const itemLabel = isSelected ? (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The name of the control being hidden and reset e.g. "Padding".
  52540. (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".
  52541. (0,external_wp_i18n_namespaceObject.__)('Show %s'), label);
  52542. return (0,external_wp_element_namespaceObject.createElement)(menu_item, {
  52543. key: label,
  52544. icon: isSelected && library_check,
  52545. isSelected: isSelected,
  52546. label: itemLabel,
  52547. onClick: () => {
  52548. if (isSelected) {
  52549. (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The name of the control being reset e.g. "Padding".
  52550. (0,external_wp_i18n_namespaceObject.__)('%s hidden and reset to default'), label), 'assertive');
  52551. } else {
  52552. (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The name of the control being reset e.g. "Padding".
  52553. (0,external_wp_i18n_namespaceObject.__)('%s is now visible'), label), 'assertive');
  52554. }
  52555. toggleItem(label);
  52556. },
  52557. role: "menuitemcheckbox"
  52558. }, label);
  52559. }));
  52560. };
  52561. const component_ToolsPanelHeader = (props, forwardedRef) => {
  52562. const {
  52563. areAllOptionalControlsHidden,
  52564. dropdownMenuClassName,
  52565. hasMenuItems,
  52566. headingClassName,
  52567. label: labelText,
  52568. menuItems,
  52569. resetAll,
  52570. toggleItem,
  52571. ...headerProps
  52572. } = useToolsPanelHeader(props);
  52573. if (!labelText) {
  52574. return null;
  52575. }
  52576. const defaultItems = Object.entries((menuItems === null || menuItems === void 0 ? void 0 : menuItems.default) || {});
  52577. const optionalItems = Object.entries((menuItems === null || menuItems === void 0 ? void 0 : menuItems.optional) || {});
  52578. const dropDownMenuIcon = areAllOptionalControlsHidden ? library_plus : more_vertical;
  52579. const dropDownMenuLabelText = (0,external_wp_i18n_namespaceObject.sprintf)( // translators: %s: The name of the tool e.g. "Color" or "Typography".
  52580. (0,external_wp_i18n_namespaceObject._x)('%s options', 'Button label to reveal tool panel options'), labelText);
  52581. const dropdownMenuDescriptionText = areAllOptionalControlsHidden ? (0,external_wp_i18n_namespaceObject.__)('All options are currently hidden') : undefined;
  52582. const canResetAll = [...defaultItems, ...optionalItems].some(_ref5 => {
  52583. let [, isSelected] = _ref5;
  52584. return isSelected;
  52585. });
  52586. return (0,external_wp_element_namespaceObject.createElement)(h_stack_component, extends_extends({}, headerProps, {
  52587. ref: forwardedRef
  52588. }), (0,external_wp_element_namespaceObject.createElement)(heading_component, {
  52589. level: 2,
  52590. className: headingClassName
  52591. }, labelText), hasMenuItems && (0,external_wp_element_namespaceObject.createElement)(dropdown_menu, {
  52592. icon: dropDownMenuIcon,
  52593. label: dropDownMenuLabelText,
  52594. menuProps: {
  52595. className: dropdownMenuClassName
  52596. },
  52597. toggleProps: {
  52598. isSmall: true,
  52599. describedBy: dropdownMenuDescriptionText
  52600. }
  52601. }, () => (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(DefaultControlsGroup, {
  52602. items: defaultItems,
  52603. toggleItem: toggleItem
  52604. }), (0,external_wp_element_namespaceObject.createElement)(OptionalControlsGroup, {
  52605. items: optionalItems,
  52606. toggleItem: toggleItem
  52607. }), (0,external_wp_element_namespaceObject.createElement)(menu_group, null, (0,external_wp_element_namespaceObject.createElement)(menu_item, {
  52608. "aria-disabled": !canResetAll,
  52609. variant: 'tertiary',
  52610. onClick: () => {
  52611. if (canResetAll) {
  52612. resetAll();
  52613. (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('All options reset'), 'assertive');
  52614. }
  52615. }
  52616. }, (0,external_wp_i18n_namespaceObject.__)('Reset all'))))));
  52617. };
  52618. const ConnectedToolsPanelHeader = contextConnect(component_ToolsPanelHeader, 'ToolsPanelHeader');
  52619. /* harmony default export */ var tools_panel_header_component = (ConnectedToolsPanelHeader);
  52620. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tools-panel/tools-panel/hook.js
  52621. /**
  52622. * WordPress dependencies
  52623. */
  52624. /**
  52625. * Internal dependencies
  52626. */
  52627. const DEFAULT_COLUMNS = 2;
  52628. const generateMenuItems = _ref => {
  52629. let {
  52630. panelItems,
  52631. shouldReset,
  52632. currentMenuItems
  52633. } = _ref;
  52634. const menuItems = {
  52635. default: {},
  52636. optional: {}
  52637. };
  52638. panelItems.forEach(_ref2 => {
  52639. var _currentMenuItems$gro;
  52640. let {
  52641. hasValue,
  52642. isShownByDefault,
  52643. label
  52644. } = _ref2;
  52645. const group = isShownByDefault ? 'default' : 'optional'; // If a menu item for this label already exists, do not overwrite its value.
  52646. // This can cause default controls that have been flagged as customized to
  52647. // lose their value.
  52648. const existingItemValue = currentMenuItems === null || currentMenuItems === void 0 ? void 0 : (_currentMenuItems$gro = currentMenuItems[group]) === null || _currentMenuItems$gro === void 0 ? void 0 : _currentMenuItems$gro[label];
  52649. const value = existingItemValue !== undefined ? existingItemValue : hasValue();
  52650. menuItems[group][label] = shouldReset ? false : value;
  52651. });
  52652. return menuItems;
  52653. };
  52654. const isMenuItemTypeEmpty = obj => obj && Object.keys(obj).length === 0;
  52655. function useToolsPanel(props) {
  52656. const {
  52657. className,
  52658. resetAll,
  52659. panelId,
  52660. hasInnerWrapper,
  52661. shouldRenderPlaceholderItems,
  52662. __experimentalFirstVisibleItemClass,
  52663. __experimentalLastVisibleItemClass,
  52664. ...otherProps
  52665. } = useContextSystem(props, 'ToolsPanel');
  52666. const isResetting = (0,external_wp_element_namespaceObject.useRef)(false);
  52667. const wasResetting = isResetting.current; // `isResetting` is cleared via this hook to effectively batch together
  52668. // the resetAll task. Without this, the flag is cleared after the first
  52669. // control updates and forces a rerender with subsequent controls then
  52670. // believing they need to reset, unfortunately using stale data.
  52671. (0,external_wp_element_namespaceObject.useEffect)(() => {
  52672. if (wasResetting) {
  52673. isResetting.current = false;
  52674. }
  52675. }, [wasResetting]); // Allow panel items to register themselves.
  52676. const [panelItems, setPanelItems] = (0,external_wp_element_namespaceObject.useState)([]);
  52677. const registerPanelItem = (0,external_wp_element_namespaceObject.useCallback)(item => {
  52678. setPanelItems(items => {
  52679. const newItems = [...items]; // If an item with this label has already been registered, remove it
  52680. // first. This can happen when an item is moved between the default
  52681. // and optional groups.
  52682. const existingIndex = newItems.findIndex(oldItem => oldItem.label === item.label);
  52683. if (existingIndex !== -1) {
  52684. newItems.splice(existingIndex, 1);
  52685. }
  52686. return [...newItems, item];
  52687. });
  52688. }, [setPanelItems]); // Panels need to deregister on unmount to avoid orphans in menu state.
  52689. // This is an issue when panel items are being injected via SlotFills.
  52690. const deregisterPanelItem = (0,external_wp_element_namespaceObject.useCallback)(label => {
  52691. // When switching selections between components injecting matching
  52692. // controls, e.g. both panels have a "padding" control, the
  52693. // deregistration of the first panel doesn't occur until after the
  52694. // registration of the next.
  52695. setPanelItems(items => {
  52696. const newItems = [...items];
  52697. const index = newItems.findIndex(item => item.label === label);
  52698. if (index !== -1) {
  52699. newItems.splice(index, 1);
  52700. }
  52701. return newItems;
  52702. });
  52703. }, [setPanelItems]); // Manage and share display state of menu items representing child controls.
  52704. const [menuItems, setMenuItems] = (0,external_wp_element_namespaceObject.useState)({
  52705. default: {},
  52706. optional: {}
  52707. }); // Setup menuItems state as panel items register themselves.
  52708. (0,external_wp_element_namespaceObject.useEffect)(() => {
  52709. setMenuItems(prevState => {
  52710. const items = generateMenuItems({
  52711. panelItems,
  52712. shouldReset: false,
  52713. currentMenuItems: prevState
  52714. });
  52715. return items;
  52716. });
  52717. }, [generateMenuItems, panelItems, setMenuItems]); // Force a menu item to be checked.
  52718. // This is intended for use with default panel items. They are displayed
  52719. // separately to optional items and have different display states,
  52720. // we need to update that when their value is customized.
  52721. const flagItemCustomization = (0,external_wp_element_namespaceObject.useCallback)(function (label) {
  52722. let group = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'default';
  52723. setMenuItems(items => {
  52724. const newState = { ...items,
  52725. [group]: { ...items[group],
  52726. [label]: true
  52727. }
  52728. };
  52729. return newState;
  52730. });
  52731. }, [setMenuItems]); // Whether all optional menu items are hidden or not must be tracked
  52732. // in order to later determine if the panel display is empty and handle
  52733. // conditional display of a plus icon to indicate the presence of further
  52734. // menu items.
  52735. const [areAllOptionalControlsHidden, setAreAllOptionalControlsHidden] = (0,external_wp_element_namespaceObject.useState)(false);
  52736. (0,external_wp_element_namespaceObject.useEffect)(() => {
  52737. if (isMenuItemTypeEmpty(menuItems === null || menuItems === void 0 ? void 0 : menuItems.default) && !isMenuItemTypeEmpty(menuItems === null || menuItems === void 0 ? void 0 : menuItems.optional)) {
  52738. const allControlsHidden = !Object.entries(menuItems.optional).some(_ref3 => {
  52739. let [, isSelected] = _ref3;
  52740. return isSelected;
  52741. });
  52742. setAreAllOptionalControlsHidden(allControlsHidden);
  52743. }
  52744. }, [menuItems, setAreAllOptionalControlsHidden]);
  52745. const cx = useCx();
  52746. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  52747. const wrapperStyle = hasInnerWrapper && ToolsPanelWithInnerWrapper(DEFAULT_COLUMNS);
  52748. const emptyStyle = isMenuItemTypeEmpty(menuItems === null || menuItems === void 0 ? void 0 : menuItems.default) && areAllOptionalControlsHidden && ToolsPanelHiddenInnerWrapper;
  52749. return cx(ToolsPanel(DEFAULT_COLUMNS), wrapperStyle, emptyStyle, className);
  52750. }, [areAllOptionalControlsHidden, className, cx, hasInnerWrapper, menuItems]); // Toggle the checked state of a menu item which is then used to determine
  52751. // display of the item within the panel.
  52752. const toggleItem = (0,external_wp_element_namespaceObject.useCallback)(label => {
  52753. const currentItem = panelItems.find(item => item.label === label);
  52754. if (!currentItem) {
  52755. return;
  52756. }
  52757. const menuGroup = currentItem.isShownByDefault ? 'default' : 'optional';
  52758. const newMenuItems = { ...menuItems,
  52759. [menuGroup]: { ...menuItems[menuGroup],
  52760. [label]: !menuItems[menuGroup][label]
  52761. }
  52762. };
  52763. setMenuItems(newMenuItems);
  52764. }, [menuItems, panelItems, setMenuItems]); // Resets display of children and executes resetAll callback if available.
  52765. const resetAllItems = (0,external_wp_element_namespaceObject.useCallback)(() => {
  52766. if (typeof resetAll === 'function') {
  52767. isResetting.current = true; // Collect available reset filters from panel items.
  52768. const filters = [];
  52769. panelItems.forEach(item => {
  52770. if (item.resetAllFilter) {
  52771. filters.push(item.resetAllFilter);
  52772. }
  52773. });
  52774. resetAll(filters);
  52775. } // Turn off display of all non-default items.
  52776. const resetMenuItems = generateMenuItems({
  52777. panelItems,
  52778. shouldReset: true
  52779. });
  52780. setMenuItems(resetMenuItems);
  52781. }, [generateMenuItems, isResetting.current, panelItems, resetAll, setMenuItems]); // Assist ItemGroup styling when there are potentially hidden placeholder
  52782. // items by identifying first & last items that are toggled on for display.
  52783. const getFirstVisibleItemLabel = items => {
  52784. const optionalItems = menuItems.optional || {};
  52785. const firstItem = items.find(item => item.isShownByDefault || !!optionalItems[item.label]);
  52786. return firstItem === null || firstItem === void 0 ? void 0 : firstItem.label;
  52787. };
  52788. const firstDisplayedItem = getFirstVisibleItemLabel(panelItems);
  52789. const lastDisplayedItem = getFirstVisibleItemLabel([...panelItems].reverse());
  52790. const panelContext = (0,external_wp_element_namespaceObject.useMemo)(() => ({
  52791. areAllOptionalControlsHidden,
  52792. deregisterPanelItem,
  52793. firstDisplayedItem,
  52794. flagItemCustomization,
  52795. hasMenuItems: !!panelItems.length,
  52796. isResetting: isResetting.current,
  52797. lastDisplayedItem,
  52798. menuItems,
  52799. panelId,
  52800. registerPanelItem,
  52801. shouldRenderPlaceholderItems,
  52802. __experimentalFirstVisibleItemClass,
  52803. __experimentalLastVisibleItemClass
  52804. }), [areAllOptionalControlsHidden, deregisterPanelItem, firstDisplayedItem, flagItemCustomization, isResetting.current, lastDisplayedItem, menuItems, panelId, panelItems, registerPanelItem, shouldRenderPlaceholderItems, __experimentalFirstVisibleItemClass, __experimentalLastVisibleItemClass]);
  52805. return { ...otherProps,
  52806. panelContext,
  52807. resetAllItems,
  52808. toggleItem,
  52809. className: classes
  52810. };
  52811. }
  52812. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tools-panel/tools-panel/component.js
  52813. /**
  52814. * External dependencies
  52815. */
  52816. /**
  52817. * Internal dependencies
  52818. */
  52819. const component_ToolsPanel = (props, forwardedRef) => {
  52820. const {
  52821. children,
  52822. label,
  52823. panelContext,
  52824. resetAllItems,
  52825. toggleItem,
  52826. ...toolsPanelProps
  52827. } = useToolsPanel(props);
  52828. return (0,external_wp_element_namespaceObject.createElement)(grid_component, extends_extends({}, toolsPanelProps, {
  52829. columns: 2,
  52830. ref: forwardedRef
  52831. }), (0,external_wp_element_namespaceObject.createElement)(ToolsPanelContext.Provider, {
  52832. value: panelContext
  52833. }, (0,external_wp_element_namespaceObject.createElement)(tools_panel_header_component, {
  52834. label: label,
  52835. resetAll: resetAllItems,
  52836. toggleItem: toggleItem
  52837. }), children));
  52838. };
  52839. const ConnectedToolsPanel = contextConnect(component_ToolsPanel, 'ToolsPanel');
  52840. /* harmony default export */ var tools_panel_component = (ConnectedToolsPanel);
  52841. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tools-panel/tools-panel-item/hook.js
  52842. /**
  52843. * WordPress dependencies
  52844. */
  52845. /**
  52846. * Internal dependencies
  52847. */
  52848. function useToolsPanelItem(props) {
  52849. var _menuItems$menuGroup, _menuItems$menuGroup2;
  52850. const {
  52851. className,
  52852. hasValue,
  52853. isShownByDefault,
  52854. label,
  52855. panelId,
  52856. resetAllFilter,
  52857. onDeselect,
  52858. onSelect,
  52859. ...otherProps
  52860. } = useContextSystem(props, 'ToolsPanelItem');
  52861. const {
  52862. panelId: currentPanelId,
  52863. menuItems,
  52864. registerPanelItem,
  52865. deregisterPanelItem,
  52866. flagItemCustomization,
  52867. isResetting,
  52868. shouldRenderPlaceholderItems: shouldRenderPlaceholder,
  52869. firstDisplayedItem,
  52870. lastDisplayedItem,
  52871. __experimentalFirstVisibleItemClass,
  52872. __experimentalLastVisibleItemClass
  52873. } = useToolsPanelContext();
  52874. const hasValueCallback = (0,external_wp_element_namespaceObject.useCallback)(hasValue, [panelId]);
  52875. const resetAllFilterCallback = (0,external_wp_element_namespaceObject.useCallback)(resetAllFilter, [panelId]);
  52876. const previousPanelId = (0,external_wp_compose_namespaceObject.usePrevious)(currentPanelId);
  52877. const hasMatchingPanel = currentPanelId === panelId || currentPanelId === null; // Registering the panel item allows the panel to include it in its
  52878. // automatically generated menu and determine its initial checked status.
  52879. (0,external_wp_element_namespaceObject.useEffect)(() => {
  52880. if (hasMatchingPanel && previousPanelId !== null) {
  52881. registerPanelItem({
  52882. hasValue: hasValueCallback,
  52883. isShownByDefault,
  52884. label,
  52885. resetAllFilter: resetAllFilterCallback,
  52886. panelId
  52887. });
  52888. }
  52889. return () => {
  52890. if (previousPanelId === null && !!currentPanelId || currentPanelId === panelId) {
  52891. deregisterPanelItem(label);
  52892. }
  52893. };
  52894. }, [currentPanelId, hasMatchingPanel, isShownByDefault, label, hasValueCallback, panelId, previousPanelId, resetAllFilterCallback]);
  52895. const isValueSet = hasValue();
  52896. const wasValueSet = (0,external_wp_compose_namespaceObject.usePrevious)(isValueSet); // If this item represents a default control it will need to notify the
  52897. // panel when a custom value has been set.
  52898. (0,external_wp_element_namespaceObject.useEffect)(() => {
  52899. if (isShownByDefault && isValueSet && !wasValueSet) {
  52900. flagItemCustomization(label);
  52901. }
  52902. }, [isValueSet, wasValueSet, isShownByDefault, label]); // Note: `label` is used as a key when building menu item state in
  52903. // `ToolsPanel`.
  52904. const menuGroup = isShownByDefault ? 'default' : 'optional';
  52905. const isMenuItemChecked = menuItems === null || menuItems === void 0 ? void 0 : (_menuItems$menuGroup = menuItems[menuGroup]) === null || _menuItems$menuGroup === void 0 ? void 0 : _menuItems$menuGroup[label];
  52906. const wasMenuItemChecked = (0,external_wp_compose_namespaceObject.usePrevious)(isMenuItemChecked); // Determine if the panel item's corresponding menu is being toggled and
  52907. // trigger appropriate callback if it is.
  52908. (0,external_wp_element_namespaceObject.useEffect)(() => {
  52909. if (isResetting || !hasMatchingPanel) {
  52910. return;
  52911. }
  52912. if (isMenuItemChecked && !isValueSet && !wasMenuItemChecked) {
  52913. onSelect === null || onSelect === void 0 ? void 0 : onSelect();
  52914. }
  52915. if (!isMenuItemChecked && wasMenuItemChecked) {
  52916. onDeselect === null || onDeselect === void 0 ? void 0 : onDeselect();
  52917. }
  52918. }, [hasMatchingPanel, isMenuItemChecked, isResetting, isValueSet, wasMenuItemChecked]); // The item is shown if it is a default control regardless of whether it
  52919. // has a value. Optional items are shown when they are checked or have
  52920. // a value.
  52921. 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;
  52922. const cx = useCx();
  52923. const classes = (0,external_wp_element_namespaceObject.useMemo)(() => {
  52924. const placeholderStyle = shouldRenderPlaceholder && !isShown && ToolsPanelItemPlaceholder;
  52925. const firstItemStyle = firstDisplayedItem === label && __experimentalFirstVisibleItemClass;
  52926. const lastItemStyle = lastDisplayedItem === label && __experimentalLastVisibleItemClass;
  52927. return cx(ToolsPanelItem, placeholderStyle, className, firstItemStyle, lastItemStyle);
  52928. }, [isShown, shouldRenderPlaceholder, className, cx, firstDisplayedItem, lastDisplayedItem, __experimentalFirstVisibleItemClass, __experimentalLastVisibleItemClass]);
  52929. return { ...otherProps,
  52930. isShown,
  52931. shouldRenderPlaceholder,
  52932. className: classes
  52933. };
  52934. }
  52935. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tools-panel/tools-panel-item/component.js
  52936. /**
  52937. * External dependencies
  52938. */
  52939. /**
  52940. * Internal dependencies
  52941. */
  52942. // This wraps controls to be conditionally displayed within a tools panel. It
  52943. // prevents props being applied to HTML elements that would make them invalid.
  52944. const component_ToolsPanelItem = (props, forwardedRef) => {
  52945. const {
  52946. children,
  52947. isShown,
  52948. shouldRenderPlaceholder,
  52949. ...toolsPanelItemProps
  52950. } = useToolsPanelItem(props);
  52951. if (!isShown) {
  52952. return shouldRenderPlaceholder ? (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, toolsPanelItemProps, {
  52953. ref: forwardedRef
  52954. })) : null;
  52955. }
  52956. return (0,external_wp_element_namespaceObject.createElement)(component, extends_extends({}, toolsPanelItemProps, {
  52957. ref: forwardedRef
  52958. }), children);
  52959. };
  52960. const ConnectedToolsPanelItem = contextConnect(component_ToolsPanelItem, 'ToolsPanelItem');
  52961. /* harmony default export */ var tools_panel_item_component = (ConnectedToolsPanelItem);
  52962. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/roving-tab-index-context.js
  52963. /**
  52964. * WordPress dependencies
  52965. */
  52966. const RovingTabIndexContext = (0,external_wp_element_namespaceObject.createContext)();
  52967. const useRovingTabIndexContext = () => (0,external_wp_element_namespaceObject.useContext)(RovingTabIndexContext);
  52968. const RovingTabIndexProvider = RovingTabIndexContext.Provider;
  52969. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/roving-tab-index.js
  52970. /**
  52971. * WordPress dependencies
  52972. */
  52973. /**
  52974. * Internal dependencies
  52975. */
  52976. /**
  52977. * Provider for adding roving tab index behaviors to tree grid structures.
  52978. *
  52979. * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/components/src/tree-grid/README.md
  52980. *
  52981. * @param {Object} props Component props.
  52982. * @param {WPElement} props.children Children to be rendered
  52983. */
  52984. function RovingTabIndex(_ref) {
  52985. let {
  52986. children
  52987. } = _ref;
  52988. const [lastFocusedElement, setLastFocusedElement] = (0,external_wp_element_namespaceObject.useState)(); // Use `useMemo` to avoid creation of a new object for the providerValue
  52989. // on every render. Only create a new object when the `lastFocusedElement`
  52990. // value changes.
  52991. const providerValue = (0,external_wp_element_namespaceObject.useMemo)(() => ({
  52992. lastFocusedElement,
  52993. setLastFocusedElement
  52994. }), [lastFocusedElement]);
  52995. return (0,external_wp_element_namespaceObject.createElement)(RovingTabIndexProvider, {
  52996. value: providerValue
  52997. }, children);
  52998. }
  52999. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/index.js
  53000. /**
  53001. * WordPress dependencies
  53002. */
  53003. /**
  53004. * Internal dependencies
  53005. */
  53006. /**
  53007. * Return focusables in a row element, excluding those from other branches
  53008. * nested within the row.
  53009. *
  53010. * @param {Element} rowElement The DOM element representing the row.
  53011. *
  53012. * @return {?Array} The array of focusables in the row.
  53013. */
  53014. function getRowFocusables(rowElement) {
  53015. const focusablesInRow = external_wp_dom_namespaceObject.focus.focusable.find(rowElement, {
  53016. sequential: true
  53017. });
  53018. if (!focusablesInRow || !focusablesInRow.length) {
  53019. return;
  53020. }
  53021. return focusablesInRow.filter(focusable => {
  53022. return focusable.closest('[role="row"]') === rowElement;
  53023. });
  53024. }
  53025. /**
  53026. * Renders both a table and tbody element, used to create a tree hierarchy.
  53027. *
  53028. * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/components/src/tree-grid/README.md
  53029. * @param {Object} props Component props.
  53030. * @param {WPElement} props.children Children to be rendered.
  53031. * @param {Function} props.onExpandRow Callback to fire when row is expanded.
  53032. * @param {Function} props.onCollapseRow Callback to fire when row is collapsed.
  53033. * @param {Function} props.onFocusRow Callback to fire when moving focus to a different row.
  53034. * @param {string} props.applicationAriaLabel Label to use for the application role.
  53035. * @param {Object} ref A ref to the underlying DOM table element.
  53036. */
  53037. function TreeGrid(_ref, ref) {
  53038. let {
  53039. children,
  53040. onExpandRow = () => {},
  53041. onCollapseRow = () => {},
  53042. onFocusRow = () => {},
  53043. applicationAriaLabel,
  53044. ...props
  53045. } = _ref;
  53046. const onKeyDown = (0,external_wp_element_namespaceObject.useCallback)(event => {
  53047. const {
  53048. keyCode,
  53049. metaKey,
  53050. ctrlKey,
  53051. altKey
  53052. } = event; // The shift key is intentionally absent from the following list,
  53053. // to enable shift + up/down to select items from the list.
  53054. const hasModifierKeyPressed = metaKey || ctrlKey || altKey;
  53055. if (hasModifierKeyPressed || ![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].includes(keyCode)) {
  53056. return;
  53057. } // The event will be handled, stop propagation.
  53058. event.stopPropagation();
  53059. const {
  53060. activeElement
  53061. } = document;
  53062. const {
  53063. currentTarget: treeGridElement
  53064. } = event;
  53065. if (!treeGridElement.contains(activeElement)) {
  53066. return;
  53067. } // Calculate the columnIndex of the active element.
  53068. const activeRow = activeElement.closest('[role="row"]');
  53069. const focusablesInRow = getRowFocusables(activeRow);
  53070. const currentColumnIndex = focusablesInRow.indexOf(activeElement);
  53071. const canExpandCollapse = 0 === currentColumnIndex;
  53072. const cannotFocusNextColumn = canExpandCollapse && activeRow.getAttribute('aria-expanded') === 'false' && keyCode === external_wp_keycodes_namespaceObject.RIGHT;
  53073. if ([external_wp_keycodes_namespaceObject.LEFT, external_wp_keycodes_namespaceObject.RIGHT].includes(keyCode)) {
  53074. // Calculate to the next element.
  53075. let nextIndex;
  53076. if (keyCode === external_wp_keycodes_namespaceObject.LEFT) {
  53077. nextIndex = Math.max(0, currentColumnIndex - 1);
  53078. } else {
  53079. nextIndex = Math.min(currentColumnIndex + 1, focusablesInRow.length - 1);
  53080. } // Focus is at the left most column.
  53081. if (canExpandCollapse) {
  53082. if (keyCode === external_wp_keycodes_namespaceObject.LEFT) {
  53083. var _activeRow$getAttribu, _getRowFocusables, _getRowFocusables$;
  53084. // Left:
  53085. // If a row is focused, and it is expanded, collapses the current row.
  53086. if (activeRow.getAttribute('aria-expanded') === 'true') {
  53087. onCollapseRow(activeRow);
  53088. event.preventDefault();
  53089. return;
  53090. } // If a row is focused, and it is collapsed, moves to the parent row (if there is one).
  53091. 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);
  53092. const rows = Array.from(treeGridElement.querySelectorAll('[role="row"]'));
  53093. let parentRow = activeRow;
  53094. const currentRowIndex = rows.indexOf(activeRow);
  53095. for (let i = currentRowIndex; i >= 0; i--) {
  53096. if (parseInt(rows[i].getAttribute('aria-level'), 10) === level) {
  53097. parentRow = rows[i];
  53098. break;
  53099. }
  53100. }
  53101. (_getRowFocusables = getRowFocusables(parentRow)) === null || _getRowFocusables === void 0 ? void 0 : (_getRowFocusables$ = _getRowFocusables[0]) === null || _getRowFocusables$ === void 0 ? void 0 : _getRowFocusables$.focus();
  53102. }
  53103. if (keyCode === external_wp_keycodes_namespaceObject.RIGHT) {
  53104. // Right:
  53105. // If a row is focused, and it is collapsed, expands the current row.
  53106. if (activeRow.getAttribute('aria-expanded') === 'false') {
  53107. onExpandRow(activeRow);
  53108. event.preventDefault();
  53109. return;
  53110. } // If a row is focused, and it is expanded, focuses the rightmost cell in the row.
  53111. const focusableItems = getRowFocusables(activeRow);
  53112. if (focusableItems.length > 0) {
  53113. var _focusableItems;
  53114. (_focusableItems = focusableItems[focusableItems.length - 1]) === null || _focusableItems === void 0 ? void 0 : _focusableItems.focus();
  53115. }
  53116. } // Prevent key use for anything else. For example, Voiceover
  53117. // will start reading text on continued use of left/right arrow
  53118. // keys.
  53119. event.preventDefault();
  53120. return;
  53121. } // 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.
  53122. if (cannotFocusNextColumn) {
  53123. return;
  53124. }
  53125. focusablesInRow[nextIndex].focus(); // Prevent key use for anything else. This ensures Voiceover
  53126. // doesn't try to handle key navigation.
  53127. event.preventDefault();
  53128. } else if ([external_wp_keycodes_namespaceObject.UP, external_wp_keycodes_namespaceObject.DOWN].includes(keyCode)) {
  53129. // Calculate the rowIndex of the next row.
  53130. const rows = Array.from(treeGridElement.querySelectorAll('[role="row"]'));
  53131. const currentRowIndex = rows.indexOf(activeRow);
  53132. let nextRowIndex;
  53133. if (keyCode === external_wp_keycodes_namespaceObject.UP) {
  53134. nextRowIndex = Math.max(0, currentRowIndex - 1);
  53135. } else {
  53136. nextRowIndex = Math.min(currentRowIndex + 1, rows.length - 1);
  53137. } // Focus is either at the top or bottom edge of the grid. Do nothing.
  53138. if (nextRowIndex === currentRowIndex) {
  53139. // Prevent key use for anything else. For example, Voiceover
  53140. // will start navigating horizontally when reaching the vertical
  53141. // bounds of a table.
  53142. event.preventDefault();
  53143. return;
  53144. } // Get the focusables in the next row.
  53145. const focusablesInNextRow = getRowFocusables(rows[nextRowIndex]); // If for some reason there are no focusables in the next row, do nothing.
  53146. if (!focusablesInNextRow || !focusablesInNextRow.length) {
  53147. // Prevent key use for anything else. For example, Voiceover
  53148. // will still focus text when using arrow keys, while this
  53149. // component should limit navigation to focusables.
  53150. event.preventDefault();
  53151. return;
  53152. } // Try to focus the element in the next row that's at a similar column to the activeElement.
  53153. const nextIndex = Math.min(currentColumnIndex, focusablesInNextRow.length - 1);
  53154. focusablesInNextRow[nextIndex].focus(); // Let consumers know the row that was originally focused,
  53155. // and the row that is now in focus.
  53156. onFocusRow(event, activeRow, rows[nextRowIndex]); // Prevent key use for anything else. This ensures Voiceover
  53157. // doesn't try to handle key navigation.
  53158. event.preventDefault();
  53159. } else if ([external_wp_keycodes_namespaceObject.HOME, external_wp_keycodes_namespaceObject.END].includes(keyCode)) {
  53160. // Calculate the rowIndex of the next row.
  53161. const rows = Array.from(treeGridElement.querySelectorAll('[role="row"]'));
  53162. const currentRowIndex = rows.indexOf(activeRow);
  53163. let nextRowIndex;
  53164. if (keyCode === external_wp_keycodes_namespaceObject.HOME) {
  53165. nextRowIndex = 0;
  53166. } else {
  53167. nextRowIndex = rows.length - 1;
  53168. } // Focus is either at the top or bottom edge of the grid. Do nothing.
  53169. if (nextRowIndex === currentRowIndex) {
  53170. // Prevent key use for anything else. For example, Voiceover
  53171. // will start navigating horizontally when reaching the vertical
  53172. // bounds of a table.
  53173. event.preventDefault();
  53174. return;
  53175. } // Get the focusables in the next row.
  53176. const focusablesInNextRow = getRowFocusables(rows[nextRowIndex]); // If for some reason there are no focusables in the next row, do nothing.
  53177. if (!focusablesInNextRow || !focusablesInNextRow.length) {
  53178. // Prevent key use for anything else. For example, Voiceover
  53179. // will still focus text when using arrow keys, while this
  53180. // component should limit navigation to focusables.
  53181. event.preventDefault();
  53182. return;
  53183. } // Try to focus the element in the next row that's at a similar column to the activeElement.
  53184. const nextIndex = Math.min(currentColumnIndex, focusablesInNextRow.length - 1);
  53185. focusablesInNextRow[nextIndex].focus(); // Let consumers know the row that was originally focused,
  53186. // and the row that is now in focus.
  53187. onFocusRow(event, activeRow, rows[nextRowIndex]); // Prevent key use for anything else. This ensures Voiceover
  53188. // doesn't try to handle key navigation.
  53189. event.preventDefault();
  53190. }
  53191. }, [onExpandRow, onCollapseRow, onFocusRow]);
  53192. /* Disable reason: A treegrid is implemented using a table element. */
  53193. /* eslint-disable jsx-a11y/no-noninteractive-element-to-interactive-role */
  53194. return (0,external_wp_element_namespaceObject.createElement)(RovingTabIndex, null, (0,external_wp_element_namespaceObject.createElement)("div", {
  53195. role: "application",
  53196. "aria-label": applicationAriaLabel
  53197. }, (0,external_wp_element_namespaceObject.createElement)("table", extends_extends({}, props, {
  53198. role: "treegrid",
  53199. onKeyDown: onKeyDown,
  53200. ref: ref
  53201. }), (0,external_wp_element_namespaceObject.createElement)("tbody", null, children))));
  53202. /* eslint-enable jsx-a11y/no-noninteractive-element-to-interactive-role */
  53203. }
  53204. /* harmony default export */ var tree_grid = ((0,external_wp_element_namespaceObject.forwardRef)(TreeGrid));
  53205. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/row.js
  53206. /**
  53207. * WordPress dependencies
  53208. */
  53209. function TreeGridRow(_ref, ref) {
  53210. let {
  53211. children,
  53212. level,
  53213. positionInSet,
  53214. setSize,
  53215. isExpanded,
  53216. ...props
  53217. } = _ref;
  53218. return (// Disable reason: Due to an error in the ARIA 1.1 specification, the
  53219. // aria-posinset and aria-setsize properties are not supported on row
  53220. // elements. This is being corrected in ARIA 1.2. Consequently, the
  53221. // linting rule fails when validating this markup.
  53222. //
  53223. // eslint-disable-next-line jsx-a11y/role-supports-aria-props
  53224. (0,external_wp_element_namespaceObject.createElement)("tr", extends_extends({}, props, {
  53225. ref: ref,
  53226. role: "row",
  53227. "aria-level": level,
  53228. "aria-posinset": positionInSet,
  53229. "aria-setsize": setSize,
  53230. "aria-expanded": isExpanded
  53231. }), children)
  53232. );
  53233. }
  53234. /* harmony default export */ var tree_grid_row = ((0,external_wp_element_namespaceObject.forwardRef)(TreeGridRow));
  53235. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/roving-tab-index-item.js
  53236. /**
  53237. * WordPress dependencies
  53238. */
  53239. /**
  53240. * Internal dependencies
  53241. */
  53242. /* harmony default export */ var roving_tab_index_item = ((0,external_wp_element_namespaceObject.forwardRef)(function RovingTabIndexItem(_ref, forwardedRef) {
  53243. let {
  53244. children,
  53245. as: Component,
  53246. ...props
  53247. } = _ref;
  53248. const localRef = (0,external_wp_element_namespaceObject.useRef)();
  53249. const ref = forwardedRef || localRef;
  53250. const {
  53251. lastFocusedElement,
  53252. setLastFocusedElement
  53253. } = useRovingTabIndexContext();
  53254. let tabIndex;
  53255. if (lastFocusedElement) {
  53256. tabIndex = lastFocusedElement === ref.current ? 0 : -1;
  53257. }
  53258. const onFocus = event => setLastFocusedElement(event.target);
  53259. const allProps = {
  53260. ref,
  53261. tabIndex,
  53262. onFocus,
  53263. ...props
  53264. };
  53265. if (typeof children === 'function') {
  53266. return children(allProps);
  53267. }
  53268. return (0,external_wp_element_namespaceObject.createElement)(Component, allProps, children);
  53269. }));
  53270. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/item.js
  53271. /**
  53272. * WordPress dependencies
  53273. */
  53274. /**
  53275. * Internal dependencies
  53276. */
  53277. /* harmony default export */ var tree_grid_item = ((0,external_wp_element_namespaceObject.forwardRef)(function TreeGridItem(_ref, ref) {
  53278. let {
  53279. children,
  53280. ...props
  53281. } = _ref;
  53282. return (0,external_wp_element_namespaceObject.createElement)(roving_tab_index_item, extends_extends({
  53283. ref: ref
  53284. }, props), children);
  53285. }));
  53286. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/cell.js
  53287. /**
  53288. * WordPress dependencies
  53289. */
  53290. /**
  53291. * Internal dependencies
  53292. */
  53293. /* harmony default export */ var cell = ((0,external_wp_element_namespaceObject.forwardRef)(function TreeGridCell(_ref, ref) {
  53294. let {
  53295. children,
  53296. withoutGridItem = false,
  53297. ...props
  53298. } = _ref;
  53299. return (0,external_wp_element_namespaceObject.createElement)("td", extends_extends({}, props, {
  53300. role: "gridcell"
  53301. }), withoutGridItem ? children : (0,external_wp_element_namespaceObject.createElement)(tree_grid_item, {
  53302. ref: ref
  53303. }, children));
  53304. }));
  53305. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/isolated-event-container/index.js
  53306. /**
  53307. * WordPress dependencies
  53308. */
  53309. /**
  53310. * @type {import('react').MouseEventHandler<HTMLDivElement>}
  53311. */
  53312. function stopPropagation(event) {
  53313. event.stopPropagation();
  53314. }
  53315. /* harmony default export */ var isolated_event_container = ((0,external_wp_element_namespaceObject.forwardRef)((_ref, ref) => {
  53316. let {
  53317. children,
  53318. ...props
  53319. } = _ref;
  53320. external_wp_deprecated_default()('wp.components.IsolatedEventContainer', {
  53321. since: '5.7'
  53322. }); // Disable reason: this stops certain events from propagating outside of the component.
  53323. // - onMouseDown is disabled as this can cause interactions with other DOM elements.
  53324. /* eslint-disable jsx-a11y/no-static-element-interactions */
  53325. return (0,external_wp_element_namespaceObject.createElement)("div", extends_extends({}, props, {
  53326. ref: ref,
  53327. onMouseDown: stopPropagation
  53328. }), children);
  53329. /* eslint-enable jsx-a11y/no-static-element-interactions */
  53330. }));
  53331. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/z-stack/styles.js
  53332. 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)."; }
  53333. /**
  53334. * External dependencies
  53335. */
  53336. /**
  53337. * Internal dependencies
  53338. */
  53339. const ZStackView = emotion_styled_base_browser_esm("div", true ? {
  53340. target: "ebn2ljm1"
  53341. } : 0)( true ? {
  53342. name: "5ob2ly",
  53343. styles: "display:flex;position:relative"
  53344. } : 0);
  53345. const ZStackChildView = emotion_styled_base_browser_esm("div", true ? {
  53346. target: "ebn2ljm0"
  53347. } : 0)(_ref => {
  53348. let {
  53349. isLayered,
  53350. offsetAmount
  53351. } = _ref;
  53352. return isLayered ? /*#__PURE__*/emotion_react_browser_esm_css(rtl({
  53353. marginLeft: offsetAmount
  53354. })(), true ? "" : 0, true ? "" : 0) : /*#__PURE__*/emotion_react_browser_esm_css(rtl({
  53355. right: offsetAmount * -1
  53356. })(), true ? "" : 0, true ? "" : 0);
  53357. }, " ", _ref2 => {
  53358. let {
  53359. isLayered
  53360. } = _ref2;
  53361. return isLayered ? positionAbsolute : positionRelative;
  53362. }, " ", _ref3 => {
  53363. let {
  53364. zIndex
  53365. } = _ref3;
  53366. return /*#__PURE__*/emotion_react_browser_esm_css({
  53367. zIndex
  53368. }, true ? "" : 0, true ? "" : 0);
  53369. }, ";" + ( true ? "" : 0));
  53370. const positionAbsolute = true ? {
  53371. name: "a4hmbt",
  53372. styles: "position:absolute"
  53373. } : 0;
  53374. const positionRelative = true ? {
  53375. name: "bjn8wh",
  53376. styles: "position:relative"
  53377. } : 0;
  53378. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/z-stack/component.js
  53379. /**
  53380. * External dependencies
  53381. */
  53382. /**
  53383. * WordPress dependencies
  53384. */
  53385. /**
  53386. * Internal dependencies
  53387. */
  53388. function UnconnectedZStack(props, forwardedRef) {
  53389. const {
  53390. children,
  53391. className,
  53392. isLayered = true,
  53393. isReversed = false,
  53394. offset = 0,
  53395. ...otherProps
  53396. } = useContextSystem(props, 'ZStack');
  53397. const validChildren = getValidChildren(children);
  53398. const childrenLastIndex = validChildren.length - 1;
  53399. const clonedChildren = validChildren.map((child, index) => {
  53400. const zIndex = isReversed ? childrenLastIndex - index : index;
  53401. const offsetAmount = offset * index;
  53402. const key = (0,external_wp_element_namespaceObject.isValidElement)(child) ? child.key : index;
  53403. return (0,external_wp_element_namespaceObject.createElement)(ZStackChildView, {
  53404. isLayered: isLayered,
  53405. offsetAmount: offsetAmount,
  53406. zIndex: zIndex,
  53407. key: key
  53408. }, child);
  53409. });
  53410. return (0,external_wp_element_namespaceObject.createElement)(ZStackView, extends_extends({}, otherProps, {
  53411. className: className,
  53412. ref: forwardedRef
  53413. }), clonedChildren);
  53414. }
  53415. /**
  53416. * `ZStack` allows you to stack things along the Z-axis.
  53417. *
  53418. * ```jsx
  53419. * import { __experimentalZStack as ZStack } from '@wordpress/components';
  53420. *
  53421. * function Example() {
  53422. * return (
  53423. * <ZStack offset={ 20 } isLayered>
  53424. * <ExampleImage />
  53425. * <ExampleImage />
  53426. * <ExampleImage />
  53427. * </ZStack>
  53428. * );
  53429. * }
  53430. * ```
  53431. */
  53432. const ZStack = contextConnect(UnconnectedZStack, 'ZStack');
  53433. /* harmony default export */ var z_stack_component = (ZStack);
  53434. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/navigate-regions/index.js
  53435. /**
  53436. * WordPress dependencies
  53437. */
  53438. const defaultShortcuts = {
  53439. previous: [{
  53440. modifier: 'ctrlShift',
  53441. character: '`'
  53442. }, {
  53443. modifier: 'access',
  53444. character: 'p'
  53445. }],
  53446. next: [{
  53447. modifier: 'ctrl',
  53448. character: '`'
  53449. }, {
  53450. modifier: 'access',
  53451. character: 'n'
  53452. }]
  53453. };
  53454. function useNavigateRegions() {
  53455. let shortcuts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultShortcuts;
  53456. const ref = (0,external_wp_element_namespaceObject.useRef)();
  53457. const [isFocusingRegions, setIsFocusingRegions] = (0,external_wp_element_namespaceObject.useState)(false);
  53458. function focusRegion(offset) {
  53459. const regions = Array.from(ref.current.querySelectorAll('[role="region"]'));
  53460. if (!regions.length) {
  53461. return;
  53462. }
  53463. let nextRegion = regions[0];
  53464. const selectedIndex = regions.indexOf(ref.current.ownerDocument.activeElement);
  53465. if (selectedIndex !== -1) {
  53466. let nextIndex = selectedIndex + offset;
  53467. nextIndex = nextIndex === -1 ? regions.length - 1 : nextIndex;
  53468. nextIndex = nextIndex === regions.length ? 0 : nextIndex;
  53469. nextRegion = regions[nextIndex];
  53470. }
  53471. nextRegion.focus();
  53472. setIsFocusingRegions(true);
  53473. }
  53474. const clickRef = (0,external_wp_compose_namespaceObject.useRefEffect)(element => {
  53475. function onClick() {
  53476. setIsFocusingRegions(false);
  53477. }
  53478. element.addEventListener('click', onClick);
  53479. return () => {
  53480. element.removeEventListener('click', onClick);
  53481. };
  53482. }, [setIsFocusingRegions]);
  53483. return {
  53484. ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, clickRef]),
  53485. className: isFocusingRegions ? 'is-focusing-regions' : '',
  53486. onKeyDown(event) {
  53487. if (shortcuts.previous.some(_ref => {
  53488. let {
  53489. modifier,
  53490. character
  53491. } = _ref;
  53492. return external_wp_keycodes_namespaceObject.isKeyboardEvent[modifier](event, character);
  53493. })) {
  53494. focusRegion(-1);
  53495. } else if (shortcuts.next.some(_ref2 => {
  53496. let {
  53497. modifier,
  53498. character
  53499. } = _ref2;
  53500. return external_wp_keycodes_namespaceObject.isKeyboardEvent[modifier](event, character);
  53501. })) {
  53502. focusRegion(1);
  53503. }
  53504. }
  53505. };
  53506. }
  53507. /* harmony default export */ var navigate_regions = ((0,external_wp_compose_namespaceObject.createHigherOrderComponent)(Component => _ref3 => {
  53508. let {
  53509. shortcuts,
  53510. ...props
  53511. } = _ref3;
  53512. return (0,external_wp_element_namespaceObject.createElement)("div", useNavigateRegions(shortcuts), (0,external_wp_element_namespaceObject.createElement)(Component, props));
  53513. }, 'navigateRegions'));
  53514. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-constrained-tabbing/index.js
  53515. /**
  53516. * WordPress dependencies
  53517. */
  53518. const withConstrainedTabbing = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => function ComponentWithConstrainedTabbing(props) {
  53519. const ref = (0,external_wp_compose_namespaceObject.useConstrainedTabbing)();
  53520. return (0,external_wp_element_namespaceObject.createElement)("div", {
  53521. ref: ref,
  53522. tabIndex: -1
  53523. }, (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, props));
  53524. }, 'withConstrainedTabbing');
  53525. /* harmony default export */ var with_constrained_tabbing = (withConstrainedTabbing);
  53526. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-fallback-styles/index.js
  53527. /**
  53528. * External dependencies
  53529. */
  53530. /**
  53531. * WordPress dependencies
  53532. */
  53533. /* harmony default export */ var with_fallback_styles = (mapNodeToProps => (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(WrappedComponent => {
  53534. return class extends external_wp_element_namespaceObject.Component {
  53535. constructor() {
  53536. super(...arguments);
  53537. this.nodeRef = this.props.node;
  53538. this.state = {
  53539. fallbackStyles: undefined,
  53540. grabStylesCompleted: false
  53541. };
  53542. this.bindRef = this.bindRef.bind(this);
  53543. }
  53544. bindRef(node) {
  53545. if (!node) {
  53546. return;
  53547. }
  53548. this.nodeRef = node;
  53549. }
  53550. componentDidMount() {
  53551. this.grabFallbackStyles();
  53552. }
  53553. componentDidUpdate() {
  53554. this.grabFallbackStyles();
  53555. }
  53556. grabFallbackStyles() {
  53557. const {
  53558. grabStylesCompleted,
  53559. fallbackStyles
  53560. } = this.state;
  53561. if (this.nodeRef && !grabStylesCompleted) {
  53562. const newFallbackStyles = mapNodeToProps(this.nodeRef, this.props);
  53563. if (!(0,external_lodash_namespaceObject.isEqual)(newFallbackStyles, fallbackStyles)) {
  53564. this.setState({
  53565. fallbackStyles: newFallbackStyles,
  53566. grabStylesCompleted: !!(0,external_lodash_namespaceObject.every)(newFallbackStyles)
  53567. });
  53568. }
  53569. }
  53570. }
  53571. render() {
  53572. const wrappedComponent = (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, extends_extends({}, this.props, this.state.fallbackStyles));
  53573. return this.props.node ? wrappedComponent : (0,external_wp_element_namespaceObject.createElement)("div", {
  53574. ref: this.bindRef
  53575. }, " ", wrappedComponent, " ");
  53576. }
  53577. };
  53578. }, 'withFallbackStyles'));
  53579. ;// CONCATENATED MODULE: external ["wp","hooks"]
  53580. var external_wp_hooks_namespaceObject = window["wp"]["hooks"];
  53581. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-filters/index.js
  53582. /**
  53583. * External dependencies
  53584. */
  53585. /**
  53586. * WordPress dependencies
  53587. */
  53588. const ANIMATION_FRAME_PERIOD = 16;
  53589. /**
  53590. * Creates a higher-order component which adds filtering capability to the
  53591. * wrapped component. Filters get applied when the original component is about
  53592. * to be mounted. When a filter is added or removed that matches the hook name,
  53593. * the wrapped component re-renders.
  53594. *
  53595. * @param {string} hookName Hook name exposed to be used by filters.
  53596. *
  53597. * @return {Function} Higher-order component factory.
  53598. */
  53599. function withFilters(hookName) {
  53600. return (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(OriginalComponent => {
  53601. const namespace = 'core/with-filters/' + hookName;
  53602. /**
  53603. * The component definition with current filters applied. Each instance
  53604. * reuse this shared reference as an optimization to avoid excessive
  53605. * calls to `applyFilters` when many instances exist.
  53606. *
  53607. * @type {?Component}
  53608. */
  53609. let FilteredComponent;
  53610. /**
  53611. * Initializes the FilteredComponent variable once, if not already
  53612. * assigned. Subsequent calls are effectively a noop.
  53613. */
  53614. function ensureFilteredComponent() {
  53615. if (FilteredComponent === undefined) {
  53616. FilteredComponent = (0,external_wp_hooks_namespaceObject.applyFilters)(hookName, OriginalComponent);
  53617. }
  53618. }
  53619. class FilteredComponentRenderer extends external_wp_element_namespaceObject.Component {
  53620. constructor() {
  53621. super(...arguments);
  53622. ensureFilteredComponent();
  53623. }
  53624. componentDidMount() {
  53625. FilteredComponentRenderer.instances.push(this); // If there were previously no mounted instances for components
  53626. // filtered on this hook, add the hook handler.
  53627. if (FilteredComponentRenderer.instances.length === 1) {
  53628. (0,external_wp_hooks_namespaceObject.addAction)('hookRemoved', namespace, onHooksUpdated);
  53629. (0,external_wp_hooks_namespaceObject.addAction)('hookAdded', namespace, onHooksUpdated);
  53630. }
  53631. }
  53632. componentWillUnmount() {
  53633. FilteredComponentRenderer.instances = (0,external_lodash_namespaceObject.without)(FilteredComponentRenderer.instances, this); // If this was the last of the mounted components filtered on
  53634. // this hook, remove the hook handler.
  53635. if (FilteredComponentRenderer.instances.length === 0) {
  53636. (0,external_wp_hooks_namespaceObject.removeAction)('hookRemoved', namespace);
  53637. (0,external_wp_hooks_namespaceObject.removeAction)('hookAdded', namespace);
  53638. }
  53639. }
  53640. render() {
  53641. return (0,external_wp_element_namespaceObject.createElement)(FilteredComponent, this.props);
  53642. }
  53643. }
  53644. FilteredComponentRenderer.instances = [];
  53645. /**
  53646. * Updates the FilteredComponent definition, forcing a render for each
  53647. * mounted instance. This occurs a maximum of once per animation frame.
  53648. */
  53649. const throttledForceUpdate = (0,external_lodash_namespaceObject.debounce)(() => {
  53650. // Recreate the filtered component, only after delay so that it's
  53651. // computed once, even if many filters added.
  53652. FilteredComponent = (0,external_wp_hooks_namespaceObject.applyFilters)(hookName, OriginalComponent); // Force each instance to render.
  53653. FilteredComponentRenderer.instances.forEach(instance => {
  53654. instance.forceUpdate();
  53655. });
  53656. }, ANIMATION_FRAME_PERIOD);
  53657. /**
  53658. * When a filter is added or removed for the matching hook name, each
  53659. * mounted instance should re-render with the new filters having been
  53660. * applied to the original component.
  53661. *
  53662. * @param {string} updatedHookName Name of the hook that was updated.
  53663. */
  53664. function onHooksUpdated(updatedHookName) {
  53665. if (updatedHookName === hookName) {
  53666. throttledForceUpdate();
  53667. }
  53668. }
  53669. return FilteredComponentRenderer;
  53670. }, 'withFilters');
  53671. }
  53672. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-focus-return/index.js
  53673. /**
  53674. * WordPress dependencies
  53675. */
  53676. /**
  53677. * Returns true if the given object is component-like. An object is component-
  53678. * like if it is an instance of wp.element.Component, or is a function.
  53679. *
  53680. * @param {*} object Object to test.
  53681. *
  53682. * @return {boolean} Whether object is component-like.
  53683. */
  53684. function isComponentLike(object) {
  53685. return object instanceof external_wp_element_namespaceObject.Component || typeof object === 'function';
  53686. }
  53687. /**
  53688. * Higher Order Component used to be used to wrap disposable elements like
  53689. * sidebars, modals, dropdowns. When mounting the wrapped component, we track a
  53690. * reference to the current active element so we know where to restore focus
  53691. * when the component is unmounted.
  53692. *
  53693. * @param {(WPComponent|Object)} options The component to be enhanced with
  53694. * focus return behavior, or an object
  53695. * describing the component and the
  53696. * focus return characteristics.
  53697. *
  53698. * @return {Function} Higher Order Component with the focus restauration behaviour.
  53699. */
  53700. /* harmony default export */ var with_focus_return = ((0,external_wp_compose_namespaceObject.createHigherOrderComponent)(options => {
  53701. const HoC = function () {
  53702. let {
  53703. onFocusReturn
  53704. } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  53705. return WrappedComponent => {
  53706. const WithFocusReturn = props => {
  53707. const ref = (0,external_wp_compose_namespaceObject.useFocusReturn)(onFocusReturn);
  53708. return (0,external_wp_element_namespaceObject.createElement)("div", {
  53709. ref: ref
  53710. }, (0,external_wp_element_namespaceObject.createElement)(WrappedComponent, props));
  53711. };
  53712. return WithFocusReturn;
  53713. };
  53714. };
  53715. if (isComponentLike(options)) {
  53716. const WrappedComponent = options;
  53717. return HoC()(WrappedComponent);
  53718. }
  53719. return HoC(options);
  53720. }, 'withFocusReturn'));
  53721. const with_focus_return_Provider = _ref => {
  53722. let {
  53723. children
  53724. } = _ref;
  53725. external_wp_deprecated_default()('wp.components.FocusReturnProvider component', {
  53726. since: '5.7',
  53727. hint: 'This provider is not used anymore. You can just remove it from your codebase'
  53728. });
  53729. return children;
  53730. };
  53731. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-notices/index.js
  53732. /**
  53733. * External dependencies
  53734. */
  53735. /**
  53736. * WordPress dependencies
  53737. */
  53738. /**
  53739. * Internal dependencies
  53740. */
  53741. /**
  53742. * Override the default edit UI to include notices if supported.
  53743. *
  53744. * @param {WPComponent} OriginalComponent Original component.
  53745. *
  53746. * @return {WPComponent} Wrapped component.
  53747. */
  53748. /* harmony default export */ var with_notices = ((0,external_wp_compose_namespaceObject.createHigherOrderComponent)(OriginalComponent => {
  53749. function Component(props, ref) {
  53750. const [noticeList, setNoticeList] = (0,external_wp_element_namespaceObject.useState)([]);
  53751. const noticeOperations = (0,external_wp_element_namespaceObject.useMemo)(() => {
  53752. /**
  53753. * Function passed down as a prop that adds a new notice.
  53754. *
  53755. * @param {Object} notice Notice to add.
  53756. */
  53757. const createNotice = notice => {
  53758. const noticeToAdd = notice.id ? notice : { ...notice,
  53759. id: esm_browser_v4()
  53760. };
  53761. setNoticeList(current => [...current, noticeToAdd]);
  53762. };
  53763. return {
  53764. createNotice,
  53765. /**
  53766. * Function passed as a prop that adds a new error notice.
  53767. *
  53768. * @param {string} msg Error message of the notice.
  53769. */
  53770. createErrorNotice: msg => {
  53771. createNotice({
  53772. status: 'error',
  53773. content: msg
  53774. });
  53775. },
  53776. /**
  53777. * Removes a notice by id.
  53778. *
  53779. * @param {string} id Id of the notice to remove.
  53780. */
  53781. removeNotice: id => {
  53782. setNoticeList(current => current.filter(notice => notice.id !== id));
  53783. },
  53784. /**
  53785. * Removes all notices
  53786. */
  53787. removeAllNotices: () => {
  53788. setNoticeList([]);
  53789. }
  53790. };
  53791. }, []);
  53792. const propsOut = { ...props,
  53793. noticeList,
  53794. noticeOperations,
  53795. noticeUI: noticeList.length > 0 && (0,external_wp_element_namespaceObject.createElement)(list, {
  53796. className: "components-with-notices-ui",
  53797. notices: noticeList,
  53798. onRemove: noticeOperations.removeNotice
  53799. })
  53800. };
  53801. return isForwardRef ? (0,external_wp_element_namespaceObject.createElement)(OriginalComponent, extends_extends({}, propsOut, {
  53802. ref: ref
  53803. })) : (0,external_wp_element_namespaceObject.createElement)(OriginalComponent, propsOut);
  53804. }
  53805. let isForwardRef;
  53806. const {
  53807. render
  53808. } = OriginalComponent; // Returns a forwardRef if OriginalComponent appears to be a forwardRef.
  53809. if (typeof render === 'function') {
  53810. isForwardRef = true;
  53811. return (0,external_wp_element_namespaceObject.forwardRef)(Component);
  53812. }
  53813. return Component;
  53814. }));
  53815. ;// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/index.js
  53816. // Primitives.
  53817. // Components.
  53818. // Higher-Order Components.
  53819. }();
  53820. (window.wp = window.wp || {}).components = __webpack_exports__;
  53821. /******/ })()
  53822. ;