@univerjs_sheets-conditional-formatting-ui.js 273 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382
  1. import {
  2. A1,
  3. B,
  4. C2,
  5. E,
  6. E1,
  7. E2,
  8. I1,
  9. J0,
  10. K,
  11. K0 as K02,
  12. L1,
  13. M,
  14. N2,
  15. R,
  16. R2,
  17. T2,
  18. U2,
  19. Y,
  20. _1 as _12,
  21. b1,
  22. f0,
  23. g1,
  24. h1,
  25. j,
  26. o2,
  27. p1,
  28. u1,
  29. v2,
  30. w,
  31. x,
  32. x0,
  33. x1,
  34. x2,
  35. y,
  36. y0,
  37. y2,
  38. z0 as z02
  39. } from "./chunk-S77UFTYM.js";
  40. import {
  41. Ei,
  42. fc
  43. } from "./chunk-U3EPM6JO.js";
  44. import "./chunk-ALDCSYO3.js";
  45. import {
  46. Hr,
  47. Sn,
  48. Un,
  49. Ys,
  50. _s,
  51. dI,
  52. gr,
  53. ke,
  54. me,
  55. rt as rt2,
  56. sE,
  57. tE,
  58. ue,
  59. zt
  60. } from "./chunk-T4NNB5UY.js";
  61. import {
  62. F,
  63. Kd,
  64. Me,
  65. N,
  66. Nn,
  67. Pe,
  68. So,
  69. Te,
  70. Ut,
  71. V,
  72. _t,
  73. ah,
  74. an,
  75. ar as ar2,
  76. et,
  77. jr,
  78. os,
  79. po,
  80. qn,
  81. re as re2,
  82. xl,
  83. yh
  84. } from "./chunk-BW43Z7N3.js";
  85. import {
  86. fn,
  87. fr
  88. } from "./chunk-QRYBFJ3R.js";
  89. import "./chunk-MIOQ566M.js";
  90. import {
  91. $e,
  92. Fa,
  93. Kl,
  94. _1,
  95. l1,
  96. m1,
  97. n0,
  98. n1,
  99. rt
  100. } from "./chunk-POAJ2YNP.js";
  101. import {
  102. $O,
  103. BO,
  104. Gf,
  105. Po,
  106. QC,
  107. e_,
  108. r_,
  109. require_react_dom,
  110. sC,
  111. t_,
  112. um
  113. } from "./chunk-GBYP4PB2.js";
  114. import "./chunk-PZD7N4BC.js";
  115. import {
  116. Yx
  117. } from "./chunk-2MK3Q52E.js";
  118. import "./chunk-BSDDCPAW.js";
  119. import "./chunk-QG2HZMYH.js";
  120. import {
  121. Fe,
  122. K0,
  123. Mf,
  124. N0,
  125. Nt,
  126. OR,
  127. Observable,
  128. Ot,
  129. Pt,
  130. Ra,
  131. SE,
  132. Vn,
  133. Vr,
  134. W0,
  135. Ze,
  136. _n,
  137. aR,
  138. ar,
  139. b0,
  140. bufferTime,
  141. cn,
  142. debounceTime,
  143. en,
  144. filter,
  145. kt,
  146. merge,
  147. mu,
  148. nR,
  149. nt,
  150. nu,
  151. ot,
  152. qt,
  153. rR,
  154. re,
  155. tr,
  156. we,
  157. z0
  158. } from "./chunk-23V3HWTR.js";
  159. import {
  160. require_react
  161. } from "./chunk-GNR2UJZM.js";
  162. import {
  163. __toESM
  164. } from "./chunk-2LSFTFF7.js";
  165. // node_modules/.pnpm/@univerjs+sheets-conditional-formatting-ui@0.5.5_@grpc+grpc-js@1.13.4_react-dom@18.3.1_react@_h4gcegjyobiq65nckvs3tiw5ty/node_modules/@univerjs/sheets-conditional-formatting-ui/lib/es/index.js
  166. var import_react = __toESM(require_react());
  167. var import_react_dom = __toESM(require_react_dom());
  168. var ho = Object.defineProperty;
  169. var po2 = (t, e, r) => e in t ? ho(t, e, { enumerable: true, configurable: true, writable: true, value: r }) : t[e] = r;
  170. var Xe = (t, e, r) => po2(t, typeof e != "symbol" ? e + "" : e, r);
  171. var Mi = {
  172. type: ar.COMMAND,
  173. id: "sheet.command.add-average-conditional-rule",
  174. handler(t, e) {
  175. if (!e)
  176. return false;
  177. const { ranges: r, style: n, stopIfTrue: i, operator: o } = e, c = t.get(B), v = t.get(Pt), d = t.get(_n), y3 = N(d);
  178. if (!y3)
  179. return false;
  180. const { unitId: p, subUnitId: C } = y3, _ = c.createCfId(p, C), w2 = {
  181. ranges: r,
  182. cfId: _,
  183. stopIfTrue: !!i,
  184. rule: {
  185. type: y.highlightCell,
  186. subType: E.average,
  187. operator: o,
  188. style: n
  189. }
  190. };
  191. return v.executeCommand(T2.id, { unitId: p, subUnitId: C, rule: w2 });
  192. }
  193. };
  194. var Pn = {
  195. type: ar.COMMAND,
  196. id: "sheet.command.add-conditional-rule",
  197. handler(t, e) {
  198. if (!e)
  199. return false;
  200. const { rule: r } = e, n = t.get(cn), i = t.get(Pt), o = t.get(B), c = t.get(_n), v = N(c);
  201. if (!v)
  202. return false;
  203. const { unitId: d, subUnitId: y3 } = v, p = o.createCfId(d, y3), C = { unitId: d, subUnitId: y3, rule: { ...r, cfId: r.cfId || p } }, _ = b1(t, C), w2 = i.syncExecuteCommand(T2.id, C);
  204. return w2 && n.pushUndoRedo({
  205. unitID: d,
  206. redoMutations: [{ id: T2.id, params: C }],
  207. undoMutations: [_]
  208. }), w2;
  209. }
  210. };
  211. var Ni = {
  212. type: ar.COMMAND,
  213. id: "sheet.command.add-color-scale-conditional-rule",
  214. handler(t, e) {
  215. if (!e)
  216. return false;
  217. const { ranges: r, config: n, stopIfTrue: i } = e, o = t.get(B), c = t.get(Pt), v = t.get(_n), d = N(v);
  218. if (!d)
  219. return false;
  220. const { unitId: y3, subUnitId: p } = d, C = o.createCfId(y3, p), _ = {
  221. ranges: r,
  222. cfId: C,
  223. stopIfTrue: !!i,
  224. rule: {
  225. type: y.colorScale,
  226. config: n
  227. }
  228. };
  229. return c.executeCommand(T2.id, { unitId: y3, subUnitId: p, rule: _ });
  230. }
  231. };
  232. var ji = {
  233. type: ar.COMMAND,
  234. id: "sheet.command.add-data-bar-conditional-rule",
  235. handler(t, e) {
  236. if (!e)
  237. return false;
  238. const { ranges: r, min: n, max: i, nativeColor: o, positiveColor: c, isGradient: v, stopIfTrue: d, isShowValue: y3 } = e, p = t.get(B), C = t.get(_n), _ = N(C);
  239. if (!_)
  240. return false;
  241. const { unitId: w2, subUnitId: S } = _, R3 = t.get(Pt), h = p.createCfId(w2, S), s = {
  242. ranges: r,
  243. cfId: h,
  244. stopIfTrue: !!d,
  245. rule: {
  246. type: y.dataBar,
  247. isShowValue: y3,
  248. config: {
  249. min: n,
  250. max: i,
  251. nativeColor: o,
  252. positiveColor: c,
  253. isGradient: v
  254. }
  255. }
  256. };
  257. return R3.executeCommand(T2.id, { unitId: w2, subUnitId: S, rule: s });
  258. }
  259. };
  260. var Li = {
  261. type: ar.COMMAND,
  262. id: "sheet.command.add-duplicate-values-conditional-rule",
  263. handler(t, e) {
  264. if (!e)
  265. return false;
  266. const { ranges: r, style: n, stopIfTrue: i } = e, o = t.get(B), c = t.get(Pt), v = t.get(_n), d = N(v);
  267. if (!d)
  268. return false;
  269. const { unitId: y3, subUnitId: p } = d, C = o.createCfId(y3, p), _ = {
  270. ranges: r,
  271. cfId: C,
  272. stopIfTrue: !!i,
  273. rule: {
  274. type: y.highlightCell,
  275. subType: E.duplicateValues,
  276. style: n
  277. }
  278. };
  279. return c.executeCommand(T2.id, { unitId: y3, subUnitId: p, rule: _ });
  280. }
  281. };
  282. var $i = {
  283. type: ar.COMMAND,
  284. id: "sheet.command.add-number-conditional-rule",
  285. handler(t, e) {
  286. if (!e)
  287. return false;
  288. const { ranges: r, style: n, stopIfTrue: i, operator: o, value: c } = e, v = t.get(B), d = t.get(Pt), y3 = t.get(_n), p = N(y3);
  289. if (!p)
  290. return false;
  291. const { unitId: C, subUnitId: _ } = p, w2 = v.createCfId(C, _);
  292. let S;
  293. if ([w.between, w.notBetween].includes(o)) {
  294. const R3 = c;
  295. if (R3.length !== 2 || !Array.isArray(R3))
  296. return false;
  297. S = {
  298. ranges: r,
  299. cfId: w2,
  300. stopIfTrue: !!i,
  301. rule: {
  302. type: y.highlightCell,
  303. subType: E.number,
  304. operator: o,
  305. style: n,
  306. value: R3
  307. }
  308. };
  309. } else {
  310. const R3 = c;
  311. if (typeof R3 != "number")
  312. return false;
  313. S = {
  314. ranges: r,
  315. cfId: w2,
  316. stopIfTrue: !!i,
  317. rule: {
  318. type: y.highlightCell,
  319. subType: E.number,
  320. operator: o,
  321. style: n,
  322. value: R3
  323. }
  324. };
  325. }
  326. return d.executeCommand(T2.id, { unitId: C, subUnitId: _, rule: S });
  327. }
  328. };
  329. var zi = {
  330. type: ar.COMMAND,
  331. id: "sheet.command.add-rank-conditional-rule",
  332. handler(t, e) {
  333. if (!e)
  334. return false;
  335. const { ranges: r, style: n, stopIfTrue: i, isPercent: o, isBottom: c, value: v } = e, d = t.get(B), y3 = t.get(_n), p = t.get(Pt), C = N(y3);
  336. if (!C)
  337. return false;
  338. const { unitId: _, subUnitId: w2 } = C, S = d.createCfId(_, w2), R3 = {
  339. ranges: r,
  340. cfId: S,
  341. stopIfTrue: !!i,
  342. rule: {
  343. type: y.highlightCell,
  344. subType: E.rank,
  345. isPercent: o,
  346. isBottom: c,
  347. style: n,
  348. value: v
  349. }
  350. };
  351. return p.executeCommand(T2.id, { unitId: _, subUnitId: w2, rule: R3 });
  352. }
  353. };
  354. var Fi = {
  355. type: ar.COMMAND,
  356. id: "sheet.command.add-text-conditional-rule",
  357. handler(t, e) {
  358. if (!e)
  359. return false;
  360. const { ranges: r, style: n, stopIfTrue: i, operator: o, value: c } = e, v = t.get(B), d = t.get(_n), y3 = N(d);
  361. if (!y3)
  362. return false;
  363. const { unitId: p, subUnitId: C } = y3, _ = t.get(Pt), w2 = v.createCfId(p, C), S = {
  364. ranges: r,
  365. cfId: w2,
  366. stopIfTrue: !!i,
  367. rule: {
  368. type: y.highlightCell,
  369. subType: E.text,
  370. operator: o,
  371. style: n,
  372. value: c
  373. }
  374. };
  375. return _.executeCommand(T2.id, { unitId: p, subUnitId: C, rule: S });
  376. }
  377. };
  378. var Vi = {
  379. type: ar.COMMAND,
  380. id: "sheet.command.add-time-period-conditional-rule",
  381. handler(t, e) {
  382. if (!e)
  383. return false;
  384. const { ranges: r, style: n, stopIfTrue: i, operator: o } = e, c = t.get(B), v = t.get(_n), d = t.get(Pt), y3 = N(v);
  385. if (!y3)
  386. return false;
  387. const { unitId: p, subUnitId: C } = y3, _ = c.createCfId(p, C), w2 = {
  388. ranges: r,
  389. cfId: _,
  390. stopIfTrue: !!i,
  391. rule: {
  392. type: y.highlightCell,
  393. subType: E.timePeriod,
  394. operator: o,
  395. style: n
  396. }
  397. };
  398. return d.executeCommand(T2.id, { unitId: p, subUnitId: C, rule: w2 });
  399. }
  400. };
  401. var qi = {
  402. type: ar.COMMAND,
  403. id: "sheet.command.add-uniqueValues-conditional-rule",
  404. handler(t, e) {
  405. if (!e)
  406. return false;
  407. const { ranges: r, style: n, stopIfTrue: i } = e, o = t.get(B), c = t.get(_n), v = t.get(Pt), d = N(c);
  408. if (!d)
  409. return false;
  410. const { unitId: y3, subUnitId: p } = d, C = o.createCfId(y3, p), _ = {
  411. ranges: r,
  412. cfId: C,
  413. stopIfTrue: !!i,
  414. rule: {
  415. type: y.highlightCell,
  416. subType: E.uniqueValues,
  417. style: n
  418. }
  419. };
  420. return v.executeCommand(T2.id, { unitId: y3, subUnitId: p, rule: _ });
  421. }
  422. };
  423. var ar3 = {
  424. type: ar.COMMAND,
  425. id: "sheet.command.clear-range-conditional-rule",
  426. handler(t, e) {
  427. var R3;
  428. if (!e)
  429. return false;
  430. const r = t.get(B), n = t.get(_n), i = t.get(Pt), o = t.get(cn), c = t.get(F), v = N(n, e);
  431. if (!v)
  432. return false;
  433. const { unitId: d, subUnitId: y3 } = v, p = ((R3 = c.getCurrentSelections()) == null ? void 0 : R3.map((h) => h.range)) || [], C = r.getSubunitRules(d, y3);
  434. if (!(C != null && C.length) || !p.length)
  435. return false;
  436. const _ = [], w2 = [];
  437. C.forEach((h) => {
  438. const s = new kt();
  439. h.ranges.forEach((u) => {
  440. tr.foreach(u, (b, l) => {
  441. s.setValue(b, l, 1);
  442. });
  443. }), p.forEach((u) => {
  444. tr.foreach(u, (b, l) => {
  445. s.realDeleteValue(b, l);
  446. });
  447. });
  448. const a = jr(xl(s));
  449. if (a.length) {
  450. const u = { ...h, ranges: a }, b = { unitId: d, subUnitId: y3, rule: u }, l = L1(t, b);
  451. _.push({ id: U2.id, params: b }), w2.push(...l);
  452. } else {
  453. const u = { unitId: d, subUnitId: y3, cfId: h.cfId }, b = z02(t, u);
  454. _.push({ id: E2.id, params: u }), w2.push(...b);
  455. }
  456. });
  457. const S = mu(_, i).result;
  458. return S && o.pushUndoRedo({
  459. unitID: d,
  460. redoMutations: _,
  461. undoMutations: w2
  462. }), S;
  463. }
  464. };
  465. var On = {
  466. type: ar.COMMAND,
  467. id: "sheet.command.clear-worksheet-conditional-rule",
  468. handler(t, e) {
  469. const r = t.get(B), n = t.get(_n), i = t.get(Pt), o = t.get(cn), c = N(n, e);
  470. if (!c)
  471. return false;
  472. const { unitId: v, subUnitId: d } = c, y3 = r.getSubunitRules(v, d);
  473. if (!(y3 != null && y3.length))
  474. return false;
  475. const p = y3.map((S) => ({ cfId: S.cfId, unitId: v, subUnitId: d })), C = p.map((S) => ({ id: E2.id, params: S })), _ = p.map((S) => z02(t, S)[0]), w2 = mu(C, i).result;
  476. return w2 && o.pushUndoRedo({
  477. unitID: v,
  478. redoMutations: C,
  479. undoMutations: _
  480. }), w2;
  481. }
  482. };
  483. var mn = {
  484. type: ar.COMMAND,
  485. id: "sheet.command.delete-conditional-rule",
  486. handler(t, e) {
  487. if (!e)
  488. return false;
  489. const r = t.get(cn), n = t.get(Pt), i = t.get(_n), o = N(i, e);
  490. if (!o)
  491. return false;
  492. const { unitId: c, subUnitId: v } = o, d = { unitId: c, subUnitId: v, cfId: e.cfId }, y3 = z02(t, d), p = n.syncExecuteCommand(E2.id, d);
  493. return p && r.pushUndoRedo({ unitID: c, undoMutations: y3, redoMutations: [{ id: E2.id, params: d }] }), p;
  494. }
  495. };
  496. var lr = {
  497. type: ar.COMMAND,
  498. id: "sheet.command.move-conditional-rule",
  499. handler(t, e) {
  500. if (!e)
  501. return false;
  502. const r = t.get(cn), n = t.get(Pt), i = t.get(_n), o = t.get(B), c = N(i, e);
  503. if (!c)
  504. return false;
  505. const { unitId: v, subUnitId: d } = c, y3 = f0(e.start, e.end, o.getSubunitRules(v, d) || [], (R3) => R3.cfId);
  506. if (!y3)
  507. return false;
  508. const [p, C] = y3, _ = { unitId: v, subUnitId: d, start: p, end: C }, w2 = I1(_), S = n.syncExecuteCommand(v2.id, _);
  509. return S && r.pushUndoRedo({
  510. unitID: v,
  511. redoMutations: [{ id: v2.id, params: _ }],
  512. undoMutations: w2
  513. }), S;
  514. }
  515. };
  516. var cr = {
  517. type: ar.COMMAND,
  518. id: "sheet.command.set-conditional-rule",
  519. handler(t, e) {
  520. if (!e)
  521. return false;
  522. const r = t.get(cn), n = t.get(Pt), i = t.get(_n), o = N(i, e);
  523. if (!o)
  524. return false;
  525. const { unitId: c, subUnitId: v } = o, d = { unitId: c, subUnitId: v, rule: e.rule }, y3 = L1(t, d), p = n.syncExecuteCommand(U2.id, d);
  526. return p && r.pushUndoRedo({ unitID: c, undoMutations: y3, redoMutations: [{ id: U2.id, params: d }] }), p;
  527. }
  528. };
  529. function hs(t) {
  530. return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
  531. }
  532. function Ai(t) {
  533. if (t.__esModule)
  534. return t;
  535. var e = t.default;
  536. if (typeof e == "function") {
  537. var r = function n() {
  538. return this instanceof n ? Reflect.construct(e, arguments, this.constructor) : e.apply(this, arguments);
  539. };
  540. r.prototype = e.prototype;
  541. } else
  542. r = {};
  543. return Object.defineProperty(r, "__esModule", { value: true }), Object.keys(t).forEach(function(n) {
  544. var i = Object.getOwnPropertyDescriptor(t, n);
  545. Object.defineProperty(r, n, i.get ? i : {
  546. enumerable: true,
  547. get: function() {
  548. return t[n];
  549. }
  550. });
  551. }), r;
  552. }
  553. var qn2 = { exports: {} };
  554. var wt = {};
  555. var Rr;
  556. function ps() {
  557. if (Rr)
  558. return wt;
  559. Rr = 1;
  560. var t = import_react.default, e = Symbol.for("react.element"), r = Symbol.for("react.fragment"), n = Object.prototype.hasOwnProperty, i = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, o = { key: true, ref: true, __self: true, __source: true };
  561. function c(v, d, y3) {
  562. var p, C = {}, _ = null, w2 = null;
  563. y3 !== void 0 && (_ = "" + y3), d.key !== void 0 && (_ = "" + d.key), d.ref !== void 0 && (w2 = d.ref);
  564. for (p in d)
  565. n.call(d, p) && !o.hasOwnProperty(p) && (C[p] = d[p]);
  566. if (v && v.defaultProps)
  567. for (p in d = v.defaultProps, d)
  568. C[p] === void 0 && (C[p] = d[p]);
  569. return { $$typeof: e, type: v, key: _, ref: w2, props: C, _owner: i.current };
  570. }
  571. return wt.Fragment = r, wt.jsx = c, wt.jsxs = c, wt;
  572. }
  573. var _r;
  574. function gs() {
  575. return _r || (_r = 1, qn2.exports = ps()), qn2.exports;
  576. }
  577. var x3 = gs();
  578. var ms = "univer-conditional-formatting-wrap";
  579. var vs = "univer-cf-rule-item";
  580. var ys = "univer-preview";
  581. var bs = "univer-create-rule";
  582. var Ss = "univer-button";
  583. var Cs = "univer-title";
  584. var ws = "univer-label";
  585. var Rs = "univer-label-container";
  586. var _s2 = "univer-input-width";
  587. var xs = "univer-m-t-base";
  588. var Is = "univer-m-t-sm";
  589. var Es = "univer-m-t-xl";
  590. var Ts = "univer-m-l-sm";
  591. var Ps = "univer-m-l-xl";
  592. var Os = "univer-m-l-xxs";
  593. var Ds = "univer-m-l-0";
  594. var Ms = "univer-m-r-0";
  595. var $ = {
  596. conditionalFormattingWrap: ms,
  597. cfRuleItem: vs,
  598. preview: ys,
  599. createRule: bs,
  600. button: Ss,
  601. title: Cs,
  602. label: ws,
  603. labelContainer: Rs,
  604. inputWidth: _s2,
  605. mTBase: xs,
  606. mTSm: Is,
  607. mTXl: Es,
  608. mLSm: Ts,
  609. mLXl: Ps,
  610. mLXxs: Os,
  611. mL0: Ds,
  612. mR0: Ms
  613. };
  614. var Oe = function() {
  615. return Oe = Object.assign || function(t) {
  616. for (var e, r = 1, n = arguments.length; r < n; r++) {
  617. e = arguments[r];
  618. for (var i in e)
  619. Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
  620. }
  621. return t;
  622. }, Oe.apply(this, arguments);
  623. };
  624. var Ns = function(t, e) {
  625. var r = {};
  626. for (var n in t)
  627. Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]);
  628. if (t != null && typeof Object.getOwnPropertySymbols == "function")
  629. for (var i = 0, n = Object.getOwnPropertySymbols(t); i < n.length; i++)
  630. e.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[i]) && (r[n[i]] = t[n[i]]);
  631. return r;
  632. };
  633. var bt = (0, import_react.forwardRef)(function(t, e) {
  634. var r = t.icon, n = t.id, i = t.className, o = t.extend, c = Ns(t, ["icon", "id", "className", "extend"]), v = "univerjs-icon univerjs-icon-".concat(n, " ").concat(i || "").trim(), d = (0, import_react.useRef)("_".concat($s()));
  635. return Wi(r, "".concat(n), { defIds: r.defIds, idSuffix: d.current }, Oe({ ref: e, className: v }, c), o);
  636. });
  637. function Wi(t, e, r, n, i) {
  638. return (0, import_react.createElement)(t.tag, Oe(Oe({ key: e }, js(t, r, i)), n), (Ls(t, r).children || []).map(function(o, c) {
  639. return Wi(o, "".concat(e, "-").concat(t.tag, "-").concat(c), r, void 0, i);
  640. }));
  641. }
  642. function js(t, e, r) {
  643. var n = Oe({}, t.attrs);
  644. r != null && r.colorChannel1 && n.fill === "colorChannel1" && (n.fill = r.colorChannel1);
  645. var i = e.defIds;
  646. return !i || i.length === 0 || (t.tag === "use" && n["xlink:href"] && (n["xlink:href"] = n["xlink:href"] + e.idSuffix), Object.entries(n).forEach(function(o) {
  647. var c = o[0], v = o[1];
  648. typeof v == "string" && (n[c] = v.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
  649. })), n;
  650. }
  651. function Ls(t, e) {
  652. var r, n = e.defIds;
  653. return !n || n.length === 0 ? t : t.tag === "defs" && (!((r = t.children) === null || r === void 0) && r.length) ? Oe(Oe({}, t), { children: t.children.map(function(i) {
  654. return typeof i.attrs.id == "string" && n && n.indexOf(i.attrs.id) > -1 ? Oe(Oe({}, i), { attrs: Oe(Oe({}, i.attrs), { id: i.attrs.id + e.idSuffix }) }) : i;
  655. }) }) : t;
  656. }
  657. function $s() {
  658. return Math.random().toString(36).substring(2, 8);
  659. }
  660. bt.displayName = "UniverIcon";
  661. var zs = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443zM6.12398 8.30171C6.35829 8.0674 6.73819 8.0674 6.97251 8.30171L8.00007 9.32928 9.02764 8.30171C9.26195 8.0674 9.64185 8.0674 9.87617 8.30171 10.1105 8.53603 10.1105 8.91593 9.87617 9.15024L8.8486 10.1778 9.87617 11.2054C10.1105 11.4397 10.1105 11.8196 9.87617 12.0539 9.64185 12.2882 9.26195 12.2882 9.02764 12.0539L8.00007 11.0263 6.97251 12.0539C6.73819 12.2882 6.35829 12.2882 6.12398 12.0539 5.88966 11.8196 5.88966 11.4397 6.12398 11.2054L7.15154 10.1778 6.12398 9.15024C5.88966 8.91593 5.88966 8.53603 6.12398 8.30171z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V12.5331C3.15332 13.9691 4.31738 15.1332 5.75332 15.1332H10.2465C11.6825 15.1332 12.8465 13.9691 12.8465 12.5331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V12.5331C11.6465 13.3063 11.0197 13.9332 10.2465 13.9332H5.75332C4.98012 13.9332 4.35332 13.3063 4.35332 12.5331V6.82217Z", fillRule: "evenodd", clipRule: "evenodd" } }] };
  662. var dn = (0, import_react.forwardRef)(function(t, e) {
  663. return (0, import_react.createElement)(bt, Object.assign({}, t, {
  664. id: "delete-single",
  665. ref: e,
  666. icon: zs
  667. }));
  668. });
  669. dn.displayName = "DeleteSingle";
  670. var Fs = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z" } }] };
  671. var Hi = (0, import_react.forwardRef)(function(t, e) {
  672. return (0, import_react.createElement)(bt, Object.assign({}, t, {
  673. id: "increase-single",
  674. ref: e,
  675. icon: Fs
  676. }));
  677. });
  678. Hi.displayName = "IncreaseSingle";
  679. var Vs = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M11.3536 6.14645C11.5488 6.34171 11.5488 6.65829 11.3536 6.85355L8.35355 9.85355C8.15829 10.0488 7.84171 10.0488 7.64645 9.85355L4.64645 6.85355C4.45118 6.65829 4.45118 6.34171 4.64645 6.14645C4.84171 5.95118 5.15829 5.95118 5.35355 6.14645L8 8.79289L10.6464 6.14645C10.8417 5.95118 11.1583 5.95118 11.3536 6.14645Z", fillRule: "evenodd", clipRule: "evenodd" } }] };
  680. var Dn = (0, import_react.forwardRef)(function(t, e) {
  681. return (0, import_react.createElement)(bt, Object.assign({}, t, {
  682. id: "more-down-single",
  683. ref: e,
  684. icon: Vs
  685. }));
  686. });
  687. Dn.displayName = "MoreDownSingle";
  688. var qs = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "mask", attrs: { id: "mask0_622_8", style: { maskType: "alpha" }, width: 16, height: 16, x: 0, y: 0, maskUnits: "userSpaceOnUse" }, children: [{ tag: "path", attrs: { fill: "#D9D9D9", d: "M0 0H16V16H0z" } }] }, { tag: "g", attrs: { fill: "currentColor", mask: "url(#mask0_622_8)" }, children: [{ tag: "path", attrs: { d: "M6 5C6.55228 5 7 4.55228 7 4 7 3.44772 6.55228 3 6 3 5.44772 3 5 3.44772 5 4 5 4.55228 5.44772 5 6 5zM6 9C6.55228 9 7 8.55229 7 8 7 7.44772 6.55228 7 6 7 5.44772 7 5 7.44772 5 8 5 8.55229 5.44772 9 6 9zM7 12C7 12.5523 6.55228 13 6 13 5.44772 13 5 12.5523 5 12 5 11.4477 5.44772 11 6 11 6.55228 11 7 11.4477 7 12zM10 5C10.5523 5 11 4.55228 11 4 11 3.44772 10.5523 3 10 3 9.44771 3 9 3.44772 9 4 9 4.55228 9.44771 5 10 5zM11 8C11 8.55229 10.5523 9 10 9 9.44771 9 9 8.55229 9 8 9 7.44772 9.44771 7 10 7 10.5523 7 11 7.44772 11 8zM10 13C10.5523 13 11 12.5523 11 12 11 11.4477 10.5523 11 10 11 9.44771 11 9 11.4477 9 12 9 12.5523 9.44771 13 10 13z" } }] }] };
  689. var Ui = (0, import_react.forwardRef)(function(t, e) {
  690. return (0, import_react.createElement)(bt, Object.assign({}, t, {
  691. id: "sequence-single",
  692. ref: e,
  693. icon: qs
  694. }));
  695. });
  696. Ui.displayName = "SequenceSingle";
  697. var As = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 17 17", width: "1em", height: "1em" }, children: [{ tag: "mask", attrs: { id: "mask0_436_41", style: { maskType: "alpha" }, width: 17, height: 17, x: 0, y: 0, maskUnits: "userSpaceOnUse" }, children: [{ tag: "path", attrs: { fill: "#D9D9D9", d: "M0.35 0.48H16.35V16.48H0.35z" } }] }, { tag: "g", attrs: { mask: "url(#mask0_436_41)", fillRule: "evenodd", clipRule: "evenodd" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M2.27177 13.714L13.5855 2.40025L14.434 3.24878L3.1203 14.5625L2.27177 13.714Z" } }, { tag: "path", attrs: { fill: "#E5E5E5", d: "M4.2603 1.82495L2.89617 1.82495C2.23343 1.82495 1.69617 2.36221 1.69617 3.02495L1.69617 4.38908L3.02617 4.38908L3.02617 3.15495L4.2603 3.15495L4.2603 1.82495ZM15.0092 4.38908L15.0092 3.02495C15.0092 2.36221 14.4719 1.82495 13.8092 1.82495L12.4451 1.82495L12.4451 3.15495L13.6792 3.15495L13.6792 4.38908L15.0092 4.38908ZM6.98856 1.82495L6.98856 3.15495L9.71681 3.15495L9.71681 1.82495L6.98856 1.82495ZM15.0092 7.11734L13.6792 7.11734L13.6792 9.84559L15.0092 9.84559L15.0092 7.11734ZM15.0092 12.5739L13.6792 12.5739L13.6792 13.808L12.4451 13.808L12.4451 15.138L13.8092 15.138C14.4719 15.138 15.0092 14.6007 15.0092 13.938L15.0092 12.5739ZM9.71681 15.138L9.71681 13.808L6.98856 13.808L6.98856 15.138L9.71681 15.138ZM4.2603 15.138L4.2603 13.808L3.02617 13.808L3.02617 12.5739L1.69617 12.5739L1.69617 13.938C1.69617 14.6007 2.23343 15.138 2.89617 15.138L4.2603 15.138ZM1.69617 9.8456L3.02617 9.8456L3.02617 7.11734L1.69617 7.11734L1.69617 9.8456Z" } }] }] };
  698. var Zt = (0, import_react.forwardRef)(function(t, e) {
  699. return (0, import_react.createElement)(bt, Object.assign({}, t, {
  700. id: "slash-single",
  701. ref: e,
  702. icon: As
  703. }));
  704. });
  705. Zt.displayName = "SlashSingle";
  706. var An = { exports: {} };
  707. var Rt = {};
  708. var zt2 = { exports: {} };
  709. var Ws = zt2.exports;
  710. var xr;
  711. function ur() {
  712. return xr || (xr = 1, function(t, e) {
  713. (function(r, n) {
  714. n(e);
  715. })(Ws, function(r) {
  716. function n(V2) {
  717. return function(ce, E3, T, D, L, B2, q) {
  718. return V2(ce, E3, q);
  719. };
  720. }
  721. function i(V2) {
  722. return function(ce, E3, T, D) {
  723. if (!ce || !E3 || typeof ce != "object" || typeof E3 != "object")
  724. return V2(ce, E3, T, D);
  725. var L = D.get(ce), B2 = D.get(E3);
  726. if (L && B2)
  727. return L === E3 && B2 === ce;
  728. D.set(ce, E3), D.set(E3, ce);
  729. var q = V2(ce, E3, T, D);
  730. return D.delete(ce), D.delete(E3), q;
  731. };
  732. }
  733. function o(V2, Z) {
  734. var ce = {};
  735. for (var E3 in V2)
  736. ce[E3] = V2[E3];
  737. for (var E3 in Z)
  738. ce[E3] = Z[E3];
  739. return ce;
  740. }
  741. function c(V2) {
  742. return V2.constructor === Object || V2.constructor == null;
  743. }
  744. function v(V2) {
  745. return typeof V2.then == "function";
  746. }
  747. function d(V2, Z) {
  748. return V2 === Z || V2 !== V2 && Z !== Z;
  749. }
  750. var y3 = "[object Arguments]", p = "[object Boolean]", C = "[object Date]", _ = "[object RegExp]", w2 = "[object Map]", S = "[object Number]", R3 = "[object Object]", h = "[object Set]", s = "[object String]", a = Object.prototype.toString;
  751. function u(V2) {
  752. var Z = V2.areArraysEqual, ce = V2.areDatesEqual, E3 = V2.areMapsEqual, T = V2.areObjectsEqual, D = V2.areRegExpsEqual, L = V2.areSetsEqual, B2 = V2.createIsNestedEqual, q = B2(Y2);
  753. function Y2(X, ne, pe) {
  754. if (X === ne)
  755. return true;
  756. if (!X || !ne || typeof X != "object" || typeof ne != "object")
  757. return X !== X && ne !== ne;
  758. if (c(X) && c(ne))
  759. return T(X, ne, q, pe);
  760. var et2 = Array.isArray(X), Pe2 = Array.isArray(ne);
  761. if (et2 || Pe2)
  762. return et2 === Pe2 && Z(X, ne, q, pe);
  763. var Ce = a.call(X);
  764. return Ce !== a.call(ne) ? false : Ce === C ? ce(X, ne, q, pe) : Ce === _ ? D(X, ne, q, pe) : Ce === w2 ? E3(X, ne, q, pe) : Ce === h ? L(X, ne, q, pe) : Ce === R3 || Ce === y3 ? v(X) || v(ne) ? false : T(X, ne, q, pe) : Ce === p || Ce === S || Ce === s ? d(X.valueOf(), ne.valueOf()) : false;
  765. }
  766. return Y2;
  767. }
  768. function b(V2, Z, ce, E3) {
  769. var T = V2.length;
  770. if (Z.length !== T)
  771. return false;
  772. for (; T-- > 0; )
  773. if (!ce(V2[T], Z[T], T, T, V2, Z, E3))
  774. return false;
  775. return true;
  776. }
  777. var l = i(b);
  778. function g(V2, Z) {
  779. return d(V2.valueOf(), Z.valueOf());
  780. }
  781. function f(V2, Z, ce, E3) {
  782. var T = V2.size === Z.size;
  783. if (!T)
  784. return false;
  785. if (!V2.size)
  786. return true;
  787. var D = {}, L = 0;
  788. return V2.forEach(function(B2, q) {
  789. if (T) {
  790. var Y2 = false, X = 0;
  791. Z.forEach(function(ne, pe) {
  792. !Y2 && !D[X] && (Y2 = ce(q, pe, L, X, V2, Z, E3) && ce(B2, ne, q, pe, V2, Z, E3)) && (D[X] = true), X++;
  793. }), L++, T = Y2;
  794. }
  795. }), T;
  796. }
  797. var m = i(f), P = "_owner", M2 = Object.prototype.hasOwnProperty;
  798. function j2(V2, Z, ce, E3) {
  799. var T = Object.keys(V2), D = T.length;
  800. if (Object.keys(Z).length !== D)
  801. return false;
  802. for (var L; D-- > 0; ) {
  803. if (L = T[D], L === P) {
  804. var B2 = !!V2.$$typeof, q = !!Z.$$typeof;
  805. if ((B2 || q) && B2 !== q)
  806. return false;
  807. }
  808. if (!M2.call(Z, L) || !ce(V2[L], Z[L], L, L, V2, Z, E3))
  809. return false;
  810. }
  811. return true;
  812. }
  813. var N3 = i(j2);
  814. function I(V2, Z) {
  815. return V2.source === Z.source && V2.flags === Z.flags;
  816. }
  817. function O(V2, Z, ce, E3) {
  818. var T = V2.size === Z.size;
  819. if (!T)
  820. return false;
  821. if (!V2.size)
  822. return true;
  823. var D = {};
  824. return V2.forEach(function(L, B2) {
  825. if (T) {
  826. var q = false, Y2 = 0;
  827. Z.forEach(function(X, ne) {
  828. !q && !D[Y2] && (q = ce(L, X, B2, ne, V2, Z, E3)) && (D[Y2] = true), Y2++;
  829. }), T = q;
  830. }
  831. }), T;
  832. }
  833. var z = i(O), U = Object.freeze({
  834. areArraysEqual: b,
  835. areDatesEqual: g,
  836. areMapsEqual: f,
  837. areObjectsEqual: j2,
  838. areRegExpsEqual: I,
  839. areSetsEqual: O,
  840. createIsNestedEqual: n
  841. }), k = Object.freeze({
  842. areArraysEqual: l,
  843. areDatesEqual: g,
  844. areMapsEqual: m,
  845. areObjectsEqual: N3,
  846. areRegExpsEqual: I,
  847. areSetsEqual: z,
  848. createIsNestedEqual: n
  849. }), ie = u(U);
  850. function ee(V2, Z) {
  851. return ie(V2, Z, void 0);
  852. }
  853. var A = u(o(U, { createIsNestedEqual: function() {
  854. return d;
  855. } }));
  856. function F2(V2, Z) {
  857. return A(V2, Z, void 0);
  858. }
  859. var oe = u(k);
  860. function se(V2, Z) {
  861. return oe(V2, Z, /* @__PURE__ */ new WeakMap());
  862. }
  863. var de = u(o(k, {
  864. createIsNestedEqual: function() {
  865. return d;
  866. }
  867. }));
  868. function ye(V2, Z) {
  869. return de(V2, Z, /* @__PURE__ */ new WeakMap());
  870. }
  871. function Ee(V2) {
  872. return u(o(U, V2(U)));
  873. }
  874. function $e2(V2) {
  875. var Z = u(o(k, V2(k)));
  876. return function(ce, E3, T) {
  877. return T === void 0 && (T = /* @__PURE__ */ new WeakMap()), Z(ce, E3, T);
  878. };
  879. }
  880. r.circularDeepEqual = se, r.circularShallowEqual = ye, r.createCustomCircularEqual = $e2, r.createCustomEqual = Ee, r.deepEqual = ee, r.sameValueZeroEqual = d, r.shallowEqual = F2, Object.defineProperty(r, "__esModule", { value: true });
  881. });
  882. }(zt2, zt2.exports)), zt2.exports;
  883. }
  884. var Qt = { exports: {} };
  885. var Ir;
  886. function dr() {
  887. if (Ir)
  888. return Qt.exports;
  889. Ir = 1;
  890. function t(r) {
  891. var n, i, o = "";
  892. if (typeof r == "string" || typeof r == "number")
  893. o += r;
  894. else if (typeof r == "object")
  895. if (Array.isArray(r)) {
  896. var c = r.length;
  897. for (n = 0; n < c; n++)
  898. r[n] && (i = t(r[n])) && (o && (o += " "), o += i);
  899. } else
  900. for (i in r)
  901. r[i] && (o && (o += " "), o += i);
  902. return o;
  903. }
  904. function e() {
  905. for (var r, n, i = 0, o = "", c = arguments.length; i < c; i++)
  906. (r = arguments[i]) && (n = t(r)) && (o && (o += " "), o += n);
  907. return o;
  908. }
  909. return Qt.exports = e, Qt.exports.clsx = e, Qt.exports;
  910. }
  911. var ae = {};
  912. var Wn;
  913. var Er;
  914. function Hs() {
  915. return Er || (Er = 1, Wn = function(e, r, n) {
  916. return e === r ? true : e.className === r.className && n(e.style, r.style) && e.width === r.width && e.autoSize === r.autoSize && e.cols === r.cols && e.draggableCancel === r.draggableCancel && e.draggableHandle === r.draggableHandle && n(e.verticalCompact, r.verticalCompact) && n(e.compactType, r.compactType) && n(e.layout, r.layout) && n(e.margin, r.margin) && n(e.containerPadding, r.containerPadding) && e.rowHeight === r.rowHeight && e.maxRows === r.maxRows && e.isBounded === r.isBounded && e.isDraggable === r.isDraggable && e.isResizable === r.isResizable && e.allowOverlap === r.allowOverlap && e.preventCollision === r.preventCollision && e.useCSSTransforms === r.useCSSTransforms && e.transformScale === r.transformScale && e.isDroppable === r.isDroppable && n(e.resizeHandles, r.resizeHandles) && n(e.resizeHandle, r.resizeHandle) && e.onLayoutChange === r.onLayoutChange && e.onDragStart === r.onDragStart && e.onDrag === r.onDrag && e.onDragStop === r.onDragStop && e.onResizeStart === r.onResizeStart && e.onResize === r.onResize && e.onResizeStop === r.onResizeStop && e.onDrop === r.onDrop && n(e.droppingItem, r.droppingItem) && n(e.innerRef, r.innerRef);
  917. }), Wn;
  918. }
  919. var Tr;
  920. function St() {
  921. if (Tr)
  922. return ae;
  923. Tr = 1, Object.defineProperty(ae, "__esModule", {
  924. value: true
  925. }), ae.bottom = n, ae.childrenEqual = d, ae.cloneLayout = i, ae.cloneLayoutItem = v, ae.collides = p, ae.compact = C, ae.compactItem = S, ae.compactType = V2, ae.correctBounds = R3, ae.fastPositionEqual = y3, ae.fastRGLPropsEqual = void 0, ae.getAllCollisions = a, ae.getFirstCollision = s, ae.getLayoutItem = h, ae.getStatics = u, ae.modifyLayout = o, ae.moveElement = b, ae.moveElementAwayFromCollision = l, ae.noop = void 0, ae.perc = g, ae.resizeItemInDirection = A, ae.setTopLeft = oe, ae.setTransform = F2, ae.sortLayoutItems = se, ae.sortLayoutItemsByColRow = ye, ae.sortLayoutItemsByRowCol = de, ae.synchronizeLayoutWithChildren = Ee, ae.validateLayout = $e2, ae.withLayoutItem = c;
  926. var t = ur(), e = r(import_react.default);
  927. function r(E3) {
  928. return E3 && E3.__esModule ? E3 : { default: E3 };
  929. }
  930. function n(E3) {
  931. let T = 0, D;
  932. for (let L = 0, B2 = E3.length; L < B2; L++)
  933. D = E3[L].y + E3[L].h, D > T && (T = D);
  934. return T;
  935. }
  936. function i(E3) {
  937. const T = Array(E3.length);
  938. for (let D = 0, L = E3.length; D < L; D++)
  939. T[D] = v(E3[D]);
  940. return T;
  941. }
  942. function o(E3, T) {
  943. const D = Array(E3.length);
  944. for (let L = 0, B2 = E3.length; L < B2; L++)
  945. T.i === E3[L].i ? D[L] = T : D[L] = E3[L];
  946. return D;
  947. }
  948. function c(E3, T, D) {
  949. let L = h(E3, T);
  950. return L ? (L = D(v(L)), E3 = o(E3, L), [E3, L]) : [E3, null];
  951. }
  952. function v(E3) {
  953. return {
  954. w: E3.w,
  955. h: E3.h,
  956. x: E3.x,
  957. y: E3.y,
  958. i: E3.i,
  959. minW: E3.minW,
  960. maxW: E3.maxW,
  961. minH: E3.minH,
  962. maxH: E3.maxH,
  963. moved: !!E3.moved,
  964. static: !!E3.static,
  965. // These can be null/undefined
  966. isDraggable: E3.isDraggable,
  967. isResizable: E3.isResizable,
  968. resizeHandles: E3.resizeHandles,
  969. isBounded: E3.isBounded
  970. };
  971. }
  972. function d(E3, T) {
  973. return (0, t.deepEqual)(e.default.Children.map(E3, (D) => D == null ? void 0 : D.key), e.default.Children.map(T, (D) => D == null ? void 0 : D.key)) && (0, t.deepEqual)(e.default.Children.map(E3, (D) => D == null ? void 0 : D.props["data-grid"]), e.default.Children.map(T, (D) => D == null ? void 0 : D.props["data-grid"]));
  974. }
  975. ae.fastRGLPropsEqual = Hs();
  976. function y3(E3, T) {
  977. return E3.left === T.left && E3.top === T.top && E3.width === T.width && E3.height === T.height;
  978. }
  979. function p(E3, T) {
  980. return !(E3.i === T.i || E3.x + E3.w <= T.x || E3.x >= T.x + T.w || E3.y + E3.h <= T.y || E3.y >= T.y + T.h);
  981. }
  982. function C(E3, T, D, L) {
  983. const B2 = u(E3), q = se(E3, T), Y2 = Array(E3.length);
  984. for (let X = 0, ne = q.length; X < ne; X++) {
  985. let pe = v(q[X]);
  986. pe.static || (pe = S(B2, pe, T, D, q, L), B2.push(pe)), Y2[E3.indexOf(q[X])] = pe, pe.moved = false;
  987. }
  988. return Y2;
  989. }
  990. const _ = {
  991. x: "w",
  992. y: "h"
  993. };
  994. function w2(E3, T, D, L) {
  995. const B2 = _[L];
  996. T[L] += 1;
  997. const q = E3.map((Y2) => Y2.i).indexOf(T.i);
  998. for (let Y2 = q + 1; Y2 < E3.length; Y2++) {
  999. const X = E3[Y2];
  1000. if (!X.static) {
  1001. if (X.y > T.y + T.h)
  1002. break;
  1003. p(T, X) && w2(E3, X, D + T[B2], L);
  1004. }
  1005. }
  1006. T[L] = D;
  1007. }
  1008. function S(E3, T, D, L, B2, q) {
  1009. const Y2 = D === "vertical", X = D === "horizontal";
  1010. if (Y2)
  1011. for (T.y = Math.min(n(E3), T.y); T.y > 0 && !s(E3, T); )
  1012. T.y--;
  1013. else if (X)
  1014. for (; T.x > 0 && !s(E3, T); )
  1015. T.x--;
  1016. let ne;
  1017. for (; (ne = s(E3, T)) && !(D === null && q); )
  1018. if (X ? w2(B2, T, ne.x + ne.w, "x") : w2(B2, T, ne.y + ne.h, "y"), X && T.x + T.w > L)
  1019. for (T.x = L - T.w, T.y++; T.x > 0 && !s(E3, T); )
  1020. T.x--;
  1021. return T.y = Math.max(T.y, 0), T.x = Math.max(T.x, 0), T;
  1022. }
  1023. function R3(E3, T) {
  1024. const D = u(E3);
  1025. for (let L = 0, B2 = E3.length; L < B2; L++) {
  1026. const q = E3[L];
  1027. if (q.x + q.w > T.cols && (q.x = T.cols - q.w), q.x < 0 && (q.x = 0, q.w = T.cols), !q.static)
  1028. D.push(q);
  1029. else
  1030. for (; s(D, q); )
  1031. q.y++;
  1032. }
  1033. return E3;
  1034. }
  1035. function h(E3, T) {
  1036. for (let D = 0, L = E3.length; D < L; D++)
  1037. if (E3[D].i === T)
  1038. return E3[D];
  1039. }
  1040. function s(E3, T) {
  1041. for (let D = 0, L = E3.length; D < L; D++)
  1042. if (p(E3[D], T))
  1043. return E3[D];
  1044. }
  1045. function a(E3, T) {
  1046. return E3.filter((D) => p(D, T));
  1047. }
  1048. function u(E3) {
  1049. return E3.filter((T) => T.static);
  1050. }
  1051. function b(E3, T, D, L, B2, q, Y2, X, ne) {
  1052. if (T.static && T.isDraggable !== true || T.y === L && T.x === D)
  1053. return E3;
  1054. `${T.i}${String(D)}${String(L)}${T.x}${T.y}`;
  1055. const pe = T.x, et2 = T.y;
  1056. typeof D == "number" && (T.x = D), typeof L == "number" && (T.y = L), T.moved = true;
  1057. let Pe2 = se(E3, Y2);
  1058. (Y2 === "vertical" && typeof L == "number" ? et2 >= L : Y2 === "horizontal" && typeof D == "number" ? pe >= D : false) && (Pe2 = Pe2.reverse());
  1059. const dt = a(Pe2, T), Jt = dt.length > 0;
  1060. if (Jt && ne)
  1061. return i(E3);
  1062. if (Jt && q)
  1063. return `${T.i}`, T.x = pe, T.y = et2, T.moved = false, E3;
  1064. for (let Ln = 0, fo = dt.length; Ln < fo; Ln++) {
  1065. const tt = dt[Ln];
  1066. `${T.i}${T.x}${T.y}${tt.i}${tt.x}${tt.y}`, !tt.moved && (tt.static ? E3 = l(E3, tt, T, B2, Y2) : E3 = l(E3, T, tt, B2, Y2));
  1067. }
  1068. return E3;
  1069. }
  1070. function l(E3, T, D, L, B2, q) {
  1071. const Y2 = B2 === "horizontal", X = B2 === "vertical", ne = T.static;
  1072. if (L) {
  1073. L = false;
  1074. const Pe2 = {
  1075. x: Y2 ? Math.max(T.x - D.w, 0) : D.x,
  1076. y: X ? Math.max(T.y - D.h, 0) : D.y,
  1077. w: D.w,
  1078. h: D.h,
  1079. i: "-1"
  1080. }, Ce = s(E3, Pe2), dt = Ce && Ce.y + Ce.h > T.y, Jt = Ce && T.x + T.w > Ce.x;
  1081. if (Ce) {
  1082. if (dt && X)
  1083. return b(E3, D, void 0, T.y + 1, L, ne, B2);
  1084. if (dt && B2 == null)
  1085. return T.y = D.y, D.y = D.y + D.h, E3;
  1086. if (Jt && Y2)
  1087. return b(E3, T, D.x, void 0, L, ne, B2);
  1088. } else
  1089. return `${D.i}${Pe2.x}${Pe2.y}`, b(E3, D, Y2 ? Pe2.x : void 0, X ? Pe2.y : void 0, L, ne, B2);
  1090. }
  1091. const pe = Y2 ? D.x + 1 : void 0, et2 = X ? D.y + 1 : void 0;
  1092. return pe == null && et2 == null ? E3 : b(E3, D, Y2 ? D.x + 1 : void 0, X ? D.y + 1 : void 0, L, ne, B2);
  1093. }
  1094. function g(E3) {
  1095. return E3 * 100 + "%";
  1096. }
  1097. const f = (E3, T, D, L) => E3 + D > L ? T : D, m = (E3, T, D) => E3 < 0 ? T : D, P = (E3) => Math.max(0, E3), M2 = (E3) => Math.max(0, E3), j2 = (E3, T, D) => {
  1098. let {
  1099. left: L,
  1100. height: B2,
  1101. width: q
  1102. } = T;
  1103. const Y2 = E3.top - (B2 - E3.height);
  1104. return {
  1105. left: L,
  1106. width: q,
  1107. height: m(Y2, E3.height, B2),
  1108. top: M2(Y2)
  1109. };
  1110. }, N3 = (E3, T, D) => {
  1111. let {
  1112. top: L,
  1113. left: B2,
  1114. height: q,
  1115. width: Y2
  1116. } = T;
  1117. return {
  1118. top: L,
  1119. height: q,
  1120. width: f(E3.left, E3.width, Y2, D),
  1121. left: P(B2)
  1122. };
  1123. }, I = (E3, T, D) => {
  1124. let {
  1125. top: L,
  1126. height: B2,
  1127. width: q
  1128. } = T;
  1129. const Y2 = E3.left - (q - E3.width);
  1130. return {
  1131. height: B2,
  1132. width: Y2 < 0 ? E3.width : f(E3.left, E3.width, q, D),
  1133. top: M2(L),
  1134. left: P(Y2)
  1135. };
  1136. }, O = (E3, T, D) => {
  1137. let {
  1138. top: L,
  1139. left: B2,
  1140. height: q,
  1141. width: Y2
  1142. } = T;
  1143. return {
  1144. width: Y2,
  1145. left: B2,
  1146. height: m(L, E3.height, q),
  1147. top: M2(L)
  1148. };
  1149. }, ee = {
  1150. n: j2,
  1151. ne: function() {
  1152. return j2(arguments.length <= 0 ? void 0 : arguments[0], N3(...arguments));
  1153. },
  1154. e: N3,
  1155. se: function() {
  1156. return O(arguments.length <= 0 ? void 0 : arguments[0], N3(...arguments));
  1157. },
  1158. s: O,
  1159. sw: function() {
  1160. return O(arguments.length <= 0 ? void 0 : arguments[0], I(...arguments));
  1161. },
  1162. w: I,
  1163. nw: function() {
  1164. return j2(arguments.length <= 0 ? void 0 : arguments[0], I(...arguments));
  1165. }
  1166. };
  1167. function A(E3, T, D, L) {
  1168. const B2 = ee[E3];
  1169. return B2 ? B2(T, {
  1170. ...T,
  1171. ...D
  1172. }, L) : D;
  1173. }
  1174. function F2(E3) {
  1175. let {
  1176. top: T,
  1177. left: D,
  1178. width: L,
  1179. height: B2
  1180. } = E3;
  1181. const q = `translate(${D}px,${T}px)`;
  1182. return {
  1183. transform: q,
  1184. WebkitTransform: q,
  1185. MozTransform: q,
  1186. msTransform: q,
  1187. OTransform: q,
  1188. width: `${L}px`,
  1189. height: `${B2}px`,
  1190. position: "absolute"
  1191. };
  1192. }
  1193. function oe(E3) {
  1194. let {
  1195. top: T,
  1196. left: D,
  1197. width: L,
  1198. height: B2
  1199. } = E3;
  1200. return {
  1201. top: `${T}px`,
  1202. left: `${D}px`,
  1203. width: `${L}px`,
  1204. height: `${B2}px`,
  1205. position: "absolute"
  1206. };
  1207. }
  1208. function se(E3, T) {
  1209. return T === "horizontal" ? ye(E3) : T === "vertical" ? de(E3) : E3;
  1210. }
  1211. function de(E3) {
  1212. return E3.slice(0).sort(function(T, D) {
  1213. return T.y > D.y || T.y === D.y && T.x > D.x ? 1 : T.y === D.y && T.x === D.x ? 0 : -1;
  1214. });
  1215. }
  1216. function ye(E3) {
  1217. return E3.slice(0).sort(function(T, D) {
  1218. return T.x > D.x || T.x === D.x && T.y > D.y ? 1 : -1;
  1219. });
  1220. }
  1221. function Ee(E3, T, D, L, B2) {
  1222. E3 = E3 || [];
  1223. const q = [];
  1224. e.default.Children.forEach(T, (X) => {
  1225. if ((X == null ? void 0 : X.key) == null)
  1226. return;
  1227. const ne = h(E3, String(X.key)), pe = X.props["data-grid"];
  1228. ne && pe == null ? q.push(v(ne)) : pe ? q.push(v({
  1229. ...pe,
  1230. i: X.key
  1231. })) : q.push(v({
  1232. w: 1,
  1233. h: 1,
  1234. x: 0,
  1235. y: n(q),
  1236. i: String(X.key)
  1237. }));
  1238. });
  1239. const Y2 = R3(q, {
  1240. cols: D
  1241. });
  1242. return B2 ? Y2 : C(Y2, L, D);
  1243. }
  1244. function $e2(E3) {
  1245. let T = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "Layout";
  1246. const D = ["x", "y", "w", "h"];
  1247. if (!Array.isArray(E3))
  1248. throw new Error(T + " must be an array!");
  1249. for (let L = 0, B2 = E3.length; L < B2; L++) {
  1250. const q = E3[L];
  1251. for (let Y2 = 0; Y2 < D.length; Y2++)
  1252. if (typeof q[D[Y2]] != "number")
  1253. throw new Error("ReactGridLayout: " + T + "[" + L + "]." + D[Y2] + " must be a number!");
  1254. }
  1255. }
  1256. function V2(E3) {
  1257. const {
  1258. verticalCompact: T,
  1259. compactType: D
  1260. } = E3 || {};
  1261. return T === false ? null : D;
  1262. }
  1263. function Z() {
  1264. }
  1265. const ce = () => {
  1266. };
  1267. return ae.noop = ce, ae;
  1268. }
  1269. var He = {};
  1270. var Pr;
  1271. function fr2() {
  1272. if (Pr)
  1273. return He;
  1274. Pr = 1, Object.defineProperty(He, "__esModule", {
  1275. value: true
  1276. }), He.calcGridColWidth = t, He.calcGridItemPosition = r, He.calcGridItemWHPx = e, He.calcWH = i, He.calcXY = n, He.clamp = o;
  1277. function t(c) {
  1278. const {
  1279. margin: v,
  1280. containerPadding: d,
  1281. containerWidth: y3,
  1282. cols: p
  1283. } = c;
  1284. return (y3 - v[0] * (p - 1) - d[0] * 2) / p;
  1285. }
  1286. function e(c, v, d) {
  1287. return Number.isFinite(c) ? Math.round(v * c + Math.max(0, c - 1) * d) : c;
  1288. }
  1289. function r(c, v, d, y3, p, C) {
  1290. const {
  1291. margin: _,
  1292. containerPadding: w2,
  1293. rowHeight: S
  1294. } = c, R3 = t(c), h = {};
  1295. return C && C.resizing ? (h.width = Math.round(C.resizing.width), h.height = Math.round(C.resizing.height)) : (h.width = e(y3, R3, _[0]), h.height = e(p, S, _[1])), C && C.dragging ? (h.top = Math.round(C.dragging.top), h.left = Math.round(C.dragging.left)) : C && C.resizing && typeof C.resizing.top == "number" && typeof C.resizing.left == "number" ? (h.top = Math.round(C.resizing.top), h.left = Math.round(C.resizing.left)) : (h.top = Math.round((S + _[1]) * d + w2[1]), h.left = Math.round((R3 + _[0]) * v + w2[0])), h;
  1296. }
  1297. function n(c, v, d, y3, p) {
  1298. const {
  1299. margin: C,
  1300. cols: _,
  1301. rowHeight: w2,
  1302. maxRows: S
  1303. } = c, R3 = t(c);
  1304. let h = Math.round((d - C[0]) / (R3 + C[0])), s = Math.round((v - C[1]) / (w2 + C[1]));
  1305. return h = o(h, 0, _ - y3), s = o(s, 0, S - p), {
  1306. x: h,
  1307. y: s
  1308. };
  1309. }
  1310. function i(c, v, d, y3, p, C) {
  1311. const {
  1312. margin: _,
  1313. maxRows: w2,
  1314. cols: S,
  1315. rowHeight: R3
  1316. } = c, h = t(c);
  1317. let s = Math.round((v + _[0]) / (h + _[0])), a = Math.round((d + _[1]) / (R3 + _[1])), u = o(s, 0, S - y3), b = o(a, 0, w2 - p);
  1318. return ["sw", "w", "nw"].indexOf(C) !== -1 && (u = o(s, 0, S)), ["nw", "n", "ne"].indexOf(C) !== -1 && (b = o(a, 0, w2)), {
  1319. w: u,
  1320. h: b
  1321. };
  1322. }
  1323. function o(c, v, d) {
  1324. return Math.max(Math.min(c, d), v);
  1325. }
  1326. return He;
  1327. }
  1328. var _t2 = {};
  1329. var Hn = { exports: {} };
  1330. var Un2;
  1331. var Or;
  1332. function Us() {
  1333. if (Or)
  1334. return Un2;
  1335. Or = 1;
  1336. var t = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
  1337. return Un2 = t, Un2;
  1338. }
  1339. var kn;
  1340. var Dr;
  1341. function ks() {
  1342. if (Dr)
  1343. return kn;
  1344. Dr = 1;
  1345. var t = Us();
  1346. function e() {
  1347. }
  1348. function r() {
  1349. }
  1350. return r.resetWarningCache = e, kn = function() {
  1351. function n(c, v, d, y3, p, C) {
  1352. if (C !== t) {
  1353. var _ = new Error(
  1354. "Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types"
  1355. );
  1356. throw _.name = "Invariant Violation", _;
  1357. }
  1358. }
  1359. n.isRequired = n;
  1360. function i() {
  1361. return n;
  1362. }
  1363. var o = {
  1364. array: n,
  1365. bigint: n,
  1366. bool: n,
  1367. func: n,
  1368. number: n,
  1369. object: n,
  1370. string: n,
  1371. symbol: n,
  1372. any: n,
  1373. arrayOf: i,
  1374. element: n,
  1375. elementType: n,
  1376. instanceOf: i,
  1377. node: n,
  1378. objectOf: i,
  1379. oneOf: i,
  1380. oneOfType: i,
  1381. shape: i,
  1382. exact: i,
  1383. checkPropTypes: r,
  1384. resetWarningCache: e
  1385. };
  1386. return o.PropTypes = o, o;
  1387. }, kn;
  1388. }
  1389. var Mr;
  1390. function Qe() {
  1391. return Mr || (Mr = 1, Hn.exports = ks()()), Hn.exports;
  1392. }
  1393. var xt = { exports: {} };
  1394. var Bn = {};
  1395. function ki(t) {
  1396. var e, r, n = "";
  1397. if (typeof t == "string" || typeof t == "number")
  1398. n += t;
  1399. else if (typeof t == "object")
  1400. if (Array.isArray(t))
  1401. for (e = 0; e < t.length; e++)
  1402. t[e] && (r = ki(t[e])) && (n && (n += " "), n += r);
  1403. else
  1404. for (e in t)
  1405. t[e] && (n && (n += " "), n += e);
  1406. return n;
  1407. }
  1408. function Nr() {
  1409. for (var t, e, r = 0, n = ""; r < arguments.length; )
  1410. (t = arguments[r++]) && (e = ki(t)) && (n && (n += " "), n += e);
  1411. return n;
  1412. }
  1413. var Bs = Object.freeze(Object.defineProperty({
  1414. __proto__: null,
  1415. clsx: Nr,
  1416. default: Nr
  1417. }, Symbol.toStringTag, { value: "Module" }));
  1418. var Gs = Ai(Bs);
  1419. var ve = {};
  1420. var Ye = {};
  1421. var jr2;
  1422. function Mn() {
  1423. if (jr2)
  1424. return Ye;
  1425. jr2 = 1, Object.defineProperty(Ye, "__esModule", {
  1426. value: true
  1427. }), Ye.dontSetMe = i, Ye.findInArray = t, Ye.int = n, Ye.isFunction = e, Ye.isNum = r;
  1428. function t(o, c) {
  1429. for (let v = 0, d = o.length; v < d; v++)
  1430. if (c.apply(c, [o[v], v, o]))
  1431. return o[v];
  1432. }
  1433. function e(o) {
  1434. return typeof o == "function" || Object.prototype.toString.call(o) === "[object Function]";
  1435. }
  1436. function r(o) {
  1437. return typeof o == "number" && !isNaN(o);
  1438. }
  1439. function n(o) {
  1440. return parseInt(o, 10);
  1441. }
  1442. function i(o, c, v) {
  1443. if (o[c])
  1444. return new Error("Invalid prop ".concat(c, " passed to ").concat(v, " - do not set this, set it on the child."));
  1445. }
  1446. return Ye;
  1447. }
  1448. var Ke = {};
  1449. var Lr;
  1450. function Xs() {
  1451. if (Lr)
  1452. return Ke;
  1453. Lr = 1, Object.defineProperty(Ke, "__esModule", {
  1454. value: true
  1455. }), Ke.browserPrefixToKey = r, Ke.browserPrefixToStyle = n, Ke.default = void 0, Ke.getPrefix = e;
  1456. const t = ["Moz", "Webkit", "O", "ms"];
  1457. function e() {
  1458. var o;
  1459. let c = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "transform";
  1460. if (typeof window > "u")
  1461. return "";
  1462. const v = (o = window.document) === null || o === void 0 || (o = o.documentElement) === null || o === void 0 ? void 0 : o.style;
  1463. if (!v || c in v)
  1464. return "";
  1465. for (let d = 0; d < t.length; d++)
  1466. if (r(c, t[d]) in v)
  1467. return t[d];
  1468. return "";
  1469. }
  1470. function r(o, c) {
  1471. return c ? "".concat(c).concat(i(o)) : o;
  1472. }
  1473. function n(o, c) {
  1474. return c ? "-".concat(c.toLowerCase(), "-").concat(o) : o;
  1475. }
  1476. function i(o) {
  1477. let c = "", v = true;
  1478. for (let d = 0; d < o.length; d++)
  1479. v ? (c += o[d].toUpperCase(), v = false) : o[d] === "-" ? v = true : c += o[d];
  1480. return c;
  1481. }
  1482. return Ke.default = e(), Ke;
  1483. }
  1484. var $r;
  1485. function hr() {
  1486. if ($r)
  1487. return ve;
  1488. $r = 1, Object.defineProperty(ve, "__esModule", {
  1489. value: true
  1490. }), ve.addClassName = l, ve.addEvent = v, ve.addUserSelectStyles = u, ve.createCSSTransform = S, ve.createSVGTransform = R3, ve.getTouch = s, ve.getTouchIdentifier = a, ve.getTranslation = h, ve.innerHeight = C, ve.innerWidth = _, ve.matchesSelector = o, ve.matchesSelectorAndParentsTo = c, ve.offsetXYFromParent = w2, ve.outerHeight = y3, ve.outerWidth = p, ve.removeClassName = g, ve.removeEvent = d, ve.removeUserSelectStyles = b;
  1491. var t = Mn(), e = n(Xs());
  1492. function r(f) {
  1493. if (typeof WeakMap != "function")
  1494. return null;
  1495. var m = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap();
  1496. return (r = function(M2) {
  1497. return M2 ? P : m;
  1498. })(f);
  1499. }
  1500. function n(f, m) {
  1501. if (f && f.__esModule)
  1502. return f;
  1503. if (f === null || typeof f != "object" && typeof f != "function")
  1504. return { default: f };
  1505. var P = r(m);
  1506. if (P && P.has(f))
  1507. return P.get(f);
  1508. var M2 = {}, j2 = Object.defineProperty && Object.getOwnPropertyDescriptor;
  1509. for (var N3 in f)
  1510. if (N3 !== "default" && Object.prototype.hasOwnProperty.call(f, N3)) {
  1511. var I = j2 ? Object.getOwnPropertyDescriptor(f, N3) : null;
  1512. I && (I.get || I.set) ? Object.defineProperty(M2, N3, I) : M2[N3] = f[N3];
  1513. }
  1514. return M2.default = f, P && P.set(f, M2), M2;
  1515. }
  1516. let i = "";
  1517. function o(f, m) {
  1518. return i || (i = (0, t.findInArray)(["matches", "webkitMatchesSelector", "mozMatchesSelector", "msMatchesSelector", "oMatchesSelector"], function(P) {
  1519. return (0, t.isFunction)(f[P]);
  1520. })), (0, t.isFunction)(f[i]) ? f[i](m) : false;
  1521. }
  1522. function c(f, m, P) {
  1523. let M2 = f;
  1524. do {
  1525. if (o(M2, m))
  1526. return true;
  1527. if (M2 === P)
  1528. return false;
  1529. M2 = M2.parentNode;
  1530. } while (M2);
  1531. return false;
  1532. }
  1533. function v(f, m, P, M2) {
  1534. if (!f)
  1535. return;
  1536. const j2 = {
  1537. capture: true,
  1538. ...M2
  1539. };
  1540. f.addEventListener ? f.addEventListener(m, P, j2) : f.attachEvent ? f.attachEvent("on" + m, P) : f["on" + m] = P;
  1541. }
  1542. function d(f, m, P, M2) {
  1543. if (!f)
  1544. return;
  1545. const j2 = {
  1546. capture: true,
  1547. ...M2
  1548. };
  1549. f.removeEventListener ? f.removeEventListener(m, P, j2) : f.detachEvent ? f.detachEvent("on" + m, P) : f["on" + m] = null;
  1550. }
  1551. function y3(f) {
  1552. let m = f.clientHeight;
  1553. const P = f.ownerDocument.defaultView.getComputedStyle(f);
  1554. return m += (0, t.int)(P.borderTopWidth), m += (0, t.int)(P.borderBottomWidth), m;
  1555. }
  1556. function p(f) {
  1557. let m = f.clientWidth;
  1558. const P = f.ownerDocument.defaultView.getComputedStyle(f);
  1559. return m += (0, t.int)(P.borderLeftWidth), m += (0, t.int)(P.borderRightWidth), m;
  1560. }
  1561. function C(f) {
  1562. let m = f.clientHeight;
  1563. const P = f.ownerDocument.defaultView.getComputedStyle(f);
  1564. return m -= (0, t.int)(P.paddingTop), m -= (0, t.int)(P.paddingBottom), m;
  1565. }
  1566. function _(f) {
  1567. let m = f.clientWidth;
  1568. const P = f.ownerDocument.defaultView.getComputedStyle(f);
  1569. return m -= (0, t.int)(P.paddingLeft), m -= (0, t.int)(P.paddingRight), m;
  1570. }
  1571. function w2(f, m, P) {
  1572. const j2 = m === m.ownerDocument.body ? {
  1573. left: 0,
  1574. top: 0
  1575. } : m.getBoundingClientRect(), N3 = (f.clientX + m.scrollLeft - j2.left) / P, I = (f.clientY + m.scrollTop - j2.top) / P;
  1576. return {
  1577. x: N3,
  1578. y: I
  1579. };
  1580. }
  1581. function S(f, m) {
  1582. const P = h(f, m, "px");
  1583. return {
  1584. [(0, e.browserPrefixToKey)("transform", e.default)]: P
  1585. };
  1586. }
  1587. function R3(f, m) {
  1588. return h(f, m, "");
  1589. }
  1590. function h(f, m, P) {
  1591. let {
  1592. x: M2,
  1593. y: j2
  1594. } = f, N3 = "translate(".concat(M2).concat(P, ",").concat(j2).concat(P, ")");
  1595. if (m) {
  1596. const I = "".concat(typeof m.x == "string" ? m.x : m.x + P), O = "".concat(typeof m.y == "string" ? m.y : m.y + P);
  1597. N3 = "translate(".concat(I, ", ").concat(O, ")") + N3;
  1598. }
  1599. return N3;
  1600. }
  1601. function s(f, m) {
  1602. return f.targetTouches && (0, t.findInArray)(f.targetTouches, (P) => m === P.identifier) || f.changedTouches && (0, t.findInArray)(f.changedTouches, (P) => m === P.identifier);
  1603. }
  1604. function a(f) {
  1605. if (f.targetTouches && f.targetTouches[0])
  1606. return f.targetTouches[0].identifier;
  1607. if (f.changedTouches && f.changedTouches[0])
  1608. return f.changedTouches[0].identifier;
  1609. }
  1610. function u(f) {
  1611. if (!f)
  1612. return;
  1613. let m = f.getElementById("react-draggable-style-el");
  1614. m || (m = f.createElement("style"), m.type = "text/css", m.id = "react-draggable-style-el", m.innerHTML = `.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
  1615. `, m.innerHTML += `.react-draggable-transparent-selection *::selection {all: inherit;}
  1616. `, f.getElementsByTagName("head")[0].appendChild(m)), f.body && l(f.body, "react-draggable-transparent-selection");
  1617. }
  1618. function b(f) {
  1619. if (f)
  1620. try {
  1621. if (f.body && g(f.body, "react-draggable-transparent-selection"), f.selection)
  1622. f.selection.empty();
  1623. else {
  1624. const m = (f.defaultView || window).getSelection();
  1625. m && m.type !== "Caret" && m.removeAllRanges();
  1626. }
  1627. } catch {
  1628. }
  1629. }
  1630. function l(f, m) {
  1631. f.classList ? f.classList.add(m) : f.className.match(new RegExp("(?:^|\\s)".concat(m, "(?!\\S)"))) || (f.className += " ".concat(m));
  1632. }
  1633. function g(f, m) {
  1634. f.classList ? f.classList.remove(m) : f.className = f.className.replace(new RegExp("(?:^|\\s)".concat(m, "(?!\\S)"), "g"), "");
  1635. }
  1636. return ve;
  1637. }
  1638. var Ae = {};
  1639. var zr;
  1640. function Bi() {
  1641. if (zr)
  1642. return Ae;
  1643. zr = 1, Object.defineProperty(Ae, "__esModule", {
  1644. value: true
  1645. }), Ae.canDragX = i, Ae.canDragY = o, Ae.createCoreData = v, Ae.createDraggableData = d, Ae.getBoundPosition = r, Ae.getControlPosition = c, Ae.snapToGrid = n;
  1646. var t = Mn(), e = hr();
  1647. function r(C, _, w2) {
  1648. if (!C.props.bounds)
  1649. return [_, w2];
  1650. let {
  1651. bounds: S
  1652. } = C.props;
  1653. S = typeof S == "string" ? S : y3(S);
  1654. const R3 = p(C);
  1655. if (typeof S == "string") {
  1656. const {
  1657. ownerDocument: h
  1658. } = R3, s = h.defaultView;
  1659. let a;
  1660. if (S === "parent" ? a = R3.parentNode : a = h.querySelector(S), !(a instanceof s.HTMLElement))
  1661. throw new Error('Bounds selector "' + S + '" could not find an element.');
  1662. const u = a, b = s.getComputedStyle(R3), l = s.getComputedStyle(u);
  1663. S = {
  1664. left: -R3.offsetLeft + (0, t.int)(l.paddingLeft) + (0, t.int)(b.marginLeft),
  1665. top: -R3.offsetTop + (0, t.int)(l.paddingTop) + (0, t.int)(b.marginTop),
  1666. right: (0, e.innerWidth)(u) - (0, e.outerWidth)(R3) - R3.offsetLeft + (0, t.int)(l.paddingRight) - (0, t.int)(b.marginRight),
  1667. bottom: (0, e.innerHeight)(u) - (0, e.outerHeight)(R3) - R3.offsetTop + (0, t.int)(l.paddingBottom) - (0, t.int)(b.marginBottom)
  1668. };
  1669. }
  1670. return (0, t.isNum)(S.right) && (_ = Math.min(_, S.right)), (0, t.isNum)(S.bottom) && (w2 = Math.min(w2, S.bottom)), (0, t.isNum)(S.left) && (_ = Math.max(_, S.left)), (0, t.isNum)(S.top) && (w2 = Math.max(w2, S.top)), [_, w2];
  1671. }
  1672. function n(C, _, w2) {
  1673. const S = Math.round(_ / C[0]) * C[0], R3 = Math.round(w2 / C[1]) * C[1];
  1674. return [S, R3];
  1675. }
  1676. function i(C) {
  1677. return C.props.axis === "both" || C.props.axis === "x";
  1678. }
  1679. function o(C) {
  1680. return C.props.axis === "both" || C.props.axis === "y";
  1681. }
  1682. function c(C, _, w2) {
  1683. const S = typeof _ == "number" ? (0, e.getTouch)(C, _) : null;
  1684. if (typeof _ == "number" && !S)
  1685. return null;
  1686. const R3 = p(w2), h = w2.props.offsetParent || R3.offsetParent || R3.ownerDocument.body;
  1687. return (0, e.offsetXYFromParent)(S || C, h, w2.props.scale);
  1688. }
  1689. function v(C, _, w2) {
  1690. const S = !(0, t.isNum)(C.lastX), R3 = p(C);
  1691. return S ? {
  1692. node: R3,
  1693. deltaX: 0,
  1694. deltaY: 0,
  1695. lastX: _,
  1696. lastY: w2,
  1697. x: _,
  1698. y: w2
  1699. } : {
  1700. node: R3,
  1701. deltaX: _ - C.lastX,
  1702. deltaY: w2 - C.lastY,
  1703. lastX: C.lastX,
  1704. lastY: C.lastY,
  1705. x: _,
  1706. y: w2
  1707. };
  1708. }
  1709. function d(C, _) {
  1710. const w2 = C.props.scale;
  1711. return {
  1712. node: _.node,
  1713. x: C.state.x + _.deltaX / w2,
  1714. y: C.state.y + _.deltaY / w2,
  1715. deltaX: _.deltaX / w2,
  1716. deltaY: _.deltaY / w2,
  1717. lastX: C.state.x,
  1718. lastY: C.state.y
  1719. };
  1720. }
  1721. function y3(C) {
  1722. return {
  1723. left: C.left,
  1724. top: C.top,
  1725. right: C.right,
  1726. bottom: C.bottom
  1727. };
  1728. }
  1729. function p(C) {
  1730. const _ = C.findDOMNode();
  1731. if (!_)
  1732. throw new Error("<DraggableCore>: Unmounted during event!");
  1733. return _;
  1734. }
  1735. return Ae;
  1736. }
  1737. var It = {};
  1738. var en2 = {};
  1739. var Fr;
  1740. function Gi() {
  1741. if (Fr)
  1742. return en2;
  1743. Fr = 1, Object.defineProperty(en2, "__esModule", {
  1744. value: true
  1745. }), en2.default = t;
  1746. function t() {
  1747. }
  1748. return en2;
  1749. }
  1750. var Vr2;
  1751. function Ys2() {
  1752. if (Vr2)
  1753. return It;
  1754. Vr2 = 1, Object.defineProperty(It, "__esModule", {
  1755. value: true
  1756. }), It.default = void 0;
  1757. var t = y3(import_react.default), e = v(Qe()), r = v(import_react_dom.default), n = hr(), i = Bi(), o = Mn(), c = v(Gi());
  1758. function v(h) {
  1759. return h && h.__esModule ? h : { default: h };
  1760. }
  1761. function d(h) {
  1762. if (typeof WeakMap != "function")
  1763. return null;
  1764. var s = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap();
  1765. return (d = function(u) {
  1766. return u ? a : s;
  1767. })(h);
  1768. }
  1769. function y3(h, s) {
  1770. if (h && h.__esModule)
  1771. return h;
  1772. if (h === null || typeof h != "object" && typeof h != "function")
  1773. return { default: h };
  1774. var a = d(s);
  1775. if (a && a.has(h))
  1776. return a.get(h);
  1777. var u = {}, b = Object.defineProperty && Object.getOwnPropertyDescriptor;
  1778. for (var l in h)
  1779. if (l !== "default" && Object.prototype.hasOwnProperty.call(h, l)) {
  1780. var g = b ? Object.getOwnPropertyDescriptor(h, l) : null;
  1781. g && (g.get || g.set) ? Object.defineProperty(u, l, g) : u[l] = h[l];
  1782. }
  1783. return u.default = h, a && a.set(h, u), u;
  1784. }
  1785. function p(h, s, a) {
  1786. return s = C(s), s in h ? Object.defineProperty(h, s, { value: a, enumerable: true, configurable: true, writable: true }) : h[s] = a, h;
  1787. }
  1788. function C(h) {
  1789. var s = _(h, "string");
  1790. return typeof s == "symbol" ? s : String(s);
  1791. }
  1792. function _(h, s) {
  1793. if (typeof h != "object" || h === null)
  1794. return h;
  1795. var a = h[Symbol.toPrimitive];
  1796. if (a !== void 0) {
  1797. var u = a.call(h, s || "default");
  1798. if (typeof u != "object")
  1799. return u;
  1800. throw new TypeError("@@toPrimitive must return a primitive value.");
  1801. }
  1802. return (s === "string" ? String : Number)(h);
  1803. }
  1804. const w2 = {
  1805. touch: {
  1806. start: "touchstart",
  1807. move: "touchmove",
  1808. stop: "touchend"
  1809. },
  1810. mouse: {
  1811. start: "mousedown",
  1812. move: "mousemove",
  1813. stop: "mouseup"
  1814. }
  1815. };
  1816. let S = w2.mouse, R3 = class extends t.Component {
  1817. constructor() {
  1818. super(...arguments), p(this, "dragging", false), p(this, "lastX", NaN), p(this, "lastY", NaN), p(this, "touchIdentifier", null), p(this, "mounted", false), p(this, "handleDragStart", (s) => {
  1819. if (this.props.onMouseDown(s), !this.props.allowAnyClick && typeof s.button == "number" && s.button !== 0)
  1820. return false;
  1821. const a = this.findDOMNode();
  1822. if (!a || !a.ownerDocument || !a.ownerDocument.body)
  1823. throw new Error("<DraggableCore> not mounted on DragStart!");
  1824. const {
  1825. ownerDocument: u
  1826. } = a;
  1827. if (this.props.disabled || !(s.target instanceof u.defaultView.Node) || this.props.handle && !(0, n.matchesSelectorAndParentsTo)(s.target, this.props.handle, a) || this.props.cancel && (0, n.matchesSelectorAndParentsTo)(s.target, this.props.cancel, a))
  1828. return;
  1829. s.type === "touchstart" && s.preventDefault();
  1830. const b = (0, n.getTouchIdentifier)(s);
  1831. this.touchIdentifier = b;
  1832. const l = (0, i.getControlPosition)(s, b, this);
  1833. if (l == null)
  1834. return;
  1835. const {
  1836. x: g,
  1837. y: f
  1838. } = l, m = (0, i.createCoreData)(this, g, f);
  1839. (0, c.default)("DraggableCore: handleDragStart: %j", m), (0, c.default)("calling", this.props.onStart), !(this.props.onStart(s, m) === false || this.mounted === false) && (this.props.enableUserSelectHack && (0, n.addUserSelectStyles)(u), this.dragging = true, this.lastX = g, this.lastY = f, (0, n.addEvent)(u, S.move, this.handleDrag), (0, n.addEvent)(u, S.stop, this.handleDragStop));
  1840. }), p(this, "handleDrag", (s) => {
  1841. const a = (0, i.getControlPosition)(s, this.touchIdentifier, this);
  1842. if (a == null)
  1843. return;
  1844. let {
  1845. x: u,
  1846. y: b
  1847. } = a;
  1848. if (Array.isArray(this.props.grid)) {
  1849. let f = u - this.lastX, m = b - this.lastY;
  1850. if ([f, m] = (0, i.snapToGrid)(this.props.grid, f, m), !f && !m)
  1851. return;
  1852. u = this.lastX + f, b = this.lastY + m;
  1853. }
  1854. const l = (0, i.createCoreData)(this, u, b);
  1855. if ((0, c.default)("DraggableCore: handleDrag: %j", l), this.props.onDrag(s, l) === false || this.mounted === false) {
  1856. try {
  1857. this.handleDragStop(new MouseEvent("mouseup"));
  1858. } catch {
  1859. const m = document.createEvent("MouseEvents");
  1860. m.initMouseEvent("mouseup", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null), this.handleDragStop(m);
  1861. }
  1862. return;
  1863. }
  1864. this.lastX = u, this.lastY = b;
  1865. }), p(this, "handleDragStop", (s) => {
  1866. if (!this.dragging)
  1867. return;
  1868. const a = (0, i.getControlPosition)(s, this.touchIdentifier, this);
  1869. if (a == null)
  1870. return;
  1871. let {
  1872. x: u,
  1873. y: b
  1874. } = a;
  1875. if (Array.isArray(this.props.grid)) {
  1876. let m = u - this.lastX || 0, P = b - this.lastY || 0;
  1877. [m, P] = (0, i.snapToGrid)(this.props.grid, m, P), u = this.lastX + m, b = this.lastY + P;
  1878. }
  1879. const l = (0, i.createCoreData)(this, u, b);
  1880. if (this.props.onStop(s, l) === false || this.mounted === false)
  1881. return false;
  1882. const f = this.findDOMNode();
  1883. f && this.props.enableUserSelectHack && (0, n.removeUserSelectStyles)(f.ownerDocument), (0, c.default)("DraggableCore: handleDragStop: %j", l), this.dragging = false, this.lastX = NaN, this.lastY = NaN, f && ((0, c.default)("DraggableCore: Removing handlers"), (0, n.removeEvent)(f.ownerDocument, S.move, this.handleDrag), (0, n.removeEvent)(f.ownerDocument, S.stop, this.handleDragStop));
  1884. }), p(this, "onMouseDown", (s) => (S = w2.mouse, this.handleDragStart(s))), p(this, "onMouseUp", (s) => (S = w2.mouse, this.handleDragStop(s))), p(this, "onTouchStart", (s) => (S = w2.touch, this.handleDragStart(s))), p(this, "onTouchEnd", (s) => (S = w2.touch, this.handleDragStop(s)));
  1885. }
  1886. componentDidMount() {
  1887. this.mounted = true;
  1888. const s = this.findDOMNode();
  1889. s && (0, n.addEvent)(s, w2.touch.start, this.onTouchStart, {
  1890. passive: false
  1891. });
  1892. }
  1893. componentWillUnmount() {
  1894. this.mounted = false;
  1895. const s = this.findDOMNode();
  1896. if (s) {
  1897. const {
  1898. ownerDocument: a
  1899. } = s;
  1900. (0, n.removeEvent)(a, w2.mouse.move, this.handleDrag), (0, n.removeEvent)(a, w2.touch.move, this.handleDrag), (0, n.removeEvent)(a, w2.mouse.stop, this.handleDragStop), (0, n.removeEvent)(a, w2.touch.stop, this.handleDragStop), (0, n.removeEvent)(s, w2.touch.start, this.onTouchStart, {
  1901. passive: false
  1902. }), this.props.enableUserSelectHack && (0, n.removeUserSelectStyles)(a);
  1903. }
  1904. }
  1905. // React Strict Mode compatibility: if `nodeRef` is passed, we will use it instead of trying to find
  1906. // the underlying DOM node ourselves. See the README for more information.
  1907. findDOMNode() {
  1908. var s, a;
  1909. return (s = this.props) !== null && s !== void 0 && s.nodeRef ? (a = this.props) === null || a === void 0 || (a = a.nodeRef) === null || a === void 0 ? void 0 : a.current : r.default.findDOMNode(this);
  1910. }
  1911. render() {
  1912. return t.cloneElement(t.Children.only(this.props.children), {
  1913. // Note: mouseMove handler is attached to document so it will still function
  1914. // when the user drags quickly and leaves the bounds of the element.
  1915. onMouseDown: this.onMouseDown,
  1916. onMouseUp: this.onMouseUp,
  1917. // onTouchStart is added on `componentDidMount` so they can be added with
  1918. // {passive: false}, which allows it to cancel. See
  1919. // https://developers.google.com/web/updates/2017/01/scrolling-intervention
  1920. onTouchEnd: this.onTouchEnd
  1921. });
  1922. }
  1923. };
  1924. return It.default = R3, p(R3, "displayName", "DraggableCore"), p(R3, "propTypes", {
  1925. /**
  1926. * `allowAnyClick` allows dragging using any mouse button.
  1927. * By default, we only accept the left button.
  1928. *
  1929. * Defaults to `false`.
  1930. */
  1931. allowAnyClick: e.default.bool,
  1932. children: e.default.node.isRequired,
  1933. /**
  1934. * `disabled`, if true, stops the <Draggable> from dragging. All handlers,
  1935. * with the exception of `onMouseDown`, will not fire.
  1936. */
  1937. disabled: e.default.bool,
  1938. /**
  1939. * By default, we add 'user-select:none' attributes to the document body
  1940. * to prevent ugly text selection during drag. If this is causing problems
  1941. * for your app, set this to `false`.
  1942. */
  1943. enableUserSelectHack: e.default.bool,
  1944. /**
  1945. * `offsetParent`, if set, uses the passed DOM node to compute drag offsets
  1946. * instead of using the parent node.
  1947. */
  1948. offsetParent: function(h, s) {
  1949. if (h[s] && h[s].nodeType !== 1)
  1950. throw new Error("Draggable's offsetParent must be a DOM Node.");
  1951. },
  1952. /**
  1953. * `grid` specifies the x and y that dragging should snap to.
  1954. */
  1955. grid: e.default.arrayOf(e.default.number),
  1956. /**
  1957. * `handle` specifies a selector to be used as the handle that initiates drag.
  1958. *
  1959. * Example:
  1960. *
  1961. * ```jsx
  1962. * let App = React.createClass({
  1963. * render: function () {
  1964. * return (
  1965. * <Draggable handle=".handle">
  1966. * <div>
  1967. * <div className="handle">Click me to drag</div>
  1968. * <div>This is some other content</div>
  1969. * </div>
  1970. * </Draggable>
  1971. * );
  1972. * }
  1973. * });
  1974. * ```
  1975. */
  1976. handle: e.default.string,
  1977. /**
  1978. * `cancel` specifies a selector to be used to prevent drag initialization.
  1979. *
  1980. * Example:
  1981. *
  1982. * ```jsx
  1983. * let App = React.createClass({
  1984. * render: function () {
  1985. * return(
  1986. * <Draggable cancel=".cancel">
  1987. * <div>
  1988. * <div className="cancel">You can't drag from here</div>
  1989. * <div>Dragging here works fine</div>
  1990. * </div>
  1991. * </Draggable>
  1992. * );
  1993. * }
  1994. * });
  1995. * ```
  1996. */
  1997. cancel: e.default.string,
  1998. /* If running in React Strict mode, ReactDOM.findDOMNode() is deprecated.
  1999. * Unfortunately, in order for <Draggable> to work properly, we need raw access
  2000. * to the underlying DOM node. If you want to avoid the warning, pass a `nodeRef`
  2001. * as in this example:
  2002. *
  2003. * function MyComponent() {
  2004. * const nodeRef = React.useRef(null);
  2005. * return (
  2006. * <Draggable nodeRef={nodeRef}>
  2007. * <div ref={nodeRef}>Example Target</div>
  2008. * </Draggable>
  2009. * );
  2010. * }
  2011. *
  2012. * This can be used for arbitrarily nested components, so long as the ref ends up
  2013. * pointing to the actual child DOM node and not a custom component.
  2014. */
  2015. nodeRef: e.default.object,
  2016. /**
  2017. * Called when dragging starts.
  2018. * If this function returns the boolean false, dragging will be canceled.
  2019. */
  2020. onStart: e.default.func,
  2021. /**
  2022. * Called while dragging.
  2023. * If this function returns the boolean false, dragging will be canceled.
  2024. */
  2025. onDrag: e.default.func,
  2026. /**
  2027. * Called when dragging stops.
  2028. * If this function returns the boolean false, the drag will remain active.
  2029. */
  2030. onStop: e.default.func,
  2031. /**
  2032. * A workaround option which can be passed if onMouseDown needs to be accessed,
  2033. * since it'll always be blocked (as there is internal use of onMouseDown)
  2034. */
  2035. onMouseDown: e.default.func,
  2036. /**
  2037. * `scale`, if set, applies scaling while dragging an element
  2038. */
  2039. scale: e.default.number,
  2040. /**
  2041. * These properties should be defined on the child, not here.
  2042. */
  2043. className: o.dontSetMe,
  2044. style: o.dontSetMe,
  2045. transform: o.dontSetMe
  2046. }), p(R3, "defaultProps", {
  2047. allowAnyClick: false,
  2048. // by default only accept left click
  2049. disabled: false,
  2050. enableUserSelectHack: true,
  2051. onStart: function() {
  2052. },
  2053. onDrag: function() {
  2054. },
  2055. onStop: function() {
  2056. },
  2057. onMouseDown: function() {
  2058. },
  2059. scale: 1
  2060. }), It;
  2061. }
  2062. var qr;
  2063. function Ks() {
  2064. return qr || (qr = 1, function(t) {
  2065. Object.defineProperty(t, "__esModule", {
  2066. value: true
  2067. }), Object.defineProperty(t, "DraggableCore", {
  2068. enumerable: true,
  2069. get: function() {
  2070. return d.default;
  2071. }
  2072. }), t.default = void 0;
  2073. var e = _(import_react.default), r = p(Qe()), n = p(import_react_dom.default), i = p(Gs), o = hr(), c = Bi(), v = Mn(), d = p(Ys2()), y3 = p(Gi());
  2074. function p(a) {
  2075. return a && a.__esModule ? a : { default: a };
  2076. }
  2077. function C(a) {
  2078. if (typeof WeakMap != "function")
  2079. return null;
  2080. var u = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap();
  2081. return (C = function(l) {
  2082. return l ? b : u;
  2083. })(a);
  2084. }
  2085. function _(a, u) {
  2086. if (a && a.__esModule)
  2087. return a;
  2088. if (a === null || typeof a != "object" && typeof a != "function")
  2089. return { default: a };
  2090. var b = C(u);
  2091. if (b && b.has(a))
  2092. return b.get(a);
  2093. var l = {}, g = Object.defineProperty && Object.getOwnPropertyDescriptor;
  2094. for (var f in a)
  2095. if (f !== "default" && Object.prototype.hasOwnProperty.call(a, f)) {
  2096. var m = g ? Object.getOwnPropertyDescriptor(a, f) : null;
  2097. m && (m.get || m.set) ? Object.defineProperty(l, f, m) : l[f] = a[f];
  2098. }
  2099. return l.default = a, b && b.set(a, l), l;
  2100. }
  2101. function w2() {
  2102. return w2 = Object.assign ? Object.assign.bind() : function(a) {
  2103. for (var u = 1; u < arguments.length; u++) {
  2104. var b = arguments[u];
  2105. for (var l in b)
  2106. Object.prototype.hasOwnProperty.call(b, l) && (a[l] = b[l]);
  2107. }
  2108. return a;
  2109. }, w2.apply(this, arguments);
  2110. }
  2111. function S(a, u, b) {
  2112. return u = R3(u), u in a ? Object.defineProperty(a, u, { value: b, enumerable: true, configurable: true, writable: true }) : a[u] = b, a;
  2113. }
  2114. function R3(a) {
  2115. var u = h(a, "string");
  2116. return typeof u == "symbol" ? u : String(u);
  2117. }
  2118. function h(a, u) {
  2119. if (typeof a != "object" || a === null)
  2120. return a;
  2121. var b = a[Symbol.toPrimitive];
  2122. if (b !== void 0) {
  2123. var l = b.call(a, u || "default");
  2124. if (typeof l != "object")
  2125. return l;
  2126. throw new TypeError("@@toPrimitive must return a primitive value.");
  2127. }
  2128. return (u === "string" ? String : Number)(a);
  2129. }
  2130. class s extends e.Component {
  2131. // React 16.3+
  2132. // Arity (props, state)
  2133. static getDerivedStateFromProps(u, b) {
  2134. let {
  2135. position: l
  2136. } = u, {
  2137. prevPropsPosition: g
  2138. } = b;
  2139. return l && (!g || l.x !== g.x || l.y !== g.y) ? ((0, y3.default)("Draggable: getDerivedStateFromProps %j", {
  2140. position: l,
  2141. prevPropsPosition: g
  2142. }), {
  2143. x: l.x,
  2144. y: l.y,
  2145. prevPropsPosition: {
  2146. ...l
  2147. }
  2148. }) : null;
  2149. }
  2150. constructor(u) {
  2151. super(u), S(this, "onDragStart", (b, l) => {
  2152. if ((0, y3.default)("Draggable: onDragStart: %j", l), this.props.onStart(b, (0, c.createDraggableData)(this, l)) === false)
  2153. return false;
  2154. this.setState({
  2155. dragging: true,
  2156. dragged: true
  2157. });
  2158. }), S(this, "onDrag", (b, l) => {
  2159. if (!this.state.dragging)
  2160. return false;
  2161. (0, y3.default)("Draggable: onDrag: %j", l);
  2162. const g = (0, c.createDraggableData)(this, l), f = {
  2163. x: g.x,
  2164. y: g.y,
  2165. slackX: 0,
  2166. slackY: 0
  2167. };
  2168. if (this.props.bounds) {
  2169. const {
  2170. x: P,
  2171. y: M2
  2172. } = f;
  2173. f.x += this.state.slackX, f.y += this.state.slackY;
  2174. const [j2, N3] = (0, c.getBoundPosition)(this, f.x, f.y);
  2175. f.x = j2, f.y = N3, f.slackX = this.state.slackX + (P - f.x), f.slackY = this.state.slackY + (M2 - f.y), g.x = f.x, g.y = f.y, g.deltaX = f.x - this.state.x, g.deltaY = f.y - this.state.y;
  2176. }
  2177. if (this.props.onDrag(b, g) === false)
  2178. return false;
  2179. this.setState(f);
  2180. }), S(this, "onDragStop", (b, l) => {
  2181. if (!this.state.dragging || this.props.onStop(b, (0, c.createDraggableData)(this, l)) === false)
  2182. return false;
  2183. (0, y3.default)("Draggable: onDragStop: %j", l);
  2184. const f = {
  2185. dragging: false,
  2186. slackX: 0,
  2187. slackY: 0
  2188. };
  2189. if (!!this.props.position) {
  2190. const {
  2191. x: P,
  2192. y: M2
  2193. } = this.props.position;
  2194. f.x = P, f.y = M2;
  2195. }
  2196. this.setState(f);
  2197. }), this.state = {
  2198. // Whether or not we are currently dragging.
  2199. dragging: false,
  2200. // Whether or not we have been dragged before.
  2201. dragged: false,
  2202. // Current transform x and y.
  2203. x: u.position ? u.position.x : u.defaultPosition.x,
  2204. y: u.position ? u.position.y : u.defaultPosition.y,
  2205. prevPropsPosition: {
  2206. ...u.position
  2207. },
  2208. // Used for compensating for out-of-bounds drags
  2209. slackX: 0,
  2210. slackY: 0,
  2211. // Can only determine if SVG after mounting
  2212. isElementSVG: false
  2213. }, u.position && !(u.onDrag || u.onStop) && console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.");
  2214. }
  2215. componentDidMount() {
  2216. typeof window.SVGElement < "u" && this.findDOMNode() instanceof window.SVGElement && this.setState({
  2217. isElementSVG: true
  2218. });
  2219. }
  2220. componentWillUnmount() {
  2221. this.setState({
  2222. dragging: false
  2223. });
  2224. }
  2225. // React Strict Mode compatibility: if `nodeRef` is passed, we will use it instead of trying to find
  2226. // the underlying DOM node ourselves. See the README for more information.
  2227. findDOMNode() {
  2228. var u, b;
  2229. return (u = (b = this.props) === null || b === void 0 || (b = b.nodeRef) === null || b === void 0 ? void 0 : b.current) !== null && u !== void 0 ? u : n.default.findDOMNode(this);
  2230. }
  2231. render() {
  2232. const {
  2233. axis: u,
  2234. bounds: b,
  2235. children: l,
  2236. defaultPosition: g,
  2237. defaultClassName: f,
  2238. defaultClassNameDragging: m,
  2239. defaultClassNameDragged: P,
  2240. position: M2,
  2241. positionOffset: j2,
  2242. scale: N3,
  2243. ...I
  2244. } = this.props;
  2245. let O = {}, z = null;
  2246. const k = !!!M2 || this.state.dragging, ie = M2 || g, ee = {
  2247. // Set left if horizontal drag is enabled
  2248. x: (0, c.canDragX)(this) && k ? this.state.x : ie.x,
  2249. // Set top if vertical drag is enabled
  2250. y: (0, c.canDragY)(this) && k ? this.state.y : ie.y
  2251. };
  2252. this.state.isElementSVG ? z = (0, o.createSVGTransform)(ee, j2) : O = (0, o.createCSSTransform)(ee, j2);
  2253. const A = (0, i.default)(l.props.className || "", f, {
  2254. [m]: this.state.dragging,
  2255. [P]: this.state.dragged
  2256. });
  2257. return e.createElement(d.default, w2({}, I, {
  2258. onStart: this.onDragStart,
  2259. onDrag: this.onDrag,
  2260. onStop: this.onDragStop
  2261. }), e.cloneElement(e.Children.only(l), {
  2262. className: A,
  2263. style: {
  2264. ...l.props.style,
  2265. ...O
  2266. },
  2267. transform: z
  2268. }));
  2269. }
  2270. }
  2271. t.default = s, S(s, "displayName", "Draggable"), S(s, "propTypes", {
  2272. // Accepts all props <DraggableCore> accepts.
  2273. ...d.default.propTypes,
  2274. /**
  2275. * `axis` determines which axis the draggable can move.
  2276. *
  2277. * Note that all callbacks will still return data as normal. This only
  2278. * controls flushing to the DOM.
  2279. *
  2280. * 'both' allows movement horizontally and vertically.
  2281. * 'x' limits movement to horizontal axis.
  2282. * 'y' limits movement to vertical axis.
  2283. * 'none' limits all movement.
  2284. *
  2285. * Defaults to 'both'.
  2286. */
  2287. axis: r.default.oneOf(["both", "x", "y", "none"]),
  2288. /**
  2289. * `bounds` determines the range of movement available to the element.
  2290. * Available values are:
  2291. *
  2292. * 'parent' restricts movement within the Draggable's parent node.
  2293. *
  2294. * Alternatively, pass an object with the following properties, all of which are optional:
  2295. *
  2296. * {left: LEFT_BOUND, right: RIGHT_BOUND, bottom: BOTTOM_BOUND, top: TOP_BOUND}
  2297. *
  2298. * All values are in px.
  2299. *
  2300. * Example:
  2301. *
  2302. * ```jsx
  2303. * let App = React.createClass({
  2304. * render: function () {
  2305. * return (
  2306. * <Draggable bounds={{right: 300, bottom: 300}}>
  2307. * <div>Content</div>
  2308. * </Draggable>
  2309. * );
  2310. * }
  2311. * });
  2312. * ```
  2313. */
  2314. bounds: r.default.oneOfType([r.default.shape({
  2315. left: r.default.number,
  2316. right: r.default.number,
  2317. top: r.default.number,
  2318. bottom: r.default.number
  2319. }), r.default.string, r.default.oneOf([false])]),
  2320. defaultClassName: r.default.string,
  2321. defaultClassNameDragging: r.default.string,
  2322. defaultClassNameDragged: r.default.string,
  2323. /**
  2324. * `defaultPosition` specifies the x and y that the dragged item should start at
  2325. *
  2326. * Example:
  2327. *
  2328. * ```jsx
  2329. * let App = React.createClass({
  2330. * render: function () {
  2331. * return (
  2332. * <Draggable defaultPosition={{x: 25, y: 25}}>
  2333. * <div>I start with transformX: 25px and transformY: 25px;</div>
  2334. * </Draggable>
  2335. * );
  2336. * }
  2337. * });
  2338. * ```
  2339. */
  2340. defaultPosition: r.default.shape({
  2341. x: r.default.number,
  2342. y: r.default.number
  2343. }),
  2344. positionOffset: r.default.shape({
  2345. x: r.default.oneOfType([r.default.number, r.default.string]),
  2346. y: r.default.oneOfType([r.default.number, r.default.string])
  2347. }),
  2348. /**
  2349. * `position`, if present, defines the current position of the element.
  2350. *
  2351. * This is similar to how form elements in React work - if no `position` is supplied, the component
  2352. * is uncontrolled.
  2353. *
  2354. * Example:
  2355. *
  2356. * ```jsx
  2357. * let App = React.createClass({
  2358. * render: function () {
  2359. * return (
  2360. * <Draggable position={{x: 25, y: 25}}>
  2361. * <div>I start with transformX: 25px and transformY: 25px;</div>
  2362. * </Draggable>
  2363. * );
  2364. * }
  2365. * });
  2366. * ```
  2367. */
  2368. position: r.default.shape({
  2369. x: r.default.number,
  2370. y: r.default.number
  2371. }),
  2372. /**
  2373. * These properties should be defined on the child, not here.
  2374. */
  2375. className: v.dontSetMe,
  2376. style: v.dontSetMe,
  2377. transform: v.dontSetMe
  2378. }), S(s, "defaultProps", {
  2379. ...d.default.defaultProps,
  2380. axis: "both",
  2381. bounds: false,
  2382. defaultClassName: "react-draggable",
  2383. defaultClassNameDragging: "react-draggable-dragging",
  2384. defaultClassNameDragged: "react-draggable-dragged",
  2385. defaultPosition: {
  2386. x: 0,
  2387. y: 0
  2388. },
  2389. scale: 1
  2390. });
  2391. }(Bn)), Bn;
  2392. }
  2393. var Ar;
  2394. function pr() {
  2395. if (Ar)
  2396. return xt.exports;
  2397. Ar = 1;
  2398. const {
  2399. default: t,
  2400. DraggableCore: e
  2401. } = Ks();
  2402. return xt.exports = t, xt.exports.default = t, xt.exports.DraggableCore = e, xt.exports;
  2403. }
  2404. var Et = { exports: {} };
  2405. var Tt = {};
  2406. var tn = {};
  2407. var Wr;
  2408. function Zs() {
  2409. if (Wr)
  2410. return tn;
  2411. Wr = 1, tn.__esModule = true, tn.cloneElement = v;
  2412. var t = e(import_react.default);
  2413. function e(d) {
  2414. return d && d.__esModule ? d : { default: d };
  2415. }
  2416. function r(d, y3) {
  2417. var p = Object.keys(d);
  2418. if (Object.getOwnPropertySymbols) {
  2419. var C = Object.getOwnPropertySymbols(d);
  2420. y3 && (C = C.filter(function(_) {
  2421. return Object.getOwnPropertyDescriptor(d, _).enumerable;
  2422. })), p.push.apply(p, C);
  2423. }
  2424. return p;
  2425. }
  2426. function n(d) {
  2427. for (var y3 = 1; y3 < arguments.length; y3++) {
  2428. var p = arguments[y3] != null ? arguments[y3] : {};
  2429. y3 % 2 ? r(Object(p), true).forEach(function(C) {
  2430. i(d, C, p[C]);
  2431. }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(d, Object.getOwnPropertyDescriptors(p)) : r(Object(p)).forEach(function(C) {
  2432. Object.defineProperty(d, C, Object.getOwnPropertyDescriptor(p, C));
  2433. });
  2434. }
  2435. return d;
  2436. }
  2437. function i(d, y3, p) {
  2438. return y3 = o(y3), y3 in d ? Object.defineProperty(d, y3, { value: p, enumerable: true, configurable: true, writable: true }) : d[y3] = p, d;
  2439. }
  2440. function o(d) {
  2441. var y3 = c(d, "string");
  2442. return typeof y3 == "symbol" ? y3 : String(y3);
  2443. }
  2444. function c(d, y3) {
  2445. if (typeof d != "object" || d === null)
  2446. return d;
  2447. var p = d[Symbol.toPrimitive];
  2448. if (p !== void 0) {
  2449. var C = p.call(d, y3 || "default");
  2450. if (typeof C != "object")
  2451. return C;
  2452. throw new TypeError("@@toPrimitive must return a primitive value.");
  2453. }
  2454. return (y3 === "string" ? String : Number)(d);
  2455. }
  2456. function v(d, y3) {
  2457. return y3.style && d.props.style && (y3.style = n(n({}, d.props.style), y3.style)), y3.className && d.props.className && (y3.className = d.props.className + " " + y3.className), t.default.cloneElement(d, y3);
  2458. }
  2459. return tn;
  2460. }
  2461. var Pt2 = {};
  2462. var Hr2;
  2463. function Xi() {
  2464. if (Hr2)
  2465. return Pt2;
  2466. Hr2 = 1, Pt2.__esModule = true, Pt2.resizableProps = void 0;
  2467. var t = e(Qe());
  2468. pr();
  2469. function e(n) {
  2470. return n && n.__esModule ? n : { default: n };
  2471. }
  2472. var r = {
  2473. /*
  2474. * Restricts resizing to a particular axis (default: 'both')
  2475. * 'both' - allows resizing by width or height
  2476. * 'x' - only allows the width to be changed
  2477. * 'y' - only allows the height to be changed
  2478. * 'none' - disables resizing altogether
  2479. * */
  2480. axis: t.default.oneOf(["both", "x", "y", "none"]),
  2481. className: t.default.string,
  2482. /*
  2483. * Require that one and only one child be present.
  2484. * */
  2485. children: t.default.element.isRequired,
  2486. /*
  2487. * These will be passed wholesale to react-draggable's DraggableCore
  2488. * */
  2489. draggableOpts: t.default.shape({
  2490. allowAnyClick: t.default.bool,
  2491. cancel: t.default.string,
  2492. children: t.default.node,
  2493. disabled: t.default.bool,
  2494. enableUserSelectHack: t.default.bool,
  2495. offsetParent: t.default.node,
  2496. grid: t.default.arrayOf(t.default.number),
  2497. handle: t.default.string,
  2498. nodeRef: t.default.object,
  2499. onStart: t.default.func,
  2500. onDrag: t.default.func,
  2501. onStop: t.default.func,
  2502. onMouseDown: t.default.func,
  2503. scale: t.default.number
  2504. }),
  2505. /*
  2506. * Initial height
  2507. * */
  2508. height: function() {
  2509. for (var i = arguments.length, o = new Array(i), c = 0; c < i; c++)
  2510. o[c] = arguments[c];
  2511. var v = o[0];
  2512. if (v.axis === "both" || v.axis === "y") {
  2513. var d;
  2514. return (d = t.default.number).isRequired.apply(d, o);
  2515. }
  2516. return t.default.number.apply(t.default, o);
  2517. },
  2518. /*
  2519. * Customize cursor resize handle
  2520. * */
  2521. handle: t.default.oneOfType([t.default.node, t.default.func]),
  2522. /*
  2523. * If you change this, be sure to update your css
  2524. * */
  2525. handleSize: t.default.arrayOf(t.default.number),
  2526. lockAspectRatio: t.default.bool,
  2527. /*
  2528. * Max X & Y measure
  2529. * */
  2530. maxConstraints: t.default.arrayOf(t.default.number),
  2531. /*
  2532. * Min X & Y measure
  2533. * */
  2534. minConstraints: t.default.arrayOf(t.default.number),
  2535. /*
  2536. * Called on stop resize event
  2537. * */
  2538. onResizeStop: t.default.func,
  2539. /*
  2540. * Called on start resize event
  2541. * */
  2542. onResizeStart: t.default.func,
  2543. /*
  2544. * Called on resize event
  2545. * */
  2546. onResize: t.default.func,
  2547. /*
  2548. * Defines which resize handles should be rendered (default: 'se')
  2549. * 's' - South handle (bottom-center)
  2550. * 'w' - West handle (left-center)
  2551. * 'e' - East handle (right-center)
  2552. * 'n' - North handle (top-center)
  2553. * 'sw' - Southwest handle (bottom-left)
  2554. * 'nw' - Northwest handle (top-left)
  2555. * 'se' - Southeast handle (bottom-right)
  2556. * 'ne' - Northeast handle (top-center)
  2557. * */
  2558. resizeHandles: t.default.arrayOf(t.default.oneOf(["s", "w", "e", "n", "sw", "nw", "se", "ne"])),
  2559. /*
  2560. * If `transform: scale(n)` is set on the parent, this should be set to `n`.
  2561. * */
  2562. transformScale: t.default.number,
  2563. /*
  2564. * Initial width
  2565. */
  2566. width: function() {
  2567. for (var i = arguments.length, o = new Array(i), c = 0; c < i; c++)
  2568. o[c] = arguments[c];
  2569. var v = o[0];
  2570. if (v.axis === "both" || v.axis === "x") {
  2571. var d;
  2572. return (d = t.default.number).isRequired.apply(d, o);
  2573. }
  2574. return t.default.number.apply(t.default, o);
  2575. }
  2576. };
  2577. return Pt2.resizableProps = r, Pt2;
  2578. }
  2579. var Ur;
  2580. function Yi() {
  2581. if (Ur)
  2582. return Tt;
  2583. Ur = 1, Tt.__esModule = true, Tt.default = void 0;
  2584. var t = c(import_react.default), e = pr(), r = Zs(), n = Xi(), i = ["children", "className", "draggableOpts", "width", "height", "handle", "handleSize", "lockAspectRatio", "axis", "minConstraints", "maxConstraints", "onResize", "onResizeStop", "onResizeStart", "resizeHandles", "transformScale"];
  2585. function o(s) {
  2586. if (typeof WeakMap != "function")
  2587. return null;
  2588. var a = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new WeakMap();
  2589. return (o = function(l) {
  2590. return l ? u : a;
  2591. })(s);
  2592. }
  2593. function c(s, a) {
  2594. if (s && s.__esModule)
  2595. return s;
  2596. if (s === null || typeof s != "object" && typeof s != "function")
  2597. return { default: s };
  2598. var u = o(a);
  2599. if (u && u.has(s))
  2600. return u.get(s);
  2601. var b = {}, l = Object.defineProperty && Object.getOwnPropertyDescriptor;
  2602. for (var g in s)
  2603. if (g !== "default" && Object.prototype.hasOwnProperty.call(s, g)) {
  2604. var f = l ? Object.getOwnPropertyDescriptor(s, g) : null;
  2605. f && (f.get || f.set) ? Object.defineProperty(b, g, f) : b[g] = s[g];
  2606. }
  2607. return b.default = s, u && u.set(s, b), b;
  2608. }
  2609. function v() {
  2610. return v = Object.assign ? Object.assign.bind() : function(s) {
  2611. for (var a = 1; a < arguments.length; a++) {
  2612. var u = arguments[a];
  2613. for (var b in u)
  2614. Object.prototype.hasOwnProperty.call(u, b) && (s[b] = u[b]);
  2615. }
  2616. return s;
  2617. }, v.apply(this, arguments);
  2618. }
  2619. function d(s, a) {
  2620. if (s == null)
  2621. return {};
  2622. var u = {}, b = Object.keys(s), l, g;
  2623. for (g = 0; g < b.length; g++)
  2624. l = b[g], !(a.indexOf(l) >= 0) && (u[l] = s[l]);
  2625. return u;
  2626. }
  2627. function y3(s, a) {
  2628. var u = Object.keys(s);
  2629. if (Object.getOwnPropertySymbols) {
  2630. var b = Object.getOwnPropertySymbols(s);
  2631. a && (b = b.filter(function(l) {
  2632. return Object.getOwnPropertyDescriptor(s, l).enumerable;
  2633. })), u.push.apply(u, b);
  2634. }
  2635. return u;
  2636. }
  2637. function p(s) {
  2638. for (var a = 1; a < arguments.length; a++) {
  2639. var u = arguments[a] != null ? arguments[a] : {};
  2640. a % 2 ? y3(Object(u), true).forEach(function(b) {
  2641. C(s, b, u[b]);
  2642. }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(s, Object.getOwnPropertyDescriptors(u)) : y3(Object(u)).forEach(function(b) {
  2643. Object.defineProperty(s, b, Object.getOwnPropertyDescriptor(u, b));
  2644. });
  2645. }
  2646. return s;
  2647. }
  2648. function C(s, a, u) {
  2649. return a = _(a), a in s ? Object.defineProperty(s, a, { value: u, enumerable: true, configurable: true, writable: true }) : s[a] = u, s;
  2650. }
  2651. function _(s) {
  2652. var a = w2(s, "string");
  2653. return typeof a == "symbol" ? a : String(a);
  2654. }
  2655. function w2(s, a) {
  2656. if (typeof s != "object" || s === null)
  2657. return s;
  2658. var u = s[Symbol.toPrimitive];
  2659. if (u !== void 0) {
  2660. var b = u.call(s, a || "default");
  2661. if (typeof b != "object")
  2662. return b;
  2663. throw new TypeError("@@toPrimitive must return a primitive value.");
  2664. }
  2665. return (a === "string" ? String : Number)(s);
  2666. }
  2667. function S(s, a) {
  2668. s.prototype = Object.create(a.prototype), s.prototype.constructor = s, R3(s, a);
  2669. }
  2670. function R3(s, a) {
  2671. return R3 = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(b, l) {
  2672. return b.__proto__ = l, b;
  2673. }, R3(s, a);
  2674. }
  2675. var h = function(s) {
  2676. S(a, s);
  2677. function a() {
  2678. for (var b, l = arguments.length, g = new Array(l), f = 0; f < l; f++)
  2679. g[f] = arguments[f];
  2680. return b = s.call.apply(s, [this].concat(g)) || this, b.handleRefs = {}, b.lastHandleRect = null, b.slack = null, b;
  2681. }
  2682. var u = a.prototype;
  2683. return u.componentWillUnmount = function() {
  2684. this.resetData();
  2685. }, u.resetData = function() {
  2686. this.lastHandleRect = this.slack = null;
  2687. }, u.runConstraints = function(l, g) {
  2688. var f = this.props, m = f.minConstraints, P = f.maxConstraints, M2 = f.lockAspectRatio;
  2689. if (!m && !P && !M2)
  2690. return [l, g];
  2691. if (M2) {
  2692. var j2 = this.props.width / this.props.height, N3 = l - this.props.width, I = g - this.props.height;
  2693. Math.abs(N3) > Math.abs(I * j2) ? g = l / j2 : l = g * j2;
  2694. }
  2695. var O = l, z = g, U = this.slack || [0, 0], k = U[0], ie = U[1];
  2696. return l += k, g += ie, m && (l = Math.max(m[0], l), g = Math.max(m[1], g)), P && (l = Math.min(P[0], l), g = Math.min(P[1], g)), this.slack = [k + (O - l), ie + (z - g)], [l, g];
  2697. }, u.resizeHandler = function(l, g) {
  2698. var f = this;
  2699. return function(m, P) {
  2700. var M2 = P.node, j2 = P.deltaX, N3 = P.deltaY;
  2701. l === "onResizeStart" && f.resetData();
  2702. var I = (f.props.axis === "both" || f.props.axis === "x") && g !== "n" && g !== "s", O = (f.props.axis === "both" || f.props.axis === "y") && g !== "e" && g !== "w";
  2703. if (!(!I && !O)) {
  2704. var z = g[0], U = g[g.length - 1], k = M2.getBoundingClientRect();
  2705. if (f.lastHandleRect != null) {
  2706. if (U === "w") {
  2707. var ie = k.left - f.lastHandleRect.left;
  2708. j2 += ie;
  2709. }
  2710. if (z === "n") {
  2711. var ee = k.top - f.lastHandleRect.top;
  2712. N3 += ee;
  2713. }
  2714. }
  2715. f.lastHandleRect = k, U === "w" && (j2 = -j2), z === "n" && (N3 = -N3);
  2716. var A = f.props.width + (I ? j2 / f.props.transformScale : 0), F2 = f.props.height + (O ? N3 / f.props.transformScale : 0), oe = f.runConstraints(A, F2);
  2717. A = oe[0], F2 = oe[1];
  2718. var se = A !== f.props.width || F2 !== f.props.height, de = typeof f.props[l] == "function" ? f.props[l] : null, ye = l === "onResize" && !se;
  2719. de && !ye && (m.persist == null || m.persist(), de(m, {
  2720. node: M2,
  2721. size: {
  2722. width: A,
  2723. height: F2
  2724. },
  2725. handle: g
  2726. })), l === "onResizeStop" && f.resetData();
  2727. }
  2728. };
  2729. }, u.renderResizeHandle = function(l, g) {
  2730. var f = this.props.handle;
  2731. if (!f)
  2732. return t.createElement("span", {
  2733. className: "react-resizable-handle react-resizable-handle-" + l,
  2734. ref: g
  2735. });
  2736. if (typeof f == "function")
  2737. return f(l, g);
  2738. var m = typeof f.type == "string", P = p({
  2739. ref: g
  2740. }, m ? {} : {
  2741. handleAxis: l
  2742. });
  2743. return t.cloneElement(f, P);
  2744. }, u.render = function() {
  2745. var l = this, g = this.props, f = g.children, m = g.className, P = g.draggableOpts;
  2746. g.width, g.height, g.handle, g.handleSize, g.lockAspectRatio, g.axis, g.minConstraints, g.maxConstraints, g.onResize, g.onResizeStop, g.onResizeStart;
  2747. var M2 = g.resizeHandles;
  2748. g.transformScale;
  2749. var j2 = d(g, i);
  2750. return (0, r.cloneElement)(f, p(p({}, j2), {}, {
  2751. className: (m ? m + " " : "") + "react-resizable",
  2752. children: [].concat(f.props.children, M2.map(function(N3) {
  2753. var I, O = (I = l.handleRefs[N3]) != null ? I : l.handleRefs[N3] = t.createRef();
  2754. return t.createElement(e.DraggableCore, v({}, P, {
  2755. nodeRef: O,
  2756. key: "resizableHandle-" + N3,
  2757. onStop: l.resizeHandler("onResizeStop", N3),
  2758. onStart: l.resizeHandler("onResizeStart", N3),
  2759. onDrag: l.resizeHandler("onResize", N3)
  2760. }), l.renderResizeHandle(N3, O));
  2761. }))
  2762. }));
  2763. }, a;
  2764. }(t.Component);
  2765. return Tt.default = h, h.propTypes = n.resizableProps, h.defaultProps = {
  2766. axis: "both",
  2767. handleSize: [20, 20],
  2768. lockAspectRatio: false,
  2769. minConstraints: [20, 20],
  2770. maxConstraints: [1 / 0, 1 / 0],
  2771. resizeHandles: ["se"],
  2772. transformScale: 1
  2773. }, Tt;
  2774. }
  2775. var Ot2 = {};
  2776. var kr;
  2777. function Js() {
  2778. if (kr)
  2779. return Ot2;
  2780. kr = 1, Ot2.__esModule = true, Ot2.default = void 0;
  2781. var t = v(import_react.default), e = o(Qe()), r = o(Yi()), n = Xi(), i = ["handle", "handleSize", "onResize", "onResizeStart", "onResizeStop", "draggableOpts", "minConstraints", "maxConstraints", "lockAspectRatio", "axis", "width", "height", "resizeHandles", "style", "transformScale"];
  2782. function o(a) {
  2783. return a && a.__esModule ? a : { default: a };
  2784. }
  2785. function c(a) {
  2786. if (typeof WeakMap != "function")
  2787. return null;
  2788. var u = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap();
  2789. return (c = function(g) {
  2790. return g ? b : u;
  2791. })(a);
  2792. }
  2793. function v(a, u) {
  2794. if (a && a.__esModule)
  2795. return a;
  2796. if (a === null || typeof a != "object" && typeof a != "function")
  2797. return { default: a };
  2798. var b = c(u);
  2799. if (b && b.has(a))
  2800. return b.get(a);
  2801. var l = {}, g = Object.defineProperty && Object.getOwnPropertyDescriptor;
  2802. for (var f in a)
  2803. if (f !== "default" && Object.prototype.hasOwnProperty.call(a, f)) {
  2804. var m = g ? Object.getOwnPropertyDescriptor(a, f) : null;
  2805. m && (m.get || m.set) ? Object.defineProperty(l, f, m) : l[f] = a[f];
  2806. }
  2807. return l.default = a, b && b.set(a, l), l;
  2808. }
  2809. function d() {
  2810. return d = Object.assign ? Object.assign.bind() : function(a) {
  2811. for (var u = 1; u < arguments.length; u++) {
  2812. var b = arguments[u];
  2813. for (var l in b)
  2814. Object.prototype.hasOwnProperty.call(b, l) && (a[l] = b[l]);
  2815. }
  2816. return a;
  2817. }, d.apply(this, arguments);
  2818. }
  2819. function y3(a, u) {
  2820. var b = Object.keys(a);
  2821. if (Object.getOwnPropertySymbols) {
  2822. var l = Object.getOwnPropertySymbols(a);
  2823. u && (l = l.filter(function(g) {
  2824. return Object.getOwnPropertyDescriptor(a, g).enumerable;
  2825. })), b.push.apply(b, l);
  2826. }
  2827. return b;
  2828. }
  2829. function p(a) {
  2830. for (var u = 1; u < arguments.length; u++) {
  2831. var b = arguments[u] != null ? arguments[u] : {};
  2832. u % 2 ? y3(Object(b), true).forEach(function(l) {
  2833. C(a, l, b[l]);
  2834. }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(a, Object.getOwnPropertyDescriptors(b)) : y3(Object(b)).forEach(function(l) {
  2835. Object.defineProperty(a, l, Object.getOwnPropertyDescriptor(b, l));
  2836. });
  2837. }
  2838. return a;
  2839. }
  2840. function C(a, u, b) {
  2841. return u = _(u), u in a ? Object.defineProperty(a, u, { value: b, enumerable: true, configurable: true, writable: true }) : a[u] = b, a;
  2842. }
  2843. function _(a) {
  2844. var u = w2(a, "string");
  2845. return typeof u == "symbol" ? u : String(u);
  2846. }
  2847. function w2(a, u) {
  2848. if (typeof a != "object" || a === null)
  2849. return a;
  2850. var b = a[Symbol.toPrimitive];
  2851. if (b !== void 0) {
  2852. var l = b.call(a, u || "default");
  2853. if (typeof l != "object")
  2854. return l;
  2855. throw new TypeError("@@toPrimitive must return a primitive value.");
  2856. }
  2857. return (u === "string" ? String : Number)(a);
  2858. }
  2859. function S(a, u) {
  2860. if (a == null)
  2861. return {};
  2862. var b = {}, l = Object.keys(a), g, f;
  2863. for (f = 0; f < l.length; f++)
  2864. g = l[f], !(u.indexOf(g) >= 0) && (b[g] = a[g]);
  2865. return b;
  2866. }
  2867. function R3(a, u) {
  2868. a.prototype = Object.create(u.prototype), a.prototype.constructor = a, h(a, u);
  2869. }
  2870. function h(a, u) {
  2871. return h = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(l, g) {
  2872. return l.__proto__ = g, l;
  2873. }, h(a, u);
  2874. }
  2875. var s = function(a) {
  2876. R3(u, a);
  2877. function u() {
  2878. for (var l, g = arguments.length, f = new Array(g), m = 0; m < g; m++)
  2879. f[m] = arguments[m];
  2880. return l = a.call.apply(a, [this].concat(f)) || this, l.state = {
  2881. width: l.props.width,
  2882. height: l.props.height,
  2883. propsWidth: l.props.width,
  2884. propsHeight: l.props.height
  2885. }, l.onResize = function(P, M2) {
  2886. var j2 = M2.size;
  2887. l.props.onResize ? (P.persist == null || P.persist(), l.setState(j2, function() {
  2888. return l.props.onResize && l.props.onResize(P, M2);
  2889. })) : l.setState(j2);
  2890. }, l;
  2891. }
  2892. u.getDerivedStateFromProps = function(g, f) {
  2893. return f.propsWidth !== g.width || f.propsHeight !== g.height ? {
  2894. width: g.width,
  2895. height: g.height,
  2896. propsWidth: g.width,
  2897. propsHeight: g.height
  2898. } : null;
  2899. };
  2900. var b = u.prototype;
  2901. return b.render = function() {
  2902. var g = this.props, f = g.handle, m = g.handleSize;
  2903. g.onResize;
  2904. var P = g.onResizeStart, M2 = g.onResizeStop, j2 = g.draggableOpts, N3 = g.minConstraints, I = g.maxConstraints, O = g.lockAspectRatio, z = g.axis;
  2905. g.width, g.height;
  2906. var U = g.resizeHandles, k = g.style, ie = g.transformScale, ee = S(g, i);
  2907. return t.createElement(r.default, {
  2908. axis: z,
  2909. draggableOpts: j2,
  2910. handle: f,
  2911. handleSize: m,
  2912. height: this.state.height,
  2913. lockAspectRatio: O,
  2914. maxConstraints: I,
  2915. minConstraints: N3,
  2916. onResizeStart: P,
  2917. onResize: this.onResize,
  2918. onResizeStop: M2,
  2919. resizeHandles: U,
  2920. transformScale: ie,
  2921. width: this.state.width
  2922. }, t.createElement("div", d({}, ee, {
  2923. style: p(p({}, k), {}, {
  2924. width: this.state.width + "px",
  2925. height: this.state.height + "px"
  2926. })
  2927. })));
  2928. }, u;
  2929. }(t.Component);
  2930. return Ot2.default = s, s.propTypes = p(p({}, n.resizableProps), {}, {
  2931. children: e.default.element
  2932. }), Ot2;
  2933. }
  2934. var Br;
  2935. function Qs() {
  2936. return Br || (Br = 1, Et.exports = function() {
  2937. throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable");
  2938. }, Et.exports.Resizable = Yi().default, Et.exports.ResizableBox = Js().default), Et.exports;
  2939. }
  2940. var Ue = {};
  2941. var Gr;
  2942. function Ki() {
  2943. if (Gr)
  2944. return Ue;
  2945. Gr = 1, Object.defineProperty(Ue, "__esModule", {
  2946. value: true
  2947. }), Ue.resizeHandleType = Ue.resizeHandleAxesType = Ue.default = void 0;
  2948. var t = r(Qe()), e = r(import_react.default);
  2949. function r(o) {
  2950. return o && o.__esModule ? o : { default: o };
  2951. }
  2952. const n = Ue.resizeHandleAxesType = t.default.arrayOf(t.default.oneOf(["s", "w", "e", "n", "sw", "nw", "se", "ne"])), i = Ue.resizeHandleType = t.default.oneOfType([t.default.node, t.default.func]);
  2953. return Ue.default = {
  2954. //
  2955. // Basic props
  2956. //
  2957. className: t.default.string,
  2958. style: t.default.object,
  2959. // This can be set explicitly. If it is not set, it will automatically
  2960. // be set to the container width. Note that resizes will *not* cause this to adjust.
  2961. // If you need that behavior, use WidthProvider.
  2962. width: t.default.number,
  2963. // If true, the container height swells and contracts to fit contents
  2964. autoSize: t.default.bool,
  2965. // # of cols.
  2966. cols: t.default.number,
  2967. // A selector that will not be draggable.
  2968. draggableCancel: t.default.string,
  2969. // A selector for the draggable handler
  2970. draggableHandle: t.default.string,
  2971. // Deprecated
  2972. verticalCompact: function(o) {
  2973. o.verticalCompact;
  2974. },
  2975. // Choose vertical or hotizontal compaction
  2976. compactType: t.default.oneOf(["vertical", "horizontal"]),
  2977. // layout is an array of object with the format:
  2978. // {x: Number, y: Number, w: Number, h: Number, i: String}
  2979. layout: function(o) {
  2980. var c = o.layout;
  2981. c !== void 0 && St().validateLayout(c, "layout");
  2982. },
  2983. //
  2984. // Grid Dimensions
  2985. //
  2986. // Margin between items [x, y] in px
  2987. margin: t.default.arrayOf(t.default.number),
  2988. // Padding inside the container [x, y] in px
  2989. containerPadding: t.default.arrayOf(t.default.number),
  2990. // Rows have a static height, but you can change this based on breakpoints if you like
  2991. rowHeight: t.default.number,
  2992. // Default Infinity, but you can specify a max here if you like.
  2993. // Note that this isn't fully fleshed out and won't error if you specify a layout that
  2994. // extends beyond the row capacity. It will, however, not allow users to drag/resize
  2995. // an item past the barrier. They can push items beyond the barrier, though.
  2996. // Intentionally not documented for this reason.
  2997. maxRows: t.default.number,
  2998. //
  2999. // Flags
  3000. //
  3001. isBounded: t.default.bool,
  3002. isDraggable: t.default.bool,
  3003. isResizable: t.default.bool,
  3004. // If true, grid can be placed one over the other.
  3005. allowOverlap: t.default.bool,
  3006. // If true, grid items won't change position when being dragged over.
  3007. preventCollision: t.default.bool,
  3008. // Use CSS transforms instead of top/left
  3009. useCSSTransforms: t.default.bool,
  3010. // parent layout transform scale
  3011. transformScale: t.default.number,
  3012. // If true, an external element can trigger onDrop callback with a specific grid position as a parameter
  3013. isDroppable: t.default.bool,
  3014. // Resize handle options
  3015. resizeHandles: n,
  3016. resizeHandle: i,
  3017. //
  3018. // Callbacks
  3019. //
  3020. // Callback so you can save the layout. Calls after each drag & resize stops.
  3021. onLayoutChange: t.default.func,
  3022. // Calls when drag starts. Callback is of the signature (layout, oldItem, newItem, placeholder, e, ?node).
  3023. // All callbacks below have the same signature. 'start' and 'stop' callbacks omit the 'placeholder'.
  3024. onDragStart: t.default.func,
  3025. // Calls on each drag movement.
  3026. onDrag: t.default.func,
  3027. // Calls when drag is complete.
  3028. onDragStop: t.default.func,
  3029. //Calls when resize starts.
  3030. onResizeStart: t.default.func,
  3031. // Calls when resize movement happens.
  3032. onResize: t.default.func,
  3033. // Calls when resize is complete.
  3034. onResizeStop: t.default.func,
  3035. // Calls when some element is dropped.
  3036. onDrop: t.default.func,
  3037. //
  3038. // Other validations
  3039. //
  3040. droppingItem: t.default.shape({
  3041. i: t.default.string.isRequired,
  3042. w: t.default.number.isRequired,
  3043. h: t.default.number.isRequired
  3044. }),
  3045. // Children must not have duplicate keys.
  3046. children: function(o, c) {
  3047. const v = o[c], d = {};
  3048. e.default.Children.forEach(v, function(y3) {
  3049. if ((y3 == null ? void 0 : y3.key) != null) {
  3050. if (d[y3.key])
  3051. throw new Error('Duplicate child key "' + y3.key + '" found! This will cause problems in ReactGridLayout.');
  3052. d[y3.key] = true;
  3053. }
  3054. });
  3055. },
  3056. // Optional ref for getting a reference for the wrapping div.
  3057. innerRef: t.default.any
  3058. }, Ue;
  3059. }
  3060. var Xr;
  3061. function ea() {
  3062. if (Xr)
  3063. return _t2;
  3064. Xr = 1, Object.defineProperty(_t2, "__esModule", {
  3065. value: true
  3066. }), _t2.default = void 0;
  3067. var t = d(import_react.default), e = d(Qe()), r = pr(), n = Qs(), i = St(), o = fr2(), c = Ki(), v = d(dr());
  3068. function d(w2) {
  3069. return w2 && w2.__esModule ? w2 : { default: w2 };
  3070. }
  3071. function y3(w2, S, R3) {
  3072. return S = p(S), S in w2 ? Object.defineProperty(w2, S, { value: R3, enumerable: true, configurable: true, writable: true }) : w2[S] = R3, w2;
  3073. }
  3074. function p(w2) {
  3075. var S = C(w2, "string");
  3076. return typeof S == "symbol" ? S : String(S);
  3077. }
  3078. function C(w2, S) {
  3079. if (typeof w2 != "object" || w2 === null)
  3080. return w2;
  3081. var R3 = w2[Symbol.toPrimitive];
  3082. if (R3 !== void 0) {
  3083. var h = R3.call(w2, S || "default");
  3084. if (typeof h != "object")
  3085. return h;
  3086. throw new TypeError("@@toPrimitive must return a primitive value.");
  3087. }
  3088. return (S === "string" ? String : Number)(w2);
  3089. }
  3090. let _ = class extends t.default.Component {
  3091. constructor() {
  3092. super(...arguments), y3(this, "state", {
  3093. resizing: null,
  3094. dragging: null,
  3095. className: ""
  3096. }), y3(this, "elementRef", t.default.createRef()), y3(this, "onDragStart", (S, R3) => {
  3097. let {
  3098. node: h
  3099. } = R3;
  3100. const {
  3101. onDragStart: s,
  3102. transformScale: a
  3103. } = this.props;
  3104. if (!s)
  3105. return;
  3106. const u = {
  3107. top: 0,
  3108. left: 0
  3109. }, {
  3110. offsetParent: b
  3111. } = h;
  3112. if (!b)
  3113. return;
  3114. const l = b.getBoundingClientRect(), g = h.getBoundingClientRect(), f = g.left / a, m = l.left / a, P = g.top / a, M2 = l.top / a;
  3115. u.left = f - m + b.scrollLeft, u.top = P - M2 + b.scrollTop, this.setState({
  3116. dragging: u
  3117. });
  3118. const {
  3119. x: j2,
  3120. y: N3
  3121. } = (0, o.calcXY)(this.getPositionParams(), u.top, u.left, this.props.w, this.props.h);
  3122. return s.call(this, this.props.i, j2, N3, {
  3123. e: S,
  3124. node: h,
  3125. newPosition: u
  3126. });
  3127. }), y3(this, "onDrag", (S, R3) => {
  3128. let {
  3129. node: h,
  3130. deltaX: s,
  3131. deltaY: a
  3132. } = R3;
  3133. const {
  3134. onDrag: u
  3135. } = this.props;
  3136. if (!u)
  3137. return;
  3138. if (!this.state.dragging)
  3139. throw new Error("onDrag called before onDragStart.");
  3140. let b = this.state.dragging.top + a, l = this.state.dragging.left + s;
  3141. const {
  3142. isBounded: g,
  3143. i: f,
  3144. w: m,
  3145. h: P,
  3146. containerWidth: M2
  3147. } = this.props, j2 = this.getPositionParams();
  3148. if (g) {
  3149. const {
  3150. offsetParent: U
  3151. } = h;
  3152. if (U) {
  3153. const {
  3154. margin: k,
  3155. rowHeight: ie,
  3156. containerPadding: ee
  3157. } = this.props, A = U.clientHeight - (0, o.calcGridItemWHPx)(P, ie, k[1]);
  3158. b = (0, o.clamp)(b - ee[1], 0, A);
  3159. const F2 = (0, o.calcGridColWidth)(j2), oe = M2 - (0, o.calcGridItemWHPx)(m, F2, k[0]);
  3160. l = (0, o.clamp)(l - ee[0], 0, oe);
  3161. }
  3162. }
  3163. const N3 = {
  3164. top: b,
  3165. left: l
  3166. };
  3167. this.setState({
  3168. dragging: N3
  3169. });
  3170. const {
  3171. containerPadding: I
  3172. } = this.props, {
  3173. x: O,
  3174. y: z
  3175. } = (0, o.calcXY)(j2, b - I[1], l - I[0], m, P);
  3176. return u.call(this, f, O, z, {
  3177. e: S,
  3178. node: h,
  3179. newPosition: N3
  3180. });
  3181. }), y3(this, "onDragStop", (S, R3) => {
  3182. let {
  3183. node: h
  3184. } = R3;
  3185. const {
  3186. onDragStop: s
  3187. } = this.props;
  3188. if (!s)
  3189. return;
  3190. if (!this.state.dragging)
  3191. throw new Error("onDragEnd called before onDragStart.");
  3192. const {
  3193. w: a,
  3194. h: u,
  3195. i: b,
  3196. containerPadding: l
  3197. } = this.props, {
  3198. left: g,
  3199. top: f
  3200. } = this.state.dragging, m = {
  3201. top: f,
  3202. left: g
  3203. };
  3204. this.setState({
  3205. dragging: null
  3206. });
  3207. const {
  3208. x: P,
  3209. y: M2
  3210. } = (0, o.calcXY)(this.getPositionParams(), f - l[1], g - l[0], a, u);
  3211. return s.call(this, b, P, M2, {
  3212. e: S,
  3213. node: h,
  3214. newPosition: m
  3215. });
  3216. }), y3(this, "onResizeStop", (S, R3, h) => this.onResizeHandler(S, R3, h, "onResizeStop")), y3(this, "onResizeStart", (S, R3, h) => this.onResizeHandler(S, R3, h, "onResizeStart")), y3(this, "onResize", (S, R3, h) => this.onResizeHandler(S, R3, h, "onResize"));
  3217. }
  3218. shouldComponentUpdate(S, R3) {
  3219. if (this.props.children !== S.children || this.props.droppingPosition !== S.droppingPosition)
  3220. return true;
  3221. const h = (0, o.calcGridItemPosition)(this.getPositionParams(this.props), this.props.x, this.props.y, this.props.w, this.props.h, this.state), s = (0, o.calcGridItemPosition)(this.getPositionParams(S), S.x, S.y, S.w, S.h, R3);
  3222. return !(0, i.fastPositionEqual)(h, s) || this.props.useCSSTransforms !== S.useCSSTransforms;
  3223. }
  3224. componentDidMount() {
  3225. this.moveDroppingItem({});
  3226. }
  3227. componentDidUpdate(S) {
  3228. this.moveDroppingItem(S);
  3229. }
  3230. // When a droppingPosition is present, this means we should fire a move event, as if we had moved
  3231. // this element by `x, y` pixels.
  3232. moveDroppingItem(S) {
  3233. const {
  3234. droppingPosition: R3
  3235. } = this.props;
  3236. if (!R3)
  3237. return;
  3238. const h = this.elementRef.current;
  3239. if (!h)
  3240. return;
  3241. const s = S.droppingPosition || {
  3242. left: 0,
  3243. top: 0
  3244. }, {
  3245. dragging: a
  3246. } = this.state, u = a && R3.left !== s.left || R3.top !== s.top;
  3247. if (!a)
  3248. this.onDragStart(R3.e, {
  3249. node: h,
  3250. deltaX: R3.left,
  3251. deltaY: R3.top
  3252. });
  3253. else if (u) {
  3254. const b = R3.left - a.left, l = R3.top - a.top;
  3255. this.onDrag(R3.e, {
  3256. node: h,
  3257. deltaX: b,
  3258. deltaY: l
  3259. });
  3260. }
  3261. }
  3262. getPositionParams() {
  3263. let S = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.props;
  3264. return {
  3265. cols: S.cols,
  3266. containerPadding: S.containerPadding,
  3267. containerWidth: S.containerWidth,
  3268. margin: S.margin,
  3269. maxRows: S.maxRows,
  3270. rowHeight: S.rowHeight
  3271. };
  3272. }
  3273. /**
  3274. * This is where we set the grid item's absolute placement. It gets a little tricky because we want to do it
  3275. * well when server rendering, and the only way to do that properly is to use percentage width/left because
  3276. * we don't know exactly what the browser viewport is.
  3277. * Unfortunately, CSS Transforms, which are great for performance, break in this instance because a percentage
  3278. * left is relative to the item itself, not its container! So we cannot use them on the server rendering pass.
  3279. *
  3280. * @param {Object} pos Position object with width, height, left, top.
  3281. * @return {Object} Style object.
  3282. */
  3283. createStyle(S) {
  3284. const {
  3285. usePercentages: R3,
  3286. containerWidth: h,
  3287. useCSSTransforms: s
  3288. } = this.props;
  3289. let a;
  3290. return s ? a = (0, i.setTransform)(S) : (a = (0, i.setTopLeft)(S), R3 && (a.left = (0, i.perc)(S.left / h), a.width = (0, i.perc)(S.width / h))), a;
  3291. }
  3292. /**
  3293. * Mix a Draggable instance into a child.
  3294. * @param {Element} child Child element.
  3295. * @return {Element} Child wrapped in Draggable.
  3296. */
  3297. mixinDraggable(S, R3) {
  3298. return t.default.createElement(r.DraggableCore, {
  3299. disabled: !R3,
  3300. onStart: this.onDragStart,
  3301. onDrag: this.onDrag,
  3302. onStop: this.onDragStop,
  3303. handle: this.props.handle,
  3304. cancel: ".react-resizable-handle" + (this.props.cancel ? "," + this.props.cancel : ""),
  3305. scale: this.props.transformScale,
  3306. nodeRef: this.elementRef
  3307. }, S);
  3308. }
  3309. /**
  3310. * Utility function to setup callback handler definitions for
  3311. * similarily structured resize events.
  3312. */
  3313. curryResizeHandler(S, R3) {
  3314. return (h, s) => (
  3315. /*: Function*/
  3316. R3(h, s, S)
  3317. );
  3318. }
  3319. /**
  3320. * Mix a Resizable instance into a child.
  3321. * @param {Element} child Child element.
  3322. * @param {Object} position Position object (pixel values)
  3323. * @return {Element} Child wrapped in Resizable.
  3324. */
  3325. mixinResizable(S, R3, h) {
  3326. const {
  3327. cols: s,
  3328. minW: a,
  3329. minH: u,
  3330. maxW: b,
  3331. maxH: l,
  3332. transformScale: g,
  3333. resizeHandles: f,
  3334. resizeHandle: m
  3335. } = this.props, P = this.getPositionParams(), M2 = (0, o.calcGridItemPosition)(P, 0, 0, s, 0).width, j2 = (0, o.calcGridItemPosition)(P, 0, 0, a, u), N3 = (0, o.calcGridItemPosition)(P, 0, 0, b, l), I = [j2.width, j2.height], O = [Math.min(N3.width, M2), Math.min(N3.height, 1 / 0)];
  3336. return t.default.createElement(
  3337. n.Resizable,
  3338. {
  3339. draggableOpts: {
  3340. disabled: !h
  3341. },
  3342. className: h ? void 0 : "react-resizable-hide",
  3343. width: R3.width,
  3344. height: R3.height,
  3345. minConstraints: I,
  3346. maxConstraints: O,
  3347. onResizeStop: this.curryResizeHandler(R3, this.onResizeStop),
  3348. onResizeStart: this.curryResizeHandler(R3, this.onResizeStart),
  3349. onResize: this.curryResizeHandler(R3, this.onResize),
  3350. transformScale: g,
  3351. resizeHandles: f,
  3352. handle: m
  3353. },
  3354. S
  3355. );
  3356. }
  3357. /**
  3358. * Wrapper around resize events to provide more useful data.
  3359. */
  3360. onResizeHandler(S, R3, h, s) {
  3361. let {
  3362. node: a,
  3363. size: u,
  3364. handle: b
  3365. } = R3;
  3366. const l = this.props[s];
  3367. if (!l)
  3368. return;
  3369. const {
  3370. x: g,
  3371. y: f,
  3372. i: m,
  3373. maxH: P,
  3374. minH: M2,
  3375. containerWidth: j2
  3376. } = this.props, {
  3377. minW: N3,
  3378. maxW: I
  3379. } = this.props;
  3380. let O = u;
  3381. a && (O = (0, i.resizeItemInDirection)(b, h, u, j2), this.setState({
  3382. resizing: s === "onResizeStop" ? null : O
  3383. }));
  3384. let {
  3385. w: z,
  3386. h: U
  3387. } = (0, o.calcWH)(this.getPositionParams(), O.width, O.height, g, f, b);
  3388. z = (0, o.clamp)(z, Math.max(N3, 1), I), U = (0, o.clamp)(U, M2, P), l.call(this, m, z, U, {
  3389. e: S,
  3390. node: a,
  3391. size: O,
  3392. handle: b
  3393. });
  3394. }
  3395. render() {
  3396. const {
  3397. x: S,
  3398. y: R3,
  3399. w: h,
  3400. h: s,
  3401. isDraggable: a,
  3402. isResizable: u,
  3403. droppingPosition: b,
  3404. useCSSTransforms: l
  3405. } = this.props, g = (0, o.calcGridItemPosition)(this.getPositionParams(), S, R3, h, s, this.state), f = t.default.Children.only(this.props.children);
  3406. let m = t.default.cloneElement(f, {
  3407. ref: this.elementRef,
  3408. className: (0, v.default)("react-grid-item", f.props.className, this.props.className, {
  3409. static: this.props.static,
  3410. resizing: !!this.state.resizing,
  3411. "react-draggable": a,
  3412. "react-draggable-dragging": !!this.state.dragging,
  3413. dropping: !!b,
  3414. cssTransforms: l
  3415. }),
  3416. // We can set the width and height on the child, but unfortunately we can't set the position.
  3417. style: {
  3418. ...this.props.style,
  3419. ...f.props.style,
  3420. ...this.createStyle(g)
  3421. }
  3422. });
  3423. return m = this.mixinResizable(m, g, u), m = this.mixinDraggable(m, a), m;
  3424. }
  3425. };
  3426. return _t2.default = _, y3(_, "propTypes", {
  3427. // Children must be only a single element
  3428. children: e.default.element,
  3429. // General grid attributes
  3430. cols: e.default.number.isRequired,
  3431. containerWidth: e.default.number.isRequired,
  3432. rowHeight: e.default.number.isRequired,
  3433. margin: e.default.array.isRequired,
  3434. maxRows: e.default.number.isRequired,
  3435. containerPadding: e.default.array.isRequired,
  3436. // These are all in grid units
  3437. x: e.default.number.isRequired,
  3438. y: e.default.number.isRequired,
  3439. w: e.default.number.isRequired,
  3440. h: e.default.number.isRequired,
  3441. // All optional
  3442. minW: function(w2, S) {
  3443. const R3 = w2[S];
  3444. if (typeof R3 != "number")
  3445. return new Error("minWidth not Number");
  3446. if (R3 > w2.w || R3 > w2.maxW)
  3447. return new Error("minWidth larger than item width/maxWidth");
  3448. },
  3449. maxW: function(w2, S) {
  3450. const R3 = w2[S];
  3451. if (typeof R3 != "number")
  3452. return new Error("maxWidth not Number");
  3453. if (R3 < w2.w || R3 < w2.minW)
  3454. return new Error("maxWidth smaller than item width/minWidth");
  3455. },
  3456. minH: function(w2, S) {
  3457. const R3 = w2[S];
  3458. if (typeof R3 != "number")
  3459. return new Error("minHeight not Number");
  3460. if (R3 > w2.h || R3 > w2.maxH)
  3461. return new Error("minHeight larger than item height/maxHeight");
  3462. },
  3463. maxH: function(w2, S) {
  3464. const R3 = w2[S];
  3465. if (typeof R3 != "number")
  3466. return new Error("maxHeight not Number");
  3467. if (R3 < w2.h || R3 < w2.minH)
  3468. return new Error("maxHeight smaller than item height/minHeight");
  3469. },
  3470. // ID is nice to have for callbacks
  3471. i: e.default.string.isRequired,
  3472. // Resize handle options
  3473. resizeHandles: c.resizeHandleAxesType,
  3474. resizeHandle: c.resizeHandleType,
  3475. // Functions
  3476. onDragStop: e.default.func,
  3477. onDragStart: e.default.func,
  3478. onDrag: e.default.func,
  3479. onResizeStop: e.default.func,
  3480. onResizeStart: e.default.func,
  3481. onResize: e.default.func,
  3482. // Flags
  3483. isDraggable: e.default.bool.isRequired,
  3484. isResizable: e.default.bool.isRequired,
  3485. isBounded: e.default.bool.isRequired,
  3486. static: e.default.bool,
  3487. // Use CSS transforms instead of top/left
  3488. useCSSTransforms: e.default.bool.isRequired,
  3489. transformScale: e.default.number,
  3490. // Others
  3491. className: e.default.string,
  3492. // Selector for draggable handle
  3493. handle: e.default.string,
  3494. // Selector for draggable cancel (see react-draggable)
  3495. cancel: e.default.string,
  3496. // Current position of a dropping element
  3497. droppingPosition: e.default.shape({
  3498. e: e.default.object.isRequired,
  3499. left: e.default.number.isRequired,
  3500. top: e.default.number.isRequired
  3501. })
  3502. }), y3(_, "defaultProps", {
  3503. className: "",
  3504. cancel: "",
  3505. handle: "",
  3506. minH: 1,
  3507. minW: 1,
  3508. maxH: 1 / 0,
  3509. maxW: 1 / 0,
  3510. transformScale: 1
  3511. }), _t2;
  3512. }
  3513. var Yr;
  3514. function Zi() {
  3515. if (Yr)
  3516. return Rt;
  3517. Yr = 1, Object.defineProperty(Rt, "__esModule", {
  3518. value: true
  3519. }), Rt.default = void 0;
  3520. var t = y3(import_react.default), e = ur(), r = v(dr()), n = St(), i = fr2(), o = v(ea()), c = v(Ki());
  3521. function v(h) {
  3522. return h && h.__esModule ? h : { default: h };
  3523. }
  3524. function d(h) {
  3525. if (typeof WeakMap != "function")
  3526. return null;
  3527. var s = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap();
  3528. return (d = function(u) {
  3529. return u ? a : s;
  3530. })(h);
  3531. }
  3532. function y3(h, s) {
  3533. if (h && h.__esModule)
  3534. return h;
  3535. if (h === null || typeof h != "object" && typeof h != "function")
  3536. return { default: h };
  3537. var a = d(s);
  3538. if (a && a.has(h))
  3539. return a.get(h);
  3540. var u = { __proto__: null }, b = Object.defineProperty && Object.getOwnPropertyDescriptor;
  3541. for (var l in h)
  3542. if (l !== "default" && Object.prototype.hasOwnProperty.call(h, l)) {
  3543. var g = b ? Object.getOwnPropertyDescriptor(h, l) : null;
  3544. g && (g.get || g.set) ? Object.defineProperty(u, l, g) : u[l] = h[l];
  3545. }
  3546. return u.default = h, a && a.set(h, u), u;
  3547. }
  3548. function p(h, s, a) {
  3549. return s = C(s), s in h ? Object.defineProperty(h, s, { value: a, enumerable: true, configurable: true, writable: true }) : h[s] = a, h;
  3550. }
  3551. function C(h) {
  3552. var s = _(h, "string");
  3553. return typeof s == "symbol" ? s : String(s);
  3554. }
  3555. function _(h, s) {
  3556. if (typeof h != "object" || h === null)
  3557. return h;
  3558. var a = h[Symbol.toPrimitive];
  3559. if (a !== void 0) {
  3560. var u = a.call(h, s || "default");
  3561. if (typeof u != "object")
  3562. return u;
  3563. throw new TypeError("@@toPrimitive must return a primitive value.");
  3564. }
  3565. return (s === "string" ? String : Number)(h);
  3566. }
  3567. const w2 = "react-grid-layout";
  3568. let S = false;
  3569. try {
  3570. S = /firefox/i.test(navigator.userAgent);
  3571. } catch {
  3572. }
  3573. let R3 = class extends t.Component {
  3574. constructor() {
  3575. super(...arguments), p(this, "state", {
  3576. activeDrag: null,
  3577. layout: (0, n.synchronizeLayoutWithChildren)(
  3578. this.props.layout,
  3579. this.props.children,
  3580. this.props.cols,
  3581. // Legacy support for verticalCompact: false
  3582. (0, n.compactType)(this.props),
  3583. this.props.allowOverlap
  3584. ),
  3585. mounted: false,
  3586. oldDragItem: null,
  3587. oldLayout: null,
  3588. oldResizeItem: null,
  3589. resizing: false,
  3590. droppingDOMNode: null,
  3591. children: []
  3592. }), p(this, "dragEnterCounter", 0), p(this, "onDragStart", (s, a, u, b) => {
  3593. let {
  3594. e: l,
  3595. node: g
  3596. } = b;
  3597. const {
  3598. layout: f
  3599. } = this.state, m = (0, n.getLayoutItem)(f, s);
  3600. if (!m)
  3601. return;
  3602. const P = {
  3603. w: m.w,
  3604. h: m.h,
  3605. x: m.x,
  3606. y: m.y,
  3607. placeholder: true,
  3608. i: s
  3609. };
  3610. return this.setState({
  3611. oldDragItem: (0, n.cloneLayoutItem)(m),
  3612. oldLayout: f,
  3613. activeDrag: P
  3614. }), this.props.onDragStart(f, m, m, null, l, g);
  3615. }), p(this, "onDrag", (s, a, u, b) => {
  3616. let {
  3617. e: l,
  3618. node: g
  3619. } = b;
  3620. const {
  3621. oldDragItem: f
  3622. } = this.state;
  3623. let {
  3624. layout: m
  3625. } = this.state;
  3626. const {
  3627. cols: P,
  3628. allowOverlap: M2,
  3629. preventCollision: j2
  3630. } = this.props, N3 = (0, n.getLayoutItem)(m, s);
  3631. if (!N3)
  3632. return;
  3633. const I = {
  3634. w: N3.w,
  3635. h: N3.h,
  3636. x: N3.x,
  3637. y: N3.y,
  3638. placeholder: true,
  3639. i: s
  3640. };
  3641. m = (0, n.moveElement)(m, N3, a, u, true, j2, (0, n.compactType)(this.props), P, M2), this.props.onDrag(m, f, N3, I, l, g), this.setState({
  3642. layout: M2 ? m : (0, n.compact)(m, (0, n.compactType)(this.props), P),
  3643. activeDrag: I
  3644. });
  3645. }), p(this, "onDragStop", (s, a, u, b) => {
  3646. let {
  3647. e: l,
  3648. node: g
  3649. } = b;
  3650. if (!this.state.activeDrag)
  3651. return;
  3652. const {
  3653. oldDragItem: f
  3654. } = this.state;
  3655. let {
  3656. layout: m
  3657. } = this.state;
  3658. const {
  3659. cols: P,
  3660. preventCollision: M2,
  3661. allowOverlap: j2
  3662. } = this.props, N3 = (0, n.getLayoutItem)(m, s);
  3663. if (!N3)
  3664. return;
  3665. m = (0, n.moveElement)(m, N3, a, u, true, M2, (0, n.compactType)(this.props), P, j2);
  3666. const O = j2 ? m : (0, n.compact)(m, (0, n.compactType)(this.props), P);
  3667. this.props.onDragStop(O, f, N3, null, l, g);
  3668. const {
  3669. oldLayout: z
  3670. } = this.state;
  3671. this.setState({
  3672. activeDrag: null,
  3673. layout: O,
  3674. oldDragItem: null,
  3675. oldLayout: null
  3676. }), this.onLayoutMaybeChanged(O, z);
  3677. }), p(this, "onResizeStart", (s, a, u, b) => {
  3678. let {
  3679. e: l,
  3680. node: g
  3681. } = b;
  3682. const {
  3683. layout: f
  3684. } = this.state, m = (0, n.getLayoutItem)(f, s);
  3685. m && (this.setState({
  3686. oldResizeItem: (0, n.cloneLayoutItem)(m),
  3687. oldLayout: this.state.layout,
  3688. resizing: true
  3689. }), this.props.onResizeStart(f, m, m, null, l, g));
  3690. }), p(this, "onResize", (s, a, u, b) => {
  3691. let {
  3692. e: l,
  3693. node: g,
  3694. size: f,
  3695. handle: m
  3696. } = b;
  3697. const {
  3698. oldResizeItem: P
  3699. } = this.state, {
  3700. layout: M2
  3701. } = this.state, {
  3702. cols: j2,
  3703. preventCollision: N3,
  3704. allowOverlap: I
  3705. } = this.props;
  3706. let O = false, z, U, k;
  3707. const [ie, ee] = (0, n.withLayoutItem)(M2, s, (F2) => {
  3708. let oe;
  3709. return U = F2.x, k = F2.y, ["sw", "w", "nw", "n", "ne"].indexOf(m) !== -1 && (["sw", "nw", "w"].indexOf(m) !== -1 && (U = F2.x + (F2.w - a), a = F2.x !== U && U < 0 ? F2.w : a, U = U < 0 ? 0 : U), ["ne", "n", "nw"].indexOf(m) !== -1 && (k = F2.y + (F2.h - u), u = F2.y !== k && k < 0 ? F2.h : u, k = k < 0 ? 0 : k), O = true), N3 && !I && (oe = (0, n.getAllCollisions)(M2, {
  3710. ...F2,
  3711. w: a,
  3712. h: u,
  3713. x: U,
  3714. y: k
  3715. }).filter((de) => de.i !== F2.i).length > 0, oe && (k = F2.y, u = F2.h, U = F2.x, a = F2.w, O = false)), F2.w = a, F2.h = u, F2;
  3716. });
  3717. if (!ee)
  3718. return;
  3719. z = ie, O && (z = (0, n.moveElement)(ie, ee, U, k, true, this.props.preventCollision, (0, n.compactType)(this.props), j2, I));
  3720. const A = {
  3721. w: ee.w,
  3722. h: ee.h,
  3723. x: ee.x,
  3724. y: ee.y,
  3725. static: true,
  3726. i: s
  3727. };
  3728. this.props.onResize(z, P, ee, A, l, g), this.setState({
  3729. layout: I ? z : (0, n.compact)(z, (0, n.compactType)(this.props), j2),
  3730. activeDrag: A
  3731. });
  3732. }), p(this, "onResizeStop", (s, a, u, b) => {
  3733. let {
  3734. e: l,
  3735. node: g
  3736. } = b;
  3737. const {
  3738. layout: f,
  3739. oldResizeItem: m
  3740. } = this.state, {
  3741. cols: P,
  3742. allowOverlap: M2
  3743. } = this.props, j2 = (0, n.getLayoutItem)(f, s), N3 = M2 ? f : (0, n.compact)(f, (0, n.compactType)(this.props), P);
  3744. this.props.onResizeStop(N3, m, j2, null, l, g);
  3745. const {
  3746. oldLayout: I
  3747. } = this.state;
  3748. this.setState({
  3749. activeDrag: null,
  3750. layout: N3,
  3751. oldResizeItem: null,
  3752. oldLayout: null,
  3753. resizing: false
  3754. }), this.onLayoutMaybeChanged(N3, I);
  3755. }), p(this, "onDragOver", (s) => {
  3756. var ie;
  3757. if (s.preventDefault(), s.stopPropagation(), S && // $FlowIgnore can't figure this out
  3758. !((ie = s.nativeEvent.target) != null && ie.classList.contains(w2)))
  3759. return false;
  3760. const {
  3761. droppingItem: a,
  3762. onDropDragOver: u,
  3763. margin: b,
  3764. cols: l,
  3765. rowHeight: g,
  3766. maxRows: f,
  3767. width: m,
  3768. containerPadding: P,
  3769. transformScale: M2
  3770. } = this.props, j2 = u == null ? void 0 : u(s);
  3771. if (j2 === false)
  3772. return this.state.droppingDOMNode && this.removeDroppingPlaceholder(), false;
  3773. const N3 = {
  3774. ...a,
  3775. ...j2
  3776. }, {
  3777. layout: I
  3778. } = this.state, O = s.currentTarget.getBoundingClientRect(), z = s.clientX - O.left, U = s.clientY - O.top, k = {
  3779. left: z / M2,
  3780. top: U / M2,
  3781. e: s
  3782. };
  3783. if (this.state.droppingDOMNode) {
  3784. if (this.state.droppingPosition) {
  3785. const {
  3786. left: ee,
  3787. top: A
  3788. } = this.state.droppingPosition;
  3789. (ee != z || A != U) && this.setState({
  3790. droppingPosition: k
  3791. });
  3792. }
  3793. } else {
  3794. const ee = {
  3795. cols: l,
  3796. margin: b,
  3797. maxRows: f,
  3798. rowHeight: g,
  3799. containerWidth: m,
  3800. containerPadding: P || b
  3801. }, A = (0, i.calcXY)(ee, U, z, N3.w, N3.h);
  3802. this.setState({
  3803. droppingDOMNode: t.createElement("div", {
  3804. key: N3.i
  3805. }),
  3806. droppingPosition: k,
  3807. layout: [...I, {
  3808. ...N3,
  3809. x: A.x,
  3810. y: A.y,
  3811. static: false,
  3812. isDraggable: true
  3813. }]
  3814. });
  3815. }
  3816. }), p(this, "removeDroppingPlaceholder", () => {
  3817. const {
  3818. droppingItem: s,
  3819. cols: a
  3820. } = this.props, {
  3821. layout: u
  3822. } = this.state, b = (0, n.compact)(u.filter((l) => l.i !== s.i), (0, n.compactType)(this.props), a, this.props.allowOverlap);
  3823. this.setState({
  3824. layout: b,
  3825. droppingDOMNode: null,
  3826. activeDrag: null,
  3827. droppingPosition: void 0
  3828. });
  3829. }), p(this, "onDragLeave", (s) => {
  3830. s.preventDefault(), s.stopPropagation(), this.dragEnterCounter--, this.dragEnterCounter === 0 && this.removeDroppingPlaceholder();
  3831. }), p(this, "onDragEnter", (s) => {
  3832. s.preventDefault(), s.stopPropagation(), this.dragEnterCounter++;
  3833. }), p(this, "onDrop", (s) => {
  3834. s.preventDefault(), s.stopPropagation();
  3835. const {
  3836. droppingItem: a
  3837. } = this.props, {
  3838. layout: u
  3839. } = this.state, b = u.find((l) => l.i === a.i);
  3840. this.dragEnterCounter = 0, this.removeDroppingPlaceholder(), this.props.onDrop(u, b, s);
  3841. });
  3842. }
  3843. componentDidMount() {
  3844. this.setState({
  3845. mounted: true
  3846. }), this.onLayoutMaybeChanged(this.state.layout, this.props.layout);
  3847. }
  3848. static getDerivedStateFromProps(s, a) {
  3849. let u;
  3850. return a.activeDrag ? null : (!(0, e.deepEqual)(s.layout, a.propsLayout) || s.compactType !== a.compactType ? u = s.layout : (0, n.childrenEqual)(s.children, a.children) || (u = a.layout), u ? {
  3851. layout: (0, n.synchronizeLayoutWithChildren)(u, s.children, s.cols, (0, n.compactType)(s), s.allowOverlap),
  3852. // We need to save these props to state for using
  3853. // getDerivedStateFromProps instead of componentDidMount (in which we would get extra rerender)
  3854. compactType: s.compactType,
  3855. children: s.children,
  3856. propsLayout: s.layout
  3857. } : null);
  3858. }
  3859. shouldComponentUpdate(s, a) {
  3860. return (
  3861. // NOTE: this is almost always unequal. Therefore the only way to get better performance
  3862. // from SCU is if the user intentionally memoizes children. If they do, and they can
  3863. // handle changes properly, performance will increase.
  3864. this.props.children !== s.children || !(0, n.fastRGLPropsEqual)(this.props, s, e.deepEqual) || this.state.activeDrag !== a.activeDrag || this.state.mounted !== a.mounted || this.state.droppingPosition !== a.droppingPosition
  3865. );
  3866. }
  3867. componentDidUpdate(s, a) {
  3868. if (!this.state.activeDrag) {
  3869. const u = this.state.layout, b = a.layout;
  3870. this.onLayoutMaybeChanged(u, b);
  3871. }
  3872. }
  3873. /**
  3874. * Calculates a pixel value for the container.
  3875. * @return {String} Container height in pixels.
  3876. */
  3877. containerHeight() {
  3878. if (!this.props.autoSize)
  3879. return;
  3880. const s = (0, n.bottom)(this.state.layout), a = this.props.containerPadding ? this.props.containerPadding[1] : this.props.margin[1];
  3881. return s * this.props.rowHeight + (s - 1) * this.props.margin[1] + a * 2 + "px";
  3882. }
  3883. onLayoutMaybeChanged(s, a) {
  3884. a || (a = this.state.layout), (0, e.deepEqual)(a, s) || this.props.onLayoutChange(s);
  3885. }
  3886. /**
  3887. * Create a placeholder object.
  3888. * @return {Element} Placeholder div.
  3889. */
  3890. placeholder() {
  3891. const {
  3892. activeDrag: s
  3893. } = this.state;
  3894. if (!s)
  3895. return null;
  3896. const {
  3897. width: a,
  3898. cols: u,
  3899. margin: b,
  3900. containerPadding: l,
  3901. rowHeight: g,
  3902. maxRows: f,
  3903. useCSSTransforms: m,
  3904. transformScale: P
  3905. } = this.props;
  3906. return t.createElement(o.default, {
  3907. w: s.w,
  3908. h: s.h,
  3909. x: s.x,
  3910. y: s.y,
  3911. i: s.i,
  3912. className: `react-grid-placeholder ${this.state.resizing ? "placeholder-resizing" : ""}`,
  3913. containerWidth: a,
  3914. cols: u,
  3915. margin: b,
  3916. containerPadding: l || b,
  3917. maxRows: f,
  3918. rowHeight: g,
  3919. isDraggable: false,
  3920. isResizable: false,
  3921. isBounded: false,
  3922. useCSSTransforms: m,
  3923. transformScale: P
  3924. }, t.createElement("div", null));
  3925. }
  3926. /**
  3927. * Given a grid item, set its style attributes & surround in a <Draggable>.
  3928. * @param {Element} child React element.
  3929. * @return {Element} Element wrapped in draggable and properly placed.
  3930. */
  3931. processGridItem(s, a) {
  3932. if (!s || !s.key)
  3933. return;
  3934. const u = (0, n.getLayoutItem)(this.state.layout, String(s.key));
  3935. if (!u)
  3936. return null;
  3937. const {
  3938. width: b,
  3939. cols: l,
  3940. margin: g,
  3941. containerPadding: f,
  3942. rowHeight: m,
  3943. maxRows: P,
  3944. isDraggable: M2,
  3945. isResizable: j2,
  3946. isBounded: N3,
  3947. useCSSTransforms: I,
  3948. transformScale: O,
  3949. draggableCancel: z,
  3950. draggableHandle: U,
  3951. resizeHandles: k,
  3952. resizeHandle: ie
  3953. } = this.props, {
  3954. mounted: ee,
  3955. droppingPosition: A
  3956. } = this.state, F2 = typeof u.isDraggable == "boolean" ? u.isDraggable : !u.static && M2, oe = typeof u.isResizable == "boolean" ? u.isResizable : !u.static && j2, se = u.resizeHandles || k, de = F2 && N3 && u.isBounded !== false;
  3957. return t.createElement(o.default, {
  3958. containerWidth: b,
  3959. cols: l,
  3960. margin: g,
  3961. containerPadding: f || g,
  3962. maxRows: P,
  3963. rowHeight: m,
  3964. cancel: z,
  3965. handle: U,
  3966. onDragStop: this.onDragStop,
  3967. onDragStart: this.onDragStart,
  3968. onDrag: this.onDrag,
  3969. onResizeStart: this.onResizeStart,
  3970. onResize: this.onResize,
  3971. onResizeStop: this.onResizeStop,
  3972. isDraggable: F2,
  3973. isResizable: oe,
  3974. isBounded: de,
  3975. useCSSTransforms: I && ee,
  3976. usePercentages: !ee,
  3977. transformScale: O,
  3978. w: u.w,
  3979. h: u.h,
  3980. x: u.x,
  3981. y: u.y,
  3982. i: u.i,
  3983. minH: u.minH,
  3984. minW: u.minW,
  3985. maxH: u.maxH,
  3986. maxW: u.maxW,
  3987. static: u.static,
  3988. droppingPosition: a ? A : void 0,
  3989. resizeHandles: se,
  3990. resizeHandle: ie
  3991. }, s);
  3992. }
  3993. render() {
  3994. const {
  3995. className: s,
  3996. style: a,
  3997. isDroppable: u,
  3998. innerRef: b
  3999. } = this.props, l = (0, r.default)(w2, s), g = {
  4000. height: this.containerHeight(),
  4001. ...a
  4002. };
  4003. return t.createElement("div", {
  4004. ref: b,
  4005. className: l,
  4006. style: g,
  4007. onDrop: u ? this.onDrop : n.noop,
  4008. onDragLeave: u ? this.onDragLeave : n.noop,
  4009. onDragEnter: u ? this.onDragEnter : n.noop,
  4010. onDragOver: u ? this.onDragOver : n.noop
  4011. }, t.Children.map(this.props.children, (f) => this.processGridItem(f)), u && this.state.droppingDOMNode && this.processGridItem(this.state.droppingDOMNode, true), this.placeholder());
  4012. }
  4013. };
  4014. return Rt.default = R3, p(R3, "displayName", "ReactGridLayout"), p(R3, "propTypes", c.default), p(R3, "defaultProps", {
  4015. autoSize: true,
  4016. cols: 12,
  4017. className: "",
  4018. style: {},
  4019. draggableHandle: "",
  4020. draggableCancel: "",
  4021. containerPadding: null,
  4022. rowHeight: 150,
  4023. maxRows: 1 / 0,
  4024. // infinite vertical growth
  4025. layout: [],
  4026. margin: [10, 10],
  4027. isBounded: false,
  4028. isDraggable: true,
  4029. isResizable: true,
  4030. allowOverlap: false,
  4031. isDroppable: false,
  4032. useCSSTransforms: true,
  4033. transformScale: 1,
  4034. verticalCompact: true,
  4035. compactType: "vertical",
  4036. preventCollision: false,
  4037. droppingItem: {
  4038. i: "__dropping-elem__",
  4039. h: 1,
  4040. w: 1
  4041. },
  4042. resizeHandles: ["se"],
  4043. onLayoutChange: n.noop,
  4044. onDragStart: n.noop,
  4045. onDrag: n.noop,
  4046. onDragStop: n.noop,
  4047. onResizeStart: n.noop,
  4048. onResize: n.noop,
  4049. onResizeStop: n.noop,
  4050. onDrop: n.noop,
  4051. onDropDragOver: n.noop
  4052. }), Rt;
  4053. }
  4054. var Dt = {};
  4055. var rt3 = {};
  4056. var Kr;
  4057. function Ji() {
  4058. if (Kr)
  4059. return rt3;
  4060. Kr = 1, Object.defineProperty(rt3, "__esModule", {
  4061. value: true
  4062. }), rt3.findOrGenerateResponsiveLayout = n, rt3.getBreakpointFromWidth = e, rt3.getColsFromBreakpoint = r, rt3.sortBreakpoints = i;
  4063. var t = St();
  4064. function e(o, c) {
  4065. const v = i(o);
  4066. let d = v[0];
  4067. for (let y3 = 1, p = v.length; y3 < p; y3++) {
  4068. const C = v[y3];
  4069. c > o[C] && (d = C);
  4070. }
  4071. return d;
  4072. }
  4073. function r(o, c) {
  4074. if (!c[o])
  4075. throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint " + o + " is missing!");
  4076. return c[o];
  4077. }
  4078. function n(o, c, v, d, y3, p) {
  4079. if (o[v])
  4080. return (0, t.cloneLayout)(o[v]);
  4081. let C = o[d];
  4082. const _ = i(c), w2 = _.slice(_.indexOf(v));
  4083. for (let S = 0, R3 = w2.length; S < R3; S++) {
  4084. const h = w2[S];
  4085. if (o[h]) {
  4086. C = o[h];
  4087. break;
  4088. }
  4089. }
  4090. return C = (0, t.cloneLayout)(C || []), (0, t.compact)((0, t.correctBounds)(C, {
  4091. cols: y3
  4092. }), p, y3);
  4093. }
  4094. function i(o) {
  4095. return Object.keys(o).sort(function(v, d) {
  4096. return o[v] - o[d];
  4097. });
  4098. }
  4099. return rt3;
  4100. }
  4101. var Zr;
  4102. function ta() {
  4103. if (Zr)
  4104. return Dt;
  4105. Zr = 1, Object.defineProperty(Dt, "__esModule", {
  4106. value: true
  4107. }), Dt.default = void 0;
  4108. var t = d(import_react.default), e = c(Qe()), r = ur(), n = St(), i = Ji(), o = c(Zi());
  4109. function c(h) {
  4110. return h && h.__esModule ? h : { default: h };
  4111. }
  4112. function v(h) {
  4113. if (typeof WeakMap != "function")
  4114. return null;
  4115. var s = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap();
  4116. return (v = function(u) {
  4117. return u ? a : s;
  4118. })(h);
  4119. }
  4120. function d(h, s) {
  4121. if (h && h.__esModule)
  4122. return h;
  4123. if (h === null || typeof h != "object" && typeof h != "function")
  4124. return { default: h };
  4125. var a = v(s);
  4126. if (a && a.has(h))
  4127. return a.get(h);
  4128. var u = { __proto__: null }, b = Object.defineProperty && Object.getOwnPropertyDescriptor;
  4129. for (var l in h)
  4130. if (l !== "default" && Object.prototype.hasOwnProperty.call(h, l)) {
  4131. var g = b ? Object.getOwnPropertyDescriptor(h, l) : null;
  4132. g && (g.get || g.set) ? Object.defineProperty(u, l, g) : u[l] = h[l];
  4133. }
  4134. return u.default = h, a && a.set(h, u), u;
  4135. }
  4136. function y3() {
  4137. return y3 = Object.assign ? Object.assign.bind() : function(h) {
  4138. for (var s = 1; s < arguments.length; s++) {
  4139. var a = arguments[s];
  4140. for (var u in a)
  4141. Object.prototype.hasOwnProperty.call(a, u) && (h[u] = a[u]);
  4142. }
  4143. return h;
  4144. }, y3.apply(this, arguments);
  4145. }
  4146. function p(h, s, a) {
  4147. return s = C(s), s in h ? Object.defineProperty(h, s, { value: a, enumerable: true, configurable: true, writable: true }) : h[s] = a, h;
  4148. }
  4149. function C(h) {
  4150. var s = _(h, "string");
  4151. return typeof s == "symbol" ? s : String(s);
  4152. }
  4153. function _(h, s) {
  4154. if (typeof h != "object" || h === null)
  4155. return h;
  4156. var a = h[Symbol.toPrimitive];
  4157. if (a !== void 0) {
  4158. var u = a.call(h, s || "default");
  4159. if (typeof u != "object")
  4160. return u;
  4161. throw new TypeError("@@toPrimitive must return a primitive value.");
  4162. }
  4163. return (s === "string" ? String : Number)(h);
  4164. }
  4165. const w2 = (h) => Object.prototype.toString.call(h);
  4166. function S(h, s) {
  4167. return h == null ? null : Array.isArray(h) ? h : h[s];
  4168. }
  4169. let R3 = class extends t.Component {
  4170. constructor() {
  4171. super(...arguments), p(this, "state", this.generateInitialState()), p(this, "onLayoutChange", (s) => {
  4172. this.props.onLayoutChange(s, {
  4173. ...this.props.layouts,
  4174. [this.state.breakpoint]: s
  4175. });
  4176. });
  4177. }
  4178. generateInitialState() {
  4179. const {
  4180. width: s,
  4181. breakpoints: a,
  4182. layouts: u,
  4183. cols: b
  4184. } = this.props, l = (0, i.getBreakpointFromWidth)(a, s), g = (0, i.getColsFromBreakpoint)(l, b), f = this.props.verticalCompact === false ? null : this.props.compactType;
  4185. return {
  4186. layout: (0, i.findOrGenerateResponsiveLayout)(u, a, l, l, g, f),
  4187. breakpoint: l,
  4188. cols: g
  4189. };
  4190. }
  4191. static getDerivedStateFromProps(s, a) {
  4192. if (!(0, r.deepEqual)(s.layouts, a.layouts)) {
  4193. const {
  4194. breakpoint: u,
  4195. cols: b
  4196. } = a;
  4197. return {
  4198. layout: (0, i.findOrGenerateResponsiveLayout)(s.layouts, s.breakpoints, u, u, b, s.compactType),
  4199. layouts: s.layouts
  4200. };
  4201. }
  4202. return null;
  4203. }
  4204. componentDidUpdate(s) {
  4205. (this.props.width != s.width || this.props.breakpoint !== s.breakpoint || !(0, r.deepEqual)(this.props.breakpoints, s.breakpoints) || !(0, r.deepEqual)(this.props.cols, s.cols)) && this.onWidthChange(s);
  4206. }
  4207. /**
  4208. * When the width changes work through breakpoints and reset state with the new width & breakpoint.
  4209. * Width changes are necessary to figure out the widget widths.
  4210. */
  4211. onWidthChange(s) {
  4212. const {
  4213. breakpoints: a,
  4214. cols: u,
  4215. layouts: b,
  4216. compactType: l
  4217. } = this.props, g = this.props.breakpoint || (0, i.getBreakpointFromWidth)(this.props.breakpoints, this.props.width), f = this.state.breakpoint, m = (0, i.getColsFromBreakpoint)(g, u), P = {
  4218. ...b
  4219. };
  4220. if (f !== g || s.breakpoints !== a || s.cols !== u) {
  4221. f in P || (P[f] = (0, n.cloneLayout)(this.state.layout));
  4222. let N3 = (0, i.findOrGenerateResponsiveLayout)(P, a, g, f, m, l);
  4223. N3 = (0, n.synchronizeLayoutWithChildren)(N3, this.props.children, m, l, this.props.allowOverlap), P[g] = N3, this.props.onLayoutChange(N3, P), this.props.onBreakpointChange(g, m), this.setState({
  4224. breakpoint: g,
  4225. layout: N3,
  4226. cols: m
  4227. });
  4228. }
  4229. const M2 = S(this.props.margin, g), j2 = S(this.props.containerPadding, g);
  4230. this.props.onWidthChange(this.props.width, M2, m, j2);
  4231. }
  4232. render() {
  4233. const {
  4234. breakpoint: s,
  4235. breakpoints: a,
  4236. cols: u,
  4237. layouts: b,
  4238. margin: l,
  4239. containerPadding: g,
  4240. onBreakpointChange: f,
  4241. onLayoutChange: m,
  4242. onWidthChange: P,
  4243. ...M2
  4244. } = this.props;
  4245. return t.createElement(o.default, y3({}, M2, {
  4246. // $FlowIgnore should allow nullable here due to DefaultProps
  4247. margin: S(l, this.state.breakpoint),
  4248. containerPadding: S(g, this.state.breakpoint),
  4249. onLayoutChange: this.onLayoutChange,
  4250. layout: this.state.layout,
  4251. cols: this.state.cols
  4252. }));
  4253. }
  4254. };
  4255. return Dt.default = R3, p(R3, "propTypes", {
  4256. //
  4257. // Basic props
  4258. //
  4259. // Optional, but if you are managing width yourself you may want to set the breakpoint
  4260. // yourself as well.
  4261. breakpoint: e.default.string,
  4262. // {name: pxVal}, e.g. {lg: 1200, md: 996, sm: 768, xs: 480}
  4263. breakpoints: e.default.object,
  4264. allowOverlap: e.default.bool,
  4265. // # of cols. This is a breakpoint -> cols map
  4266. cols: e.default.object,
  4267. // # of margin. This is a breakpoint -> margin map
  4268. // e.g. { lg: [5, 5], md: [10, 10], sm: [15, 15] }
  4269. // Margin between items [x, y] in px
  4270. // e.g. [10, 10]
  4271. margin: e.default.oneOfType([e.default.array, e.default.object]),
  4272. // # of containerPadding. This is a breakpoint -> containerPadding map
  4273. // e.g. { lg: [5, 5], md: [10, 10], sm: [15, 15] }
  4274. // Padding inside the container [x, y] in px
  4275. // e.g. [10, 10]
  4276. containerPadding: e.default.oneOfType([e.default.array, e.default.object]),
  4277. // layouts is an object mapping breakpoints to layouts.
  4278. // e.g. {lg: Layout, md: Layout, ...}
  4279. layouts(h, s) {
  4280. if (w2(h[s]) !== "[object Object]")
  4281. throw new Error("Layout property must be an object. Received: " + w2(h[s]));
  4282. Object.keys(h[s]).forEach((a) => {
  4283. if (!(a in h.breakpoints))
  4284. throw new Error("Each key in layouts must align with a key in breakpoints.");
  4285. (0, n.validateLayout)(h.layouts[a], "layouts." + a);
  4286. });
  4287. },
  4288. // The width of this component.
  4289. // Required in this propTypes stanza because generateInitialState() will fail without it.
  4290. width: e.default.number.isRequired,
  4291. //
  4292. // Callbacks
  4293. //
  4294. // Calls back with breakpoint and new # cols
  4295. onBreakpointChange: e.default.func,
  4296. // Callback so you can save the layout.
  4297. // Calls back with (currentLayout, allLayouts). allLayouts are keyed by breakpoint.
  4298. onLayoutChange: e.default.func,
  4299. // Calls back with (containerWidth, margin, cols, containerPadding)
  4300. onWidthChange: e.default.func
  4301. }), p(R3, "defaultProps", {
  4302. breakpoints: {
  4303. lg: 1200,
  4304. md: 996,
  4305. sm: 768,
  4306. xs: 480,
  4307. xxs: 0
  4308. },
  4309. cols: {
  4310. lg: 12,
  4311. md: 10,
  4312. sm: 6,
  4313. xs: 4,
  4314. xxs: 2
  4315. },
  4316. containerPadding: {
  4317. lg: null,
  4318. md: null,
  4319. sm: null,
  4320. xs: null,
  4321. xxs: null
  4322. },
  4323. layouts: {},
  4324. margin: [10, 10],
  4325. allowOverlap: false,
  4326. onBreakpointChange: n.noop,
  4327. onLayoutChange: n.noop,
  4328. onWidthChange: n.noop
  4329. }), Dt;
  4330. }
  4331. var nn = {};
  4332. var Qi = function() {
  4333. if (typeof Map < "u")
  4334. return Map;
  4335. function t(e, r) {
  4336. var n = -1;
  4337. return e.some(function(i, o) {
  4338. return i[0] === r ? (n = o, true) : false;
  4339. }), n;
  4340. }
  4341. return (
  4342. /** @class */
  4343. function() {
  4344. function e() {
  4345. this.__entries__ = [];
  4346. }
  4347. return Object.defineProperty(e.prototype, "size", {
  4348. /**
  4349. * @returns {boolean}
  4350. */
  4351. get: function() {
  4352. return this.__entries__.length;
  4353. },
  4354. enumerable: true,
  4355. configurable: true
  4356. }), e.prototype.get = function(r) {
  4357. var n = t(this.__entries__, r), i = this.__entries__[n];
  4358. return i && i[1];
  4359. }, e.prototype.set = function(r, n) {
  4360. var i = t(this.__entries__, r);
  4361. ~i ? this.__entries__[i][1] = n : this.__entries__.push([r, n]);
  4362. }, e.prototype.delete = function(r) {
  4363. var n = this.__entries__, i = t(n, r);
  4364. ~i && n.splice(i, 1);
  4365. }, e.prototype.has = function(r) {
  4366. return !!~t(this.__entries__, r);
  4367. }, e.prototype.clear = function() {
  4368. this.__entries__.splice(0);
  4369. }, e.prototype.forEach = function(r, n) {
  4370. n === void 0 && (n = null);
  4371. for (var i = 0, o = this.__entries__; i < o.length; i++) {
  4372. var c = o[i];
  4373. r.call(n, c[1], c[0]);
  4374. }
  4375. }, e;
  4376. }()
  4377. );
  4378. }();
  4379. var er = typeof window < "u" && typeof document < "u" && window.document === document;
  4380. var vn = function() {
  4381. return typeof global < "u" && global.Math === Math ? global : typeof self < "u" && self.Math === Math ? self : typeof window < "u" && window.Math === Math ? window : Function("return this")();
  4382. }();
  4383. var na = function() {
  4384. return typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(vn) : function(t) {
  4385. return setTimeout(function() {
  4386. return t(Date.now());
  4387. }, 1e3 / 60);
  4388. };
  4389. }();
  4390. var ra = 2;
  4391. function ia(t, e) {
  4392. var r = false, n = false, i = 0;
  4393. function o() {
  4394. r && (r = false, t()), n && v();
  4395. }
  4396. function c() {
  4397. na(o);
  4398. }
  4399. function v() {
  4400. var d = Date.now();
  4401. if (r) {
  4402. if (d - i < ra)
  4403. return;
  4404. n = true;
  4405. } else
  4406. r = true, n = false, setTimeout(c, e);
  4407. i = d;
  4408. }
  4409. return v;
  4410. }
  4411. var oa = 20;
  4412. var sa = ["top", "right", "bottom", "left", "width", "height", "size", "weight"];
  4413. var aa = typeof MutationObserver < "u";
  4414. var la = (
  4415. /** @class */
  4416. function() {
  4417. function t() {
  4418. this.connected_ = false, this.mutationEventsAdded_ = false, this.mutationsObserver_ = null, this.observers_ = [], this.onTransitionEnd_ = this.onTransitionEnd_.bind(this), this.refresh = ia(this.refresh.bind(this), oa);
  4419. }
  4420. return t.prototype.addObserver = function(e) {
  4421. ~this.observers_.indexOf(e) || this.observers_.push(e), this.connected_ || this.connect_();
  4422. }, t.prototype.removeObserver = function(e) {
  4423. var r = this.observers_, n = r.indexOf(e);
  4424. ~n && r.splice(n, 1), !r.length && this.connected_ && this.disconnect_();
  4425. }, t.prototype.refresh = function() {
  4426. var e = this.updateObservers_();
  4427. e && this.refresh();
  4428. }, t.prototype.updateObservers_ = function() {
  4429. var e = this.observers_.filter(function(r) {
  4430. return r.gatherActive(), r.hasActive();
  4431. });
  4432. return e.forEach(function(r) {
  4433. return r.broadcastActive();
  4434. }), e.length > 0;
  4435. }, t.prototype.connect_ = function() {
  4436. !er || this.connected_ || (document.addEventListener("transitionend", this.onTransitionEnd_), window.addEventListener("resize", this.refresh), aa ? (this.mutationsObserver_ = new MutationObserver(this.refresh), this.mutationsObserver_.observe(document, {
  4437. attributes: true,
  4438. childList: true,
  4439. characterData: true,
  4440. subtree: true
  4441. })) : (document.addEventListener("DOMSubtreeModified", this.refresh), this.mutationEventsAdded_ = true), this.connected_ = true);
  4442. }, t.prototype.disconnect_ = function() {
  4443. !er || !this.connected_ || (document.removeEventListener("transitionend", this.onTransitionEnd_), window.removeEventListener("resize", this.refresh), this.mutationsObserver_ && this.mutationsObserver_.disconnect(), this.mutationEventsAdded_ && document.removeEventListener("DOMSubtreeModified", this.refresh), this.mutationsObserver_ = null, this.mutationEventsAdded_ = false, this.connected_ = false);
  4444. }, t.prototype.onTransitionEnd_ = function(e) {
  4445. var r = e.propertyName, n = r === void 0 ? "" : r, i = sa.some(function(o) {
  4446. return !!~n.indexOf(o);
  4447. });
  4448. i && this.refresh();
  4449. }, t.getInstance = function() {
  4450. return this.instance_ || (this.instance_ = new t()), this.instance_;
  4451. }, t.instance_ = null, t;
  4452. }()
  4453. );
  4454. var eo = function(t, e) {
  4455. for (var r = 0, n = Object.keys(e); r < n.length; r++) {
  4456. var i = n[r];
  4457. Object.defineProperty(t, i, {
  4458. value: e[i],
  4459. enumerable: false,
  4460. writable: false,
  4461. configurable: true
  4462. });
  4463. }
  4464. return t;
  4465. };
  4466. var gt = function(t) {
  4467. var e = t && t.ownerDocument && t.ownerDocument.defaultView;
  4468. return e || vn;
  4469. };
  4470. var to = Nn2(0, 0, 0, 0);
  4471. function yn(t) {
  4472. return parseFloat(t) || 0;
  4473. }
  4474. function Jr(t) {
  4475. for (var e = [], r = 1; r < arguments.length; r++)
  4476. e[r - 1] = arguments[r];
  4477. return e.reduce(function(n, i) {
  4478. var o = t["border-" + i + "-width"];
  4479. return n + yn(o);
  4480. }, 0);
  4481. }
  4482. function ca(t) {
  4483. for (var e = ["top", "right", "bottom", "left"], r = {}, n = 0, i = e; n < i.length; n++) {
  4484. var o = i[n], c = t["padding-" + o];
  4485. r[o] = yn(c);
  4486. }
  4487. return r;
  4488. }
  4489. function ua(t) {
  4490. var e = t.getBBox();
  4491. return Nn2(0, 0, e.width, e.height);
  4492. }
  4493. function da(t) {
  4494. var e = t.clientWidth, r = t.clientHeight;
  4495. if (!e && !r)
  4496. return to;
  4497. var n = gt(t).getComputedStyle(t), i = ca(n), o = i.left + i.right, c = i.top + i.bottom, v = yn(n.width), d = yn(n.height);
  4498. if (n.boxSizing === "border-box" && (Math.round(v + o) !== e && (v -= Jr(n, "left", "right") + o), Math.round(d + c) !== r && (d -= Jr(n, "top", "bottom") + c)), !ha(t)) {
  4499. var y3 = Math.round(v + o) - e, p = Math.round(d + c) - r;
  4500. Math.abs(y3) !== 1 && (v -= y3), Math.abs(p) !== 1 && (d -= p);
  4501. }
  4502. return Nn2(i.left, i.top, v, d);
  4503. }
  4504. var fa = function() {
  4505. return typeof SVGGraphicsElement < "u" ? function(t) {
  4506. return t instanceof gt(t).SVGGraphicsElement;
  4507. } : function(t) {
  4508. return t instanceof gt(t).SVGElement && typeof t.getBBox == "function";
  4509. };
  4510. }();
  4511. function ha(t) {
  4512. return t === gt(t).document.documentElement;
  4513. }
  4514. function pa(t) {
  4515. return er ? fa(t) ? ua(t) : da(t) : to;
  4516. }
  4517. function ga(t) {
  4518. var e = t.x, r = t.y, n = t.width, i = t.height, o = typeof DOMRectReadOnly < "u" ? DOMRectReadOnly : Object, c = Object.create(o.prototype);
  4519. return eo(c, {
  4520. x: e,
  4521. y: r,
  4522. width: n,
  4523. height: i,
  4524. top: r,
  4525. right: e + n,
  4526. bottom: i + r,
  4527. left: e
  4528. }), c;
  4529. }
  4530. function Nn2(t, e, r, n) {
  4531. return { x: t, y: e, width: r, height: n };
  4532. }
  4533. var ma = (
  4534. /** @class */
  4535. function() {
  4536. function t(e) {
  4537. this.broadcastWidth = 0, this.broadcastHeight = 0, this.contentRect_ = Nn2(0, 0, 0, 0), this.target = e;
  4538. }
  4539. return t.prototype.isActive = function() {
  4540. var e = pa(this.target);
  4541. return this.contentRect_ = e, e.width !== this.broadcastWidth || e.height !== this.broadcastHeight;
  4542. }, t.prototype.broadcastRect = function() {
  4543. var e = this.contentRect_;
  4544. return this.broadcastWidth = e.width, this.broadcastHeight = e.height, e;
  4545. }, t;
  4546. }()
  4547. );
  4548. var va = (
  4549. /** @class */
  4550. function() {
  4551. function t(e, r) {
  4552. var n = ga(r);
  4553. eo(this, { target: e, contentRect: n });
  4554. }
  4555. return t;
  4556. }()
  4557. );
  4558. var ya = (
  4559. /** @class */
  4560. function() {
  4561. function t(e, r, n) {
  4562. if (this.activeObservations_ = [], this.observations_ = new Qi(), typeof e != "function")
  4563. throw new TypeError("The callback provided as parameter 1 is not a function.");
  4564. this.callback_ = e, this.controller_ = r, this.callbackCtx_ = n;
  4565. }
  4566. return t.prototype.observe = function(e) {
  4567. if (!arguments.length)
  4568. throw new TypeError("1 argument required, but only 0 present.");
  4569. if (!(typeof Element > "u" || !(Element instanceof Object))) {
  4570. if (!(e instanceof gt(e).Element))
  4571. throw new TypeError('parameter 1 is not of type "Element".');
  4572. var r = this.observations_;
  4573. r.has(e) || (r.set(e, new ma(e)), this.controller_.addObserver(this), this.controller_.refresh());
  4574. }
  4575. }, t.prototype.unobserve = function(e) {
  4576. if (!arguments.length)
  4577. throw new TypeError("1 argument required, but only 0 present.");
  4578. if (!(typeof Element > "u" || !(Element instanceof Object))) {
  4579. if (!(e instanceof gt(e).Element))
  4580. throw new TypeError('parameter 1 is not of type "Element".');
  4581. var r = this.observations_;
  4582. r.has(e) && (r.delete(e), r.size || this.controller_.removeObserver(this));
  4583. }
  4584. }, t.prototype.disconnect = function() {
  4585. this.clearActive(), this.observations_.clear(), this.controller_.removeObserver(this);
  4586. }, t.prototype.gatherActive = function() {
  4587. var e = this;
  4588. this.clearActive(), this.observations_.forEach(function(r) {
  4589. r.isActive() && e.activeObservations_.push(r);
  4590. });
  4591. }, t.prototype.broadcastActive = function() {
  4592. if (this.hasActive()) {
  4593. var e = this.callbackCtx_, r = this.activeObservations_.map(function(n) {
  4594. return new va(n.target, n.broadcastRect());
  4595. });
  4596. this.callback_.call(e, r, e), this.clearActive();
  4597. }
  4598. }, t.prototype.clearActive = function() {
  4599. this.activeObservations_.splice(0);
  4600. }, t.prototype.hasActive = function() {
  4601. return this.activeObservations_.length > 0;
  4602. }, t;
  4603. }()
  4604. );
  4605. var no = typeof WeakMap < "u" ? /* @__PURE__ */ new WeakMap() : new Qi();
  4606. var ro = (
  4607. /** @class */
  4608. function() {
  4609. function t(e) {
  4610. if (!(this instanceof t))
  4611. throw new TypeError("Cannot call a class as a function.");
  4612. if (!arguments.length)
  4613. throw new TypeError("1 argument required, but only 0 present.");
  4614. var r = la.getInstance(), n = new ya(e, r, this);
  4615. no.set(this, n);
  4616. }
  4617. return t;
  4618. }()
  4619. );
  4620. [
  4621. "observe",
  4622. "unobserve",
  4623. "disconnect"
  4624. ].forEach(function(t) {
  4625. ro.prototype[t] = function() {
  4626. var e;
  4627. return (e = no.get(this))[t].apply(e, arguments);
  4628. };
  4629. });
  4630. var ba = function() {
  4631. return typeof vn.ResizeObserver < "u" ? vn.ResizeObserver : ro;
  4632. }();
  4633. var Sa = Object.freeze(Object.defineProperty({
  4634. __proto__: null,
  4635. default: ba
  4636. }, Symbol.toStringTag, { value: "Module" }));
  4637. var Ca = Ai(Sa);
  4638. var Qr;
  4639. function wa() {
  4640. if (Qr)
  4641. return nn;
  4642. Qr = 1, Object.defineProperty(nn, "__esModule", {
  4643. value: true
  4644. }), nn.default = _;
  4645. var t = c(import_react.default), e = i(Qe()), r = i(Ca), n = i(dr());
  4646. function i(w2) {
  4647. return w2 && w2.__esModule ? w2 : { default: w2 };
  4648. }
  4649. function o(w2) {
  4650. if (typeof WeakMap != "function")
  4651. return null;
  4652. var S = /* @__PURE__ */ new WeakMap(), R3 = /* @__PURE__ */ new WeakMap();
  4653. return (o = function(h) {
  4654. return h ? R3 : S;
  4655. })(w2);
  4656. }
  4657. function c(w2, S) {
  4658. if (w2 && w2.__esModule)
  4659. return w2;
  4660. if (w2 === null || typeof w2 != "object" && typeof w2 != "function")
  4661. return { default: w2 };
  4662. var R3 = o(S);
  4663. if (R3 && R3.has(w2))
  4664. return R3.get(w2);
  4665. var h = { __proto__: null }, s = Object.defineProperty && Object.getOwnPropertyDescriptor;
  4666. for (var a in w2)
  4667. if (a !== "default" && Object.prototype.hasOwnProperty.call(w2, a)) {
  4668. var u = s ? Object.getOwnPropertyDescriptor(w2, a) : null;
  4669. u && (u.get || u.set) ? Object.defineProperty(h, a, u) : h[a] = w2[a];
  4670. }
  4671. return h.default = w2, R3 && R3.set(w2, h), h;
  4672. }
  4673. function v() {
  4674. return v = Object.assign ? Object.assign.bind() : function(w2) {
  4675. for (var S = 1; S < arguments.length; S++) {
  4676. var R3 = arguments[S];
  4677. for (var h in R3)
  4678. Object.prototype.hasOwnProperty.call(R3, h) && (w2[h] = R3[h]);
  4679. }
  4680. return w2;
  4681. }, v.apply(this, arguments);
  4682. }
  4683. function d(w2, S, R3) {
  4684. return S = y3(S), S in w2 ? Object.defineProperty(w2, S, { value: R3, enumerable: true, configurable: true, writable: true }) : w2[S] = R3, w2;
  4685. }
  4686. function y3(w2) {
  4687. var S = p(w2, "string");
  4688. return typeof S == "symbol" ? S : String(S);
  4689. }
  4690. function p(w2, S) {
  4691. if (typeof w2 != "object" || w2 === null)
  4692. return w2;
  4693. var R3 = w2[Symbol.toPrimitive];
  4694. if (R3 !== void 0) {
  4695. var h = R3.call(w2, S || "default");
  4696. if (typeof h != "object")
  4697. return h;
  4698. throw new TypeError("@@toPrimitive must return a primitive value.");
  4699. }
  4700. return (S === "string" ? String : Number)(w2);
  4701. }
  4702. const C = "react-grid-layout";
  4703. function _(w2) {
  4704. var S;
  4705. return S = class extends t.Component {
  4706. constructor() {
  4707. super(...arguments), d(this, "state", {
  4708. width: 1280
  4709. }), d(this, "elementRef", t.createRef()), d(this, "mounted", false), d(this, "resizeObserver", void 0);
  4710. }
  4711. componentDidMount() {
  4712. this.mounted = true, this.resizeObserver = new r.default((s) => {
  4713. if (this.elementRef.current instanceof HTMLElement) {
  4714. const u = s[0].contentRect.width;
  4715. this.setState({
  4716. width: u
  4717. });
  4718. }
  4719. });
  4720. const h = this.elementRef.current;
  4721. h instanceof HTMLElement && this.resizeObserver.observe(h);
  4722. }
  4723. componentWillUnmount() {
  4724. this.mounted = false;
  4725. const h = this.elementRef.current;
  4726. h instanceof HTMLElement && this.resizeObserver.unobserve(h), this.resizeObserver.disconnect();
  4727. }
  4728. render() {
  4729. const {
  4730. measureBeforeMount: h,
  4731. ...s
  4732. } = this.props;
  4733. return h && !this.mounted ? t.createElement("div", {
  4734. className: (0, n.default)(this.props.className, C),
  4735. style: this.props.style,
  4736. ref: this.elementRef
  4737. }) : t.createElement(w2, v({
  4738. innerRef: this.elementRef
  4739. }, s, this.state));
  4740. }
  4741. }, d(S, "defaultProps", {
  4742. measureBeforeMount: false
  4743. }), d(S, "propTypes", {
  4744. // If true, will not render children until mounted. Useful for getting the exact width before
  4745. // rendering, to prevent any unsightly resizing.
  4746. measureBeforeMount: e.default.bool
  4747. }), S;
  4748. }
  4749. return nn;
  4750. }
  4751. var ei;
  4752. function Ra2() {
  4753. return ei || (ei = 1, function(t) {
  4754. t.exports = Zi().default, t.exports.utils = St(), t.exports.calculateUtils = fr2(), t.exports.Responsive = ta().default, t.exports.Responsive.utils = Ji(), t.exports.WidthProvider = wa().default;
  4755. }(An)), An.exports;
  4756. }
  4757. var _a = Ra2();
  4758. var xa = hs(_a);
  4759. var Ia = Object.defineProperty;
  4760. var Ea = Object.getOwnPropertyDescriptor;
  4761. var Ta = (t, e, r, n) => {
  4762. for (var i = n > 1 ? void 0 : n ? Ea(e, r) : e, o = t.length - 1, c; o >= 0; o--)
  4763. (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
  4764. return n && i && Ia(e, r, i), i;
  4765. };
  4766. var Pa = (t, e) => (r, n) => e(r, n, t);
  4767. var mt = class extends nt {
  4768. constructor(e) {
  4769. super();
  4770. Xe(this, "_initLocal", () => {
  4771. });
  4772. Xe(this, "_findReplaceIndex", (e2) => {
  4773. const r = /\{([^}]+)?\}/g, n = [];
  4774. let i = r.exec(e2);
  4775. for (; i; )
  4776. n.push({
  4777. startIndex: i.index,
  4778. key: Number(i[1]),
  4779. endIndex: i.index + i[0].length - 1
  4780. }), i = r.exec(e2);
  4781. return n;
  4782. });
  4783. this._localeService = e, this._initLocal();
  4784. }
  4785. tWithReactNode(e, ...r) {
  4786. const n = this._localeService.getLocales(), i = e.split("."), o = n && this._localeService.resolveKeyPath(n, i);
  4787. if (typeof o == "string") {
  4788. const c = [];
  4789. return this._findReplaceIndex(o).forEach((v, d, y3) => {
  4790. const p = y3[d - 1] || { startIndex: 0, endIndex: -1 };
  4791. if (p.endIndex + 1 < v.startIndex) {
  4792. const C = o.slice(p.endIndex + 1, v.startIndex);
  4793. C && c.push(C);
  4794. }
  4795. if (r[v.key] && c.push(r[v.key]), d === y3.length - 1) {
  4796. const C = o.slice(v.endIndex + 1);
  4797. C && c.push(C);
  4798. }
  4799. }), c;
  4800. }
  4801. return [];
  4802. }
  4803. };
  4804. mt = Ta([
  4805. Pa(0, ot(Vr))
  4806. ], mt);
  4807. var Oa = "univer-cf-preview";
  4808. var rn = {
  4809. cfPreview: Oa
  4810. };
  4811. var Ct = (t) => {
  4812. var i, o;
  4813. const e = t.rule;
  4814. if (!e)
  4815. return null;
  4816. const r = (0, import_react.useMemo)(() => {
  4817. if (e.type === y.colorScale) {
  4818. const c = e.config.map((y3, p) => ({ color: new Nt(y3.color), value: p })), v = c.length - 1;
  4819. return new Array(5).fill("").map((y3, p, C) => p * v / (C.length - 1)).map((y3) => y0(c, y3));
  4820. }
  4821. return null;
  4822. }, [e]), n = (0, import_react.useMemo)(() => {
  4823. if (e.type === y.iconSet)
  4824. return e.config.map((c) => {
  4825. const v = o2[c.iconType];
  4826. return v && v[Number(c.iconId)];
  4827. });
  4828. }, [e]);
  4829. switch (e.type) {
  4830. case y.dataBar: {
  4831. const { isGradient: c } = e.config, v = { width: "50%", height: "100%" }, d = c ? `linear-gradient(to right, ${e.config.positiveColor || x2}, rgb(255 255 255))` : e.config.positiveColor, y3 = c ? `linear-gradient(to right, rgb(255 255 255),${e.config.nativeColor || y2})` : e.config.nativeColor;
  4832. return x3.jsxs("div", { className: rn.cfPreview, children: [
  4833. x3.jsx("div", { style: { ...v, background: y3, border: `1px solid ${e.config.nativeColor || y2}` } }),
  4834. x3.jsx("div", { style: { ...v, background: d, border: `1px solid ${e.config.positiveColor || x2}` } })
  4835. ] });
  4836. }
  4837. case y.colorScale:
  4838. return r && x3.jsx("div", { className: rn.cfPreview, children: r.map((c, v) => x3.jsx("div", { style: { width: `${100 / r.length}%`, height: "100%", background: c } }, v)) });
  4839. case y.iconSet:
  4840. return n && x3.jsx("div", { className: rn.cfPreview, children: n.map((c, v) => c ? x3.jsx("img", { style: { height: "100%" }, src: c }, v) : x3.jsx(Zt, {}, v)) });
  4841. case y.highlightCell: {
  4842. const { ul: c, st: v, it: d, bl: y3, bg: p, cl: C } = e.style, _ = (c == null ? void 0 : c.s) === we.TRUE, w2 = (v == null ? void 0 : v.s) === we.TRUE, S = d === we.TRUE, R3 = y3 === we.TRUE, h = (i = p == null ? void 0 : p.rgb) != null ? i : E1, s = (o = C == null ? void 0 : C.rgb) != null ? o : p1, a = {
  4843. fontWeight: R3 ? "bold" : void 0,
  4844. fontStyle: S ? "italic" : void 0,
  4845. textDecoration: `${_ ? "underline" : ""} ${w2 ? "line-through" : ""}`.replace(/^ /, "") || void 0,
  4846. backgroundColor: h,
  4847. color: s
  4848. };
  4849. return x3.jsx("div", { style: a, className: rn.cfPreview, children: "123" });
  4850. }
  4851. }
  4852. return null;
  4853. };
  4854. var Da = "univer-cf-rule-list";
  4855. var Ma = "univer-rule-selector";
  4856. var Na = "univer-select";
  4857. var ja = "univer-select-selector";
  4858. var La = "univer-select-selection-item";
  4859. var $a = "univer-select-selection-search-input";
  4860. var za = "univer-btn-list";
  4861. var Fa2 = "univer-gap";
  4862. var Va = "univer-icon";
  4863. var qa = "univer-disabled";
  4864. var Aa = "univer-rule-item";
  4865. var Wa = "univer-rule-describe";
  4866. var Ha = "univer-rule-type";
  4867. var Ua = "univer-rule-range";
  4868. var ka = "univer-active";
  4869. var Ba = "univer-draggableHandle";
  4870. var Ga = "univer-delete-item";
  4871. var Xa = "univer-grid-layout-wrap";
  4872. var Ya = "univer-react-grid-item";
  4873. var be = {
  4874. cfRuleList: Da,
  4875. ruleSelector: Ma,
  4876. select: Na,
  4877. selectSelector: ja,
  4878. selectSelectionItem: La,
  4879. selectSelectionSearchInput: $a,
  4880. btnList: za,
  4881. gap: Fa2,
  4882. icon: Va,
  4883. disabled: qa,
  4884. ruleItem: Aa,
  4885. ruleDescribe: Wa,
  4886. ruleType: Ha,
  4887. ruleRange: Ua,
  4888. active: ka,
  4889. draggableHandle: Ba,
  4890. deleteItem: Ga,
  4891. gridLayoutWrap: Xa,
  4892. reactGridItem: Ya
  4893. };
  4894. var Ka = (t, e) => {
  4895. const r = t.rule;
  4896. switch (r.type) {
  4897. case y.colorScale:
  4898. return e.t("sheet.cf.ruleType.colorScale");
  4899. case y.dataBar:
  4900. return e.t("sheet.cf.ruleType.dataBar");
  4901. case y.iconSet:
  4902. return e.t("sheet.cf.ruleType.iconSet");
  4903. case y.highlightCell:
  4904. switch (r.subType) {
  4905. case E.average: {
  4906. const n = r.operator;
  4907. return e.t(`sheet.cf.preview.describe.${n}`, e.t("sheet.cf.subRuleType.average"));
  4908. }
  4909. case E.duplicateValues:
  4910. return e.t("sheet.cf.subRuleType.duplicateValues");
  4911. case E.uniqueValues:
  4912. return e.t("sheet.cf.subRuleType.uniqueValues");
  4913. case E.number: {
  4914. const n = r.operator;
  4915. return e.t(`sheet.cf.preview.describe.${n}`, ...Array.isArray(r.value) ? r.value.map((i) => String(i)) : [String(r.value || "")]);
  4916. }
  4917. case E.text: {
  4918. const n = r.operator;
  4919. return e.t(`sheet.cf.preview.describe.${n}`, r.value || "");
  4920. }
  4921. case E.timePeriod: {
  4922. const n = r.operator;
  4923. return e.t(`sheet.cf.preview.describe.${n}`);
  4924. }
  4925. case E.rank:
  4926. return r.isPercent ? r.isBottom ? e.t("sheet.cf.preview.describe.bottomNPercent", String(r.value)) : e.t("sheet.cf.preview.describe.topNPercent", String(r.value)) : r.isBottom ? e.t("sheet.cf.preview.describe.bottomN", String(r.value)) : e.t("sheet.cf.preview.describe.topN", String(r.value));
  4927. case E.formula:
  4928. return e.t("sheet.cf.ruleType.formula");
  4929. }
  4930. }
  4931. };
  4932. var ti = 0;
  4933. var Za = (t) => {
  4934. const { onClick: e } = t, r = W0(B), n = W0(_n), i = W0(F), o = W0(Pt), c = W0(Vr), v = W0(Ot), d = W0(mt), y3 = z0(() => n.getCurrentTypeOfUnit$(Fe.UNIVER_SHEET), void 0, void 0, []), p = y3.getUnitId(), C = y3.getActiveSheet();
  4935. if (!C)
  4936. throw new Error("No active sheet found");
  4937. const _ = C.getSheetId(), [w2, S] = (0, import_react.useState)([]), [R3, h] = (0, import_react.useState)("2"), [s, a] = (0, import_react.useState)(0), [u, b] = (0, import_react.useState)(-1), [l, g] = (0, import_react.useState)(ti), f = (0, import_react.useRef)(null), m = [
  4938. { label: c.t("sheet.cf.panel.workSheet"), value: "2" },
  4939. { label: c.t("sheet.cf.panel.selectedRange"), value: "1" }
  4940. ], P = () => {
  4941. const A = r.getSubunitRules(p, _);
  4942. if (!A || !A.length)
  4943. return [];
  4944. if (R3 === "1") {
  4945. const F2 = i.getCurrentLastSelection();
  4946. if (!F2)
  4947. return [];
  4948. const oe = F2.range;
  4949. return A.filter((de) => de.ranges.some((ye) => en.intersects(ye, oe)));
  4950. } else if (R3 === "2")
  4951. return [...A];
  4952. return [];
  4953. }, [M2, j2] = (0, import_react.useState)(P);
  4954. dI(w2), (0, import_react.useEffect)(() => {
  4955. const A = o.onCommandExecuted((F2) => {
  4956. F2.id === an.id && a(Math.random());
  4957. });
  4958. return () => A.dispose();
  4959. }), (0, import_react.useEffect)(() => {
  4960. j2(P);
  4961. }, [R3, s, p, _]), (0, import_react.useEffect)(() => {
  4962. if (R3 === "2")
  4963. return;
  4964. const A = new Observable((F2) => {
  4965. const oe = [re2.id, T2.id, U2.id, E2.id, v2.id], se = o.onCommandExecuted((de) => {
  4966. const { id: ye, params: Ee } = de, $e2 = n.getCurrentUnitForType(Fe.UNIVER_SHEET).getUnitId();
  4967. oe.includes(ye) && Ee.unitId === $e2 && F2.next(null);
  4968. });
  4969. return () => se.dispose();
  4970. }).pipe(debounceTime(16)).subscribe(() => {
  4971. j2(P);
  4972. });
  4973. return () => {
  4974. A.unsubscribe();
  4975. };
  4976. }, [n, R3, p, _]), (0, import_react.useEffect)(() => {
  4977. const A = r.$ruleChange.subscribe(() => {
  4978. a(Math.random());
  4979. });
  4980. return () => A.unsubscribe();
  4981. }, [r]), (0, import_react.useEffect)(() => {
  4982. const A = () => {
  4983. var de;
  4984. const se = Math.max(0, (((de = f.current) == null ? void 0 : de.getBoundingClientRect().width) || 0) - 8);
  4985. return ti = se, se;
  4986. }, oe = new Observable((se) => {
  4987. const de = document.querySelector(".univer-sidebar");
  4988. if (de) {
  4989. let ye = setTimeout(() => {
  4990. se.next();
  4991. }, 150);
  4992. const Ee = () => {
  4993. ye && clearTimeout(ye), ye = null;
  4994. }, $e2 = (V2) => {
  4995. V2.propertyName === "width" && (Ee(), se.next());
  4996. };
  4997. return de.addEventListener("transitionend", $e2), () => {
  4998. Ee(), de.removeEventListener("transitionend", $e2);
  4999. };
  5000. }
  5001. }).pipe(debounceTime(16)).subscribe(() => {
  5002. g(A());
  5003. });
  5004. return () => {
  5005. oe.unsubscribe();
  5006. };
  5007. }, []);
  5008. const N3 = (A) => {
  5009. var se;
  5010. const F2 = n.getCurrentUnitForType(Fe.UNIVER_SHEET).getUnitId(), oe = (se = n.getCurrentUnitForType(Fe.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : se.getSheetId();
  5011. if (!F2 || !oe)
  5012. throw new Error("No active sheet found");
  5013. o.executeCommand(mn.id, { unitId: F2, subUnitId: oe, cfId: A.cfId });
  5014. }, I = (A, F2) => {
  5015. b(F2.y);
  5016. }, O = (A, F2, oe) => {
  5017. var V2;
  5018. b(-1);
  5019. const se = n.getCurrentUnitForType(Fe.UNIVER_SHEET).getUnitId(), de = (V2 = n.getCurrentUnitForType(Fe.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : V2.getSheetId();
  5020. if (!se || !de)
  5021. throw new Error("No active sheet found");
  5022. const ye = (Z) => {
  5023. const ce = M2.length;
  5024. return Math.min(ce - 1, Math.max(0, Z));
  5025. }, Ee = M2[ye(F2.y)].cfId, $e2 = M2[ye(oe.y)].cfId;
  5026. Ee !== $e2 && o.executeCommand(lr.id, { unitId: se, subUnitId: de, start: { id: Ee, type: "self" }, end: { id: $e2, type: oe.y > F2.y ? "after" : "before" } });
  5027. }, z = () => {
  5028. t.onCreate();
  5029. }, U = () => {
  5030. R3 === "2" ? o.executeCommand(On.id) : R3 === "1" && M2.map((F2) => ({ unitId: p, subUnitId: _, cfId: F2.cfId })).forEach((F2) => {
  5031. o.executeCommand(mn.id, F2);
  5032. });
  5033. }, k = (0, import_react.useMemo)(() => {
  5034. const A = n.getCurrentUnitForType(Fe.UNIVER_SHEET), F2 = A.getActiveSheet();
  5035. return M2.filter((oe) => {
  5036. const se = oe.ranges;
  5037. return yh(v, A.getUnitId(), F2.getSheetId(), se);
  5038. });
  5039. }, [M2]), ie = k.map((A, F2) => ({ i: A.cfId, x: 0, w: 12, y: F2, h: 1, isResizable: false })), ee = (0, import_react.useMemo)(() => {
  5040. const A = n.getCurrentUnitForType(Fe.UNIVER_SHEET), F2 = A.getActiveSheet();
  5041. return M2.every((oe) => {
  5042. const se = oe.ranges;
  5043. return yh(v, A.getUnitId(), F2.getSheetId(), se);
  5044. });
  5045. }, [M2]);
  5046. return x3.jsxs("div", { className: be.cfRuleList, children: [
  5047. x3.jsxs("div", { className: be.ruleSelector, children: [
  5048. x3.jsx("div", { children: d.tWithReactNode(
  5049. "sheet.cf.panel.managerRuleSelect",
  5050. x3.jsx(r_, { className: be.select, options: m, value: R3, onChange: (A) => {
  5051. h(A);
  5052. } })
  5053. ).map((A, F2) => x3.jsx("span", { children: A }, F2)) }),
  5054. x3.jsxs("div", { className: be.btnList, children: [
  5055. x3.jsx(Gf, { title: c.t("sheet.cf.panel.createRule"), placement: "bottom", children: x3.jsx(
  5056. "div",
  5057. {
  5058. className: `
  5059. ${be.icon}
  5060. `,
  5061. onClick: z,
  5062. children: x3.jsx(Hi, {})
  5063. }
  5064. ) }),
  5065. M2.length && ee ? x3.jsx(Gf, { title: c.t("sheet.cf.panel.clear"), placement: "bottom", children: x3.jsx(
  5066. "div",
  5067. {
  5068. className: `
  5069. ${be.gap}
  5070. ${be.icon}
  5071. `,
  5072. onClick: U,
  5073. children: x3.jsx(dn, {})
  5074. }
  5075. ) }) : x3.jsx(
  5076. "div",
  5077. {
  5078. className: `
  5079. ${be.gap}
  5080. ${be.disabled}
  5081. `,
  5082. children: x3.jsx(dn, {})
  5083. }
  5084. )
  5085. ] })
  5086. ] }),
  5087. x3.jsx("div", { ref: f, className: be.gridLayoutWrap, children: l ? x3.jsx(
  5088. xa,
  5089. {
  5090. onDragStop: O,
  5091. onDragStart: I,
  5092. layout: ie,
  5093. cols: 12,
  5094. rowHeight: 60,
  5095. width: l,
  5096. margin: [0, 10],
  5097. draggableHandle: ".draggableHandle",
  5098. children: k == null ? void 0 : k.map((A, F2) => x3.jsx("div", { children: x3.jsxs(
  5099. "div",
  5100. {
  5101. onMouseMove: () => {
  5102. A.ranges !== w2 && S(A.ranges);
  5103. },
  5104. onMouseLeave: () => S([]),
  5105. onClick: () => {
  5106. e(A);
  5107. },
  5108. className: `
  5109. ${be.ruleItem}
  5110. ${u === F2 ? be.active : ""}
  5111. `,
  5112. children: [
  5113. x3.jsx(
  5114. "div",
  5115. {
  5116. className: `
  5117. ${be.draggableHandle}
  5118. draggableHandle
  5119. `,
  5120. onClick: (oe) => oe.stopPropagation(),
  5121. children: x3.jsx(Ui, {})
  5122. }
  5123. ),
  5124. x3.jsxs("div", { className: be.ruleDescribe, children: [
  5125. x3.jsx("div", { className: be.ruleType, children: Ka(A, c) }),
  5126. x3.jsx("div", { className: be.ruleRange, children: A.ranges.map((oe) => fr(oe)).join(",") })
  5127. ] }),
  5128. x3.jsx("div", { className: be.preview, children: x3.jsx(Ct, { rule: A.rule }) }),
  5129. x3.jsx(
  5130. "div",
  5131. {
  5132. className: `
  5133. ${be.deleteItem}
  5134. ${u === F2 ? be.active : ""}
  5135. `,
  5136. onClick: (oe) => {
  5137. oe.stopPropagation(), N3(A), S([]);
  5138. },
  5139. children: x3.jsx(dn, {})
  5140. }
  5141. )
  5142. ]
  5143. }
  5144. ) }, `${A.cfId}`))
  5145. }
  5146. ) : null })
  5147. ] });
  5148. };
  5149. var Ja = "univer-cf-color-picker";
  5150. var Qa = "univer-cf-color-picker-icon";
  5151. var el = "univer-icon-dropdown";
  5152. var Gn = {
  5153. cfColorPicker: Ja,
  5154. cfColorPickerIcon: Qa,
  5155. iconDropdown: el
  5156. };
  5157. var lt = (t) => {
  5158. const { color: e, onChange: r, disable: n = false, iconId: i = "PaintBucket", className: o, isNeedDropdownIcon: c = true } = t, v = W0(n1), d = (0, import_react.useMemo)(() => new Nt(e), [e]), y3 = v.get(i);
  5159. return y3 && (n ? x3.jsx(y3, { className: o, extend: { colorChannel1: d.isValid ? e : "rgb(var(--primary-color))" } }) : x3.jsx(
  5160. sC,
  5161. {
  5162. overlay: x3.jsx(
  5163. "div",
  5164. {
  5165. className: `
  5166. ${Gn.cfColorPicker}
  5167. `,
  5168. children: x3.jsx($O, { value: e, onChange: r })
  5169. }
  5170. ),
  5171. children: x3.jsxs(
  5172. "span",
  5173. {
  5174. className: `
  5175. ${Gn.cfColorPickerIcon}
  5176. ${o}
  5177. `,
  5178. children: [
  5179. x3.jsx(y3, { extend: { colorChannel1: d.isValid ? e : "rgb(var(--primary-color))" } }),
  5180. c && x3.jsx(Dn, { className: Gn.iconDropdown })
  5181. ]
  5182. }
  5183. )
  5184. }
  5185. ));
  5186. };
  5187. var tl = "univer-cf-rule-style-editor";
  5188. var nl = "univer-cf-preview-wrap";
  5189. var rl = "univer-text";
  5190. var il = "univer-position-relative";
  5191. var ol = "univer-btn-list";
  5192. var sl = "univer-util-item";
  5193. var al = "univer-icon-set";
  5194. var ll = "univer-render-config";
  5195. var cl = "univer-flex";
  5196. var ul = "univer-width45";
  5197. var dl = "univer-icon-wrap";
  5198. var fl = "univer-icon";
  5199. var hl = "univer-dropdown-icon";
  5200. var pl = "univer-error-input";
  5201. var gl = "univer-error-text";
  5202. var ml = "univer-icon-group-list";
  5203. var vl = "univer-title";
  5204. var yl = "univer-group";
  5205. var bl = "univer-item-content";
  5206. var Sl = "univer-item-wrap";
  5207. var Cl = "univer-item";
  5208. var wl = "univer-icon-item-list-wrap";
  5209. var Rl = "univer-none";
  5210. var _l = "univer-icon-item-list";
  5211. var xl2 = "univer-width100";
  5212. var Il = "univer-stress";
  5213. var W = {
  5214. cfRuleStyleEditor: tl,
  5215. cfPreviewWrap: nl,
  5216. text: rl,
  5217. positionRelative: il,
  5218. btnList: ol,
  5219. utilItem: sl,
  5220. iconSet: al,
  5221. renderConfig: ll,
  5222. flex: cl,
  5223. width45: ul,
  5224. iconWrap: dl,
  5225. icon: fl,
  5226. dropdownIcon: hl,
  5227. errorInput: pl,
  5228. errorText: gl,
  5229. iconGroupList: ml,
  5230. title: vl,
  5231. group: yl,
  5232. itemContent: bl,
  5233. itemWrap: Sl,
  5234. item: Cl,
  5235. iconItemListWrap: wl,
  5236. none: Rl,
  5237. iconItemList: _l,
  5238. width100: xl2,
  5239. stress: Il
  5240. };
  5241. var it = (t, e) => ({ label: e.t(`sheet.cf.valueType.${t}`), value: t });
  5242. var Xn = (t) => {
  5243. var S;
  5244. const { type: e, className: r, onChange: n, id: i, value: o } = t, c = W0(_n), v = c.getCurrentUnitForType(Fe.UNIVER_SHEET).getUnitId(), d = (S = c.getCurrentUnitForType(Fe.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : S.getSheetId(), y3 = (0, import_react.useMemo)(() => String(o).startsWith("=") ? String(o) : "=", [o]), p = (0, import_react.useMemo)(() => [x.max, x.min, "none"].includes(e) ? { disabled: true } : [x.percent, x.percentile].includes(e) ? {
  5245. min: 0,
  5246. max: 100
  5247. } : {
  5248. min: Number.MIN_SAFE_INTEGER,
  5249. max: Number.MAX_SAFE_INTEGER
  5250. }, [e]), C = (0, import_react.useRef)({}), [_, w2] = (0, import_react.useState)(false);
  5251. return Kl((R3) => {
  5252. var s;
  5253. const h = (s = C.current) == null ? void 0 : s.handleOutClick;
  5254. h && h(R3, () => w2(false));
  5255. }), e === x.formula ? x3.jsx("div", { style: { width: "100%", marginLeft: 4 }, children: x3.jsx(
  5256. fc,
  5257. {
  5258. initValue: y3,
  5259. unitId: v,
  5260. subUnitId: d,
  5261. isFocus: _,
  5262. onChange: (R3 = "") => {
  5263. n(R3 || "");
  5264. },
  5265. onFocus: () => w2(true),
  5266. actions: C.current
  5267. }
  5268. ) }) : x3.jsx(BO, { className: r, value: Number(t.value) || 0, onChange: (R3) => t.onChange(R3 || 0), ...p });
  5269. };
  5270. var El = (t) => {
  5271. var N3;
  5272. const { interceptorManager: e } = t, r = W0(Vr), n = ((N3 = t.rule) == null ? void 0 : N3.type) === y.colorScale ? t.rule : void 0, i = [it(x.num, r), it(x.percent, r), it(x.percentile, r), it(x.formula, r)], o = [it(x.min, r), ...i], c = [it("none", r), ...i], v = [it(x.max, r), ...i], [d, y3] = (0, import_react.useState)(() => {
  5273. var O;
  5274. const I = x.min;
  5275. return n && ((O = n.config[0]) == null ? void 0 : O.value.type) || I;
  5276. }), [p, C] = (0, import_react.useState)(() => {
  5277. var O;
  5278. const I = "none";
  5279. return !n || n.config.length !== 3 ? I : ((O = n.config[1]) == null ? void 0 : O.value.type) || I;
  5280. }), [_, w2] = (0, import_react.useState)(() => {
  5281. var O;
  5282. const I = x.max;
  5283. return n && ((O = n.config[n.config.length - 1]) == null ? void 0 : O.value.type) || I;
  5284. }), [S, R3] = (0, import_react.useState)(() => {
  5285. if (!n)
  5286. return 10;
  5287. const O = n.config[0];
  5288. return (O == null ? void 0 : O.value.value) === void 0 ? 10 : O == null ? void 0 : O.value.value;
  5289. }), [h, s] = (0, import_react.useState)(() => {
  5290. var z;
  5291. if (!n || n.config.length !== 3)
  5292. return 50;
  5293. const O = (z = n.config[1]) == null ? void 0 : z.value.value;
  5294. return O === void 0 ? 50 : O;
  5295. }), [a, u] = (0, import_react.useState)(() => {
  5296. var z;
  5297. if (!n)
  5298. return 90;
  5299. const O = (z = n.config[n.config.length - 1]) == null ? void 0 : z.value.value;
  5300. return O === void 0 ? 90 : O;
  5301. }), [b, l] = (0, import_react.useState)(() => {
  5302. var O;
  5303. const I = "#d0d9fb";
  5304. return n && ((O = n.config[0]) == null ? void 0 : O.color) || I;
  5305. }), [g, f] = (0, import_react.useState)(() => {
  5306. var O;
  5307. const I = "#7790f3";
  5308. return !n || n.config.length !== 3 ? I : ((O = n.config[1]) == null ? void 0 : O.color) || I;
  5309. }), [m, P] = (0, import_react.useState)(() => {
  5310. var O;
  5311. const I = "#2e55ef";
  5312. return n && ((O = n.config[n.config.length - 1]) == null ? void 0 : O.color) || I;
  5313. }), M2 = (0, import_react.useMemo)(() => (I) => {
  5314. const {
  5315. minType: O,
  5316. medianType: z,
  5317. maxType: U,
  5318. minValue: k,
  5319. medianValue: ie,
  5320. maxValue: ee,
  5321. minColor: A,
  5322. medianColor: F2,
  5323. maxColor: oe
  5324. } = I, se = [];
  5325. return se.push({ color: A, value: { type: O, value: k } }), z !== "none" && se.push({ color: F2, value: { type: z, value: ie } }), se.push({ color: oe, value: { type: U, value: ee } }), { config: se.map((ye, Ee) => ({ ...ye, index: Ee })), type: y.colorScale };
  5326. }, []);
  5327. (0, import_react.useEffect)(() => e.intercept(e.getInterceptPoints().submit, {
  5328. handler() {
  5329. return M2({ minType: d, medianType: p, maxType: _, minValue: S, medianValue: h, maxValue: a, minColor: b, medianColor: g, maxColor: m });
  5330. }
  5331. }), [M2, d, p, _, S, h, a, b, g, m, e]);
  5332. const j2 = (I) => {
  5333. t.onChange(M2(I));
  5334. };
  5335. return x3.jsxs("div", { children: [
  5336. x3.jsx("div", { className: $.title, children: r.t("sheet.cf.panel.styleRule") }),
  5337. x3.jsx(
  5338. "div",
  5339. {
  5340. className: `
  5341. ${W.cfPreviewWrap}
  5342. `,
  5343. children: x3.jsx(Ct, { rule: M2({ minType: d, medianType: p, maxType: _, minValue: S, medianValue: h, maxValue: a, minColor: b, medianColor: g, maxColor: m }) })
  5344. }
  5345. ),
  5346. x3.jsx("div", { className: $.label, children: r.t("sheet.cf.valueType.min") }),
  5347. x3.jsxs(
  5348. "div",
  5349. {
  5350. className: `
  5351. ${$.labelContainer}
  5352. ${$.mTSm}
  5353. `,
  5354. children: [
  5355. x3.jsx(
  5356. r_,
  5357. {
  5358. style: { flexShrink: 0 },
  5359. options: o,
  5360. value: d,
  5361. onChange: (I) => {
  5362. y3(I);
  5363. const O = x1(I, 10);
  5364. R3(O), j2({ minType: I, medianType: p, maxType: _, minValue: O, medianValue: h, maxValue: a, minColor: b, medianColor: g, maxColor: m });
  5365. }
  5366. }
  5367. ),
  5368. x3.jsx(
  5369. Xn,
  5370. {
  5371. id: "min",
  5372. className: `
  5373. ${$.mLXxs}
  5374. `,
  5375. value: S,
  5376. type: d,
  5377. onChange: (I) => {
  5378. R3(I), j2({ minType: d, medianType: p, maxType: _, minValue: I, medianValue: h, maxValue: a, minColor: b, medianColor: g, maxColor: m });
  5379. }
  5380. }
  5381. ),
  5382. x3.jsx(
  5383. lt,
  5384. {
  5385. className: $.mLXxs,
  5386. color: b,
  5387. onChange: (I) => {
  5388. l(I), j2({ minType: d, medianType: p, maxType: _, minValue: S, medianValue: h, maxValue: a, minColor: I, medianColor: g, maxColor: m });
  5389. }
  5390. }
  5391. )
  5392. ]
  5393. }
  5394. ),
  5395. x3.jsx("div", { className: $.label, children: r.t("sheet.cf.panel.medianValue") }),
  5396. x3.jsxs(
  5397. "div",
  5398. {
  5399. className: `
  5400. ${$.labelContainer}
  5401. ${$.mTSm}
  5402. `,
  5403. children: [
  5404. x3.jsx(
  5405. r_,
  5406. {
  5407. style: { flexShrink: 0 },
  5408. options: c,
  5409. value: p,
  5410. onChange: (I) => {
  5411. C(I);
  5412. const O = x1(I, 50);
  5413. s(O), j2({ minType: d, medianType: I, maxType: _, minValue: S, medianValue: O, maxValue: a, minColor: b, medianColor: g, maxColor: m });
  5414. }
  5415. }
  5416. ),
  5417. x3.jsx(
  5418. Xn,
  5419. {
  5420. id: "median",
  5421. className: `
  5422. ${$.mLXxs}
  5423. `,
  5424. value: h,
  5425. type: p,
  5426. onChange: (I) => {
  5427. s(I), j2({ minType: d, medianType: p, maxType: _, minValue: S, medianValue: I, maxValue: a, minColor: b, medianColor: g, maxColor: m });
  5428. }
  5429. }
  5430. ),
  5431. p !== "none" && x3.jsx(
  5432. lt,
  5433. {
  5434. className: $.mLXxs,
  5435. color: g,
  5436. onChange: (I) => {
  5437. f(I), j2({ minType: d, medianType: p, maxType: _, minValue: S, medianValue: h, maxValue: a, minColor: b, medianColor: I, maxColor: m });
  5438. }
  5439. }
  5440. )
  5441. ]
  5442. }
  5443. ),
  5444. x3.jsx("div", { className: $.label, children: r.t("sheet.cf.valueType.max") }),
  5445. x3.jsxs(
  5446. "div",
  5447. {
  5448. className: `
  5449. ${$.labelContainer}
  5450. ${$.mTSm}
  5451. `,
  5452. children: [
  5453. x3.jsx(
  5454. r_,
  5455. {
  5456. style: { flexShrink: 0 },
  5457. options: v,
  5458. value: _,
  5459. onChange: (I) => {
  5460. w2(I);
  5461. const O = x1(I, 90);
  5462. u(O), j2({ minType: d, medianType: p, maxType: I, minValue: S, medianValue: h, maxValue: O, minColor: b, medianColor: g, maxColor: m });
  5463. }
  5464. }
  5465. ),
  5466. x3.jsx(
  5467. Xn,
  5468. {
  5469. id: "max",
  5470. className: `
  5471. ${$.mLXxs}
  5472. `,
  5473. value: a,
  5474. type: _,
  5475. onChange: (I) => {
  5476. u(I), j2({ minType: d, medianType: p, maxType: _, minValue: S, medianValue: h, maxValue: I, minColor: b, medianColor: g, maxColor: m });
  5477. }
  5478. }
  5479. ),
  5480. x3.jsx(
  5481. lt,
  5482. {
  5483. className: $.mLXxs,
  5484. color: m,
  5485. onChange: (I) => {
  5486. P(I), j2({ minType: d, medianType: p, maxType: _, minValue: S, medianValue: h, maxValue: a, minColor: b, medianColor: g, maxColor: I });
  5487. }
  5488. }
  5489. )
  5490. ]
  5491. }
  5492. )
  5493. ] });
  5494. };
  5495. var ft = (t, e) => ({ label: e.t(`sheet.cf.valueType.${t}`), value: t });
  5496. var ni = (t) => {
  5497. var R3;
  5498. const { onChange: e, className: r, value: n, type: i, id: o, disabled: c = false } = t, v = W0(_n), d = v.getCurrentUnitForType(Fe.UNIVER_SHEET).getUnitId(), y3 = (R3 = v.getCurrentUnitForType(Fe.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : R3.getSheetId(), p = (0, import_react.useRef)({}), [C, _] = (0, import_react.useState)(false);
  5499. Kl((h) => {
  5500. var a;
  5501. const s = (a = p.current) == null ? void 0 : a.handleOutClick;
  5502. s && s(h, () => _(false));
  5503. });
  5504. const w2 = (0, import_react.useRef)(n), S = (0, import_react.useMemo)(() => [x.percentile, x.percent].includes(i) ? {
  5505. max: 100,
  5506. min: 0
  5507. } : {
  5508. min: Number.MIN_SAFE_INTEGER,
  5509. max: Number.MAX_SAFE_INTEGER
  5510. }, [i]);
  5511. if (i === x.formula) {
  5512. const h = String(w2.current).startsWith("=") ? String(w2.current) || "" : "=";
  5513. return x3.jsx("div", { style: { width: "100%", marginLeft: 12 }, children: x3.jsx(
  5514. fc,
  5515. {
  5516. initValue: h,
  5517. unitId: d,
  5518. subUnitId: y3,
  5519. isFocus: C,
  5520. onChange: (s = "") => {
  5521. e(s || "");
  5522. },
  5523. onFocus: () => _(true),
  5524. actions: p.current
  5525. }
  5526. ) });
  5527. }
  5528. return x3.jsx(
  5529. BO,
  5530. {
  5531. className: r,
  5532. value: Number(n) || 0,
  5533. disabled: c,
  5534. onChange: (h) => {
  5535. e(h || 0);
  5536. },
  5537. ...S
  5538. }
  5539. );
  5540. };
  5541. var Tl = (t) => {
  5542. var N3;
  5543. const { interceptorManager: e } = t, r = W0(Vr), n = ((N3 = t.rule) == null ? void 0 : N3.type) === y.dataBar ? t.rule : void 0, [i, o] = (0, import_react.useState)(() => {
  5544. var O;
  5545. const I = "0";
  5546. return n ? (O = n.config) != null && O.isGradient ? "1" : "0" : I;
  5547. }), [c, v] = (0, import_react.useState)(() => {
  5548. var I;
  5549. return n ? ((I = n.config) == null ? void 0 : I.positiveColor) || x2 : x2;
  5550. }), [d, y3] = (0, import_react.useState)(() => {
  5551. var I;
  5552. return n ? ((I = n.config) == null ? void 0 : I.nativeColor) || y2 : y2;
  5553. }), p = [ft(x.num, r), ft(x.percent, r), ft(x.percentile, r), ft(x.formula, r)], C = [ft(x.min, r), ...p], _ = [ft(x.max, r), ...p], [w2, S] = (0, import_react.useState)(() => {
  5554. var O;
  5555. const I = C[0].value;
  5556. return n && ((O = n.config) == null ? void 0 : O.min.type) || I;
  5557. }), [R3, h] = (0, import_react.useState)(() => {
  5558. var O;
  5559. const I = _[0].value;
  5560. return n && ((O = n.config) == null ? void 0 : O.max.type) || I;
  5561. }), [s, a] = (0, import_react.useState)(() => {
  5562. var z;
  5563. if (!n)
  5564. return 0;
  5565. const O = ((z = n.config) == null ? void 0 : z.min) || {};
  5566. return O.type === x.formula ? O.value || "=" : O.value || 0;
  5567. }), [u, b] = (0, import_react.useState)(() => {
  5568. var z;
  5569. if (!n)
  5570. return 100;
  5571. const O = ((z = n.config) == null ? void 0 : z.max) || {};
  5572. return O.type === x.formula ? O.value || "=" : O.value === void 0 ? 100 : O.value;
  5573. }), [l, g] = (0, import_react.useState)(() => n ? n.isShowValue === void 0 ? true : !!n.isShowValue : true), f = (I) => ({ config: {
  5574. min: { type: I.minValueType, value: I.minValue },
  5575. max: { type: I.maxValueType, value: I.maxValue },
  5576. isGradient: I.isGradient === "1",
  5577. positiveColor: I.positiveColor || x2,
  5578. nativeColor: I.nativeColor || y2
  5579. }, type: y.dataBar, isShowValue: I.isShowValue });
  5580. (0, import_react.useEffect)(() => e.intercept(e.getInterceptPoints().submit, {
  5581. handler() {
  5582. return f({ isGradient: i, minValue: s, minValueType: w2, maxValue: u, maxValueType: R3, positiveColor: c, nativeColor: d, isShowValue: l });
  5583. }
  5584. }), [i, s, w2, u, R3, c, d, e, l]);
  5585. const m = (I) => {
  5586. t.onChange(f(I));
  5587. }, P = (I) => {
  5588. v(I), m({ isGradient: i, minValue: s, minValueType: w2, maxValue: u, maxValueType: R3, positiveColor: I, nativeColor: d, isShowValue: l });
  5589. }, M2 = (I) => {
  5590. y3(I), m({ isGradient: i, minValue: s, minValueType: w2, maxValue: u, maxValueType: R3, positiveColor: c, nativeColor: I, isShowValue: l });
  5591. }, j2 = (I) => p.map((O) => O.value).includes(I);
  5592. return x3.jsxs("div", { children: [
  5593. x3.jsx("div", { className: $.title, children: r.t("sheet.cf.panel.styleRule") }),
  5594. x3.jsx(
  5595. "div",
  5596. {
  5597. className: `
  5598. ${W.cfPreviewWrap}
  5599. `,
  5600. children: x3.jsx(Ct, { rule: f({ isGradient: i, minValue: s, minValueType: w2, maxValue: u, maxValueType: R3, positiveColor: c, nativeColor: d, isShowValue: l }) })
  5601. }
  5602. ),
  5603. x3.jsxs("div", { children: [
  5604. x3.jsx("div", { className: $.label, children: r.t("sheet.cf.panel.fillType") }),
  5605. x3.jsxs(
  5606. "div",
  5607. {
  5608. className: `
  5609. ${$.mTSm}
  5610. ${$.mLXxs}
  5611. ${$.labelContainer}
  5612. `,
  5613. children: [
  5614. x3.jsxs(
  5615. t_,
  5616. {
  5617. value: i,
  5618. onChange: (I) => {
  5619. o(I), m({ isGradient: I, minValue: s, minValueType: w2, maxValue: u, maxValueType: R3, positiveColor: c, nativeColor: d, isShowValue: l });
  5620. },
  5621. children: [
  5622. x3.jsx(e_, { value: "0", children: x3.jsx("span", { className: W.text, children: r.t("sheet.cf.panel.pureColor") }) }),
  5623. x3.jsx(e_, { value: "1", children: x3.jsx("span", { className: W.text, children: r.t("sheet.cf.panel.gradient") }) })
  5624. ]
  5625. }
  5626. ),
  5627. x3.jsxs(
  5628. "div",
  5629. {
  5630. className: `
  5631. ${W.utilItem}
  5632. ${$.mLXl}
  5633. `,
  5634. children: [
  5635. x3.jsx(
  5636. um,
  5637. {
  5638. checked: !l,
  5639. onChange: (I) => {
  5640. g(!I), m({ isGradient: I, minValue: s, minValueType: w2, maxValue: u, maxValueType: R3, positiveColor: c, nativeColor: d, isShowValue: !I });
  5641. }
  5642. }
  5643. ),
  5644. r.t("sheet.cf.panel.onlyShowDataBar")
  5645. ]
  5646. }
  5647. )
  5648. ]
  5649. }
  5650. )
  5651. ] }),
  5652. x3.jsxs("div", { children: [
  5653. x3.jsx("div", { className: $.label, children: r.t("sheet.cf.panel.colorSet") }),
  5654. x3.jsxs(
  5655. "div",
  5656. {
  5657. className: `
  5658. ${$.labelContainer}
  5659. ${$.mTSm}
  5660. ${$.mLXxs}
  5661. `,
  5662. children: [
  5663. x3.jsxs(
  5664. "div",
  5665. {
  5666. className: `
  5667. ${$.labelContainer}
  5668. `,
  5669. children: [
  5670. x3.jsx(
  5671. "div",
  5672. {
  5673. className: `
  5674. ${W.text}
  5675. `,
  5676. children: r.t("sheet.cf.panel.native")
  5677. }
  5678. ),
  5679. x3.jsx(
  5680. lt,
  5681. {
  5682. color: d,
  5683. onChange: M2
  5684. }
  5685. )
  5686. ]
  5687. }
  5688. ),
  5689. x3.jsxs(
  5690. "div",
  5691. {
  5692. className: `
  5693. ${$.labelContainer}
  5694. ${$.mLSm}
  5695. `,
  5696. children: [
  5697. x3.jsx(
  5698. "div",
  5699. {
  5700. className: `
  5701. ${W.text}
  5702. `,
  5703. children: r.t("sheet.cf.panel.positive")
  5704. }
  5705. ),
  5706. x3.jsx(
  5707. lt,
  5708. {
  5709. color: c,
  5710. onChange: P
  5711. }
  5712. )
  5713. ]
  5714. }
  5715. )
  5716. ]
  5717. }
  5718. )
  5719. ] }),
  5720. x3.jsxs("div", { children: [
  5721. x3.jsx("div", { className: $.label, children: r.t("sheet.cf.valueType.min") }),
  5722. x3.jsxs(
  5723. "div",
  5724. {
  5725. className: `
  5726. ${$.mTSm}
  5727. ${$.labelContainer}
  5728. `,
  5729. children: [
  5730. x3.jsx(
  5731. r_,
  5732. {
  5733. style: { width: "50%", flexShrink: 0 },
  5734. options: C,
  5735. value: w2,
  5736. onChange: (I) => {
  5737. S(I);
  5738. const O = x1(I, 10);
  5739. a(O), m({ isGradient: i, minValue: O, minValueType: I, maxValue: u, maxValueType: R3, positiveColor: c, nativeColor: d, isShowValue: l });
  5740. }
  5741. }
  5742. ),
  5743. x3.jsx(
  5744. ni,
  5745. {
  5746. disabled: !j2(w2),
  5747. id: "min",
  5748. type: w2,
  5749. className: $.mLSm,
  5750. value: s,
  5751. onChange: (I) => {
  5752. a(I || 0), m({ isGradient: i, minValue: I || 0, minValueType: w2, maxValue: u, maxValueType: R3, positiveColor: c, nativeColor: d, isShowValue: l });
  5753. }
  5754. }
  5755. )
  5756. ]
  5757. }
  5758. ),
  5759. x3.jsx("div", { className: $.label, children: r.t("sheet.cf.valueType.max") }),
  5760. x3.jsxs(
  5761. "div",
  5762. {
  5763. className: `
  5764. ${$.mTSm}
  5765. ${$.labelContainer}
  5766. `,
  5767. children: [
  5768. x3.jsx(
  5769. r_,
  5770. {
  5771. style: { width: "50%", flexShrink: 0 },
  5772. options: _,
  5773. value: R3,
  5774. onChange: (I) => {
  5775. h(I);
  5776. const O = x1(I, 90);
  5777. b(O), m({ isGradient: i, minValue: s, minValueType: w2, maxValue: O, maxValueType: I, positiveColor: c, nativeColor: d, isShowValue: l });
  5778. }
  5779. }
  5780. ),
  5781. x3.jsx(
  5782. ni,
  5783. {
  5784. disabled: !j2(R3),
  5785. id: "max",
  5786. type: R3,
  5787. className: $.mLSm,
  5788. value: u,
  5789. onChange: (I) => {
  5790. b(I || 0), m({ isGradient: i, minValue: s, minValueType: w2, maxValue: I || 0, maxValueType: R3, positiveColor: c, nativeColor: d, isShowValue: l });
  5791. }
  5792. }
  5793. )
  5794. ]
  5795. }
  5796. )
  5797. ] })
  5798. ] });
  5799. };
  5800. function io(t) {
  5801. var e, r, n = "";
  5802. if (typeof t == "string" || typeof t == "number")
  5803. n += t;
  5804. else if (typeof t == "object")
  5805. if (Array.isArray(t)) {
  5806. var i = t.length;
  5807. for (e = 0; e < i; e++)
  5808. t[e] && (r = io(t[e])) && (n && (n += " "), n += r);
  5809. } else
  5810. for (r in t)
  5811. t[r] && (n && (n += " "), n += r);
  5812. return n;
  5813. }
  5814. function on() {
  5815. for (var t, e, r = 0, n = "", i = arguments.length; r < i; r++)
  5816. (t = arguments[r]) && (e = io(t)) && (n && (n += " "), n += e);
  5817. return n;
  5818. }
  5819. var Pl = "univer-cf-style-edit";
  5820. var Ol = "univer-button-item";
  5821. var Dl = "univer-isActive";
  5822. var ke2 = {
  5823. cfStyleEdit: Pl,
  5824. buttonItem: Ol,
  5825. isActive: Dl
  5826. };
  5827. var sn = (t) => [we.FALSE, void 0].includes(t) ? we.TRUE : we.FALSE;
  5828. var an2 = (t) => t !== we.FALSE;
  5829. var gr2 = (t) => {
  5830. const { style: e, onChange: r, className: n } = t, i = W0(n1), [o, c] = (0, import_react.useState)(() => {
  5831. if (e != null && e.bl)
  5832. return e.bl;
  5833. }), [v, d] = (0, import_react.useState)(() => {
  5834. if (e != null && e.it)
  5835. return e.it;
  5836. }), [y3, p] = (0, import_react.useState)(() => {
  5837. if (e != null && e.ul)
  5838. return e.ul.s;
  5839. }), [C, _] = (0, import_react.useState)(() => {
  5840. if (e != null && e.st)
  5841. return e.st.s;
  5842. }), [w2, S] = (0, import_react.useState)(() => {
  5843. var g;
  5844. const l = "#2f56ef";
  5845. return (g = e == null ? void 0 : e.cl) != null && g.rgb ? e.cl.rgb : l;
  5846. }), [R3, h] = (0, import_react.useState)(() => {
  5847. var g;
  5848. const l = "#e8ecfc";
  5849. return (g = e == null ? void 0 : e.bg) != null && g.rgb ? e.bg.rgb : l;
  5850. }), s = i.get("BoldSingle"), a = i.get("ItalicSingle"), u = i.get("UnderlineSingle"), b = i.get("StrikethroughSingle");
  5851. return (0, import_react.useEffect)(() => {
  5852. const l = {
  5853. bl: o,
  5854. it: v
  5855. };
  5856. w2 !== void 0 && (l.cl = { rgb: w2 }), R3 !== void 0 && (l.bg = { rgb: R3 }), C !== void 0 && (l.st = { s: C }), y3 !== void 0 && (l.ul = { s: y3 }), r(g1(l));
  5857. }, [o, v, y3, C, w2, R3]), x3.jsxs(
  5858. "div",
  5859. {
  5860. className: `
  5861. ${ke2.cfStyleEdit}
  5862. ${n}
  5863. `,
  5864. children: [
  5865. s && x3.jsx("div", { className: on({ [ke2.isActive]: an2(o || we.FALSE) }, ke2.buttonItem), onClick: () => c(sn(o)), children: x3.jsx(s, {}) }),
  5866. a && x3.jsx("div", { className: on({ [ke2.isActive]: an2(v || we.FALSE) }, ke2.buttonItem), onClick: () => d(sn(v)), children: x3.jsx(a, {}) }),
  5867. u && x3.jsx("div", { className: on({ [ke2.isActive]: an2(y3 || we.FALSE) }, ke2.buttonItem), onClick: () => p(sn(y3)), children: x3.jsx(u, {}) }),
  5868. b && x3.jsx("div", { className: on({ [ke2.isActive]: an2(C || we.FALSE) }, ke2.buttonItem), onClick: () => _(sn(C)), children: x3.jsx(b, {}) }),
  5869. x3.jsx(lt, { color: w2, onChange: S, iconId: "FontColor" }),
  5870. x3.jsx(lt, { color: R3, onChange: h, iconId: "PaintBucket" })
  5871. ]
  5872. }
  5873. );
  5874. };
  5875. var Ml = (t) => {
  5876. var b;
  5877. const { onChange: e, interceptorManager: r } = t, n = W0(Vr), o = W0(_n).getCurrentUnitForType(Fe.UNIVER_SHEET), c = o.getActiveSheet(), v = ((b = t.rule) == null ? void 0 : b.type) === y.highlightCell ? t.rule : void 0, d = (0, import_react.useRef)(null), [y3, p] = (0, import_react.useState)(false), C = (0, import_react.useRef)({}), [_, w2] = (0, import_react.useState)({}), [S, R3] = (0, import_react.useState)(() => (v == null ? void 0 : v.subType) === E.formula ? v.value : "="), [h, s] = (0, import_react.useState)(void 0), a = (l) => ({
  5878. style: l.style,
  5879. value: S,
  5880. type: y.highlightCell,
  5881. subType: E.formula
  5882. });
  5883. (0, import_react.useEffect)(() => r.intercept(r.getInterceptPoints().submit, {
  5884. handler() {
  5885. return a({ style: _, formula: S });
  5886. }
  5887. }), [_, S, r]), (0, import_react.useEffect)(() => r.intercept(r.getInterceptPoints().beforeSubmit, {
  5888. handler: (g, f, m) => h || S.length === 1 || !S.startsWith("=") ? (s(n.t("sheet.cf.errorMessage.formulaError")), false) : m(g)
  5889. }), [h, S]);
  5890. const u = (l) => {
  5891. e(a(l));
  5892. };
  5893. return Kl((l) => {
  5894. var f;
  5895. const g = (f = C.current) == null ? void 0 : f.handleOutClick;
  5896. g && g(l, () => p(false));
  5897. }), x3.jsxs("div", { ref: d, children: [
  5898. x3.jsx(
  5899. "div",
  5900. {
  5901. className: `
  5902. ${$.title}
  5903. ${$.mTBase}
  5904. `,
  5905. children: n.t("sheet.cf.panel.styleRule")
  5906. }
  5907. ),
  5908. x3.jsx(
  5909. "div",
  5910. {
  5911. className: `
  5912. ${$.mTSm}
  5913. `,
  5914. children: x3.jsx(
  5915. fc,
  5916. {
  5917. onChange: (l) => {
  5918. R3(l), u({ style: _, formula: l });
  5919. },
  5920. onVerify: (l, g) => {
  5921. !l || g.length === 1 ? s(n.t("sheet.cf.errorMessage.formulaError")) : s(void 0);
  5922. },
  5923. errorText: h,
  5924. onFocus: () => {
  5925. p(true);
  5926. },
  5927. actions: C.current,
  5928. isFocus: y3,
  5929. initValue: S,
  5930. unitId: o.getUnitId(),
  5931. subUnitId: c == null ? void 0 : c.getSheetId()
  5932. }
  5933. )
  5934. }
  5935. ),
  5936. x3.jsx(
  5937. "div",
  5938. {
  5939. className: `
  5940. ${W.cfPreviewWrap}
  5941. `,
  5942. children: x3.jsx(Ct, { rule: a({ style: _, formula: S }) })
  5943. }
  5944. ),
  5945. x3.jsx(
  5946. gr2,
  5947. {
  5948. style: v == null ? void 0 : v.style,
  5949. className: `
  5950. ${$.mTSm}
  5951. `,
  5952. onChange: (l) => {
  5953. w2(l), u({ style: l, formula: S });
  5954. }
  5955. }
  5956. )
  5957. ] });
  5958. };
  5959. var ln = (t) => x3.jsxs("div", { style: { position: "relative" }, children: [
  5960. x3.jsx(
  5961. "div",
  5962. {
  5963. style: {
  5964. position: "absolute",
  5965. zIndex: 999,
  5966. bottom: "-13px",
  5967. fontSize: "10px",
  5968. color: "red"
  5969. },
  5970. children: t.errorText
  5971. }
  5972. ),
  5973. t.children
  5974. ] });
  5975. var fe = (t, e) => ({ label: e.t(`sheet.cf.operator.${t}`), value: t });
  5976. var Nl = (t) => {
  5977. const { type: e, operator: r, onChange: n, value: i, interceptorManager: o } = t, c = W0(Vr), [v, d] = (0, import_react.useState)(() => typeof i == "number" ? i : 0), [y3, p] = (0, import_react.useState)(""), [C, _] = (0, import_react.useState)(() => typeof i == "string" ? i : ""), [w2, S] = (0, import_react.useState)(""), [R3, h] = (0, import_react.useState)(() => Array.isArray(i) ? i[0] === void 0 ? 0 : i[0] : 0), [s, a] = (0, import_react.useState)(""), [u, b] = (0, import_react.useState)(() => Array.isArray(i) ? i[1] === void 0 ? 100 : i[1] : 100), [l, g] = (0, import_react.useState)("");
  5978. switch ((0, import_react.useEffect)(() => {
  5979. switch (e) {
  5980. case E.text: {
  5981. [
  5982. M.beginsWith,
  5983. M.endsWith,
  5984. M.containsText,
  5985. M.notContainsText,
  5986. M.equal,
  5987. M.notEqual
  5988. ].includes(r) && n(C);
  5989. break;
  5990. }
  5991. case E.number: {
  5992. [
  5993. w.equal,
  5994. w.notEqual,
  5995. w.greaterThan,
  5996. w.greaterThanOrEqual,
  5997. w.lessThan,
  5998. w.lessThanOrEqual
  5999. ].includes(r) && n(v), [w.between, w.notBetween].includes(r) && n([R3, u]);
  6000. break;
  6001. }
  6002. }
  6003. }, [e]), (0, import_react.useEffect)(() => {
  6004. const f = o.intercept(o.getInterceptPoints().beforeSubmit, {
  6005. handler: (m, P, M2) => {
  6006. switch (e) {
  6007. case E.text:
  6008. if ([
  6009. M.beginsWith,
  6010. M.containsText,
  6011. M.endsWith,
  6012. M.notEqual,
  6013. M.notContainsText,
  6014. M.equal
  6015. ].includes(r))
  6016. return C ? M2(m) : (S(c.t("sheet.cf.errorMessage.notBlank")), false);
  6017. }
  6018. return M2(m);
  6019. }
  6020. });
  6021. return () => {
  6022. f();
  6023. };
  6024. }, [e, v, C, r]), e) {
  6025. case E.text: {
  6026. if ([
  6027. M.beginsWith,
  6028. M.endsWith,
  6029. M.containsText,
  6030. M.notContainsText,
  6031. M.equal,
  6032. M.notEqual
  6033. ].includes(r)) {
  6034. const f = (m) => {
  6035. _(m), n(m);
  6036. };
  6037. return x3.jsx(
  6038. "div",
  6039. {
  6040. className: `
  6041. ${$.mTSm}
  6042. `,
  6043. children: x3.jsx(ln, { errorText: w2, children: x3.jsx(
  6044. QC,
  6045. {
  6046. className: W.width100,
  6047. value: C,
  6048. onChange: (m) => {
  6049. S(""), f(m);
  6050. }
  6051. }
  6052. ) })
  6053. }
  6054. );
  6055. }
  6056. break;
  6057. }
  6058. case E.number: {
  6059. if ([
  6060. w.equal,
  6061. w.notEqual,
  6062. w.greaterThan,
  6063. w.greaterThanOrEqual,
  6064. w.lessThan,
  6065. w.lessThanOrEqual
  6066. ].includes(r)) {
  6067. const f = (m) => {
  6068. d(m || 0), n(m || 0), p("");
  6069. };
  6070. return x3.jsx(
  6071. "div",
  6072. {
  6073. className: `
  6074. ${$.mTSm}
  6075. `,
  6076. children: x3.jsx(ln, { errorText: y3, children: x3.jsx(BO, { min: Number.MIN_SAFE_INTEGER, max: Number.MAX_SAFE_INTEGER, className: W.width100, value: v, onChange: f }) })
  6077. }
  6078. );
  6079. }
  6080. if ([w.between, w.notBetween].includes(r)) {
  6081. const f = (P) => {
  6082. h(P || 0), n([P || 0, u]), a("");
  6083. }, m = (P) => {
  6084. b(P || 0), n([R3, P || 0]), g("");
  6085. };
  6086. return x3.jsxs(
  6087. "div",
  6088. {
  6089. className: `
  6090. ${$.mTSm}
  6091. ${$.labelContainer}
  6092. `,
  6093. children: [
  6094. x3.jsx(ln, { errorText: s, children: x3.jsx(BO, { min: Number.MIN_SAFE_INTEGER, max: Number.MAX_SAFE_INTEGER, value: R3, onChange: f }) }),
  6095. x3.jsx(ln, { errorText: l, children: x3.jsx(
  6096. BO,
  6097. {
  6098. min: Number.MIN_SAFE_INTEGER,
  6099. max: Number.MAX_SAFE_INTEGER,
  6100. className: `
  6101. ${$.mLSm}
  6102. `,
  6103. value: u,
  6104. onChange: m
  6105. }
  6106. ) })
  6107. ]
  6108. }
  6109. );
  6110. }
  6111. }
  6112. }
  6113. return null;
  6114. };
  6115. var ri = (t, e) => {
  6116. switch (t) {
  6117. case E.text:
  6118. return [
  6119. fe(M.containsText, e),
  6120. fe(M.notContainsText, e),
  6121. fe(M.beginsWith, e),
  6122. fe(M.endsWith, e),
  6123. fe(M.equal, e),
  6124. fe(M.notEqual, e),
  6125. fe(M.containsBlanks, e),
  6126. fe(M.notContainsBlanks, e),
  6127. fe(M.containsErrors, e),
  6128. fe(M.notContainsErrors, e)
  6129. ];
  6130. case E.number:
  6131. return [
  6132. fe(w.between, e),
  6133. fe(w.notBetween, e),
  6134. fe(w.equal, e),
  6135. fe(w.notEqual, e),
  6136. fe(w.greaterThan, e),
  6137. fe(w.greaterThanOrEqual, e),
  6138. fe(w.lessThan, e),
  6139. fe(w.lessThanOrEqual, e)
  6140. ];
  6141. case E.timePeriod:
  6142. return [
  6143. fe(R.yesterday, e),
  6144. fe(R.today, e),
  6145. fe(R.tomorrow, e),
  6146. fe(R.last7Days, e),
  6147. fe(R.lastWeek, e),
  6148. fe(R.thisWeek, e),
  6149. fe(R.nextWeek, e),
  6150. fe(R.lastMonth, e),
  6151. fe(R.thisMonth, e),
  6152. fe(R.nextMonth, e)
  6153. ];
  6154. }
  6155. };
  6156. var ii = (t) => {
  6157. var b;
  6158. const { interceptorManager: e, onChange: r } = t, n = W0(Vr), i = ((b = t.rule) == null ? void 0 : b.type) === y.highlightCell ? t.rule : void 0, [o, c] = (0, import_react.useState)(() => {
  6159. const l = E.text;
  6160. return i && i.subType || l;
  6161. }), v = [
  6162. {
  6163. value: E.text,
  6164. label: n.t("sheet.cf.subRuleType.text")
  6165. },
  6166. {
  6167. value: E.number,
  6168. label: n.t("sheet.cf.subRuleType.number")
  6169. },
  6170. {
  6171. value: E.timePeriod,
  6172. label: n.t("sheet.cf.subRuleType.timePeriod")
  6173. },
  6174. {
  6175. value: E.duplicateValues,
  6176. label: n.t("sheet.cf.subRuleType.duplicateValues")
  6177. },
  6178. {
  6179. value: E.uniqueValues,
  6180. label: n.t("sheet.cf.subRuleType.uniqueValues")
  6181. }
  6182. ], d = (0, import_react.useMemo)(() => ri(o, n), [o]), [y3, p] = (0, import_react.useState)(() => {
  6183. const l = d ? d[0].value : void 0;
  6184. return i && i.operator || l;
  6185. }), [C, _] = (0, import_react.useState)(() => {
  6186. var f;
  6187. const l = "";
  6188. return i ? (f = i.value) != null ? f : _12(i.subType, i.operator) : l;
  6189. }), [w2, S] = (0, import_react.useState)({}), R3 = (0, import_react.useMemo)(() => (l) => {
  6190. var g, f, m, P, M2, j2, N3, I, O, z, U, k, ie, ee, A;
  6191. switch (l.subType || o) {
  6192. case E.text: {
  6193. if ([
  6194. M.beginsWith,
  6195. M.endsWith,
  6196. M.containsText,
  6197. M.notContainsText,
  6198. M.equal,
  6199. M.notEqual
  6200. ].includes(y3))
  6201. return {
  6202. type: y.highlightCell,
  6203. subType: (g = l.subType) != null ? g : o,
  6204. operator: (f = l.operator) != null ? f : y3,
  6205. style: (m = l.style) != null ? m : w2,
  6206. value: (P = l.value) != null ? P : C
  6207. };
  6208. break;
  6209. }
  6210. case E.number: {
  6211. if ([
  6212. w.equal,
  6213. w.notEqual,
  6214. w.greaterThan,
  6215. w.greaterThanOrEqual,
  6216. w.lessThan,
  6217. w.lessThanOrEqual
  6218. ].includes(y3))
  6219. return {
  6220. type: y.highlightCell,
  6221. subType: (M2 = l.subType) != null ? M2 : o,
  6222. operator: (j2 = l.operator) != null ? j2 : y3,
  6223. style: (N3 = l.style) != null ? N3 : w2,
  6224. value: (I = l.value) != null ? I : C
  6225. };
  6226. if ([w.between, w.notBetween].includes(y3))
  6227. return {
  6228. type: y.highlightCell,
  6229. subType: (O = l.subType) != null ? O : o,
  6230. operator: (z = l.operator) != null ? z : y3,
  6231. style: (U = l.style) != null ? U : w2,
  6232. value: (k = l.value) != null ? k : C
  6233. };
  6234. break;
  6235. }
  6236. }
  6237. return {
  6238. type: y.highlightCell,
  6239. subType: (ie = l.subType) != null ? ie : o,
  6240. operator: (ee = l.operator) != null ? ee : y3,
  6241. style: (A = l.style) != null ? A : w2
  6242. };
  6243. }, [o, y3, C, w2]);
  6244. (0, import_react.useEffect)(() => e.intercept(e.getInterceptPoints().submit, {
  6245. handler() {
  6246. return R3({});
  6247. }
  6248. }), [R3, e]), (0, import_react.useEffect)(() => {
  6249. v.some((l) => l.value === o) || c(v[0].value);
  6250. }, [v]);
  6251. const h = (l) => {
  6252. const g = l, f = ri(g, n), m = f && f[0].value;
  6253. c(g), p(m), m && _(_12(g, m)), r(R3({ subType: g, operator: m }));
  6254. }, s = (l) => {
  6255. const g = l;
  6256. p(g), r(R3({ operator: g }));
  6257. }, a = (l) => {
  6258. _(l), r(R3({ value: l }));
  6259. }, u = (0, import_react.useMemo)(() => `${o}_${y3}_${Math.random()}`, [o, y3]);
  6260. return x3.jsxs("div", { children: [
  6261. x3.jsx(
  6262. "div",
  6263. {
  6264. className: `
  6265. ${$.title}
  6266. ${$.mTBase}
  6267. `,
  6268. children: n.t("sheet.cf.panel.styleRule")
  6269. }
  6270. ),
  6271. x3.jsx(
  6272. r_,
  6273. {
  6274. className: `
  6275. ${$.mTSm}
  6276. ${W.width100}
  6277. `,
  6278. onChange: h,
  6279. value: o,
  6280. options: v
  6281. }
  6282. ),
  6283. (d == null ? void 0 : d.length) && x3.jsx(
  6284. r_,
  6285. {
  6286. className: `
  6287. ${$.mTSm}
  6288. ${W.width100}
  6289. `,
  6290. onChange: s,
  6291. value: y3 || "",
  6292. options: d
  6293. }
  6294. ),
  6295. x3.jsx(Nl, { value: C, interceptorManager: e, type: o, operator: y3, rule: i, onChange: a }, u),
  6296. x3.jsx(
  6297. "div",
  6298. {
  6299. className: `
  6300. ${W.cfPreviewWrap}
  6301. `,
  6302. children: x3.jsx(Ct, { rule: R3({}) })
  6303. }
  6304. ),
  6305. x3.jsx(
  6306. gr2,
  6307. {
  6308. style: i == null ? void 0 : i.style,
  6309. className: `
  6310. ${$.mLXxs}
  6311. `,
  6312. onChange: (l) => {
  6313. S(l), r(R3({ style: l }));
  6314. }
  6315. }
  6316. )
  6317. ] });
  6318. };
  6319. var oo = (t, e) => (o2[t] || [])[Number(e)] || "";
  6320. var jl = (t) => {
  6321. var d;
  6322. const e = W0(_n), r = e.getCurrentUnitForType(Fe.UNIVER_SHEET).getUnitId(), n = (d = e.getCurrentUnitForType(Fe.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : d.getSheetId(), i = (0, import_react.useMemo)(() => t.error ? W.errorInput : "", [t.error]), o = (0, import_react.useRef)({}), [c, v] = (0, import_react.useState)(false);
  6323. return Kl((y3) => {
  6324. var C;
  6325. const p = (C = o.current) == null ? void 0 : C.handleOutClick;
  6326. p && p(y3, () => v(false));
  6327. }), x3.jsx("div", { className: W.positionRelative, children: t.type !== x.formula ? x3.jsxs(x3.Fragment, { children: [
  6328. x3.jsx(BO, { className: i, value: Number(t.value) || 0, onChange: (y3) => t.onChange(y3 != null ? y3 : 0) }),
  6329. t.error && x3.jsx("div", { className: W.errorText, children: t.error })
  6330. ] }) : x3.jsx("div", { style: { width: "100%" }, children: x3.jsx(
  6331. fc,
  6332. {
  6333. initValue: String(t.value),
  6334. unitId: r,
  6335. subUnitId: n,
  6336. isFocus: c,
  6337. onChange: (y3 = "") => {
  6338. const p = y3 || "";
  6339. t.onChange(p);
  6340. },
  6341. onFocus: () => v(true),
  6342. actions: o.current
  6343. }
  6344. ) }) });
  6345. };
  6346. var oi = (t, e, r) => ({
  6347. operator: w.greaterThan,
  6348. value: { type: x.num, value: (r.length - 1 - e) * 10 },
  6349. iconType: t,
  6350. iconId: String(e)
  6351. });
  6352. var Ll = (0, import_react.forwardRef)((t, e) => {
  6353. const r = W0(Vr), n = (i) => {
  6354. t.onClick(i);
  6355. };
  6356. return x3.jsx("div", { ref: e, className: W.iconGroupList, children: K02.map((i, o) => x3.jsxs("div", { className: W.group, children: [
  6357. x3.jsx("div", { className: W.title, children: r.t(i.title) }),
  6358. x3.jsx("div", { className: W.itemContent, children: i.group.map((c) => x3.jsx("div", { className: W.itemWrap, onClick: () => {
  6359. n(c.name);
  6360. }, children: x3.jsx("div", { className: W.item, children: c.list.map((v, d) => x3.jsx("img", { className: W.icon, src: v }, d)) }) }, c.name)) })
  6361. ] }, o)) });
  6362. });
  6363. var $l = (t) => {
  6364. const e = (0, import_react.useMemo)(() => {
  6365. const n = [];
  6366. for (const i in o2) {
  6367. const o = o2[i], c = i;
  6368. o.forEach((v, d) => {
  6369. n.push({
  6370. iconType: c,
  6371. base64: v,
  6372. iconId: String(d)
  6373. });
  6374. });
  6375. }
  6376. return n;
  6377. }, []), r = (n) => {
  6378. t.onClick(n.iconType, n.iconId);
  6379. };
  6380. return x3.jsxs("div", { className: W.iconItemListWrap, children: [
  6381. x3.jsxs("div", { className: W.none, onClick: () => r({ iconType: J0, iconId: "", base64: "" }), children: [
  6382. x3.jsx(Zt, { className: W.icon }),
  6383. x3.jsx("span", { children: "无单元格图标" })
  6384. ] }),
  6385. x3.jsx("div", { className: W.iconItemList, children: e.map((n) => x3.jsx("div", { className: W.item, children: x3.jsx(
  6386. "img",
  6387. {
  6388. onClick: () => r(n),
  6389. className: `
  6390. ${W.icon}
  6391. `,
  6392. src: n.base64
  6393. }
  6394. ) }, `${n.iconType}_${n.iconId}`)) })
  6395. ] });
  6396. };
  6397. var zl = (t) => {
  6398. const { onChange: e, configList: r, errorMap: n = {} } = t, i = W0(Vr), o = [
  6399. { label: i.t(`sheet.cf.symbol.${w.greaterThan}`), value: w.greaterThan },
  6400. { label: i.t(`sheet.cf.symbol.${w.greaterThanOrEqual}`), value: w.greaterThanOrEqual }
  6401. ], c = [
  6402. { label: i.t(`sheet.cf.valueType.${x.num}`), value: x.num },
  6403. { label: i.t(`sheet.cf.valueType.${x.percent}`), value: x.percent },
  6404. { label: i.t(`sheet.cf.valueType.${x.percentile}`), value: x.percentile },
  6405. { label: i.t(`sheet.cf.valueType.${x.formula}`), value: x.formula }
  6406. ], v = (C, _) => {
  6407. e([String(_), "value", "value"], C);
  6408. }, d = (C, _) => {
  6409. e([String(_), "operator"], C);
  6410. const w2 = _12(E.number, C);
  6411. v(w2, _);
  6412. }, y3 = (C, _) => {
  6413. e([String(_), "value", "type"], C);
  6414. const w2 = r[_], S = _12(E.number, w2.operator);
  6415. v(S, _);
  6416. };
  6417. return (0, import_react.useMemo)(() => r.map((C, _) => {
  6418. const w2 = n[_], S = oo(C.iconType, C.iconId), R3 = _ === r.length - 1, h = _ === 0, s = r[_ - 1], a = (s == null ? void 0 : s.value.type) === x.formula ? i.t("sheet.cf.valueType.formula") : s == null ? void 0 : s.value.value, u = (b, l) => {
  6419. const g = { ...C, iconId: l, iconType: b };
  6420. e([String(_)], g);
  6421. };
  6422. return x3.jsxs(
  6423. "div",
  6424. {
  6425. className: `
  6426. ${_ ? $.mTXl : $.mTSm}
  6427. `,
  6428. children: [
  6429. x3.jsxs(
  6430. "div",
  6431. {
  6432. className: `
  6433. ${$.label}
  6434. ${W.flex}
  6435. `,
  6436. children: [
  6437. x3.jsxs(
  6438. "div",
  6439. {
  6440. className: `
  6441. ${W.width45}
  6442. `,
  6443. children: [
  6444. i.t("sheet.cf.iconSet.icon"),
  6445. _ + 1
  6446. ]
  6447. }
  6448. ),
  6449. x3.jsx(
  6450. "div",
  6451. {
  6452. className: `
  6453. ${W.width45}
  6454. `,
  6455. children: x3.jsxs(x3.Fragment, { children: [
  6456. !h && !R3 && i.t("sheet.cf.iconSet.rule"),
  6457. !h && !R3 && x3.jsxs("span", { className: W.stress, children: [
  6458. "(",
  6459. i.t("sheet.cf.iconSet.when"),
  6460. i.t(`sheet.cf.symbol.${x0(s.operator)}`),
  6461. a,
  6462. R3 ? "" : ` ${i.t("sheet.cf.iconSet.and")} `,
  6463. ")"
  6464. ] })
  6465. ] })
  6466. }
  6467. )
  6468. ]
  6469. }
  6470. ),
  6471. x3.jsxs(
  6472. "div",
  6473. {
  6474. className: `
  6475. ${W.flex}
  6476. ${$.mTSm}
  6477. `,
  6478. children: [
  6479. x3.jsx(
  6480. "div",
  6481. {
  6482. className: `
  6483. ${W.iconWrap}
  6484. ${W.width45}
  6485. `,
  6486. children: x3.jsx(sC, { overlay: x3.jsx($l, { onClick: u, iconId: C.iconId, iconType: C.iconType }), children: x3.jsxs("div", { className: W.dropdownIcon, children: [
  6487. S ? x3.jsx("img", { src: S, className: W.icon }) : x3.jsx(Zt, { className: W.icon }),
  6488. x3.jsx(Dn, {})
  6489. ] }) })
  6490. }
  6491. ),
  6492. R3 ? x3.jsxs(
  6493. "div",
  6494. {
  6495. className: `
  6496. ${W.width45}
  6497. ${$.label}
  6498. `,
  6499. style: { marginTop: 0 },
  6500. children: [
  6501. i.t("sheet.cf.iconSet.rule"),
  6502. x3.jsxs("span", { className: W.stress, children: [
  6503. "(",
  6504. i.t("sheet.cf.iconSet.when"),
  6505. i.t(`sheet.cf.symbol.${x0(s.operator)}`),
  6506. a,
  6507. R3 ? "" : ` ${i.t("sheet.cf.iconSet.and")} `,
  6508. ")"
  6509. ] })
  6510. ]
  6511. }
  6512. ) : x3.jsx(
  6513. r_,
  6514. {
  6515. className: `
  6516. ${$.mL0}
  6517. ${W.width45}
  6518. ${$.mR0}
  6519. `,
  6520. options: o,
  6521. value: C.operator,
  6522. onChange: (b) => {
  6523. d(b, _);
  6524. }
  6525. }
  6526. )
  6527. ]
  6528. }
  6529. ),
  6530. R3 ? x3.jsx("div", {}) : x3.jsxs(x3.Fragment, { children: [
  6531. x3.jsxs(
  6532. "div",
  6533. {
  6534. className: `
  6535. ${$.mTSm}
  6536. ${$.label}
  6537. ${W.flex}
  6538. `,
  6539. children: [
  6540. x3.jsx(
  6541. "div",
  6542. {
  6543. className: `
  6544. ${W.width45}
  6545. `,
  6546. children: i.t("sheet.cf.iconSet.type")
  6547. }
  6548. ),
  6549. x3.jsx(
  6550. "div",
  6551. {
  6552. className: `
  6553. ${W.width45}
  6554. `,
  6555. children: i.t("sheet.cf.iconSet.value")
  6556. }
  6557. )
  6558. ]
  6559. }
  6560. ),
  6561. x3.jsxs(
  6562. "div",
  6563. {
  6564. className: `
  6565. ${$.mTSm}
  6566. ${W.flex}
  6567. `,
  6568. children: [
  6569. x3.jsx(
  6570. r_,
  6571. {
  6572. style: { flexShrink: 0 },
  6573. className: `
  6574. ${W.width45}
  6575. ${$.mL0}
  6576. `,
  6577. options: c,
  6578. value: C.value.type,
  6579. onChange: (b) => {
  6580. y3(b, _);
  6581. }
  6582. }
  6583. ),
  6584. x3.jsx(
  6585. "div",
  6586. {
  6587. className: `
  6588. ${$.mL0}
  6589. ${W.width45}
  6590. `,
  6591. children: x3.jsx(
  6592. jl,
  6593. {
  6594. id: _,
  6595. type: C.value.type,
  6596. error: w2,
  6597. value: C.value.value || "",
  6598. onChange: (b) => v(b, _)
  6599. }
  6600. )
  6601. }
  6602. )
  6603. ]
  6604. }
  6605. )
  6606. ] })
  6607. ]
  6608. },
  6609. _
  6610. );
  6611. }), [r, n]);
  6612. };
  6613. var Fl = (t) => {
  6614. var b;
  6615. const { interceptorManager: e } = t, r = ((b = t.rule) == null ? void 0 : b.type) === y.iconSet ? t.rule : void 0, n = W0(Vr), [i, o] = (0, import_react.useState)({}), [c, v] = (0, import_react.useState)(() => {
  6616. const l = Object.keys(o2)[0];
  6617. if (r && r.config.length) {
  6618. const g = r.config[0].iconType;
  6619. if (!r.config.some((m) => m.iconType !== g))
  6620. return g;
  6621. }
  6622. return l;
  6623. }), [d, y3] = (0, import_react.useState)(() => {
  6624. if (r && r.config.length)
  6625. return re.deepClone(r == null ? void 0 : r.config);
  6626. const l = o2[c] || [];
  6627. return new Array(l.length).fill("").map((g, f, m) => f === m.length - 1 ? {
  6628. operator: w.lessThanOrEqual,
  6629. value: { type: x.num, value: Number.MAX_SAFE_INTEGER },
  6630. iconType: c,
  6631. iconId: String(f)
  6632. } : oi(c, f, m));
  6633. }), [p, C] = (0, import_react.useState)(() => r ? !!r.isShowValue : true), _ = (0, import_react.useMemo)(() => {
  6634. const l = d.map((g) => oo(g.iconType, g.iconId));
  6635. return x3.jsx("div", { className: W.iconWrap, children: l.map((g, f) => g ? x3.jsx(
  6636. "img",
  6637. {
  6638. className: W.icon,
  6639. src: g
  6640. },
  6641. f
  6642. ) : x3.jsx(Zt, { className: W.icon }, f)) });
  6643. }, [d]), w2 = (l) => {
  6644. if (l.reduce((f, m, P) => f.preType && !f.result || l.length - 1 === P ? f : m.value.type === x.formula ? {
  6645. preType: x.formula,
  6646. result: false
  6647. } : f.preType ? {
  6648. result: f.preType === m.value.type,
  6649. preType: m.value.type
  6650. } : {
  6651. result: true,
  6652. preType: m.value.type
  6653. }, { result: true, preType: "" }).result && [x.num, x.percent, x.percentile].includes(l[0].value.type)) {
  6654. const f = {};
  6655. return l.forEach((m, P, M2) => {
  6656. if (P - 1 < 0 || P === M2.length - 1)
  6657. return;
  6658. const N3 = l[P - 1], I = x0(N3.operator);
  6659. Y({ operator: I, value: N3.value.value }, m.value.value) || (f[P] = `${n.t(`sheet.cf.form.${I}`, String(N3.value.value))} `);
  6660. }), f;
  6661. }
  6662. return {};
  6663. }, S = (l, g) => {
  6664. b0(d, l) !== g && (N0(d, l, g), y3([...d]), o(w2(d)));
  6665. }, R3 = (l) => {
  6666. v(l);
  6667. const g = o2[l] || [], f = new Array(g.length).fill("").map((m, P, M2) => oi(l, P, M2));
  6668. y3(f), o(w2(f));
  6669. };
  6670. (0, import_react.useEffect)(() => {
  6671. const l = e.intercept(e.getInterceptPoints().submit, {
  6672. handler() {
  6673. return { type: y.iconSet, isShowValue: p, config: d };
  6674. }
  6675. });
  6676. return () => {
  6677. l();
  6678. };
  6679. }, [p, d, e]), (0, import_react.useEffect)(() => {
  6680. const l = e.intercept(e.getInterceptPoints().beforeSubmit, {
  6681. handler() {
  6682. return Object.keys(i).length === 0;
  6683. }
  6684. });
  6685. return () => {
  6686. l();
  6687. };
  6688. }, [p, d, e, i]);
  6689. const h = () => {
  6690. const l = d.map((g) => ({ ...g }));
  6691. d.forEach((g, f) => {
  6692. const m = d.length - 1 - f, P = l[m];
  6693. g.iconId = P.iconId, g.iconType = P.iconType;
  6694. }), y3([...d]);
  6695. }, s = W0(_1), [a, u] = (0, import_react.useState)();
  6696. return n0(a, s.rootContainerElement), x3.jsxs("div", { className: W.iconSet, children: [
  6697. x3.jsx("div", { className: $.title, children: n.t("sheet.cf.panel.styleRule") }),
  6698. x3.jsx(
  6699. "div",
  6700. {
  6701. className: `
  6702. ${$.mTSm}
  6703. `,
  6704. children: x3.jsx(
  6705. sC,
  6706. {
  6707. placement: "bottomLeft",
  6708. overlay: x3.jsx(
  6709. Ll,
  6710. {
  6711. ref: (l) => !a && l && u(l),
  6712. iconType: c,
  6713. onClick: R3
  6714. }
  6715. ),
  6716. children: x3.jsxs("div", { className: W.dropdownIcon, style: { width: "unset" }, children: [
  6717. _,
  6718. x3.jsx(Dn, {})
  6719. ] })
  6720. }
  6721. )
  6722. }
  6723. ),
  6724. x3.jsxs(
  6725. "div",
  6726. {
  6727. className: `
  6728. ${$.mTSm}
  6729. ${W.renderConfig}
  6730. `,
  6731. children: [
  6732. x3.jsxs("div", { className: W.utilItem, children: [
  6733. x3.jsx(um, { onChange: h }),
  6734. n.t("sheet.cf.iconSet.reverseIconOrder")
  6735. ] }),
  6736. x3.jsxs(
  6737. "div",
  6738. {
  6739. className: `
  6740. ${W.utilItem}
  6741. ${$.mLXl}
  6742. `,
  6743. children: [
  6744. x3.jsx(um, { checked: !p, onChange: (l) => {
  6745. C(!l);
  6746. } }),
  6747. n.t("sheet.cf.iconSet.onlyShowIcon")
  6748. ]
  6749. }
  6750. )
  6751. ]
  6752. }
  6753. ),
  6754. x3.jsx(zl, { errorMap: i, onChange: S, configList: d })
  6755. ] });
  6756. };
  6757. var Vl = (t) => {
  6758. var h;
  6759. const { onChange: e, interceptorManager: r } = t, n = W0(Vr), i = ((h = t.rule) == null ? void 0 : h.type) === y.highlightCell ? t.rule : void 0, o = [
  6760. { label: n.t("sheet.cf.panel.isNotBottom"), value: "isNotBottom" },
  6761. { label: n.t("sheet.cf.panel.isBottom"), value: "isBottom" },
  6762. { label: n.t("sheet.cf.panel.greaterThanAverage"), value: "greaterThanAverage" },
  6763. { label: n.t("sheet.cf.panel.lessThanAverage"), value: "lessThanAverage" }
  6764. ], [c, v] = (0, import_react.useState)(() => {
  6765. const s = o[0].value, a = i == null ? void 0 : i.type;
  6766. if (!i)
  6767. return s;
  6768. switch (a) {
  6769. case y.highlightCell:
  6770. switch (i.subType) {
  6771. case E.average:
  6772. return [w.greaterThan, w.greaterThanOrEqual].includes(i.operator) ? "greaterThanAverage" : [w.lessThan, w.lessThanOrEqual].includes(i.operator) ? "lessThanAverage" : s;
  6773. case E.rank:
  6774. return i.isBottom ? "isBottom" : "isNotBottom";
  6775. }
  6776. }
  6777. return s;
  6778. }), [d, y3] = (0, import_react.useState)(() => {
  6779. const a = i == null ? void 0 : i.type;
  6780. if (!i)
  6781. return 10;
  6782. switch (a) {
  6783. case y.highlightCell:
  6784. switch (i.subType) {
  6785. case E.rank:
  6786. return i.value || 10;
  6787. }
  6788. }
  6789. return 10;
  6790. }), [p, C] = (0, import_react.useState)(() => {
  6791. const a = i == null ? void 0 : i.type;
  6792. if (!i)
  6793. return false;
  6794. switch (a) {
  6795. case y.highlightCell:
  6796. switch (i.subType) {
  6797. case E.rank:
  6798. return i.isPercent || false;
  6799. }
  6800. }
  6801. return false;
  6802. }), [_, w2] = (0, import_react.useState)({}), S = (s) => {
  6803. const { type: a, isPercent: u, value: b, style: l } = s;
  6804. if (a === "isNotBottom")
  6805. return { type: y.highlightCell, subType: E.rank, isPercent: u, isBottom: false, value: b, style: l };
  6806. if (a === "isBottom")
  6807. return { type: y.highlightCell, subType: E.rank, isPercent: u, isBottom: true, value: b, style: l };
  6808. if (a === "greaterThanAverage")
  6809. return { type: y.highlightCell, subType: E.average, operator: w.greaterThan, style: l };
  6810. if (a === "lessThanAverage")
  6811. return { type: y.highlightCell, subType: E.average, operator: w.lessThan, style: l };
  6812. };
  6813. (0, import_react.useEffect)(() => r.intercept(r.getInterceptPoints().submit, {
  6814. handler() {
  6815. return S({ type: c, isPercent: p, value: d, style: _ });
  6816. }
  6817. }), [c, p, d, _, r]);
  6818. const R3 = (s) => {
  6819. e(S(s));
  6820. };
  6821. return x3.jsxs("div", { children: [
  6822. x3.jsx(
  6823. "div",
  6824. {
  6825. className: `
  6826. ${$.title}
  6827. ${$.mTBase}
  6828. `,
  6829. children: n.t("sheet.cf.panel.styleRule")
  6830. }
  6831. ),
  6832. x3.jsx(
  6833. r_,
  6834. {
  6835. className: `
  6836. ${W.width100}
  6837. ${$.mTSm}
  6838. `,
  6839. value: c,
  6840. options: o,
  6841. onChange: (s) => {
  6842. v(s), R3({ type: s, isPercent: p, value: d, style: _ });
  6843. }
  6844. }
  6845. ),
  6846. ["isNotBottom", "isBottom"].includes(c) && x3.jsxs(
  6847. "div",
  6848. {
  6849. className: `
  6850. ${$.labelContainer}
  6851. ${$.mTSm}
  6852. `,
  6853. children: [
  6854. x3.jsx(
  6855. BO,
  6856. {
  6857. min: 1,
  6858. max: 1e3,
  6859. value: d,
  6860. onChange: (s) => {
  6861. const a = s || 0;
  6862. y3(a), R3({ type: c, isPercent: p, value: a, style: _ });
  6863. }
  6864. }
  6865. ),
  6866. x3.jsxs(
  6867. "div",
  6868. {
  6869. className: `
  6870. ${$.mLSm}
  6871. ${$.labelContainer}
  6872. ${W.text}
  6873. `,
  6874. children: [
  6875. x3.jsx(
  6876. um,
  6877. {
  6878. checked: p,
  6879. onChange: (s) => {
  6880. C(!!s), R3({ type: c, isPercent: !!s, value: d, style: _ });
  6881. }
  6882. }
  6883. ),
  6884. n.t("sheet.cf.valueType.percent")
  6885. ]
  6886. }
  6887. )
  6888. ]
  6889. }
  6890. ),
  6891. x3.jsx(
  6892. "div",
  6893. {
  6894. className: `
  6895. ${W.cfPreviewWrap}
  6896. `,
  6897. children: x3.jsx(Ct, { rule: S({ type: c, isPercent: p, value: d, style: _ }) })
  6898. }
  6899. ),
  6900. x3.jsx(
  6901. gr2,
  6902. {
  6903. style: i == null ? void 0 : i.style,
  6904. className: `
  6905. ${$.mTSm}
  6906. `,
  6907. onChange: (s) => {
  6908. w2(s), R3({ type: c, isPercent: p, value: d, style: s });
  6909. }
  6910. }
  6911. )
  6912. ] });
  6913. };
  6914. var ql = nR("beforeSubmit");
  6915. var Al = nR("submit");
  6916. var si = (t) => t.getCurrentUnitForType(Fe.UNIVER_SHEET).getUnitId();
  6917. var ai = (t) => {
  6918. var e;
  6919. return (e = t.getCurrentUnitForType(Fe.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : e.getSheetId();
  6920. };
  6921. var Wl = (t) => {
  6922. var M2, j2, N3;
  6923. const e = W0(Vr), r = W0(Pt), n = W0(_n), i = W0(B), o = W0(F), c = si(n), v = ai(n), [d, y3] = (0, import_react.useState)(true), p = (0, import_react.useRef)({}), [C, _] = (0, import_react.useState)(void 0), w2 = (0, import_react.useRef)((j2 = (M2 = t.rule) == null ? void 0 : M2.ranges) != null ? j2 : []), S = (0, import_react.useMemo)(() => {
  6924. var O, z, U;
  6925. let I = (O = t.rule) == null ? void 0 : O.ranges;
  6926. return I != null && I.length || (I = (U = (z = o.getCurrentSelections()) == null ? void 0 : z.map((k) => k.range)) != null ? U : []), w2.current = I, I != null && I.length ? I.map((k) => {
  6927. const ie = fr(k);
  6928. return ie === "NaN" ? "" : ie;
  6929. }).filter((k) => !!k).join(",") : "";
  6930. }, [t.rule]), R3 = [
  6931. { label: e.t("sheet.cf.ruleType.highlightCell"), value: "1" },
  6932. { label: e.t("sheet.cf.panel.rankAndAverage"), value: "2" },
  6933. { label: e.t("sheet.cf.ruleType.dataBar"), value: "3" },
  6934. { label: e.t("sheet.cf.ruleType.colorScale"), value: "4" },
  6935. { label: e.t("sheet.cf.ruleType.formula"), value: "5" },
  6936. { label: e.t("sheet.cf.ruleType.iconSet"), value: "6" }
  6937. ], [h, s] = (0, import_react.useState)(() => {
  6938. var z, U;
  6939. const I = (z = t.rule) == null ? void 0 : z.rule.type, O = R3[0].value;
  6940. if (!I)
  6941. return O;
  6942. switch (I) {
  6943. case y.highlightCell: {
  6944. switch ((U = t.rule) == null ? void 0 : U.rule.subType) {
  6945. case E.number:
  6946. case E.text:
  6947. case E.duplicateValues:
  6948. case E.uniqueValues:
  6949. case E.timePeriod:
  6950. return "1";
  6951. case E.average:
  6952. case E.rank:
  6953. return "2";
  6954. case E.formula:
  6955. return "5";
  6956. }
  6957. break;
  6958. }
  6959. case y.dataBar:
  6960. return "3";
  6961. case y.colorScale:
  6962. return "4";
  6963. case y.iconSet:
  6964. return "6";
  6965. }
  6966. return O;
  6967. }), a = (0, import_react.useRef)(), u = (0, import_react.useMemo)(() => new rR({ beforeSubmit: ql, submit: Al }), []), b = (0, import_react.useMemo)(() => {
  6968. switch (h) {
  6969. case "1":
  6970. return ii;
  6971. case "2":
  6972. return Vl;
  6973. case "3":
  6974. return Tl;
  6975. case "4":
  6976. return El;
  6977. case "5":
  6978. return Ml;
  6979. case "6":
  6980. return Fl;
  6981. default:
  6982. return ii;
  6983. }
  6984. }, [h]);
  6985. (0, import_react.useEffect)(() => {
  6986. const I = r.onCommandExecuted((O) => {
  6987. if (O.id === Ut.id) {
  6988. const z = O.params;
  6989. z.subUnitId === v && z.unitId === c && t.onCancel();
  6990. }
  6991. O.id === an.id && t.onCancel();
  6992. });
  6993. return () => I.dispose();
  6994. }, []);
  6995. const l = (I) => {
  6996. a.current = I;
  6997. }, g = (I) => {
  6998. const O = I.split(",").filter((z) => !!z).map(fn).map((z) => z.range);
  6999. w2.current = O;
  7000. }, f = () => {
  7001. if (C)
  7002. return;
  7003. const O = (() => {
  7004. const U = n.getCurrentUnitForType(Fe.UNIVER_SHEET).getActiveSheet();
  7005. if (!U)
  7006. throw new Error("No active sheet found");
  7007. return w2.current.map((ee) => Kd(ee, U.getRowCount(), U.getColumnCount())).filter((ee) => !(Number.isNaN(ee.startRow) || Number.isNaN(ee.startColumn)));
  7008. })();
  7009. if (u.fetchThroughInterceptors(u.getInterceptPoints().beforeSubmit)(true, null)) {
  7010. const U = u.fetchThroughInterceptors(u.getInterceptPoints().submit)(null, null);
  7011. if (U) {
  7012. const k = si(n), ie = ai(n);
  7013. if (!k || !ie)
  7014. throw new Error("No active sheet found");
  7015. let ee = {};
  7016. t.rule && t.rule.cfId ? (ee = { ...t.rule, ranges: O, rule: U }, r.executeCommand(cr.id, { unitId: k, subUnitId: ie, rule: ee }), t.onCancel()) : (ee = { cfId: i.createCfId(k, ie), ranges: O, rule: U, stopIfTrue: false }, r.executeCommand(Pn.id, { unitId: k, subUnitId: ie, rule: ee }), t.onCancel());
  7017. }
  7018. }
  7019. }, m = () => {
  7020. t.onCancel();
  7021. }, P = (I, O) => {
  7022. I ? O.length < 1 ? _(e.t("sheet.cf.errorMessage.rangeError")) : _(void 0) : _(e.t("sheet.cf.errorMessage.rangeError"));
  7023. };
  7024. return Kl((I) => {
  7025. var z;
  7026. const O = (z = p.current) == null ? void 0 : z.handleOutClick;
  7027. O && O(I, () => y3(false));
  7028. }), x3.jsxs("div", { className: W.cfRuleStyleEditor, children: [
  7029. x3.jsx("div", { className: $.title, children: e.t("sheet.cf.panel.range") }),
  7030. x3.jsx(
  7031. "div",
  7032. {
  7033. className: `
  7034. ${$.mTBase}
  7035. `,
  7036. children: x3.jsx(
  7037. Ei,
  7038. {
  7039. unitId: c,
  7040. errorText: C,
  7041. subUnitId: v,
  7042. initValue: S,
  7043. onChange: g,
  7044. onVerify: P,
  7045. onFocus: () => y3(true),
  7046. isFocus: d,
  7047. actions: p.current
  7048. }
  7049. )
  7050. }
  7051. ),
  7052. x3.jsx("div", { className: $.title, children: e.t("sheet.cf.panel.styleType") }),
  7053. x3.jsx("div", { className: $.mTBase, children: x3.jsx(r_, { className: W.width100, value: h, options: R3, onChange: (I) => s(I) }) }),
  7054. x3.jsx(b, { interceptorManager: u, rule: (N3 = t.rule) == null ? void 0 : N3.rule, onChange: l }),
  7055. x3.jsxs(
  7056. "div",
  7057. {
  7058. className: `
  7059. ${$.mTBase}
  7060. ${W.btnList}
  7061. `,
  7062. children: [
  7063. x3.jsx(Po, { size: "small", onClick: m, children: e.t("sheet.cf.panel.cancel") }),
  7064. x3.jsx(Po, { className: $.mLSm, size: "small", type: "primary", onClick: f, children: e.t("sheet.cf.panel.submit") })
  7065. ]
  7066. }
  7067. )
  7068. ] });
  7069. };
  7070. var Hl = (t) => {
  7071. const [e, r] = (0, import_react.useState)(t.rule), [n, i] = (0, import_react.useState)(!!t.rule), o = () => {
  7072. i(true);
  7073. }, c = () => {
  7074. i(false), r(void 0);
  7075. }, v = (d) => {
  7076. r(d), i(true);
  7077. };
  7078. return x3.jsx("div", { className: $.conditionalFormattingWrap, children: n ? x3.jsx(Wl, { onCancel: c, rule: e }) : x3.jsx(Za, { onClick: v, onCreate: o }) });
  7079. };
  7080. var Ul = Object.defineProperty;
  7081. var kl = Object.getOwnPropertyDescriptor;
  7082. var Bl = (t, e, r, n) => {
  7083. for (var i = n > 1 ? void 0 : n ? kl(e, r) : e, o = t.length - 1, c; o >= 0; o--)
  7084. (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
  7085. return n && i && Ul(e, r, i), i;
  7086. };
  7087. var Mt = (t, e) => (r, n) => e(r, n, t);
  7088. var cn2 = "sheet.conditional.formatting.panel";
  7089. var Ht = class extends nt {
  7090. constructor(e, r, n, i, o) {
  7091. super();
  7092. Xe(this, "_sidebarDisposable", null);
  7093. this._univerInstanceService = e, this._injector = r, this._componentManager = n, this._sidebarService = i, this._localeService = o, this._initPanel(), this.disposeWithMe(
  7094. this._univerInstanceService.getCurrentTypeOfUnit$(Fe.UNIVER_SHEET).subscribe((c) => {
  7095. var v;
  7096. c || (v = this._sidebarDisposable) == null || v.dispose();
  7097. })
  7098. ), this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe((c) => {
  7099. c.id === cn2 && (c.visible || setTimeout(() => {
  7100. this._sidebarService.sidebarOptions$.next({ visible: false });
  7101. }));
  7102. }));
  7103. }
  7104. openPanel(e) {
  7105. const r = {
  7106. id: cn2,
  7107. header: { title: this._localeService.t("sheet.cf.title") },
  7108. children: {
  7109. label: cn2,
  7110. rule: e,
  7111. key: qt(4)
  7112. },
  7113. onClose: () => this._sidebarDisposable = null
  7114. };
  7115. this._sidebarDisposable = this._sidebarService.open(r);
  7116. }
  7117. _initPanel() {
  7118. this._componentManager.register(cn2, Hl);
  7119. }
  7120. };
  7121. Ht = Bl([
  7122. Mt(0, _n),
  7123. Mt(1, ot(Ot)),
  7124. Mt(2, ot(n1)),
  7125. Mt(3, ot(rt)),
  7126. Mt(4, ot(Vr))
  7127. ], Ht);
  7128. var Te2 = ((t) => (t[t.createRule = 1] = "createRule", t[t.viewRule = 2] = "viewRule", t[t.highlightCell = 3] = "highlightCell", t[t.rank = 4] = "rank", t[t.formula = 5] = "formula", t[t.colorScale = 6] = "colorScale", t[t.dataBar = 7] = "dataBar", t[t.icon = 8] = "icon", t[t.clearRangeRules = 9] = "clearRangeRules", t[t.clearWorkSheetRules = 10] = "clearWorkSheetRules", t))(Te2 || {});
  7129. var jn = {
  7130. id: "sheet.operation.open.conditional.formatting.panel",
  7131. type: ar.OPERATION,
  7132. handler: (t, e) => {
  7133. var v;
  7134. const r = t.get(Ht), n = t.get(F), i = t.get(Pt), o = ((v = n.getCurrentSelections()) == null ? void 0 : v.map((d) => d.range)) || [];
  7135. switch (e.value) {
  7136. case 3: {
  7137. r.openPanel({ ...A1(), ranges: o });
  7138. break;
  7139. }
  7140. case 4: {
  7141. const d = {
  7142. ...A1,
  7143. ranges: o,
  7144. rule: {
  7145. type: y.highlightCell,
  7146. subType: E.rank
  7147. }
  7148. };
  7149. r.openPanel(d);
  7150. break;
  7151. }
  7152. case 5: {
  7153. const d = {
  7154. ...A1,
  7155. ranges: o,
  7156. rule: {
  7157. type: y.highlightCell,
  7158. subType: E.formula,
  7159. value: "="
  7160. }
  7161. };
  7162. r.openPanel(d);
  7163. break;
  7164. }
  7165. case 6: {
  7166. const d = {
  7167. ...A1,
  7168. ranges: o,
  7169. rule: {
  7170. type: y.colorScale,
  7171. config: []
  7172. }
  7173. };
  7174. r.openPanel(d);
  7175. break;
  7176. }
  7177. case 7: {
  7178. const d = {
  7179. ...A1,
  7180. ranges: o,
  7181. rule: {
  7182. type: y.dataBar,
  7183. isShowValue: true
  7184. }
  7185. };
  7186. r.openPanel(d);
  7187. break;
  7188. }
  7189. case 8: {
  7190. const d = {
  7191. ...A1,
  7192. ranges: o,
  7193. rule: {
  7194. type: y.iconSet,
  7195. config: [],
  7196. isShowValue: true
  7197. }
  7198. };
  7199. r.openPanel(d);
  7200. break;
  7201. }
  7202. case 2: {
  7203. r.openPanel();
  7204. break;
  7205. }
  7206. case 1: {
  7207. r.openPanel({ ...A1(), ranges: o });
  7208. break;
  7209. }
  7210. case 9: {
  7211. i.executeCommand(ar3.id, { ranges: o });
  7212. break;
  7213. }
  7214. case 10: {
  7215. i.executeCommand(On.id);
  7216. break;
  7217. }
  7218. }
  7219. return true;
  7220. }
  7221. };
  7222. var Gl = Object.defineProperty;
  7223. var Xl = Object.getOwnPropertyDescriptor;
  7224. var Yl = (t, e, r, n) => {
  7225. for (var i = n > 1 ? void 0 : n ? Xl(e, r) : e, o = t.length - 1, c; o >= 0; o--)
  7226. (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
  7227. return n && i && Gl(e, r, i), i;
  7228. };
  7229. var Nt2 = (t, e) => (r, n) => e(r, n, t);
  7230. var Ut2 = class extends nt {
  7231. constructor(e, r, n, i, o) {
  7232. super();
  7233. Xe(this, "_copyInfo");
  7234. this._sheetClipboardService = e, this._conditionalFormattingRuleModel = r, this._injector = n, this._conditionalFormattingViewModel = i, this._univerInstanceService = o, this._initClipboardHook();
  7235. }
  7236. _initClipboardHook() {
  7237. this.disposeWithMe(
  7238. this._sheetClipboardService.addClipboardHook({
  7239. id: N2,
  7240. onBeforeCopy: (e, r, n) => this._collectConditionalRule(e, r, n),
  7241. onPasteCells: (e, r, n, i) => {
  7242. const { copyType: o = gr.COPY, pasteType: c } = i, { range: v } = e || {}, { range: d } = r;
  7243. return this._generateConditionalFormattingMutations(d, { copyType: o, pasteType: c, copyRange: v });
  7244. }
  7245. })
  7246. );
  7247. }
  7248. _collectConditionalRule(e, r, n) {
  7249. const i = new kt(), o = {};
  7250. this._copyInfo = {
  7251. matrix: i,
  7252. info: {
  7253. unitId: e,
  7254. subUnitId: r,
  7255. cfMap: o
  7256. }
  7257. };
  7258. const c = this._injector.invoke((p) => Ys(n, p, e, r));
  7259. if (!c)
  7260. return;
  7261. const { rows: v, cols: d } = c, y3 = /* @__PURE__ */ new Set();
  7262. v.forEach((p, C) => {
  7263. d.forEach((_, w2) => {
  7264. const S = this._conditionalFormattingViewModel.getCellCfs(e, r, p, _);
  7265. S && (S.forEach((R3) => y3.add(R3.cfId)), i.setValue(C, w2, S.map((R3) => R3.cfId)));
  7266. });
  7267. }), y3.forEach((p) => {
  7268. const C = this._conditionalFormattingRuleModel.getRule(e, r, p);
  7269. C && (o[p] = C.rule);
  7270. });
  7271. }
  7272. // eslint-disable-next-line max-lines-per-function
  7273. _generateConditionalFormattingMutations(e, r) {
  7274. const n = this._univerInstanceService.getCurrentUnitForType(Fe.UNIVER_SHEET), i = n.getActiveSheet(), o = n.getUnitId();
  7275. if (!i)
  7276. return { redos: [], undos: [] };
  7277. const c = i.getSheetId();
  7278. if (r.copyType === gr.CUT)
  7279. return this._copyInfo = null, { redos: [], undos: [] };
  7280. if (!this._copyInfo || !r.copyRange)
  7281. return { redos: [], undos: [] };
  7282. if (![
  7283. rt2.SPECIAL_PASTE_FORMAT,
  7284. rt2.DEFAULT_PASTE,
  7285. rt2.SPECIAL_PASTE_BESIDES_BORDER
  7286. ].includes(
  7287. r.pasteType
  7288. ))
  7289. return { redos: [], undos: [] };
  7290. const { ranges: [d, y3], mapFunc: p } = _s([r.copyRange, e]), C = sE(d, y3, true), _ = {};
  7291. tr.foreach(y3, (l, g) => {
  7292. const { row: f, col: m } = p(l, g), P = this._conditionalFormattingViewModel.getCellCfs(o, c, f, m);
  7293. P && P.forEach((M2) => {
  7294. if (!_[M2.cfId]) {
  7295. const j2 = new kt();
  7296. _[M2.cfId] = j2;
  7297. const N3 = this._conditionalFormattingRuleModel.getRule(o, c, M2.cfId);
  7298. N3 == null || N3.ranges.forEach((I) => {
  7299. tr.foreach(I, (O, z) => {
  7300. j2.setValue(O, z, 1);
  7301. });
  7302. });
  7303. }
  7304. _[M2.cfId].realDeleteValue(f, m);
  7305. });
  7306. });
  7307. const { matrix: w2, info: S } = this._copyInfo, R3 = [];
  7308. let h = this._conditionalFormattingRuleModel.createCfId(o, c);
  7309. const s = {}, a = (l) => {
  7310. if (s[l])
  7311. return s[l];
  7312. const g = S == null ? void 0 : S.cfMap[l], f = [...this._conditionalFormattingRuleModel.getSubunitRules(o, c) || [], ...R3].find((m) => re.diffValue(m.rule, g));
  7313. if (f)
  7314. return s[l] = f, f;
  7315. {
  7316. const m = {
  7317. rule: g,
  7318. cfId: h,
  7319. ranges: [],
  7320. stopIfTrue: false
  7321. };
  7322. return s[l] = m, R3.push(m), h = `${Number(h) + 1}`, m;
  7323. }
  7324. };
  7325. C.forEach((l) => {
  7326. w2 && w2.forValue((g, f, m) => {
  7327. const P = en.getPositionRange(
  7328. {
  7329. startRow: g,
  7330. endRow: g,
  7331. startColumn: f,
  7332. endColumn: f
  7333. },
  7334. l.startRange
  7335. ), { row: M2, col: j2 } = p(P.startRow, P.startColumn);
  7336. m.forEach((N3) => {
  7337. if (!_[N3]) {
  7338. const I = a(N3), O = new kt();
  7339. _[N3] = O, I.ranges.forEach((z) => {
  7340. tr.foreach(z, (U, k) => {
  7341. O.setValue(U, k, 1);
  7342. });
  7343. });
  7344. }
  7345. _[N3].setValue(M2, j2, 1);
  7346. });
  7347. });
  7348. });
  7349. const u = [], b = [];
  7350. for (const l in _) {
  7351. const g = _[l], f = jr(xl(g));
  7352. if (!f.length) {
  7353. const m = {
  7354. unitId: o,
  7355. subUnitId: c,
  7356. cfId: l
  7357. };
  7358. u.push({ id: E2.id, params: m }), b.push(...z02(this._injector, m));
  7359. }
  7360. if (R3.some((m) => m.cfId === l)) {
  7361. const m = a(l), P = {
  7362. unitId: o,
  7363. subUnitId: c,
  7364. rule: { ...m, ranges: f }
  7365. };
  7366. u.push({ id: T2.id, params: P }), b.push(b1(this._injector, P));
  7367. } else {
  7368. const m = this._conditionalFormattingRuleModel.getRule(o, c, l);
  7369. if (!m)
  7370. continue;
  7371. const P = {
  7372. unitId: o,
  7373. subUnitId: c,
  7374. rule: { ...m, ranges: f }
  7375. };
  7376. u.push({ id: U2.id, params: P }), b.push(...L1(this._injector, P));
  7377. }
  7378. }
  7379. return {
  7380. redos: u,
  7381. undos: b
  7382. };
  7383. }
  7384. };
  7385. Ut2 = Yl([
  7386. Nt2(0, ot(Sn)),
  7387. Nt2(1, ot(B)),
  7388. Nt2(2, ot(Ot)),
  7389. Nt2(3, ot(j)),
  7390. Nt2(4, ot(_n))
  7391. ], Ut2);
  7392. var Kl2 = Object.defineProperty;
  7393. var Zl = Object.getOwnPropertyDescriptor;
  7394. var Jl = (t, e, r, n) => {
  7395. for (var i = n > 1 ? void 0 : n ? Zl(e, r) : e, o = t.length - 1, c; o >= 0; o--)
  7396. (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
  7397. return n && i && Kl2(e, r, i), i;
  7398. };
  7399. var Yn = (t, e) => (r, n) => e(r, n, t);
  7400. var kt2 = class extends nt {
  7401. constructor(t, e, r) {
  7402. super(), this._localeService = t, this._commandService = e, this._sheetPermissionCheckController = r, this._commandExecutedListener();
  7403. }
  7404. _commandExecutedListener() {
  7405. this.disposeWithMe(
  7406. this._commandService.beforeCommandExecuted((t) => {
  7407. t.id === Pn.id && (this._sheetPermissionCheckController.permissionCheckWithRanges({
  7408. workbookTypes: [Me],
  7409. rangeTypes: [Pe],
  7410. worksheetTypes: [Te, ar2]
  7411. }, t.params.rule.ranges) || this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.setStyleErr")));
  7412. })
  7413. );
  7414. }
  7415. };
  7416. kt2 = Jl([
  7417. Yn(0, ot(Vr)),
  7418. Yn(1, Pt),
  7419. Yn(2, ot(Nn))
  7420. ], kt2);
  7421. var Ql = Object.defineProperty;
  7422. var ec = Object.getOwnPropertyDescriptor;
  7423. var tc = (t, e, r, n) => {
  7424. for (var i = n > 1 ? void 0 : n ? ec(e, r) : e, o = t.length - 1, c; o >= 0; o--)
  7425. (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
  7426. return n && i && Ql(e, r, i), i;
  7427. };
  7428. var un = (t, e) => (r, n) => e(r, n, t);
  7429. var Bt = class extends nt {
  7430. constructor(t, e, r, n) {
  7431. super(), this._conditionalFormattingRuleModel = t, this._univerInstanceService = e, this._injector = r, this._refRangeService = n, this._initRefRange();
  7432. }
  7433. _initRefRange() {
  7434. const t = /* @__PURE__ */ new Map(), e = (n, i, o) => `${n}_${i}_${o}`, r = (n, i, o) => {
  7435. const c = (d) => {
  7436. const y3 = [...o.ranges], p = y3.map((_) => os(_, d)).filter((_) => !!_);
  7437. if (aR(p, y3))
  7438. return { redos: [], undos: [] };
  7439. if (p.length) {
  7440. const _ = { unitId: n, subUnitId: i, rule: { ...o, ranges: p } }, w2 = [{ id: U2.id, params: _ }], S = L1(this._injector, _);
  7441. return { redos: w2, undos: S };
  7442. } else {
  7443. const _ = { unitId: n, subUnitId: i, cfId: o.cfId }, w2 = [{ id: E2.id, params: _ }], S = z02(this._injector, _);
  7444. return { redos: w2, undos: S };
  7445. }
  7446. }, v = [];
  7447. o.ranges.forEach((d) => {
  7448. const y3 = this._refRangeService.registerRefRange(d, c);
  7449. v.push(() => y3.dispose());
  7450. }), t.set(e(n, i, o.cfId), () => v.forEach((d) => d()));
  7451. };
  7452. this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe((n) => {
  7453. const { unitId: i, subUnitId: o, rule: c } = n, v = this._univerInstanceService.getCurrentUnitForType(Fe.UNIVER_SHEET), d = v.getActiveSheet();
  7454. if (!(n.unitId !== v.getUnitId() || n.subUnitId !== (d == null ? void 0 : d.getSheetId())))
  7455. switch (n.type) {
  7456. case "add": {
  7457. r(n.unitId, n.subUnitId, n.rule);
  7458. break;
  7459. }
  7460. case "delete": {
  7461. const y3 = t.get(e(i, o, c.cfId));
  7462. y3 && y3();
  7463. break;
  7464. }
  7465. case "set": {
  7466. const y3 = t.get(e(i, o, c.cfId));
  7467. y3 && y3(), r(n.unitId, n.subUnitId, n.rule);
  7468. }
  7469. }
  7470. })), this.disposeWithMe(Ze(() => {
  7471. t.forEach((n) => {
  7472. n();
  7473. }), t.clear();
  7474. }));
  7475. }
  7476. };
  7477. Bt = tc([
  7478. un(0, ot(B)),
  7479. un(1, ot(_n)),
  7480. un(2, ot(Ot)),
  7481. un(3, ot(_t))
  7482. ], Bt);
  7483. var nc = Object.defineProperty;
  7484. var rc = Object.getOwnPropertyDescriptor;
  7485. var ic = (t, e, r, n) => {
  7486. for (var i = n > 1 ? void 0 : n ? rc(e, r) : e, o = t.length - 1, c; o >= 0; o--)
  7487. (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
  7488. return n && i && nc(e, r, i), i;
  7489. };
  7490. var ht = (t, e) => (r, n) => e(r, n, t);
  7491. var Gt = class extends nt {
  7492. constructor(e, r, n, i, o, c) {
  7493. super();
  7494. Xe(this, "_ruleChangeCacheMap", /* @__PURE__ */ new Map());
  7495. this._sheetInterceptorService = e, this._conditionalFormattingService = r, this._univerInstanceService = n, this._renderManagerService = i, this._conditionalFormattingViewModel = o, this._conditionalFormattingRuleModel = c, this._initViewModelInterceptor(), this._initSkeleton(), this.disposeWithMe(() => {
  7496. this._ruleChangeCacheMap.clear();
  7497. });
  7498. }
  7499. _markDirtySkeleton() {
  7500. var r, n, i;
  7501. const e = this._univerInstanceService.getCurrentUnitForType(Fe.UNIVER_SHEET).getUnitId();
  7502. (r = this._renderManagerService.getRenderById(e)) == null || r.with(me).reCalculate(), (i = (n = this._renderManagerService.getRenderById(e)) == null ? void 0 : n.mainComponent) == null || i.makeDirty();
  7503. }
  7504. _initSkeleton() {
  7505. this.disposeWithMe(merge(this._conditionalFormattingRuleModel.$ruleChange, this._conditionalFormattingViewModel.markDirty$).pipe(
  7506. bufferTime(16),
  7507. filter((e) => !!e.length),
  7508. filter((e) => {
  7509. const r = this._univerInstanceService.getCurrentUnitForType(Fe.UNIVER_SHEET);
  7510. if (!r)
  7511. return false;
  7512. const n = r.getActiveSheet();
  7513. return n ? e.filter((i) => i.unitId === r.getUnitId() && i.subUnitId === n.getSheetId()).length > 0 : false;
  7514. })
  7515. ).subscribe(() => this._markDirtySkeleton()));
  7516. }
  7517. _initViewModelInterceptor() {
  7518. this.disposeWithMe(this._sheetInterceptorService.intercept(et.CELL_CONTENT, {
  7519. effect: Vn.Style,
  7520. handler: (e, r, n) => {
  7521. const i = this._conditionalFormattingService.composeStyle(r.unitId, r.subUnitId, r.row, r.col);
  7522. if (!i)
  7523. return n(e);
  7524. const o = r.workbook.getStyles(), v = { ...(typeof (e == null ? void 0 : e.s) == "string" ? o.get(e == null ? void 0 : e.s) : e == null ? void 0 : e.s) || {} }, d = { ...e, s: v };
  7525. return i.style && Object.assign(v, i.style), d.fontRenderExtension || (d.fontRenderExtension = {}, i.isShowValue !== void 0 && (d.fontRenderExtension.isSkip = !i.isShowValue)), i.dataBar && (d.dataBar = i.dataBar), i.iconSet && (d.iconSet = i.iconSet, d.fontRenderExtension.leftOffset = h1 + u1), n(d);
  7526. },
  7527. priority: 10
  7528. }));
  7529. }
  7530. };
  7531. Gt = ic([
  7532. ht(0, ot(V)),
  7533. ht(1, ot(K)),
  7534. ht(2, ot(_n)),
  7535. ht(3, ot(Yx)),
  7536. ht(4, ot(j)),
  7537. ht(5, ot(B))
  7538. ], Gt);
  7539. var so = "sheets-conditional-formatting-ui.config";
  7540. var bn = {};
  7541. var ao = Object.defineProperty;
  7542. var oc = Object.getOwnPropertyDescriptor;
  7543. var sc = (t, e, r) => e in t ? ao(t, e, { enumerable: true, configurable: true, writable: true, value: r }) : t[e] = r;
  7544. var ac = (t, e, r, n) => {
  7545. for (var i = n > 1 ? void 0 : n ? oc(e, r) : e, o = t.length - 1, c; o >= 0; o--)
  7546. (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
  7547. return n && i && ao(e, r, i), i;
  7548. };
  7549. var Kn = (t, e) => (r, n) => e(r, n, t);
  7550. var lo = (t, e, r) => sc(t, typeof e != "symbol" ? e + "" : e, r);
  7551. var Sn2 = class extends Ra {
  7552. constructor(t = bn, e, r, n) {
  7553. super(), this._config = t, this._injector = e, this._commandService = r, this._configService = n;
  7554. const { menu: i, ...o } = nu(
  7555. {},
  7556. bn,
  7557. this._config
  7558. );
  7559. i && this._configService.setConfig("menu", i, { merge: true }), this._configService.setConfig(so, o), this._initCommand(), this._injector.add([Gt]), this._injector.add([Bt]), this._injector.add([Ut2]), this._injector.add([kt2]), this._injector.add([mt]);
  7560. }
  7561. _initCommand() {
  7562. [
  7563. Mi,
  7564. Ni,
  7565. ji,
  7566. Li,
  7567. $i,
  7568. zi,
  7569. Fi,
  7570. Vi,
  7571. qi,
  7572. jn,
  7573. mn,
  7574. cr,
  7575. lr,
  7576. Pn,
  7577. ar3,
  7578. On
  7579. ].forEach((t) => {
  7580. this._commandService.registerCommand(t);
  7581. });
  7582. }
  7583. };
  7584. lo(Sn2, "pluginName", `${N2}_MOBILE_UI_PLUGIN`);
  7585. lo(Sn2, "type", Fe.UNIVER_SHEET);
  7586. Sn2 = ac([
  7587. OR(R2),
  7588. Kn(1, ot(Ot)),
  7589. Kn(2, ot(Pt)),
  7590. Kn(3, SE)
  7591. ], Sn2);
  7592. var lc = Object.defineProperty;
  7593. var cc = Object.getOwnPropertyDescriptor;
  7594. var uc = (t, e, r, n) => {
  7595. for (var i = n > 1 ? void 0 : n ? cc(e, r) : e, o = t.length - 1, c; o >= 0; o--)
  7596. (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
  7597. return n && i && lc(e, r, i), i;
  7598. };
  7599. var jt = (t, e) => (r, n) => e(r, n, t);
  7600. var Cn = class extends nt {
  7601. constructor(t, e, r, n, i) {
  7602. super(), this._injector = t, this._univerInstanceService = e, this._autoFillService = r, this._conditionalFormattingRuleModel = n, this._conditionalFormattingViewModel = i, this._initAutoFill();
  7603. }
  7604. // eslint-disable-next-line max-lines-per-function
  7605. _initAutoFill() {
  7606. const t = () => ({ redos: [], undos: [] }), e = (i, o, c, v, d) => {
  7607. var w2;
  7608. const y3 = this._univerInstanceService.getCurrentUnitForType(Fe.UNIVER_SHEET).getUnitId(), p = (w2 = this._univerInstanceService.getCurrentUnitForType(Fe.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : w2.getSheetId();
  7609. if (!y3 || !p)
  7610. return;
  7611. const C = {
  7612. startRow: i.row,
  7613. startColumn: i.col,
  7614. endColumn: i.col,
  7615. endRow: i.row
  7616. }, _ = {
  7617. startRow: o.row,
  7618. startColumn: o.col,
  7619. endColumn: o.col,
  7620. endRow: o.row
  7621. };
  7622. tr.foreach(c, (S, R3) => {
  7623. const h = en.getPositionRange(
  7624. {
  7625. startRow: S,
  7626. startColumn: R3,
  7627. endColumn: R3,
  7628. endRow: S
  7629. },
  7630. C
  7631. ), s = en.getPositionRange(
  7632. {
  7633. startRow: S,
  7634. startColumn: R3,
  7635. endColumn: R3,
  7636. endRow: S
  7637. },
  7638. _
  7639. ), { row: a, col: u } = d(h.startRow, h.startColumn), b = this._conditionalFormattingViewModel.getCellCfs(
  7640. y3,
  7641. p,
  7642. a,
  7643. u
  7644. ), { row: l, col: g } = d(s.startRow, s.startColumn), f = this._conditionalFormattingViewModel.getCellCfs(
  7645. y3,
  7646. p,
  7647. l,
  7648. g
  7649. );
  7650. f && f.forEach((m) => {
  7651. let P = v.get(m.cfId);
  7652. if (!v.get(m.cfId)) {
  7653. const M2 = this._conditionalFormattingRuleModel.getRule(y3, p, m.cfId);
  7654. if (!M2)
  7655. return;
  7656. P = new kt(), M2.ranges.forEach((j2) => {
  7657. tr.foreach(j2, (N3, I) => {
  7658. P.setValue(N3, I, 1);
  7659. });
  7660. }), v.set(m.cfId, P);
  7661. }
  7662. P.realDeleteValue(l, g);
  7663. }), b && b.forEach((m) => {
  7664. let P = v.get(m.cfId);
  7665. if (!v.get(m.cfId)) {
  7666. const M2 = this._conditionalFormattingRuleModel.getRule(y3, p, m.cfId);
  7667. if (!M2)
  7668. return;
  7669. P = new kt(), M2.ranges.forEach((j2) => {
  7670. tr.foreach(j2, (N3, I) => {
  7671. P.setValue(N3, I, 1);
  7672. });
  7673. }), v.set(m.cfId, P);
  7674. }
  7675. P.setValue(l, g, 1);
  7676. });
  7677. });
  7678. }, r = (i, o) => {
  7679. var s, a, u;
  7680. const c = (s = this._univerInstanceService.getCurrentUnitForType(Fe.UNIVER_SHEET)) == null ? void 0 : s.getUnitId(), v = (u = (a = this._univerInstanceService.getCurrentUnitForType(Fe.UNIVER_SHEET)) == null ? void 0 : a.getActiveSheet()) == null ? void 0 : u.getSheetId(), d = /* @__PURE__ */ new Map(), y3 = [], p = [];
  7681. if (!c || !v)
  7682. return t();
  7683. const C = _s([i, o]), [_, w2] = C.ranges, { mapFunc: S } = C, R3 = {
  7684. row: _.startRow,
  7685. col: _.startColumn
  7686. };
  7687. return tE(_, w2).forEach((b) => {
  7688. e(R3, b.repeatStartCell, b.relativeRange, d, S);
  7689. }), d.forEach((b, l) => {
  7690. const g = this._conditionalFormattingRuleModel.getRule(c, v, l);
  7691. if (!g)
  7692. return;
  7693. const f = jr(xl(b));
  7694. if (f.length) {
  7695. const m = {
  7696. unitId: c,
  7697. subUnitId: v,
  7698. rule: { ...g, ranges: f }
  7699. };
  7700. y3.push({ id: U2.id, params: m }), p.push(...L1(this._injector, m));
  7701. } else {
  7702. const m = {
  7703. unitId: c,
  7704. subUnitId: v,
  7705. cfId: g.cfId
  7706. };
  7707. y3.push({ id: E2.id, params: m }), p.push(...z02(this._injector, m));
  7708. }
  7709. }), {
  7710. undos: p,
  7711. redos: y3
  7712. };
  7713. }, n = {
  7714. id: N2,
  7715. onFillData: (i, o, c) => {
  7716. if (c === ke.COPY || c === ke.ONLY_FORMAT || c === ke.SERIES) {
  7717. const { source: v, target: d } = i;
  7718. return r(v, d);
  7719. }
  7720. return t();
  7721. }
  7722. };
  7723. this.disposeWithMe(this._autoFillService.addHook(n));
  7724. }
  7725. };
  7726. Cn = uc([
  7727. jt(0, ot(Ot)),
  7728. jt(1, ot(_n)),
  7729. jt(2, ot(Hr)),
  7730. jt(3, ot(B)),
  7731. jt(4, ot(j))
  7732. ], Cn);
  7733. var dc = Object.defineProperty;
  7734. var fc2 = Object.getOwnPropertyDescriptor;
  7735. var hc = (t, e, r, n) => {
  7736. for (var i = n > 1 ? void 0 : n ? fc2(e, r) : e, o = t.length - 1, c; o >= 0; o--)
  7737. (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
  7738. return n && i && dc(e, r, i), i;
  7739. };
  7740. var Lt = (t, e) => (r, n) => e(r, n, t);
  7741. var wn = class extends nt {
  7742. constructor(t, e, r, n, i) {
  7743. super(), this._injector = t, this._univerInstanceService = e, this._sheetInterceptorService = r, this._selectionManagerService = n, this._conditionalFormattingRuleModel = i, this._init();
  7744. }
  7745. _init() {
  7746. this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
  7747. getMutations: (t) => {
  7748. var i;
  7749. const e = [], r = [], n = { redos: e, undos: r };
  7750. if ([So.id, po.id].includes(t.id)) {
  7751. const o = (i = this._selectionManagerService.getCurrentSelections()) == null ? void 0 : i.map((w2) => w2.range);
  7752. if (!o)
  7753. return n;
  7754. const c = this._univerInstanceService.getCurrentUnitForType(Fe.UNIVER_SHEET), v = c.getActiveSheet();
  7755. if (!v)
  7756. return n;
  7757. const d = c.getUnitId(), y3 = v.getSheetId(), p = this._conditionalFormattingRuleModel.getSubunitRules(d, y3);
  7758. if (!p || !p.length)
  7759. return n;
  7760. const { redos: C, undos: _ } = li(this._injector, p, o, d, y3);
  7761. e.push(...C), r.push(..._);
  7762. }
  7763. return n;
  7764. }
  7765. })), this.disposeWithMe(this._sheetInterceptorService.interceptRanges({
  7766. getMutations: ({ unitId: t, subUnitId: e, ranges: r }) => {
  7767. const n = [], i = [], o = { redos: n, undos: i };
  7768. if (!r || !r.length)
  7769. return o;
  7770. const c = this._conditionalFormattingRuleModel.getSubunitRules(t, e);
  7771. if (!c || !c.length)
  7772. return o;
  7773. const { redos: v, undos: d } = li(this._injector, c, r, t, e);
  7774. return n.push(...v), i.push(...d), o;
  7775. }
  7776. }));
  7777. }
  7778. };
  7779. wn = hc([
  7780. Lt(0, ot(Ot)),
  7781. Lt(1, ot(_n)),
  7782. Lt(2, ot(V)),
  7783. Lt(3, ot(F)),
  7784. Lt(4, ot(B))
  7785. ], wn);
  7786. function li(t, e, r, n, i) {
  7787. const o = [], c = [];
  7788. return e.filter((v) => r.some((d) => v.ranges.some((y3) => en.getIntersects(y3, d)))).forEach((v) => {
  7789. const y3 = new ah().add(...v.ranges).subtract(...r).merge();
  7790. if (y3.length) {
  7791. const p = {
  7792. id: U2.id,
  7793. params: {
  7794. unitId: n,
  7795. subUnitId: i,
  7796. rule: { ...v, ranges: y3 }
  7797. }
  7798. }, C = L1(t, p.params);
  7799. o.push(p), c.push(...C);
  7800. } else {
  7801. const p = {
  7802. id: E2.id,
  7803. params: {
  7804. unitId: n,
  7805. subUnitId: i,
  7806. cfId: v.cfId
  7807. }
  7808. }, C = z02(t, p.params);
  7809. o.push(p), c.push(...C);
  7810. }
  7811. }), { redos: o, undos: c };
  7812. }
  7813. var pc = Object.defineProperty;
  7814. var gc = Object.getOwnPropertyDescriptor;
  7815. var mc = (t, e, r, n) => {
  7816. for (var i = n > 1 ? void 0 : n ? gc(e, r) : e, o = t.length - 1, c; o >= 0; o--)
  7817. (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
  7818. return n && i && pc(e, r, i), i;
  7819. };
  7820. var ci = (t, e) => (r, n) => e(r, n, t);
  7821. var Rn = class extends nt {
  7822. constructor(t, e) {
  7823. super(), this._sheetInterceptorService = t, this._conditionalFormattingService = e, this._initInterceptorEditorEnd();
  7824. }
  7825. /**
  7826. * Process the values after edit
  7827. * @private
  7828. * @memberof NumfmtService
  7829. */
  7830. _initInterceptorEditorEnd() {
  7831. this.disposeWithMe(
  7832. Ze(
  7833. this._sheetInterceptorService.writeCellInterceptor.intercept(
  7834. qn,
  7835. {
  7836. handler: (t, e, r) => {
  7837. var c, v, d;
  7838. t || r(t);
  7839. const n = this._conditionalFormattingService.composeStyle(e.unitId, e.subUnitId, e.row, e.col), i = (c = n == null ? void 0 : n.style) != null ? c : {}, o = Object.keys(i);
  7840. if (t != null && t.p)
  7841. return (d = (v = t.p.body) == null ? void 0 : v.textRuns) == null || d.forEach((y3) => {
  7842. y3.ts && o.forEach((p) => {
  7843. var C;
  7844. (C = y3.ts) == null || delete C[p];
  7845. });
  7846. }), r(t);
  7847. {
  7848. const y3 = { ...(typeof (t == null ? void 0 : t.s) == "string" ? e.workbook.getStyles().get(t.s) : t == null ? void 0 : t.s) || {} };
  7849. o.forEach((C) => {
  7850. delete y3[C];
  7851. });
  7852. const p = { ...t, s: { ...y3 } };
  7853. return r(p);
  7854. }
  7855. }
  7856. }
  7857. )
  7858. )
  7859. );
  7860. }
  7861. };
  7862. Rn = mc([
  7863. ci(0, ot(V)),
  7864. ci(1, ot(K))
  7865. ], Rn);
  7866. var ui = [
  7867. an.id,
  7868. T2.id,
  7869. U2.id,
  7870. E2.id,
  7871. v2.id
  7872. ];
  7873. var $t = [
  7874. {
  7875. label: "sheet.cf.ruleType.highlightCell",
  7876. value: Te2.highlightCell
  7877. },
  7878. {
  7879. label: "sheet.cf.panel.rankAndAverage",
  7880. value: Te2.rank
  7881. },
  7882. {
  7883. label: "sheet.cf.ruleType.formula",
  7884. value: Te2.formula
  7885. },
  7886. {
  7887. label: "sheet.cf.ruleType.colorScale",
  7888. value: Te2.colorScale
  7889. },
  7890. {
  7891. label: "sheet.cf.ruleType.dataBar",
  7892. value: Te2.dataBar
  7893. },
  7894. {
  7895. label: "sheet.cf.ruleType.iconSet",
  7896. value: Te2.icon
  7897. },
  7898. {
  7899. label: "sheet.cf.menu.manageConditionalFormatting",
  7900. value: Te2.viewRule
  7901. },
  7902. {
  7903. label: "sheet.cf.menu.createConditionalFormatting",
  7904. value: Te2.createRule
  7905. },
  7906. {
  7907. label: "sheet.cf.menu.clearRangeRules",
  7908. value: Te2.clearRangeRules,
  7909. disabled: false
  7910. },
  7911. {
  7912. label: "sheet.cf.menu.clearWorkSheetRules",
  7913. value: Te2.clearWorkSheetRules
  7914. }
  7915. ];
  7916. var vc = (t) => {
  7917. const e = t.get(F), r = t.get(Pt), n = t.get(_n), i = t.get(B), o = new Observable((d) => merge(
  7918. e.selectionMoveEnd$,
  7919. e.selectionSet$,
  7920. new Observable((y3) => {
  7921. const p = r.onCommandExecuted((C) => {
  7922. var R3;
  7923. const { id: _, params: w2 } = C, S = (R3 = n.getCurrentUnitForType(Fe.UNIVER_SHEET)) == null ? void 0 : R3.getUnitId();
  7924. ui.includes(_) && w2.unitId === S && y3.next(null);
  7925. });
  7926. return () => p.dispose();
  7927. })
  7928. ).pipe(debounceTime(16)).subscribe(() => {
  7929. var R3;
  7930. const y3 = ((R3 = e.getCurrentSelections()) == null ? void 0 : R3.map((h) => h.range)) || [], p = n.getCurrentUnitForType(Fe.UNIVER_SHEET);
  7931. if (!p)
  7932. return;
  7933. const C = p.getActiveSheet();
  7934. if (!C)
  7935. return;
  7936. const S = (i.getSubunitRules(p.getUnitId(), C.getSheetId()) || []).filter((h) => h.ranges.some((s) => y3.some((a) => en.intersects(a, s)))).map((h) => h.ranges).every((h) => yh(t, p.getUnitId(), C.getSheetId(), h));
  7937. d.next(S);
  7938. })), c = new Observable(
  7939. (d) => new Observable((y3) => {
  7940. const p = r.onCommandExecuted((C) => {
  7941. var R3;
  7942. const { id: _, params: w2 } = C, S = (R3 = n.getCurrentUnitForType(Fe.UNIVER_SHEET)) == null ? void 0 : R3.getUnitId();
  7943. ui.includes(_) && w2.unitId === S && y3.next(null);
  7944. });
  7945. return () => p.dispose();
  7946. }).pipe(debounceTime(16)).subscribe(() => {
  7947. const y3 = n.getCurrentUnitForType(Fe.UNIVER_SHEET);
  7948. if (!y3)
  7949. return;
  7950. const p = y3.getActiveSheet();
  7951. if (!p)
  7952. return;
  7953. const C = i.getSubunitRules(y3.getUnitId(), p.getSheetId()) || [];
  7954. if (!C.length)
  7955. return d.next(false), false;
  7956. const _ = C.map((w2) => w2.ranges).every((w2) => yh(t, y3.getUnitId(), p.getSheetId(), w2));
  7957. d.next(_);
  7958. })
  7959. ), v = new Observable((d) => {
  7960. o.subscribe((y3) => {
  7961. const p = $t.find((C) => C.value === Te2.clearRangeRules);
  7962. p && (p.disabled = !y3, d.next($t));
  7963. }), c.subscribe((y3) => {
  7964. const p = $t.find((C) => C.value === Te2.clearWorkSheetRules);
  7965. p && (p.disabled = !y3, d.next($t));
  7966. }), d.next($t);
  7967. });
  7968. return {
  7969. id: jn.id,
  7970. type: $e.SELECTOR,
  7971. icon: "Conditions",
  7972. tooltip: "sheet.cf.title",
  7973. selections: v,
  7974. hidden$: Fa(t, Fe.UNIVER_SHEET),
  7975. disabled$: ue(t, { workbookTypes: [Me], worksheetTypes: [ar2, Te], rangeTypes: [Pe] })
  7976. };
  7977. };
  7978. var yc = {
  7979. [l1.FORMULAS_INSERT]: {
  7980. [jn.id]: {
  7981. order: 0,
  7982. menuItemFactory: vc
  7983. }
  7984. }
  7985. };
  7986. var bc = Object.defineProperty;
  7987. var Sc = Object.getOwnPropertyDescriptor;
  7988. var Cc = (t, e, r, n) => {
  7989. for (var i = n > 1 ? void 0 : n ? Sc(e, r) : e, o = t.length - 1, c; o >= 0; o--)
  7990. (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
  7991. return n && i && bc(e, r, i), i;
  7992. };
  7993. var di = (t, e) => (r, n) => e(r, n, t);
  7994. var _n2 = class extends nt {
  7995. constructor(e, r) {
  7996. super();
  7997. Xe(this, "_sidebarDisposable", null);
  7998. this._injector = e, this._menuManagerService = r, this._menuManagerService.mergeMenu(yc);
  7999. }
  8000. };
  8001. _n2 = Cc([
  8002. di(0, ot(Ot)),
  8003. di(1, m1)
  8004. ], _n2);
  8005. var wc = Object.defineProperty;
  8006. var Rc = Object.getOwnPropertyDescriptor;
  8007. var _c = (t, e, r, n) => {
  8008. for (var i = n > 1 ? void 0 : n ? Rc(e, r) : e, o = t.length - 1, c; o >= 0; o--)
  8009. (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
  8010. return n && i && wc(e, r, i), i;
  8011. };
  8012. var pt = (t, e) => (r, n) => e(r, n, t);
  8013. var xc = (t, e) => {
  8014. const r = (p) => p.endRow - p.startRow + 1, n = (p) => p.endColumn - p.startColumn + 1, i = r(e) % r(t), o = n(e) % n(t), c = Math.floor(r(e) / r(t)), v = Math.floor(n(e) / n(t)), d = [], y3 = {
  8015. startRow: 0,
  8016. endRow: r(t) - 1,
  8017. startColumn: 0,
  8018. endColumn: n(t) - 1
  8019. };
  8020. if (r(e) === 1 && n(e) === 1) {
  8021. const p = {
  8022. startRow: e.startRow,
  8023. endRow: e.startRow,
  8024. startColumn: e.startColumn,
  8025. endColumn: e.startColumn
  8026. };
  8027. return d.push({ repeatRelativeRange: y3, startRange: p }), d;
  8028. }
  8029. for (let p = 0; p < c + (i ? 0.1 : 0); p++)
  8030. for (let C = 0; C < v + (o ? 0.1 : 0); C++) {
  8031. const _ = r(t) * p, w2 = n(t) * C, S = {
  8032. startRow: _ + e.startRow,
  8033. endRow: _ + e.startRow,
  8034. startColumn: w2 + e.startColumn,
  8035. endColumn: w2 + e.startColumn
  8036. };
  8037. let R3 = y3;
  8038. p === c && i && (R3 = { ...R3 }, R3.endRow = R3.endRow - (r(t) - i)), C === v && o && (R3 = { ...R3 }, R3.endColumn = R3.endColumn - (n(t) - o)), d.push({ repeatRelativeRange: R3, startRange: S });
  8039. }
  8040. return d;
  8041. };
  8042. var xn = class extends nt {
  8043. constructor(e, r, n, i, o, c) {
  8044. super();
  8045. Xe(this, "_painterConfig", null);
  8046. this._injector = e, this._univerInstanceService = r, this._formatPainterService = n, this._sheetsSelectionsService = i, this._conditionalFormattingRuleModel = o, this._conditionalFormattingViewModel = c, this._initFormattingPainter();
  8047. }
  8048. // eslint-disable-next-line max-lines-per-function
  8049. _initFormattingPainter() {
  8050. const e = () => ({ redos: [], undos: [] }), r = (o, c, v, d, y3) => {
  8051. const { unitId: p, subUnitId: C } = this._painterConfig, { targetUnitId: _, targetSubUnitId: w2 } = y3, S = {
  8052. startRow: o.row,
  8053. startColumn: o.col,
  8054. endColumn: o.col,
  8055. endRow: o.row
  8056. }, R3 = {
  8057. startRow: c.row,
  8058. startColumn: c.col,
  8059. endColumn: c.col,
  8060. endRow: c.row
  8061. };
  8062. tr.foreach(v, (h, s) => {
  8063. const a = en.getPositionRange(
  8064. {
  8065. startRow: h,
  8066. startColumn: s,
  8067. endColumn: s,
  8068. endRow: h
  8069. },
  8070. S
  8071. ), u = en.getPositionRange(
  8072. {
  8073. startRow: h,
  8074. startColumn: s,
  8075. endColumn: s,
  8076. endRow: h
  8077. },
  8078. R3
  8079. ), b = this._conditionalFormattingViewModel.getCellCfs(
  8080. p,
  8081. C,
  8082. a.startRow,
  8083. a.startColumn
  8084. ), l = this._conditionalFormattingViewModel.getCellCfs(
  8085. _,
  8086. w2,
  8087. u.startRow,
  8088. u.startColumn
  8089. );
  8090. l && l.forEach((g) => {
  8091. let f = d.get(g.cfId);
  8092. if (!d.get(g.cfId)) {
  8093. const m = this._conditionalFormattingRuleModel.getRule(_, w2, g.cfId);
  8094. if (!m)
  8095. return;
  8096. f = new kt(), m.ranges.forEach((P) => {
  8097. tr.foreach(P, (M2, j2) => {
  8098. f.setValue(M2, j2, 1);
  8099. });
  8100. }), d.set(g.cfId, f);
  8101. }
  8102. f.realDeleteValue(u.startRow, u.startColumn);
  8103. }), b && b.forEach((g) => {
  8104. const f = d.get(g.cfId);
  8105. f && f.setValue(u.startRow, u.startColumn, 1);
  8106. });
  8107. });
  8108. }, n = (o, c, v) => {
  8109. var a;
  8110. const { range: d, unitId: y3, subUnitId: p } = this._painterConfig, C = o !== y3 || p !== c, _ = /* @__PURE__ */ new Map(), w2 = [], S = [];
  8111. if (!o || !c || !y3 || !p)
  8112. return e();
  8113. const R3 = (a = this._conditionalFormattingRuleModel.getSubunitRules(y3, p)) != null ? a : [];
  8114. R3 == null || R3.forEach((u) => {
  8115. const { ranges: b, cfId: l } = u;
  8116. if (b.some((g) => en.intersects(d, g))) {
  8117. const g = new kt();
  8118. C || b.forEach((f) => {
  8119. tr.foreach(f, (m, P) => {
  8120. g.setValue(m, P, 1);
  8121. });
  8122. }), _.set(l, g);
  8123. }
  8124. });
  8125. const h = {
  8126. row: d.startRow,
  8127. col: d.startColumn
  8128. };
  8129. return xc(d, v).forEach((u) => {
  8130. r(h, { row: u.startRange.startRow, col: u.startRange.startColumn }, u.repeatRelativeRange, _, { targetUnitId: o, targetSubUnitId: c });
  8131. }), _.forEach((u, b) => {
  8132. if (C) {
  8133. const l = this._conditionalFormattingRuleModel.getRule(o, c, b), g = jr(xl(u));
  8134. if (l)
  8135. if (g.length) {
  8136. const f = {
  8137. unitId: o,
  8138. subUnitId: c,
  8139. rule: { ...l, ranges: g }
  8140. };
  8141. w2.push({ id: U2.id, params: f }), S.push(...L1(this._injector, f));
  8142. } else {
  8143. const f = {
  8144. unitId: o,
  8145. subUnitId: c,
  8146. cfId: l.cfId
  8147. };
  8148. w2.push({ id: E2.id, params: f }), S.push(...z02(this._injector, f));
  8149. }
  8150. else if (g.length) {
  8151. const f = this._conditionalFormattingRuleModel.getRule(y3, p, b);
  8152. if (f) {
  8153. const m = {
  8154. unitId: o,
  8155. subUnitId: c,
  8156. rule: {
  8157. ...re.deepClone(f),
  8158. cfId: this._conditionalFormattingRuleModel.createCfId(o, c),
  8159. ranges: g
  8160. }
  8161. };
  8162. w2.push({ id: T2.id, params: m }), S.push(b1(this._injector, m));
  8163. }
  8164. }
  8165. } else {
  8166. const l = this._conditionalFormattingRuleModel.getRule(y3, p, b);
  8167. if (!l)
  8168. return;
  8169. const g = jr(xl(u));
  8170. if (g.length) {
  8171. const f = {
  8172. unitId: y3,
  8173. subUnitId: p,
  8174. rule: { ...l, ranges: g }
  8175. };
  8176. w2.push({ id: U2.id, params: f }), S.push(...L1(this._injector, f));
  8177. } else {
  8178. const f = {
  8179. unitId: y3,
  8180. subUnitId: p,
  8181. cfId: l.cfId
  8182. };
  8183. w2.push({ id: E2.id, params: f }), S.push(...z02(this._injector, f));
  8184. }
  8185. }
  8186. }), {
  8187. undos: S,
  8188. redos: w2
  8189. };
  8190. }, i = {
  8191. id: N2,
  8192. onStatusChange: (o) => {
  8193. var c, v, d;
  8194. switch (o) {
  8195. case zt.INFINITE:
  8196. case zt.ONCE: {
  8197. const y3 = (c = this._univerInstanceService.getCurrentUnitForType(Fe.UNIVER_SHEET)) == null ? void 0 : c.getUnitId(), p = (d = (v = this._univerInstanceService.getCurrentUnitForType(Fe.UNIVER_SHEET)) == null ? void 0 : v.getActiveSheet()) == null ? void 0 : d.getSheetId(), C = this._sheetsSelectionsService.getCurrentLastSelection(), _ = C == null ? void 0 : C.range;
  8198. y3 && p && _ && (this._painterConfig = { unitId: y3, subUnitId: p, range: _ });
  8199. break;
  8200. }
  8201. case zt.OFF: {
  8202. this._painterConfig = null;
  8203. break;
  8204. }
  8205. }
  8206. },
  8207. onApply: (o, c, v) => this._painterConfig ? n(o, c, v) : {
  8208. redos: [],
  8209. undos: []
  8210. }
  8211. };
  8212. this._formatPainterService.addHook(i);
  8213. }
  8214. };
  8215. xn = _c([
  8216. pt(0, ot(Ot)),
  8217. pt(1, ot(_n)),
  8218. pt(2, ot(Un)),
  8219. pt(3, ot(F)),
  8220. pt(4, ot(B)),
  8221. pt(5, ot(j))
  8222. ], xn);
  8223. var Ic = Object.defineProperty;
  8224. var Ec = Object.getOwnPropertyDescriptor;
  8225. var Tc = (t, e, r, n) => {
  8226. for (var i = n > 1 ? void 0 : n ? Ec(e, r) : e, o = t.length - 1, c; o >= 0; o--)
  8227. (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
  8228. return n && i && Ic(e, r, i), i;
  8229. };
  8230. var Zn = (t, e) => (r, n) => e(r, n, t);
  8231. var In = class extends nt {
  8232. constructor(t, e, r) {
  8233. super(), this._conditionalFormattingViewModel = t, this._univerInstanceService = e, this._renderManagerService = r, this._init();
  8234. }
  8235. _init() {
  8236. const t = this._univerInstanceService.getCurrentUnitForType(Fe.UNIVER_SHEET), e = (r) => {
  8237. const n = r.getUnitId(), i = this._renderManagerService.getRenderById(n);
  8238. if (!i)
  8239. return;
  8240. const o = i.with(me);
  8241. this.disposeWithMe(o.currentSkeleton$.subscribe((c) => {
  8242. if (c) {
  8243. const v = c.skeleton.rowColumnSegment, d = v.endColumn - v.startColumn + 1, p = (v.endRow - v.startRow + 1) * d * 9, C = Math.max(C2, p);
  8244. this._conditionalFormattingViewModel.setCacheLength(C);
  8245. }
  8246. }));
  8247. };
  8248. t && e(t), this._univerInstanceService.getCurrentTypeOfUnit$(Fe.UNIVER_SHEET).subscribe((r) => {
  8249. r && e(r);
  8250. });
  8251. }
  8252. };
  8253. In = Tc([
  8254. Zn(0, ot(j)),
  8255. Zn(1, _n),
  8256. Zn(2, Yx)
  8257. ], In);
  8258. var co = Object.defineProperty;
  8259. var Pc = Object.getOwnPropertyDescriptor;
  8260. var Oc = (t, e, r) => e in t ? co(t, e, { enumerable: true, configurable: true, writable: true, value: r }) : t[e] = r;
  8261. var Dc = (t, e, r, n) => {
  8262. for (var i = n > 1 ? void 0 : n ? Pc(e, r) : e, o = t.length - 1, c; o >= 0; o--)
  8263. (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
  8264. return n && i && co(e, r, i), i;
  8265. };
  8266. var Jn = (t, e) => (r, n) => e(r, n, t);
  8267. var uo = (t, e, r) => Oc(t, typeof e != "symbol" ? e + "" : e, r);
  8268. var En = class extends Ra {
  8269. constructor(t = bn, e, r, n) {
  8270. super(), this._config = t, this._injector = e, this._commandService = r, this._configService = n;
  8271. const { menu: i, ...o } = nu(
  8272. {},
  8273. bn,
  8274. this._config
  8275. );
  8276. i && this._configService.setConfig("menu", i, { merge: true }), this._configService.setConfig(so, o), this._initCommand();
  8277. }
  8278. onStarting() {
  8279. K0(this._injector, [
  8280. [Gt],
  8281. [Bt],
  8282. [Ut2],
  8283. [Cn],
  8284. [kt2],
  8285. [Ht],
  8286. [_n2],
  8287. [mt],
  8288. [Rn],
  8289. [wn],
  8290. [xn],
  8291. [In]
  8292. ]), Mf(this._injector, [
  8293. [Gt]
  8294. ]);
  8295. }
  8296. onReady() {
  8297. Mf(this._injector, [
  8298. [_n2],
  8299. [Ht]
  8300. ]);
  8301. }
  8302. onRendered() {
  8303. Mf(this._injector, [
  8304. [Cn],
  8305. [wn],
  8306. [Ut2],
  8307. [Rn],
  8308. [mt],
  8309. [xn],
  8310. [kt2],
  8311. [Bt],
  8312. [In]
  8313. ]);
  8314. }
  8315. _initCommand() {
  8316. [
  8317. Mi,
  8318. Ni,
  8319. ji,
  8320. Li,
  8321. $i,
  8322. zi,
  8323. Fi,
  8324. Vi,
  8325. qi,
  8326. jn,
  8327. mn,
  8328. cr,
  8329. lr,
  8330. Pn,
  8331. ar3,
  8332. On
  8333. ].forEach((t) => {
  8334. this._commandService.registerCommand(t);
  8335. });
  8336. }
  8337. };
  8338. uo(En, "pluginName", `${N2}_UI_PLUGIN`);
  8339. uo(En, "type", Fe.UNIVER_SHEET);
  8340. En = Dc([
  8341. OR(R2),
  8342. Jn(1, ot(Ot)),
  8343. Jn(2, ot(Pt)),
  8344. Jn(3, SE)
  8345. ], En);
  8346. export {
  8347. Mi as AddAverageCfCommand,
  8348. Pn as AddCfCommand,
  8349. Ni as AddColorScaleConditionalRuleCommand,
  8350. ji as AddDataBarConditionalRuleCommand,
  8351. Li as AddDuplicateValuesCfCommand,
  8352. $i as AddNumberCfCommand,
  8353. zi as AddRankCfCommand,
  8354. Fi as AddTextCfCommand,
  8355. Vi as AddTimePeriodCfCommand,
  8356. qi as AddUniqueValuesCfCommand,
  8357. ar3 as ClearRangeCfCommand,
  8358. On as ClearWorksheetCfCommand,
  8359. wn as ConditionalFormattingClearController,
  8360. mn as DeleteCfCommand,
  8361. lr as MoveCfCommand,
  8362. jn as OpenConditionalFormattingOperator,
  8363. cr as SetCfCommand,
  8364. Sn2 as UniverSheetsConditionalFormattingMobileUIPlugin,
  8365. En as UniverSheetsConditionalFormattingUIPlugin
  8366. };
  8367. /*! Bundled license information:
  8368. @univerjs/sheets-conditional-formatting-ui/lib/es/index.js:
  8369. (**
  8370. * @license React
  8371. * react-jsx-runtime.production.min.js
  8372. *
  8373. * Copyright (c) Facebook, Inc. and its affiliates.
  8374. *
  8375. * This source code is licensed under the MIT license found in the
  8376. * LICENSE file in the root directory of this source tree.
  8377. *)
  8378. */
  8379. //# sourceMappingURL=@univerjs_sheets-conditional-formatting-ui.js.map