index.js 272 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837
  1. var ho = Object.defineProperty;
  2. var po = (t, e, r) => e in t ? ho(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
  3. var Xe = (t, e, r) => po(t, typeof e != "symbol" ? e + "" : e, r);
  4. import { CommandType as Re, ICommandService as ge, IUniverInstanceService as ue, IUndoRedoService as vt, ObjectMatrix as Ze, Range as ze, sequenceExecute as fi, Inject as Q, LocaleService as Ie, Disposable as je, ColorKit as hi, BooleanNumber as De, useDependency as he, Injector as We, UniverInstanceType as re, Rectangle as Be, Tools as tr, get as go, set as mo, createInterceptorKey as pi, InterceptorManager as vo, generateRandomId as yo, toDisposable as gi, InterceptorEffectEnum as bo, DependentOn as mi, Plugin as vi, merge as yi, IConfigService as bi, registerDependencies as So, touchDependencies as $n } from "@univerjs/core";
  5. import { ConditionalFormattingRuleModel as me, CFRuleType as K, CFSubRuleType as G, AddConditionalRuleMutation as _e, AddConditionalRuleMutationUndoFactory as nr, CFNumberOperator as J, setConditionalRuleMutationUndoFactory as Je, SetConditionalRuleMutation as Ve, DeleteConditionalRuleMutationUndoFactory as Ge, DeleteConditionalRuleMutation as Ne, transformSupportSymmetryAnchor as Co, MoveConditionalRuleMutationUndoFactory as wo, MoveConditionalRuleMutation as fn, getColorScaleFromValue as Ro, iconMap as st, DEFAULT_BG_COLOR as _o, DEFAULT_FONT_COLOR as xo, defaultDataBarPositiveColor as Ft, defaultDataBarNativeColor as Vt, CFValueType as te, createDefaultValueByValueType as qt, removeUndefinedAttr as Io, createDefaultValue as hn, CFTextOperator as le, CFTimePeriodOperator as qe, iconGroup as Eo, getOppositeOperator as Qn, compareWithNumber as To, EMPTY_ICON_TYPE as Po, createDefaultRule as nt, ConditionalFormattingViewModel as Xt, SHEET_CONDITIONAL_FORMATTING_PLUGIN as Yt, isRangesEqual as Oo, ConditionalFormattingService as Si, DEFAULT_PADDING as Do, DEFAULT_WIDTH as Mo, UniverSheetsConditionalFormattingPlugin as Ci, CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH as No } from "@univerjs/sheets-conditional-formatting";
  6. import { getSheetCommandTarget as xe, SheetsSelectionsService as ct, findAllRectangle as At, createTopMatrixFromMatrix as Wt, SetWorksheetActiveOperation as rr, SetSelectionsOperation as jo, checkRangesEditablePermission as pn, RemoveSheetMutation as Lo, setEndForRange as $o, SheetPermissionCheckController as zo, WorkbookEditablePermission as wi, RangeProtectionPermissionEditPoint as Ri, WorksheetEditPermission as _i, WorksheetSetCellStylePermission as xi, RefRangeService as Fo, handleDefaultRangeChangeWithEffectRefCommands as Vo, SheetInterceptorService as ir, INTERCEPTOR_POINT as qo, ClearSelectionFormatCommand as Ao, ClearSelectionAllCommand as Wo, RangeMergeUtil as Ho, AFTER_CELL_EDIT as Uo } from "@univerjs/sheets";
  7. import { useObservable as ko, ComponentManager as or, useSidebarClick as Kt, ILayoutService as Bo, useScrollYOverContainer as Go, ISidebarService as Xo, MenuItemType as Yo, getMenuHiddenObservable as Ko, RibbonStartGroup as Zo, IMenuManagerService as Jo } from "@univerjs/ui";
  8. import Le, { forwardRef as ut, useRef as Fe, createElement as yt, useMemo as Se, useState as H, useEffect as we } from "react";
  9. import { Select as Me, Tooltip as mr, DropdownLegacy as sr, ColorPicker as Qo, InputNumber as at, RadioGroup as es, Radio as vr, Checkbox as gn, Input as ts, Button as yr } from "@univerjs/design";
  10. import { serializeRange as Ii, deserializeRangeWithSheet as ns } from "@univerjs/engine-formula";
  11. import { useHighlightRange as rs, ISheetClipboardService as is, COPY_TYPE as br, rangeToDiscreteRange as os, PREDEFINED_HOOK_NAME as zn, virtualizeDiscreteRanges as Ei, getRepeatRange as ss, SheetSkeletonManagerService as Ti, IAutoFillService as as, APPLY_TYPE as Fn, getAutoFillRepeatRange as ls, getCurrentRangeDisable$ as cs, IFormatPainterService as us, FormatPainterStatus as Vn } from "@univerjs/sheets-ui";
  12. import Pi from "react-dom";
  13. import { Observable as ot, debounceTime as Sr, merge as Oi } from "rxjs";
  14. import { FormulaEditor as Tn, RangeSelector as ds } from "@univerjs/sheets-formula-ui";
  15. import { IRenderManagerService as Di } from "@univerjs/engine-render";
  16. import { bufferTime as fs, filter as Cr, debounceTime as wr } from "rxjs/operators";
  17. const Mi = {
  18. type: Re.COMMAND,
  19. id: "sheet.command.add-average-conditional-rule",
  20. handler(t, e) {
  21. if (!e)
  22. return !1;
  23. const { ranges: r, style: n, stopIfTrue: i, operator: o } = e, c = t.get(me), v = t.get(ge), d = t.get(ue), y = xe(d);
  24. if (!y) return !1;
  25. const { unitId: p, subUnitId: C } = y, _ = c.createCfId(p, C), w = {
  26. ranges: r,
  27. cfId: _,
  28. stopIfTrue: !!i,
  29. rule: {
  30. type: K.highlightCell,
  31. subType: G.average,
  32. operator: o,
  33. style: n
  34. }
  35. };
  36. return v.executeCommand(_e.id, { unitId: p, subUnitId: C, rule: w });
  37. }
  38. }, Pn = {
  39. type: Re.COMMAND,
  40. id: "sheet.command.add-conditional-rule",
  41. handler(t, e) {
  42. if (!e)
  43. return !1;
  44. const { rule: r } = e, n = t.get(vt), i = t.get(ge), o = t.get(me), c = t.get(ue), v = xe(c);
  45. if (!v) return !1;
  46. const { unitId: d, subUnitId: y } = v, p = o.createCfId(d, y), C = { unitId: d, subUnitId: y, rule: { ...r, cfId: r.cfId || p } }, _ = nr(t, C), w = i.syncExecuteCommand(_e.id, C);
  47. return w && n.pushUndoRedo({
  48. unitID: d,
  49. redoMutations: [{ id: _e.id, params: C }],
  50. undoMutations: [_]
  51. }), w;
  52. }
  53. }, Ni = {
  54. type: Re.COMMAND,
  55. id: "sheet.command.add-color-scale-conditional-rule",
  56. handler(t, e) {
  57. if (!e)
  58. return !1;
  59. const { ranges: r, config: n, stopIfTrue: i } = e, o = t.get(me), c = t.get(ge), v = t.get(ue), d = xe(v);
  60. if (!d) return !1;
  61. const { unitId: y, subUnitId: p } = d, C = o.createCfId(y, p), _ = {
  62. ranges: r,
  63. cfId: C,
  64. stopIfTrue: !!i,
  65. rule: {
  66. type: K.colorScale,
  67. config: n
  68. }
  69. };
  70. return c.executeCommand(_e.id, { unitId: y, subUnitId: p, rule: _ });
  71. }
  72. }, ji = {
  73. type: Re.COMMAND,
  74. id: "sheet.command.add-data-bar-conditional-rule",
  75. handler(t, e) {
  76. if (!e)
  77. return !1;
  78. const { ranges: r, min: n, max: i, nativeColor: o, positiveColor: c, isGradient: v, stopIfTrue: d, isShowValue: y } = e, p = t.get(me), C = t.get(ue), _ = xe(C);
  79. if (!_) return !1;
  80. const { unitId: w, subUnitId: S } = _, R = t.get(ge), h = p.createCfId(w, S), s = {
  81. ranges: r,
  82. cfId: h,
  83. stopIfTrue: !!d,
  84. rule: {
  85. type: K.dataBar,
  86. isShowValue: y,
  87. config: {
  88. min: n,
  89. max: i,
  90. nativeColor: o,
  91. positiveColor: c,
  92. isGradient: v
  93. }
  94. }
  95. };
  96. return R.executeCommand(_e.id, { unitId: w, subUnitId: S, rule: s });
  97. }
  98. }, Li = {
  99. type: Re.COMMAND,
  100. id: "sheet.command.add-duplicate-values-conditional-rule",
  101. handler(t, e) {
  102. if (!e)
  103. return !1;
  104. const { ranges: r, style: n, stopIfTrue: i } = e, o = t.get(me), c = t.get(ge), v = t.get(ue), d = xe(v);
  105. if (!d) return !1;
  106. const { unitId: y, subUnitId: p } = d, C = o.createCfId(y, p), _ = {
  107. ranges: r,
  108. cfId: C,
  109. stopIfTrue: !!i,
  110. rule: {
  111. type: K.highlightCell,
  112. subType: G.duplicateValues,
  113. style: n
  114. }
  115. };
  116. return c.executeCommand(_e.id, { unitId: y, subUnitId: p, rule: _ });
  117. }
  118. }, $i = {
  119. type: Re.COMMAND,
  120. id: "sheet.command.add-number-conditional-rule",
  121. handler(t, e) {
  122. if (!e)
  123. return !1;
  124. const { ranges: r, style: n, stopIfTrue: i, operator: o, value: c } = e, v = t.get(me), d = t.get(ge), y = t.get(ue), p = xe(y);
  125. if (!p) return !1;
  126. const { unitId: C, subUnitId: _ } = p, w = v.createCfId(C, _);
  127. let S;
  128. if ([J.between, J.notBetween].includes(o)) {
  129. const R = c;
  130. if (R.length !== 2 || !Array.isArray(R))
  131. return !1;
  132. S = {
  133. ranges: r,
  134. cfId: w,
  135. stopIfTrue: !!i,
  136. rule: {
  137. type: K.highlightCell,
  138. subType: G.number,
  139. operator: o,
  140. style: n,
  141. value: R
  142. }
  143. };
  144. } else {
  145. const R = c;
  146. if (typeof R != "number")
  147. return !1;
  148. S = {
  149. ranges: r,
  150. cfId: w,
  151. stopIfTrue: !!i,
  152. rule: {
  153. type: K.highlightCell,
  154. subType: G.number,
  155. operator: o,
  156. style: n,
  157. value: R
  158. }
  159. };
  160. }
  161. return d.executeCommand(_e.id, { unitId: C, subUnitId: _, rule: S });
  162. }
  163. }, zi = {
  164. type: Re.COMMAND,
  165. id: "sheet.command.add-rank-conditional-rule",
  166. handler(t, e) {
  167. if (!e)
  168. return !1;
  169. const { ranges: r, style: n, stopIfTrue: i, isPercent: o, isBottom: c, value: v } = e, d = t.get(me), y = t.get(ue), p = t.get(ge), C = xe(y);
  170. if (!C) return !1;
  171. const { unitId: _, subUnitId: w } = C, S = d.createCfId(_, w), R = {
  172. ranges: r,
  173. cfId: S,
  174. stopIfTrue: !!i,
  175. rule: {
  176. type: K.highlightCell,
  177. subType: G.rank,
  178. isPercent: o,
  179. isBottom: c,
  180. style: n,
  181. value: v
  182. }
  183. };
  184. return p.executeCommand(_e.id, { unitId: _, subUnitId: w, rule: R });
  185. }
  186. }, Fi = {
  187. type: Re.COMMAND,
  188. id: "sheet.command.add-text-conditional-rule",
  189. handler(t, e) {
  190. if (!e)
  191. return !1;
  192. const { ranges: r, style: n, stopIfTrue: i, operator: o, value: c } = e, v = t.get(me), d = t.get(ue), y = xe(d);
  193. if (!y) return !1;
  194. const { unitId: p, subUnitId: C } = y, _ = t.get(ge), w = v.createCfId(p, C), S = {
  195. ranges: r,
  196. cfId: w,
  197. stopIfTrue: !!i,
  198. rule: {
  199. type: K.highlightCell,
  200. subType: G.text,
  201. operator: o,
  202. style: n,
  203. value: c
  204. }
  205. };
  206. return _.executeCommand(_e.id, { unitId: p, subUnitId: C, rule: S });
  207. }
  208. }, Vi = {
  209. type: Re.COMMAND,
  210. id: "sheet.command.add-time-period-conditional-rule",
  211. handler(t, e) {
  212. if (!e)
  213. return !1;
  214. const { ranges: r, style: n, stopIfTrue: i, operator: o } = e, c = t.get(me), v = t.get(ue), d = t.get(ge), y = xe(v);
  215. if (!y) return !1;
  216. const { unitId: p, subUnitId: C } = y, _ = c.createCfId(p, C), w = {
  217. ranges: r,
  218. cfId: _,
  219. stopIfTrue: !!i,
  220. rule: {
  221. type: K.highlightCell,
  222. subType: G.timePeriod,
  223. operator: o,
  224. style: n
  225. }
  226. };
  227. return d.executeCommand(_e.id, { unitId: p, subUnitId: C, rule: w });
  228. }
  229. }, qi = {
  230. type: Re.COMMAND,
  231. id: "sheet.command.add-uniqueValues-conditional-rule",
  232. handler(t, e) {
  233. if (!e)
  234. return !1;
  235. const { ranges: r, style: n, stopIfTrue: i } = e, o = t.get(me), c = t.get(ue), v = t.get(ge), d = xe(c);
  236. if (!d) return !1;
  237. const { unitId: y, subUnitId: p } = d, C = o.createCfId(y, p), _ = {
  238. ranges: r,
  239. cfId: C,
  240. stopIfTrue: !!i,
  241. rule: {
  242. type: K.highlightCell,
  243. subType: G.uniqueValues,
  244. style: n
  245. }
  246. };
  247. return v.executeCommand(_e.id, { unitId: y, subUnitId: p, rule: _ });
  248. }
  249. }, ar = {
  250. type: Re.COMMAND,
  251. id: "sheet.command.clear-range-conditional-rule",
  252. handler(t, e) {
  253. var R;
  254. if (!e)
  255. return !1;
  256. const r = t.get(me), n = t.get(ue), i = t.get(ge), o = t.get(vt), c = t.get(ct), v = xe(n, e);
  257. if (!v) return !1;
  258. const { unitId: d, subUnitId: y } = v, p = ((R = c.getCurrentSelections()) == null ? void 0 : R.map((h) => h.range)) || [], C = r.getSubunitRules(d, y);
  259. if (!(C != null && C.length) || !p.length)
  260. return !1;
  261. const _ = [], w = [];
  262. C.forEach((h) => {
  263. const s = new Ze();
  264. h.ranges.forEach((u) => {
  265. ze.foreach(u, (b, l) => {
  266. s.setValue(b, l, 1);
  267. });
  268. }), p.forEach((u) => {
  269. ze.foreach(u, (b, l) => {
  270. s.realDeleteValue(b, l);
  271. });
  272. });
  273. const a = At(Wt(s));
  274. if (a.length) {
  275. const u = { ...h, ranges: a }, b = { unitId: d, subUnitId: y, rule: u }, l = Je(t, b);
  276. _.push({ id: Ve.id, params: b }), w.push(...l);
  277. } else {
  278. const u = { unitId: d, subUnitId: y, cfId: h.cfId }, b = Ge(t, u);
  279. _.push({ id: Ne.id, params: u }), w.push(...b);
  280. }
  281. });
  282. const S = fi(_, i).result;
  283. return S && o.pushUndoRedo({
  284. unitID: d,
  285. redoMutations: _,
  286. undoMutations: w
  287. }), S;
  288. }
  289. }, On = {
  290. type: Re.COMMAND,
  291. id: "sheet.command.clear-worksheet-conditional-rule",
  292. handler(t, e) {
  293. const r = t.get(me), n = t.get(ue), i = t.get(ge), o = t.get(vt), c = xe(n, e);
  294. if (!c) return !1;
  295. const { unitId: v, subUnitId: d } = c, y = r.getSubunitRules(v, d);
  296. if (!(y != null && y.length))
  297. return !1;
  298. const p = y.map((S) => ({ cfId: S.cfId, unitId: v, subUnitId: d })), C = p.map((S) => ({ id: Ne.id, params: S })), _ = p.map((S) => Ge(t, S)[0]), w = fi(C, i).result;
  299. return w && o.pushUndoRedo({
  300. unitID: v,
  301. redoMutations: C,
  302. undoMutations: _
  303. }), w;
  304. }
  305. }, mn = {
  306. type: Re.COMMAND,
  307. id: "sheet.command.delete-conditional-rule",
  308. handler(t, e) {
  309. if (!e)
  310. return !1;
  311. const r = t.get(vt), n = t.get(ge), i = t.get(ue), o = xe(i, e);
  312. if (!o) return !1;
  313. const { unitId: c, subUnitId: v } = o, d = { unitId: c, subUnitId: v, cfId: e.cfId }, y = Ge(t, d), p = n.syncExecuteCommand(Ne.id, d);
  314. return p && r.pushUndoRedo({ unitID: c, undoMutations: y, redoMutations: [{ id: Ne.id, params: d }] }), p;
  315. }
  316. }, lr = {
  317. type: Re.COMMAND,
  318. id: "sheet.command.move-conditional-rule",
  319. handler(t, e) {
  320. if (!e)
  321. return !1;
  322. const r = t.get(vt), n = t.get(ge), i = t.get(ue), o = t.get(me), c = xe(i, e);
  323. if (!c) return !1;
  324. const { unitId: v, subUnitId: d } = c, y = Co(e.start, e.end, o.getSubunitRules(v, d) || [], (R) => R.cfId);
  325. if (!y)
  326. return !1;
  327. const [p, C] = y, _ = { unitId: v, subUnitId: d, start: p, end: C }, w = wo(_), S = n.syncExecuteCommand(fn.id, _);
  328. return S && r.pushUndoRedo({
  329. unitID: v,
  330. redoMutations: [{ id: fn.id, params: _ }],
  331. undoMutations: w
  332. }), S;
  333. }
  334. }, cr = {
  335. type: Re.COMMAND,
  336. id: "sheet.command.set-conditional-rule",
  337. handler(t, e) {
  338. if (!e)
  339. return !1;
  340. const r = t.get(vt), n = t.get(ge), i = t.get(ue), o = xe(i, e);
  341. if (!o) return !1;
  342. const { unitId: c, subUnitId: v } = o, d = { unitId: c, subUnitId: v, rule: e.rule }, y = Je(t, d), p = n.syncExecuteCommand(Ve.id, d);
  343. return p && r.pushUndoRedo({ unitID: c, undoMutations: y, redoMutations: [{ id: Ve.id, params: d }] }), p;
  344. }
  345. };
  346. function hs(t) {
  347. return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
  348. }
  349. function Ai(t) {
  350. if (t.__esModule) return t;
  351. var e = t.default;
  352. if (typeof e == "function") {
  353. var r = function n() {
  354. return this instanceof n ? Reflect.construct(e, arguments, this.constructor) : e.apply(this, arguments);
  355. };
  356. r.prototype = e.prototype;
  357. } else r = {};
  358. return Object.defineProperty(r, "__esModule", { value: !0 }), Object.keys(t).forEach(function(n) {
  359. var i = Object.getOwnPropertyDescriptor(t, n);
  360. Object.defineProperty(r, n, i.get ? i : {
  361. enumerable: !0,
  362. get: function() {
  363. return t[n];
  364. }
  365. });
  366. }), r;
  367. }
  368. var qn = { exports: {} }, wt = {};
  369. /**
  370. * @license React
  371. * react-jsx-runtime.production.min.js
  372. *
  373. * Copyright (c) Facebook, Inc. and its affiliates.
  374. *
  375. * This source code is licensed under the MIT license found in the
  376. * LICENSE file in the root directory of this source tree.
  377. */
  378. var Rr;
  379. function ps() {
  380. if (Rr) return wt;
  381. Rr = 1;
  382. var t = Le, 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: !0, ref: !0, __self: !0, __source: !0 };
  383. function c(v, d, y) {
  384. var p, C = {}, _ = null, w = null;
  385. y !== void 0 && (_ = "" + y), d.key !== void 0 && (_ = "" + d.key), d.ref !== void 0 && (w = d.ref);
  386. for (p in d) n.call(d, p) && !o.hasOwnProperty(p) && (C[p] = d[p]);
  387. if (v && v.defaultProps) for (p in d = v.defaultProps, d) C[p] === void 0 && (C[p] = d[p]);
  388. return { $$typeof: e, type: v, key: _, ref: w, props: C, _owner: i.current };
  389. }
  390. return wt.Fragment = r, wt.jsx = c, wt.jsxs = c, wt;
  391. }
  392. var _r;
  393. function gs() {
  394. return _r || (_r = 1, qn.exports = ps()), qn.exports;
  395. }
  396. var x = gs();
  397. const ms = "univer-conditional-formatting-wrap", vs = "univer-cf-rule-item", ys = "univer-preview", bs = "univer-create-rule", Ss = "univer-button", Cs = "univer-title", ws = "univer-label", Rs = "univer-label-container", _s = "univer-input-width", xs = "univer-m-t-base", Is = "univer-m-t-sm", Es = "univer-m-t-xl", Ts = "univer-m-l-sm", Ps = "univer-m-l-xl", Os = "univer-m-l-xxs", Ds = "univer-m-l-0", Ms = "univer-m-r-0", $ = {
  398. conditionalFormattingWrap: ms,
  399. cfRuleItem: vs,
  400. preview: ys,
  401. createRule: bs,
  402. button: Ss,
  403. title: Cs,
  404. label: ws,
  405. labelContainer: Rs,
  406. inputWidth: _s,
  407. mTBase: xs,
  408. mTSm: Is,
  409. mTXl: Es,
  410. mLSm: Ts,
  411. mLXl: Ps,
  412. mLXxs: Os,
  413. mL0: Ds,
  414. mR0: Ms
  415. };
  416. var Oe = function() {
  417. return Oe = Object.assign || function(t) {
  418. for (var e, r = 1, n = arguments.length; r < n; r++) {
  419. e = arguments[r];
  420. for (var i in e) Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
  421. }
  422. return t;
  423. }, Oe.apply(this, arguments);
  424. }, Ns = function(t, e) {
  425. var r = {};
  426. for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (r[n] = t[n]);
  427. if (t != null && typeof Object.getOwnPropertySymbols == "function")
  428. for (var i = 0, n = Object.getOwnPropertySymbols(t); i < n.length; i++)
  429. e.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[i]) && (r[n[i]] = t[n[i]]);
  430. return r;
  431. }, bt = ut(function(t, e) {
  432. 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 = Fe("_".concat($s()));
  433. return Wi(r, "".concat(n), { defIds: r.defIds, idSuffix: d.current }, Oe({ ref: e, className: v }, c), o);
  434. });
  435. function Wi(t, e, r, n, i) {
  436. return yt(t.tag, Oe(Oe({ key: e }, js(t, r, i)), n), (Ls(t, r).children || []).map(function(o, c) {
  437. return Wi(o, "".concat(e, "-").concat(t.tag, "-").concat(c), r, void 0, i);
  438. }));
  439. }
  440. function js(t, e, r) {
  441. var n = Oe({}, t.attrs);
  442. r != null && r.colorChannel1 && n.fill === "colorChannel1" && (n.fill = r.colorChannel1);
  443. var i = e.defIds;
  444. 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) {
  445. var c = o[0], v = o[1];
  446. typeof v == "string" && (n[c] = v.replace(/url\(#(.*)\)/, "url(#$1".concat(e.idSuffix, ")")));
  447. })), n;
  448. }
  449. function Ls(t, e) {
  450. var r, n = e.defIds;
  451. 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) {
  452. 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;
  453. }) }) : t;
  454. }
  455. function $s() {
  456. return Math.random().toString(36).substring(2, 8);
  457. }
  458. bt.displayName = "UniverIcon";
  459. 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" } }] }, dn = ut(function(t, e) {
  460. return yt(bt, Object.assign({}, t, {
  461. id: "delete-single",
  462. ref: e,
  463. icon: zs
  464. }));
  465. });
  466. dn.displayName = "DeleteSingle";
  467. 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" } }] }, Hi = ut(function(t, e) {
  468. return yt(bt, Object.assign({}, t, {
  469. id: "increase-single",
  470. ref: e,
  471. icon: Fs
  472. }));
  473. });
  474. Hi.displayName = "IncreaseSingle";
  475. 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" } }] }, Dn = ut(function(t, e) {
  476. return yt(bt, Object.assign({}, t, {
  477. id: "more-down-single",
  478. ref: e,
  479. icon: Vs
  480. }));
  481. });
  482. Dn.displayName = "MoreDownSingle";
  483. 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" } }] }] }, Ui = ut(function(t, e) {
  484. return yt(bt, Object.assign({}, t, {
  485. id: "sequence-single",
  486. ref: e,
  487. icon: qs
  488. }));
  489. });
  490. Ui.displayName = "SequenceSingle";
  491. 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" } }] }] }, Zt = ut(function(t, e) {
  492. return yt(bt, Object.assign({}, t, {
  493. id: "slash-single",
  494. ref: e,
  495. icon: As
  496. }));
  497. });
  498. Zt.displayName = "SlashSingle";
  499. var An = { exports: {} }, Rt = {}, zt = { exports: {} }, Ws = zt.exports, xr;
  500. function ur() {
  501. return xr || (xr = 1, function(t, e) {
  502. (function(r, n) {
  503. n(e);
  504. })(Ws, function(r) {
  505. function n(V) {
  506. return function(ce, E, T, D, L, B, q) {
  507. return V(ce, E, q);
  508. };
  509. }
  510. function i(V) {
  511. return function(ce, E, T, D) {
  512. if (!ce || !E || typeof ce != "object" || typeof E != "object")
  513. return V(ce, E, T, D);
  514. var L = D.get(ce), B = D.get(E);
  515. if (L && B)
  516. return L === E && B === ce;
  517. D.set(ce, E), D.set(E, ce);
  518. var q = V(ce, E, T, D);
  519. return D.delete(ce), D.delete(E), q;
  520. };
  521. }
  522. function o(V, Z) {
  523. var ce = {};
  524. for (var E in V)
  525. ce[E] = V[E];
  526. for (var E in Z)
  527. ce[E] = Z[E];
  528. return ce;
  529. }
  530. function c(V) {
  531. return V.constructor === Object || V.constructor == null;
  532. }
  533. function v(V) {
  534. return typeof V.then == "function";
  535. }
  536. function d(V, Z) {
  537. return V === Z || V !== V && Z !== Z;
  538. }
  539. var y = "[object Arguments]", p = "[object Boolean]", C = "[object Date]", _ = "[object RegExp]", w = "[object Map]", S = "[object Number]", R = "[object Object]", h = "[object Set]", s = "[object String]", a = Object.prototype.toString;
  540. function u(V) {
  541. var Z = V.areArraysEqual, ce = V.areDatesEqual, E = V.areMapsEqual, T = V.areObjectsEqual, D = V.areRegExpsEqual, L = V.areSetsEqual, B = V.createIsNestedEqual, q = B(Y);
  542. function Y(X, ne, pe) {
  543. if (X === ne)
  544. return !0;
  545. if (!X || !ne || typeof X != "object" || typeof ne != "object")
  546. return X !== X && ne !== ne;
  547. if (c(X) && c(ne))
  548. return T(X, ne, q, pe);
  549. var et = Array.isArray(X), Pe = Array.isArray(ne);
  550. if (et || Pe)
  551. return et === Pe && Z(X, ne, q, pe);
  552. var Ce = a.call(X);
  553. return Ce !== a.call(ne) ? !1 : Ce === C ? ce(X, ne, q, pe) : Ce === _ ? D(X, ne, q, pe) : Ce === w ? E(X, ne, q, pe) : Ce === h ? L(X, ne, q, pe) : Ce === R || Ce === y ? v(X) || v(ne) ? !1 : T(X, ne, q, pe) : Ce === p || Ce === S || Ce === s ? d(X.valueOf(), ne.valueOf()) : !1;
  554. }
  555. return Y;
  556. }
  557. function b(V, Z, ce, E) {
  558. var T = V.length;
  559. if (Z.length !== T)
  560. return !1;
  561. for (; T-- > 0; )
  562. if (!ce(V[T], Z[T], T, T, V, Z, E))
  563. return !1;
  564. return !0;
  565. }
  566. var l = i(b);
  567. function g(V, Z) {
  568. return d(V.valueOf(), Z.valueOf());
  569. }
  570. function f(V, Z, ce, E) {
  571. var T = V.size === Z.size;
  572. if (!T)
  573. return !1;
  574. if (!V.size)
  575. return !0;
  576. var D = {}, L = 0;
  577. return V.forEach(function(B, q) {
  578. if (T) {
  579. var Y = !1, X = 0;
  580. Z.forEach(function(ne, pe) {
  581. !Y && !D[X] && (Y = ce(q, pe, L, X, V, Z, E) && ce(B, ne, q, pe, V, Z, E)) && (D[X] = !0), X++;
  582. }), L++, T = Y;
  583. }
  584. }), T;
  585. }
  586. var m = i(f), P = "_owner", M = Object.prototype.hasOwnProperty;
  587. function j(V, Z, ce, E) {
  588. var T = Object.keys(V), D = T.length;
  589. if (Object.keys(Z).length !== D)
  590. return !1;
  591. for (var L; D-- > 0; ) {
  592. if (L = T[D], L === P) {
  593. var B = !!V.$$typeof, q = !!Z.$$typeof;
  594. if ((B || q) && B !== q)
  595. return !1;
  596. }
  597. if (!M.call(Z, L) || !ce(V[L], Z[L], L, L, V, Z, E))
  598. return !1;
  599. }
  600. return !0;
  601. }
  602. var N = i(j);
  603. function I(V, Z) {
  604. return V.source === Z.source && V.flags === Z.flags;
  605. }
  606. function O(V, Z, ce, E) {
  607. var T = V.size === Z.size;
  608. if (!T)
  609. return !1;
  610. if (!V.size)
  611. return !0;
  612. var D = {};
  613. return V.forEach(function(L, B) {
  614. if (T) {
  615. var q = !1, Y = 0;
  616. Z.forEach(function(X, ne) {
  617. !q && !D[Y] && (q = ce(L, X, B, ne, V, Z, E)) && (D[Y] = !0), Y++;
  618. }), T = q;
  619. }
  620. }), T;
  621. }
  622. var z = i(O), U = Object.freeze({
  623. areArraysEqual: b,
  624. areDatesEqual: g,
  625. areMapsEqual: f,
  626. areObjectsEqual: j,
  627. areRegExpsEqual: I,
  628. areSetsEqual: O,
  629. createIsNestedEqual: n
  630. }), k = Object.freeze({
  631. areArraysEqual: l,
  632. areDatesEqual: g,
  633. areMapsEqual: m,
  634. areObjectsEqual: N,
  635. areRegExpsEqual: I,
  636. areSetsEqual: z,
  637. createIsNestedEqual: n
  638. }), ie = u(U);
  639. function ee(V, Z) {
  640. return ie(V, Z, void 0);
  641. }
  642. var A = u(o(U, { createIsNestedEqual: function() {
  643. return d;
  644. } }));
  645. function F(V, Z) {
  646. return A(V, Z, void 0);
  647. }
  648. var oe = u(k);
  649. function se(V, Z) {
  650. return oe(V, Z, /* @__PURE__ */ new WeakMap());
  651. }
  652. var de = u(o(k, {
  653. createIsNestedEqual: function() {
  654. return d;
  655. }
  656. }));
  657. function ye(V, Z) {
  658. return de(V, Z, /* @__PURE__ */ new WeakMap());
  659. }
  660. function Ee(V) {
  661. return u(o(U, V(U)));
  662. }
  663. function $e(V) {
  664. var Z = u(o(k, V(k)));
  665. return function(ce, E, T) {
  666. return T === void 0 && (T = /* @__PURE__ */ new WeakMap()), Z(ce, E, T);
  667. };
  668. }
  669. r.circularDeepEqual = se, r.circularShallowEqual = ye, r.createCustomCircularEqual = $e, r.createCustomEqual = Ee, r.deepEqual = ee, r.sameValueZeroEqual = d, r.shallowEqual = F, Object.defineProperty(r, "__esModule", { value: !0 });
  670. });
  671. }(zt, zt.exports)), zt.exports;
  672. }
  673. var Qt = { exports: {} }, Ir;
  674. function dr() {
  675. if (Ir) return Qt.exports;
  676. Ir = 1;
  677. function t(r) {
  678. var n, i, o = "";
  679. if (typeof r == "string" || typeof r == "number") o += r;
  680. else if (typeof r == "object") if (Array.isArray(r)) {
  681. var c = r.length;
  682. for (n = 0; n < c; n++) r[n] && (i = t(r[n])) && (o && (o += " "), o += i);
  683. } else for (i in r) r[i] && (o && (o += " "), o += i);
  684. return o;
  685. }
  686. function e() {
  687. for (var r, n, i = 0, o = "", c = arguments.length; i < c; i++) (r = arguments[i]) && (n = t(r)) && (o && (o += " "), o += n);
  688. return o;
  689. }
  690. return Qt.exports = e, Qt.exports.clsx = e, Qt.exports;
  691. }
  692. var ae = {}, Wn, Er;
  693. function Hs() {
  694. return Er || (Er = 1, Wn = function(e, r, n) {
  695. return e === r ? !0 : 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);
  696. }), Wn;
  697. }
  698. var Tr;
  699. function St() {
  700. if (Tr) return ae;
  701. Tr = 1, Object.defineProperty(ae, "__esModule", {
  702. value: !0
  703. }), ae.bottom = n, ae.childrenEqual = d, ae.cloneLayout = i, ae.cloneLayoutItem = v, ae.collides = p, ae.compact = C, ae.compactItem = S, ae.compactType = V, ae.correctBounds = R, ae.fastPositionEqual = y, 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 = F, ae.sortLayoutItems = se, ae.sortLayoutItemsByColRow = ye, ae.sortLayoutItemsByRowCol = de, ae.synchronizeLayoutWithChildren = Ee, ae.validateLayout = $e, ae.withLayoutItem = c;
  704. var t = /* @__PURE__ */ ur(), e = r(Le);
  705. function r(E) {
  706. return E && E.__esModule ? E : { default: E };
  707. }
  708. function n(E) {
  709. let T = 0, D;
  710. for (let L = 0, B = E.length; L < B; L++)
  711. D = E[L].y + E[L].h, D > T && (T = D);
  712. return T;
  713. }
  714. function i(E) {
  715. const T = Array(E.length);
  716. for (let D = 0, L = E.length; D < L; D++)
  717. T[D] = v(E[D]);
  718. return T;
  719. }
  720. function o(E, T) {
  721. const D = Array(E.length);
  722. for (let L = 0, B = E.length; L < B; L++)
  723. T.i === E[L].i ? D[L] = T : D[L] = E[L];
  724. return D;
  725. }
  726. function c(E, T, D) {
  727. let L = h(E, T);
  728. return L ? (L = D(v(L)), E = o(E, L), [E, L]) : [E, null];
  729. }
  730. function v(E) {
  731. return {
  732. w: E.w,
  733. h: E.h,
  734. x: E.x,
  735. y: E.y,
  736. i: E.i,
  737. minW: E.minW,
  738. maxW: E.maxW,
  739. minH: E.minH,
  740. maxH: E.maxH,
  741. moved: !!E.moved,
  742. static: !!E.static,
  743. // These can be null/undefined
  744. isDraggable: E.isDraggable,
  745. isResizable: E.isResizable,
  746. resizeHandles: E.resizeHandles,
  747. isBounded: E.isBounded
  748. };
  749. }
  750. function d(E, T) {
  751. return (0, t.deepEqual)(e.default.Children.map(E, (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(E, (D) => D == null ? void 0 : D.props["data-grid"]), e.default.Children.map(T, (D) => D == null ? void 0 : D.props["data-grid"]));
  752. }
  753. ae.fastRGLPropsEqual = Hs();
  754. function y(E, T) {
  755. return E.left === T.left && E.top === T.top && E.width === T.width && E.height === T.height;
  756. }
  757. function p(E, T) {
  758. return !(E.i === T.i || E.x + E.w <= T.x || E.x >= T.x + T.w || E.y + E.h <= T.y || E.y >= T.y + T.h);
  759. }
  760. function C(E, T, D, L) {
  761. const B = u(E), q = se(E, T), Y = Array(E.length);
  762. for (let X = 0, ne = q.length; X < ne; X++) {
  763. let pe = v(q[X]);
  764. pe.static || (pe = S(B, pe, T, D, q, L), B.push(pe)), Y[E.indexOf(q[X])] = pe, pe.moved = !1;
  765. }
  766. return Y;
  767. }
  768. const _ = {
  769. x: "w",
  770. y: "h"
  771. };
  772. function w(E, T, D, L) {
  773. const B = _[L];
  774. T[L] += 1;
  775. const q = E.map((Y) => Y.i).indexOf(T.i);
  776. for (let Y = q + 1; Y < E.length; Y++) {
  777. const X = E[Y];
  778. if (!X.static) {
  779. if (X.y > T.y + T.h) break;
  780. p(T, X) && w(E, X, D + T[B], L);
  781. }
  782. }
  783. T[L] = D;
  784. }
  785. function S(E, T, D, L, B, q) {
  786. const Y = D === "vertical", X = D === "horizontal";
  787. if (Y)
  788. for (T.y = Math.min(n(E), T.y); T.y > 0 && !s(E, T); )
  789. T.y--;
  790. else if (X)
  791. for (; T.x > 0 && !s(E, T); )
  792. T.x--;
  793. let ne;
  794. for (; (ne = s(E, T)) && !(D === null && q); )
  795. if (X ? w(B, T, ne.x + ne.w, "x") : w(B, T, ne.y + ne.h, "y"), X && T.x + T.w > L)
  796. for (T.x = L - T.w, T.y++; T.x > 0 && !s(E, T); )
  797. T.x--;
  798. return T.y = Math.max(T.y, 0), T.x = Math.max(T.x, 0), T;
  799. }
  800. function R(E, T) {
  801. const D = u(E);
  802. for (let L = 0, B = E.length; L < B; L++) {
  803. const q = E[L];
  804. 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) D.push(q);
  805. else
  806. for (; s(D, q); )
  807. q.y++;
  808. }
  809. return E;
  810. }
  811. function h(E, T) {
  812. for (let D = 0, L = E.length; D < L; D++)
  813. if (E[D].i === T) return E[D];
  814. }
  815. function s(E, T) {
  816. for (let D = 0, L = E.length; D < L; D++)
  817. if (p(E[D], T)) return E[D];
  818. }
  819. function a(E, T) {
  820. return E.filter((D) => p(D, T));
  821. }
  822. function u(E) {
  823. return E.filter((T) => T.static);
  824. }
  825. function b(E, T, D, L, B, q, Y, X, ne) {
  826. if (T.static && T.isDraggable !== !0 || T.y === L && T.x === D) return E;
  827. `${T.i}${String(D)}${String(L)}${T.x}${T.y}`;
  828. const pe = T.x, et = T.y;
  829. typeof D == "number" && (T.x = D), typeof L == "number" && (T.y = L), T.moved = !0;
  830. let Pe = se(E, Y);
  831. (Y === "vertical" && typeof L == "number" ? et >= L : Y === "horizontal" && typeof D == "number" ? pe >= D : !1) && (Pe = Pe.reverse());
  832. const dt = a(Pe, T), Jt = dt.length > 0;
  833. if (Jt && ne)
  834. return i(E);
  835. if (Jt && q)
  836. return `${T.i}`, T.x = pe, T.y = et, T.moved = !1, E;
  837. for (let Ln = 0, fo = dt.length; Ln < fo; Ln++) {
  838. const tt = dt[Ln];
  839. `${T.i}${T.x}${T.y}${tt.i}${tt.x}${tt.y}`, !tt.moved && (tt.static ? E = l(E, tt, T, B, Y) : E = l(E, T, tt, B, Y));
  840. }
  841. return E;
  842. }
  843. function l(E, T, D, L, B, q) {
  844. const Y = B === "horizontal", X = B === "vertical", ne = T.static;
  845. if (L) {
  846. L = !1;
  847. const Pe = {
  848. x: Y ? Math.max(T.x - D.w, 0) : D.x,
  849. y: X ? Math.max(T.y - D.h, 0) : D.y,
  850. w: D.w,
  851. h: D.h,
  852. i: "-1"
  853. }, Ce = s(E, Pe), dt = Ce && Ce.y + Ce.h > T.y, Jt = Ce && T.x + T.w > Ce.x;
  854. if (Ce) {
  855. if (dt && X)
  856. return b(E, D, void 0, T.y + 1, L, ne, B);
  857. if (dt && B == null)
  858. return T.y = D.y, D.y = D.y + D.h, E;
  859. if (Jt && Y)
  860. return b(E, T, D.x, void 0, L, ne, B);
  861. } else return `${D.i}${Pe.x}${Pe.y}`, b(E, D, Y ? Pe.x : void 0, X ? Pe.y : void 0, L, ne, B);
  862. }
  863. const pe = Y ? D.x + 1 : void 0, et = X ? D.y + 1 : void 0;
  864. return pe == null && et == null ? E : b(E, D, Y ? D.x + 1 : void 0, X ? D.y + 1 : void 0, L, ne, B);
  865. }
  866. function g(E) {
  867. return E * 100 + "%";
  868. }
  869. const f = (E, T, D, L) => E + D > L ? T : D, m = (E, T, D) => E < 0 ? T : D, P = (E) => Math.max(0, E), M = (E) => Math.max(0, E), j = (E, T, D) => {
  870. let {
  871. left: L,
  872. height: B,
  873. width: q
  874. } = T;
  875. const Y = E.top - (B - E.height);
  876. return {
  877. left: L,
  878. width: q,
  879. height: m(Y, E.height, B),
  880. top: M(Y)
  881. };
  882. }, N = (E, T, D) => {
  883. let {
  884. top: L,
  885. left: B,
  886. height: q,
  887. width: Y
  888. } = T;
  889. return {
  890. top: L,
  891. height: q,
  892. width: f(E.left, E.width, Y, D),
  893. left: P(B)
  894. };
  895. }, I = (E, T, D) => {
  896. let {
  897. top: L,
  898. height: B,
  899. width: q
  900. } = T;
  901. const Y = E.left - (q - E.width);
  902. return {
  903. height: B,
  904. width: Y < 0 ? E.width : f(E.left, E.width, q, D),
  905. top: M(L),
  906. left: P(Y)
  907. };
  908. }, O = (E, T, D) => {
  909. let {
  910. top: L,
  911. left: B,
  912. height: q,
  913. width: Y
  914. } = T;
  915. return {
  916. width: Y,
  917. left: B,
  918. height: m(L, E.height, q),
  919. top: M(L)
  920. };
  921. }, ee = {
  922. n: j,
  923. ne: function() {
  924. return j(arguments.length <= 0 ? void 0 : arguments[0], N(...arguments));
  925. },
  926. e: N,
  927. se: function() {
  928. return O(arguments.length <= 0 ? void 0 : arguments[0], N(...arguments));
  929. },
  930. s: O,
  931. sw: function() {
  932. return O(arguments.length <= 0 ? void 0 : arguments[0], I(...arguments));
  933. },
  934. w: I,
  935. nw: function() {
  936. return j(arguments.length <= 0 ? void 0 : arguments[0], I(...arguments));
  937. }
  938. };
  939. function A(E, T, D, L) {
  940. const B = ee[E];
  941. return B ? B(T, {
  942. ...T,
  943. ...D
  944. }, L) : D;
  945. }
  946. function F(E) {
  947. let {
  948. top: T,
  949. left: D,
  950. width: L,
  951. height: B
  952. } = E;
  953. const q = `translate(${D}px,${T}px)`;
  954. return {
  955. transform: q,
  956. WebkitTransform: q,
  957. MozTransform: q,
  958. msTransform: q,
  959. OTransform: q,
  960. width: `${L}px`,
  961. height: `${B}px`,
  962. position: "absolute"
  963. };
  964. }
  965. function oe(E) {
  966. let {
  967. top: T,
  968. left: D,
  969. width: L,
  970. height: B
  971. } = E;
  972. return {
  973. top: `${T}px`,
  974. left: `${D}px`,
  975. width: `${L}px`,
  976. height: `${B}px`,
  977. position: "absolute"
  978. };
  979. }
  980. function se(E, T) {
  981. return T === "horizontal" ? ye(E) : T === "vertical" ? de(E) : E;
  982. }
  983. function de(E) {
  984. return E.slice(0).sort(function(T, D) {
  985. return T.y > D.y || T.y === D.y && T.x > D.x ? 1 : T.y === D.y && T.x === D.x ? 0 : -1;
  986. });
  987. }
  988. function ye(E) {
  989. return E.slice(0).sort(function(T, D) {
  990. return T.x > D.x || T.x === D.x && T.y > D.y ? 1 : -1;
  991. });
  992. }
  993. function Ee(E, T, D, L, B) {
  994. E = E || [];
  995. const q = [];
  996. e.default.Children.forEach(T, (X) => {
  997. if ((X == null ? void 0 : X.key) == null) return;
  998. const ne = h(E, String(X.key)), pe = X.props["data-grid"];
  999. ne && pe == null ? q.push(v(ne)) : pe ? q.push(v({
  1000. ...pe,
  1001. i: X.key
  1002. })) : q.push(v({
  1003. w: 1,
  1004. h: 1,
  1005. x: 0,
  1006. y: n(q),
  1007. i: String(X.key)
  1008. }));
  1009. });
  1010. const Y = R(q, {
  1011. cols: D
  1012. });
  1013. return B ? Y : C(Y, L, D);
  1014. }
  1015. function $e(E) {
  1016. let T = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "Layout";
  1017. const D = ["x", "y", "w", "h"];
  1018. if (!Array.isArray(E)) throw new Error(T + " must be an array!");
  1019. for (let L = 0, B = E.length; L < B; L++) {
  1020. const q = E[L];
  1021. for (let Y = 0; Y < D.length; Y++)
  1022. if (typeof q[D[Y]] != "number")
  1023. throw new Error("ReactGridLayout: " + T + "[" + L + "]." + D[Y] + " must be a number!");
  1024. }
  1025. }
  1026. function V(E) {
  1027. const {
  1028. verticalCompact: T,
  1029. compactType: D
  1030. } = E || {};
  1031. return T === !1 ? null : D;
  1032. }
  1033. function Z() {
  1034. }
  1035. const ce = () => {
  1036. };
  1037. return ae.noop = ce, ae;
  1038. }
  1039. var He = {}, Pr;
  1040. function fr() {
  1041. if (Pr) return He;
  1042. Pr = 1, Object.defineProperty(He, "__esModule", {
  1043. value: !0
  1044. }), He.calcGridColWidth = t, He.calcGridItemPosition = r, He.calcGridItemWHPx = e, He.calcWH = i, He.calcXY = n, He.clamp = o;
  1045. function t(c) {
  1046. const {
  1047. margin: v,
  1048. containerPadding: d,
  1049. containerWidth: y,
  1050. cols: p
  1051. } = c;
  1052. return (y - v[0] * (p - 1) - d[0] * 2) / p;
  1053. }
  1054. function e(c, v, d) {
  1055. return Number.isFinite(c) ? Math.round(v * c + Math.max(0, c - 1) * d) : c;
  1056. }
  1057. function r(c, v, d, y, p, C) {
  1058. const {
  1059. margin: _,
  1060. containerPadding: w,
  1061. rowHeight: S
  1062. } = c, R = t(c), h = {};
  1063. return C && C.resizing ? (h.width = Math.round(C.resizing.width), h.height = Math.round(C.resizing.height)) : (h.width = e(y, R, _[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 + w[1]), h.left = Math.round((R + _[0]) * v + w[0])), h;
  1064. }
  1065. function n(c, v, d, y, p) {
  1066. const {
  1067. margin: C,
  1068. cols: _,
  1069. rowHeight: w,
  1070. maxRows: S
  1071. } = c, R = t(c);
  1072. let h = Math.round((d - C[0]) / (R + C[0])), s = Math.round((v - C[1]) / (w + C[1]));
  1073. return h = o(h, 0, _ - y), s = o(s, 0, S - p), {
  1074. x: h,
  1075. y: s
  1076. };
  1077. }
  1078. function i(c, v, d, y, p, C) {
  1079. const {
  1080. margin: _,
  1081. maxRows: w,
  1082. cols: S,
  1083. rowHeight: R
  1084. } = c, h = t(c);
  1085. let s = Math.round((v + _[0]) / (h + _[0])), a = Math.round((d + _[1]) / (R + _[1])), u = o(s, 0, S - y), b = o(a, 0, w - p);
  1086. return ["sw", "w", "nw"].indexOf(C) !== -1 && (u = o(s, 0, S)), ["nw", "n", "ne"].indexOf(C) !== -1 && (b = o(a, 0, w)), {
  1087. w: u,
  1088. h: b
  1089. };
  1090. }
  1091. function o(c, v, d) {
  1092. return Math.max(Math.min(c, d), v);
  1093. }
  1094. return He;
  1095. }
  1096. var _t = {}, Hn = { exports: {} }, Un, Or;
  1097. function Us() {
  1098. if (Or) return Un;
  1099. Or = 1;
  1100. var t = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
  1101. return Un = t, Un;
  1102. }
  1103. var kn, Dr;
  1104. function ks() {
  1105. if (Dr) return kn;
  1106. Dr = 1;
  1107. var t = /* @__PURE__ */ Us();
  1108. function e() {
  1109. }
  1110. function r() {
  1111. }
  1112. return r.resetWarningCache = e, kn = function() {
  1113. function n(c, v, d, y, p, C) {
  1114. if (C !== t) {
  1115. var _ = new Error(
  1116. "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"
  1117. );
  1118. throw _.name = "Invariant Violation", _;
  1119. }
  1120. }
  1121. n.isRequired = n;
  1122. function i() {
  1123. return n;
  1124. }
  1125. var o = {
  1126. array: n,
  1127. bigint: n,
  1128. bool: n,
  1129. func: n,
  1130. number: n,
  1131. object: n,
  1132. string: n,
  1133. symbol: n,
  1134. any: n,
  1135. arrayOf: i,
  1136. element: n,
  1137. elementType: n,
  1138. instanceOf: i,
  1139. node: n,
  1140. objectOf: i,
  1141. oneOf: i,
  1142. oneOfType: i,
  1143. shape: i,
  1144. exact: i,
  1145. checkPropTypes: r,
  1146. resetWarningCache: e
  1147. };
  1148. return o.PropTypes = o, o;
  1149. }, kn;
  1150. }
  1151. var Mr;
  1152. function Qe() {
  1153. return Mr || (Mr = 1, Hn.exports = /* @__PURE__ */ ks()()), Hn.exports;
  1154. }
  1155. var xt = { exports: {} }, Bn = {};
  1156. function ki(t) {
  1157. var e, r, n = "";
  1158. if (typeof t == "string" || typeof t == "number") n += t;
  1159. else if (typeof t == "object") if (Array.isArray(t)) for (e = 0; e < t.length; e++) t[e] && (r = ki(t[e])) && (n && (n += " "), n += r);
  1160. else for (e in t) t[e] && (n && (n += " "), n += e);
  1161. return n;
  1162. }
  1163. function Nr() {
  1164. for (var t, e, r = 0, n = ""; r < arguments.length; ) (t = arguments[r++]) && (e = ki(t)) && (n && (n += " "), n += e);
  1165. return n;
  1166. }
  1167. const Bs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  1168. __proto__: null,
  1169. clsx: Nr,
  1170. default: Nr
  1171. }, Symbol.toStringTag, { value: "Module" })), Gs = /* @__PURE__ */ Ai(Bs);
  1172. var ve = {}, Ye = {}, jr;
  1173. function Mn() {
  1174. if (jr) return Ye;
  1175. jr = 1, Object.defineProperty(Ye, "__esModule", {
  1176. value: !0
  1177. }), Ye.dontSetMe = i, Ye.findInArray = t, Ye.int = n, Ye.isFunction = e, Ye.isNum = r;
  1178. function t(o, c) {
  1179. for (let v = 0, d = o.length; v < d; v++)
  1180. if (c.apply(c, [o[v], v, o])) return o[v];
  1181. }
  1182. function e(o) {
  1183. return typeof o == "function" || Object.prototype.toString.call(o) === "[object Function]";
  1184. }
  1185. function r(o) {
  1186. return typeof o == "number" && !isNaN(o);
  1187. }
  1188. function n(o) {
  1189. return parseInt(o, 10);
  1190. }
  1191. function i(o, c, v) {
  1192. if (o[c])
  1193. return new Error("Invalid prop ".concat(c, " passed to ").concat(v, " - do not set this, set it on the child."));
  1194. }
  1195. return Ye;
  1196. }
  1197. var Ke = {}, Lr;
  1198. function Xs() {
  1199. if (Lr) return Ke;
  1200. Lr = 1, Object.defineProperty(Ke, "__esModule", {
  1201. value: !0
  1202. }), Ke.browserPrefixToKey = r, Ke.browserPrefixToStyle = n, Ke.default = void 0, Ke.getPrefix = e;
  1203. const t = ["Moz", "Webkit", "O", "ms"];
  1204. function e() {
  1205. var o;
  1206. let c = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "transform";
  1207. if (typeof window > "u") return "";
  1208. const v = (o = window.document) === null || o === void 0 || (o = o.documentElement) === null || o === void 0 ? void 0 : o.style;
  1209. if (!v || c in v) return "";
  1210. for (let d = 0; d < t.length; d++)
  1211. if (r(c, t[d]) in v) return t[d];
  1212. return "";
  1213. }
  1214. function r(o, c) {
  1215. return c ? "".concat(c).concat(i(o)) : o;
  1216. }
  1217. function n(o, c) {
  1218. return c ? "-".concat(c.toLowerCase(), "-").concat(o) : o;
  1219. }
  1220. function i(o) {
  1221. let c = "", v = !0;
  1222. for (let d = 0; d < o.length; d++)
  1223. v ? (c += o[d].toUpperCase(), v = !1) : o[d] === "-" ? v = !0 : c += o[d];
  1224. return c;
  1225. }
  1226. return Ke.default = e(), Ke;
  1227. }
  1228. var $r;
  1229. function hr() {
  1230. if ($r) return ve;
  1231. $r = 1, Object.defineProperty(ve, "__esModule", {
  1232. value: !0
  1233. }), ve.addClassName = l, ve.addEvent = v, ve.addUserSelectStyles = u, ve.createCSSTransform = S, ve.createSVGTransform = R, ve.getTouch = s, ve.getTouchIdentifier = a, ve.getTranslation = h, ve.innerHeight = C, ve.innerWidth = _, ve.matchesSelector = o, ve.matchesSelectorAndParentsTo = c, ve.offsetXYFromParent = w, ve.outerHeight = y, ve.outerWidth = p, ve.removeClassName = g, ve.removeEvent = d, ve.removeUserSelectStyles = b;
  1234. var t = Mn(), e = n(Xs());
  1235. function r(f) {
  1236. if (typeof WeakMap != "function") return null;
  1237. var m = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap();
  1238. return (r = function(M) {
  1239. return M ? P : m;
  1240. })(f);
  1241. }
  1242. function n(f, m) {
  1243. if (f && f.__esModule)
  1244. return f;
  1245. if (f === null || typeof f != "object" && typeof f != "function")
  1246. return { default: f };
  1247. var P = r(m);
  1248. if (P && P.has(f))
  1249. return P.get(f);
  1250. var M = {}, j = Object.defineProperty && Object.getOwnPropertyDescriptor;
  1251. for (var N in f)
  1252. if (N !== "default" && Object.prototype.hasOwnProperty.call(f, N)) {
  1253. var I = j ? Object.getOwnPropertyDescriptor(f, N) : null;
  1254. I && (I.get || I.set) ? Object.defineProperty(M, N, I) : M[N] = f[N];
  1255. }
  1256. return M.default = f, P && P.set(f, M), M;
  1257. }
  1258. let i = "";
  1259. function o(f, m) {
  1260. return i || (i = (0, t.findInArray)(["matches", "webkitMatchesSelector", "mozMatchesSelector", "msMatchesSelector", "oMatchesSelector"], function(P) {
  1261. return (0, t.isFunction)(f[P]);
  1262. })), (0, t.isFunction)(f[i]) ? f[i](m) : !1;
  1263. }
  1264. function c(f, m, P) {
  1265. let M = f;
  1266. do {
  1267. if (o(M, m)) return !0;
  1268. if (M === P) return !1;
  1269. M = M.parentNode;
  1270. } while (M);
  1271. return !1;
  1272. }
  1273. function v(f, m, P, M) {
  1274. if (!f) return;
  1275. const j = {
  1276. capture: !0,
  1277. ...M
  1278. };
  1279. f.addEventListener ? f.addEventListener(m, P, j) : f.attachEvent ? f.attachEvent("on" + m, P) : f["on" + m] = P;
  1280. }
  1281. function d(f, m, P, M) {
  1282. if (!f) return;
  1283. const j = {
  1284. capture: !0,
  1285. ...M
  1286. };
  1287. f.removeEventListener ? f.removeEventListener(m, P, j) : f.detachEvent ? f.detachEvent("on" + m, P) : f["on" + m] = null;
  1288. }
  1289. function y(f) {
  1290. let m = f.clientHeight;
  1291. const P = f.ownerDocument.defaultView.getComputedStyle(f);
  1292. return m += (0, t.int)(P.borderTopWidth), m += (0, t.int)(P.borderBottomWidth), m;
  1293. }
  1294. function p(f) {
  1295. let m = f.clientWidth;
  1296. const P = f.ownerDocument.defaultView.getComputedStyle(f);
  1297. return m += (0, t.int)(P.borderLeftWidth), m += (0, t.int)(P.borderRightWidth), m;
  1298. }
  1299. function C(f) {
  1300. let m = f.clientHeight;
  1301. const P = f.ownerDocument.defaultView.getComputedStyle(f);
  1302. return m -= (0, t.int)(P.paddingTop), m -= (0, t.int)(P.paddingBottom), m;
  1303. }
  1304. function _(f) {
  1305. let m = f.clientWidth;
  1306. const P = f.ownerDocument.defaultView.getComputedStyle(f);
  1307. return m -= (0, t.int)(P.paddingLeft), m -= (0, t.int)(P.paddingRight), m;
  1308. }
  1309. function w(f, m, P) {
  1310. const j = m === m.ownerDocument.body ? {
  1311. left: 0,
  1312. top: 0
  1313. } : m.getBoundingClientRect(), N = (f.clientX + m.scrollLeft - j.left) / P, I = (f.clientY + m.scrollTop - j.top) / P;
  1314. return {
  1315. x: N,
  1316. y: I
  1317. };
  1318. }
  1319. function S(f, m) {
  1320. const P = h(f, m, "px");
  1321. return {
  1322. [(0, e.browserPrefixToKey)("transform", e.default)]: P
  1323. };
  1324. }
  1325. function R(f, m) {
  1326. return h(f, m, "");
  1327. }
  1328. function h(f, m, P) {
  1329. let {
  1330. x: M,
  1331. y: j
  1332. } = f, N = "translate(".concat(M).concat(P, ",").concat(j).concat(P, ")");
  1333. if (m) {
  1334. const I = "".concat(typeof m.x == "string" ? m.x : m.x + P), O = "".concat(typeof m.y == "string" ? m.y : m.y + P);
  1335. N = "translate(".concat(I, ", ").concat(O, ")") + N;
  1336. }
  1337. return N;
  1338. }
  1339. function s(f, m) {
  1340. return f.targetTouches && (0, t.findInArray)(f.targetTouches, (P) => m === P.identifier) || f.changedTouches && (0, t.findInArray)(f.changedTouches, (P) => m === P.identifier);
  1341. }
  1342. function a(f) {
  1343. if (f.targetTouches && f.targetTouches[0]) return f.targetTouches[0].identifier;
  1344. if (f.changedTouches && f.changedTouches[0]) return f.changedTouches[0].identifier;
  1345. }
  1346. function u(f) {
  1347. if (!f) return;
  1348. let m = f.getElementById("react-draggable-style-el");
  1349. 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;}
  1350. `, m.innerHTML += `.react-draggable-transparent-selection *::selection {all: inherit;}
  1351. `, f.getElementsByTagName("head")[0].appendChild(m)), f.body && l(f.body, "react-draggable-transparent-selection");
  1352. }
  1353. function b(f) {
  1354. if (f)
  1355. try {
  1356. if (f.body && g(f.body, "react-draggable-transparent-selection"), f.selection)
  1357. f.selection.empty();
  1358. else {
  1359. const m = (f.defaultView || window).getSelection();
  1360. m && m.type !== "Caret" && m.removeAllRanges();
  1361. }
  1362. } catch {
  1363. }
  1364. }
  1365. function l(f, m) {
  1366. f.classList ? f.classList.add(m) : f.className.match(new RegExp("(?:^|\\s)".concat(m, "(?!\\S)"))) || (f.className += " ".concat(m));
  1367. }
  1368. function g(f, m) {
  1369. f.classList ? f.classList.remove(m) : f.className = f.className.replace(new RegExp("(?:^|\\s)".concat(m, "(?!\\S)"), "g"), "");
  1370. }
  1371. return ve;
  1372. }
  1373. var Ae = {}, zr;
  1374. function Bi() {
  1375. if (zr) return Ae;
  1376. zr = 1, Object.defineProperty(Ae, "__esModule", {
  1377. value: !0
  1378. }), Ae.canDragX = i, Ae.canDragY = o, Ae.createCoreData = v, Ae.createDraggableData = d, Ae.getBoundPosition = r, Ae.getControlPosition = c, Ae.snapToGrid = n;
  1379. var t = Mn(), e = hr();
  1380. function r(C, _, w) {
  1381. if (!C.props.bounds) return [_, w];
  1382. let {
  1383. bounds: S
  1384. } = C.props;
  1385. S = typeof S == "string" ? S : y(S);
  1386. const R = p(C);
  1387. if (typeof S == "string") {
  1388. const {
  1389. ownerDocument: h
  1390. } = R, s = h.defaultView;
  1391. let a;
  1392. if (S === "parent" ? a = R.parentNode : a = h.querySelector(S), !(a instanceof s.HTMLElement))
  1393. throw new Error('Bounds selector "' + S + '" could not find an element.');
  1394. const u = a, b = s.getComputedStyle(R), l = s.getComputedStyle(u);
  1395. S = {
  1396. left: -R.offsetLeft + (0, t.int)(l.paddingLeft) + (0, t.int)(b.marginLeft),
  1397. top: -R.offsetTop + (0, t.int)(l.paddingTop) + (0, t.int)(b.marginTop),
  1398. right: (0, e.innerWidth)(u) - (0, e.outerWidth)(R) - R.offsetLeft + (0, t.int)(l.paddingRight) - (0, t.int)(b.marginRight),
  1399. bottom: (0, e.innerHeight)(u) - (0, e.outerHeight)(R) - R.offsetTop + (0, t.int)(l.paddingBottom) - (0, t.int)(b.marginBottom)
  1400. };
  1401. }
  1402. return (0, t.isNum)(S.right) && (_ = Math.min(_, S.right)), (0, t.isNum)(S.bottom) && (w = Math.min(w, S.bottom)), (0, t.isNum)(S.left) && (_ = Math.max(_, S.left)), (0, t.isNum)(S.top) && (w = Math.max(w, S.top)), [_, w];
  1403. }
  1404. function n(C, _, w) {
  1405. const S = Math.round(_ / C[0]) * C[0], R = Math.round(w / C[1]) * C[1];
  1406. return [S, R];
  1407. }
  1408. function i(C) {
  1409. return C.props.axis === "both" || C.props.axis === "x";
  1410. }
  1411. function o(C) {
  1412. return C.props.axis === "both" || C.props.axis === "y";
  1413. }
  1414. function c(C, _, w) {
  1415. const S = typeof _ == "number" ? (0, e.getTouch)(C, _) : null;
  1416. if (typeof _ == "number" && !S) return null;
  1417. const R = p(w), h = w.props.offsetParent || R.offsetParent || R.ownerDocument.body;
  1418. return (0, e.offsetXYFromParent)(S || C, h, w.props.scale);
  1419. }
  1420. function v(C, _, w) {
  1421. const S = !(0, t.isNum)(C.lastX), R = p(C);
  1422. return S ? {
  1423. node: R,
  1424. deltaX: 0,
  1425. deltaY: 0,
  1426. lastX: _,
  1427. lastY: w,
  1428. x: _,
  1429. y: w
  1430. } : {
  1431. node: R,
  1432. deltaX: _ - C.lastX,
  1433. deltaY: w - C.lastY,
  1434. lastX: C.lastX,
  1435. lastY: C.lastY,
  1436. x: _,
  1437. y: w
  1438. };
  1439. }
  1440. function d(C, _) {
  1441. const w = C.props.scale;
  1442. return {
  1443. node: _.node,
  1444. x: C.state.x + _.deltaX / w,
  1445. y: C.state.y + _.deltaY / w,
  1446. deltaX: _.deltaX / w,
  1447. deltaY: _.deltaY / w,
  1448. lastX: C.state.x,
  1449. lastY: C.state.y
  1450. };
  1451. }
  1452. function y(C) {
  1453. return {
  1454. left: C.left,
  1455. top: C.top,
  1456. right: C.right,
  1457. bottom: C.bottom
  1458. };
  1459. }
  1460. function p(C) {
  1461. const _ = C.findDOMNode();
  1462. if (!_)
  1463. throw new Error("<DraggableCore>: Unmounted during event!");
  1464. return _;
  1465. }
  1466. return Ae;
  1467. }
  1468. var It = {}, en = {}, Fr;
  1469. function Gi() {
  1470. if (Fr) return en;
  1471. Fr = 1, Object.defineProperty(en, "__esModule", {
  1472. value: !0
  1473. }), en.default = t;
  1474. function t() {
  1475. }
  1476. return en;
  1477. }
  1478. var Vr;
  1479. function Ys() {
  1480. if (Vr) return It;
  1481. Vr = 1, Object.defineProperty(It, "__esModule", {
  1482. value: !0
  1483. }), It.default = void 0;
  1484. var t = y(Le), e = v(/* @__PURE__ */ Qe()), r = v(Pi), n = hr(), i = Bi(), o = Mn(), c = v(Gi());
  1485. function v(h) {
  1486. return h && h.__esModule ? h : { default: h };
  1487. }
  1488. function d(h) {
  1489. if (typeof WeakMap != "function") return null;
  1490. var s = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap();
  1491. return (d = function(u) {
  1492. return u ? a : s;
  1493. })(h);
  1494. }
  1495. function y(h, s) {
  1496. if (h && h.__esModule)
  1497. return h;
  1498. if (h === null || typeof h != "object" && typeof h != "function")
  1499. return { default: h };
  1500. var a = d(s);
  1501. if (a && a.has(h))
  1502. return a.get(h);
  1503. var u = {}, b = Object.defineProperty && Object.getOwnPropertyDescriptor;
  1504. for (var l in h)
  1505. if (l !== "default" && Object.prototype.hasOwnProperty.call(h, l)) {
  1506. var g = b ? Object.getOwnPropertyDescriptor(h, l) : null;
  1507. g && (g.get || g.set) ? Object.defineProperty(u, l, g) : u[l] = h[l];
  1508. }
  1509. return u.default = h, a && a.set(h, u), u;
  1510. }
  1511. function p(h, s, a) {
  1512. return s = C(s), s in h ? Object.defineProperty(h, s, { value: a, enumerable: !0, configurable: !0, writable: !0 }) : h[s] = a, h;
  1513. }
  1514. function C(h) {
  1515. var s = _(h, "string");
  1516. return typeof s == "symbol" ? s : String(s);
  1517. }
  1518. function _(h, s) {
  1519. if (typeof h != "object" || h === null) return h;
  1520. var a = h[Symbol.toPrimitive];
  1521. if (a !== void 0) {
  1522. var u = a.call(h, s || "default");
  1523. if (typeof u != "object") return u;
  1524. throw new TypeError("@@toPrimitive must return a primitive value.");
  1525. }
  1526. return (s === "string" ? String : Number)(h);
  1527. }
  1528. const w = {
  1529. touch: {
  1530. start: "touchstart",
  1531. move: "touchmove",
  1532. stop: "touchend"
  1533. },
  1534. mouse: {
  1535. start: "mousedown",
  1536. move: "mousemove",
  1537. stop: "mouseup"
  1538. }
  1539. };
  1540. let S = w.mouse, R = class extends t.Component {
  1541. constructor() {
  1542. super(...arguments), p(this, "dragging", !1), p(this, "lastX", NaN), p(this, "lastY", NaN), p(this, "touchIdentifier", null), p(this, "mounted", !1), p(this, "handleDragStart", (s) => {
  1543. if (this.props.onMouseDown(s), !this.props.allowAnyClick && typeof s.button == "number" && s.button !== 0) return !1;
  1544. const a = this.findDOMNode();
  1545. if (!a || !a.ownerDocument || !a.ownerDocument.body)
  1546. throw new Error("<DraggableCore> not mounted on DragStart!");
  1547. const {
  1548. ownerDocument: u
  1549. } = a;
  1550. 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))
  1551. return;
  1552. s.type === "touchstart" && s.preventDefault();
  1553. const b = (0, n.getTouchIdentifier)(s);
  1554. this.touchIdentifier = b;
  1555. const l = (0, i.getControlPosition)(s, b, this);
  1556. if (l == null) return;
  1557. const {
  1558. x: g,
  1559. y: f
  1560. } = l, m = (0, i.createCoreData)(this, g, f);
  1561. (0, c.default)("DraggableCore: handleDragStart: %j", m), (0, c.default)("calling", this.props.onStart), !(this.props.onStart(s, m) === !1 || this.mounted === !1) && (this.props.enableUserSelectHack && (0, n.addUserSelectStyles)(u), this.dragging = !0, this.lastX = g, this.lastY = f, (0, n.addEvent)(u, S.move, this.handleDrag), (0, n.addEvent)(u, S.stop, this.handleDragStop));
  1562. }), p(this, "handleDrag", (s) => {
  1563. const a = (0, i.getControlPosition)(s, this.touchIdentifier, this);
  1564. if (a == null) return;
  1565. let {
  1566. x: u,
  1567. y: b
  1568. } = a;
  1569. if (Array.isArray(this.props.grid)) {
  1570. let f = u - this.lastX, m = b - this.lastY;
  1571. if ([f, m] = (0, i.snapToGrid)(this.props.grid, f, m), !f && !m) return;
  1572. u = this.lastX + f, b = this.lastY + m;
  1573. }
  1574. const l = (0, i.createCoreData)(this, u, b);
  1575. if ((0, c.default)("DraggableCore: handleDrag: %j", l), this.props.onDrag(s, l) === !1 || this.mounted === !1) {
  1576. try {
  1577. this.handleDragStop(new MouseEvent("mouseup"));
  1578. } catch {
  1579. const m = document.createEvent("MouseEvents");
  1580. m.initMouseEvent("mouseup", !0, !0, window, 0, 0, 0, 0, 0, !1, !1, !1, !1, 0, null), this.handleDragStop(m);
  1581. }
  1582. return;
  1583. }
  1584. this.lastX = u, this.lastY = b;
  1585. }), p(this, "handleDragStop", (s) => {
  1586. if (!this.dragging) return;
  1587. const a = (0, i.getControlPosition)(s, this.touchIdentifier, this);
  1588. if (a == null) return;
  1589. let {
  1590. x: u,
  1591. y: b
  1592. } = a;
  1593. if (Array.isArray(this.props.grid)) {
  1594. let m = u - this.lastX || 0, P = b - this.lastY || 0;
  1595. [m, P] = (0, i.snapToGrid)(this.props.grid, m, P), u = this.lastX + m, b = this.lastY + P;
  1596. }
  1597. const l = (0, i.createCoreData)(this, u, b);
  1598. if (this.props.onStop(s, l) === !1 || this.mounted === !1) return !1;
  1599. const f = this.findDOMNode();
  1600. f && this.props.enableUserSelectHack && (0, n.removeUserSelectStyles)(f.ownerDocument), (0, c.default)("DraggableCore: handleDragStop: %j", l), this.dragging = !1, 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));
  1601. }), p(this, "onMouseDown", (s) => (S = w.mouse, this.handleDragStart(s))), p(this, "onMouseUp", (s) => (S = w.mouse, this.handleDragStop(s))), p(this, "onTouchStart", (s) => (S = w.touch, this.handleDragStart(s))), p(this, "onTouchEnd", (s) => (S = w.touch, this.handleDragStop(s)));
  1602. }
  1603. componentDidMount() {
  1604. this.mounted = !0;
  1605. const s = this.findDOMNode();
  1606. s && (0, n.addEvent)(s, w.touch.start, this.onTouchStart, {
  1607. passive: !1
  1608. });
  1609. }
  1610. componentWillUnmount() {
  1611. this.mounted = !1;
  1612. const s = this.findDOMNode();
  1613. if (s) {
  1614. const {
  1615. ownerDocument: a
  1616. } = s;
  1617. (0, n.removeEvent)(a, w.mouse.move, this.handleDrag), (0, n.removeEvent)(a, w.touch.move, this.handleDrag), (0, n.removeEvent)(a, w.mouse.stop, this.handleDragStop), (0, n.removeEvent)(a, w.touch.stop, this.handleDragStop), (0, n.removeEvent)(s, w.touch.start, this.onTouchStart, {
  1618. passive: !1
  1619. }), this.props.enableUserSelectHack && (0, n.removeUserSelectStyles)(a);
  1620. }
  1621. }
  1622. // React Strict Mode compatibility: if `nodeRef` is passed, we will use it instead of trying to find
  1623. // the underlying DOM node ourselves. See the README for more information.
  1624. findDOMNode() {
  1625. var s, a;
  1626. 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);
  1627. }
  1628. render() {
  1629. return /* @__PURE__ */ t.cloneElement(t.Children.only(this.props.children), {
  1630. // Note: mouseMove handler is attached to document so it will still function
  1631. // when the user drags quickly and leaves the bounds of the element.
  1632. onMouseDown: this.onMouseDown,
  1633. onMouseUp: this.onMouseUp,
  1634. // onTouchStart is added on `componentDidMount` so they can be added with
  1635. // {passive: false}, which allows it to cancel. See
  1636. // https://developers.google.com/web/updates/2017/01/scrolling-intervention
  1637. onTouchEnd: this.onTouchEnd
  1638. });
  1639. }
  1640. };
  1641. return It.default = R, p(R, "displayName", "DraggableCore"), p(R, "propTypes", {
  1642. /**
  1643. * `allowAnyClick` allows dragging using any mouse button.
  1644. * By default, we only accept the left button.
  1645. *
  1646. * Defaults to `false`.
  1647. */
  1648. allowAnyClick: e.default.bool,
  1649. children: e.default.node.isRequired,
  1650. /**
  1651. * `disabled`, if true, stops the <Draggable> from dragging. All handlers,
  1652. * with the exception of `onMouseDown`, will not fire.
  1653. */
  1654. disabled: e.default.bool,
  1655. /**
  1656. * By default, we add 'user-select:none' attributes to the document body
  1657. * to prevent ugly text selection during drag. If this is causing problems
  1658. * for your app, set this to `false`.
  1659. */
  1660. enableUserSelectHack: e.default.bool,
  1661. /**
  1662. * `offsetParent`, if set, uses the passed DOM node to compute drag offsets
  1663. * instead of using the parent node.
  1664. */
  1665. offsetParent: function(h, s) {
  1666. if (h[s] && h[s].nodeType !== 1)
  1667. throw new Error("Draggable's offsetParent must be a DOM Node.");
  1668. },
  1669. /**
  1670. * `grid` specifies the x and y that dragging should snap to.
  1671. */
  1672. grid: e.default.arrayOf(e.default.number),
  1673. /**
  1674. * `handle` specifies a selector to be used as the handle that initiates drag.
  1675. *
  1676. * Example:
  1677. *
  1678. * ```jsx
  1679. * let App = React.createClass({
  1680. * render: function () {
  1681. * return (
  1682. * <Draggable handle=".handle">
  1683. * <div>
  1684. * <div className="handle">Click me to drag</div>
  1685. * <div>This is some other content</div>
  1686. * </div>
  1687. * </Draggable>
  1688. * );
  1689. * }
  1690. * });
  1691. * ```
  1692. */
  1693. handle: e.default.string,
  1694. /**
  1695. * `cancel` specifies a selector to be used to prevent drag initialization.
  1696. *
  1697. * Example:
  1698. *
  1699. * ```jsx
  1700. * let App = React.createClass({
  1701. * render: function () {
  1702. * return(
  1703. * <Draggable cancel=".cancel">
  1704. * <div>
  1705. * <div className="cancel">You can't drag from here</div>
  1706. * <div>Dragging here works fine</div>
  1707. * </div>
  1708. * </Draggable>
  1709. * );
  1710. * }
  1711. * });
  1712. * ```
  1713. */
  1714. cancel: e.default.string,
  1715. /* If running in React Strict mode, ReactDOM.findDOMNode() is deprecated.
  1716. * Unfortunately, in order for <Draggable> to work properly, we need raw access
  1717. * to the underlying DOM node. If you want to avoid the warning, pass a `nodeRef`
  1718. * as in this example:
  1719. *
  1720. * function MyComponent() {
  1721. * const nodeRef = React.useRef(null);
  1722. * return (
  1723. * <Draggable nodeRef={nodeRef}>
  1724. * <div ref={nodeRef}>Example Target</div>
  1725. * </Draggable>
  1726. * );
  1727. * }
  1728. *
  1729. * This can be used for arbitrarily nested components, so long as the ref ends up
  1730. * pointing to the actual child DOM node and not a custom component.
  1731. */
  1732. nodeRef: e.default.object,
  1733. /**
  1734. * Called when dragging starts.
  1735. * If this function returns the boolean false, dragging will be canceled.
  1736. */
  1737. onStart: e.default.func,
  1738. /**
  1739. * Called while dragging.
  1740. * If this function returns the boolean false, dragging will be canceled.
  1741. */
  1742. onDrag: e.default.func,
  1743. /**
  1744. * Called when dragging stops.
  1745. * If this function returns the boolean false, the drag will remain active.
  1746. */
  1747. onStop: e.default.func,
  1748. /**
  1749. * A workaround option which can be passed if onMouseDown needs to be accessed,
  1750. * since it'll always be blocked (as there is internal use of onMouseDown)
  1751. */
  1752. onMouseDown: e.default.func,
  1753. /**
  1754. * `scale`, if set, applies scaling while dragging an element
  1755. */
  1756. scale: e.default.number,
  1757. /**
  1758. * These properties should be defined on the child, not here.
  1759. */
  1760. className: o.dontSetMe,
  1761. style: o.dontSetMe,
  1762. transform: o.dontSetMe
  1763. }), p(R, "defaultProps", {
  1764. allowAnyClick: !1,
  1765. // by default only accept left click
  1766. disabled: !1,
  1767. enableUserSelectHack: !0,
  1768. onStart: function() {
  1769. },
  1770. onDrag: function() {
  1771. },
  1772. onStop: function() {
  1773. },
  1774. onMouseDown: function() {
  1775. },
  1776. scale: 1
  1777. }), It;
  1778. }
  1779. var qr;
  1780. function Ks() {
  1781. return qr || (qr = 1, function(t) {
  1782. Object.defineProperty(t, "__esModule", {
  1783. value: !0
  1784. }), Object.defineProperty(t, "DraggableCore", {
  1785. enumerable: !0,
  1786. get: function() {
  1787. return d.default;
  1788. }
  1789. }), t.default = void 0;
  1790. var e = _(Le), r = p(/* @__PURE__ */ Qe()), n = p(Pi), i = p(Gs), o = hr(), c = Bi(), v = Mn(), d = p(Ys()), y = p(Gi());
  1791. function p(a) {
  1792. return a && a.__esModule ? a : { default: a };
  1793. }
  1794. function C(a) {
  1795. if (typeof WeakMap != "function") return null;
  1796. var u = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap();
  1797. return (C = function(l) {
  1798. return l ? b : u;
  1799. })(a);
  1800. }
  1801. function _(a, u) {
  1802. if (a && a.__esModule)
  1803. return a;
  1804. if (a === null || typeof a != "object" && typeof a != "function")
  1805. return { default: a };
  1806. var b = C(u);
  1807. if (b && b.has(a))
  1808. return b.get(a);
  1809. var l = {}, g = Object.defineProperty && Object.getOwnPropertyDescriptor;
  1810. for (var f in a)
  1811. if (f !== "default" && Object.prototype.hasOwnProperty.call(a, f)) {
  1812. var m = g ? Object.getOwnPropertyDescriptor(a, f) : null;
  1813. m && (m.get || m.set) ? Object.defineProperty(l, f, m) : l[f] = a[f];
  1814. }
  1815. return l.default = a, b && b.set(a, l), l;
  1816. }
  1817. function w() {
  1818. return w = Object.assign ? Object.assign.bind() : function(a) {
  1819. for (var u = 1; u < arguments.length; u++) {
  1820. var b = arguments[u];
  1821. for (var l in b)
  1822. Object.prototype.hasOwnProperty.call(b, l) && (a[l] = b[l]);
  1823. }
  1824. return a;
  1825. }, w.apply(this, arguments);
  1826. }
  1827. function S(a, u, b) {
  1828. return u = R(u), u in a ? Object.defineProperty(a, u, { value: b, enumerable: !0, configurable: !0, writable: !0 }) : a[u] = b, a;
  1829. }
  1830. function R(a) {
  1831. var u = h(a, "string");
  1832. return typeof u == "symbol" ? u : String(u);
  1833. }
  1834. function h(a, u) {
  1835. if (typeof a != "object" || a === null) return a;
  1836. var b = a[Symbol.toPrimitive];
  1837. if (b !== void 0) {
  1838. var l = b.call(a, u || "default");
  1839. if (typeof l != "object") return l;
  1840. throw new TypeError("@@toPrimitive must return a primitive value.");
  1841. }
  1842. return (u === "string" ? String : Number)(a);
  1843. }
  1844. class s extends e.Component {
  1845. // React 16.3+
  1846. // Arity (props, state)
  1847. static getDerivedStateFromProps(u, b) {
  1848. let {
  1849. position: l
  1850. } = u, {
  1851. prevPropsPosition: g
  1852. } = b;
  1853. return l && (!g || l.x !== g.x || l.y !== g.y) ? ((0, y.default)("Draggable: getDerivedStateFromProps %j", {
  1854. position: l,
  1855. prevPropsPosition: g
  1856. }), {
  1857. x: l.x,
  1858. y: l.y,
  1859. prevPropsPosition: {
  1860. ...l
  1861. }
  1862. }) : null;
  1863. }
  1864. constructor(u) {
  1865. super(u), S(this, "onDragStart", (b, l) => {
  1866. if ((0, y.default)("Draggable: onDragStart: %j", l), this.props.onStart(b, (0, c.createDraggableData)(this, l)) === !1) return !1;
  1867. this.setState({
  1868. dragging: !0,
  1869. dragged: !0
  1870. });
  1871. }), S(this, "onDrag", (b, l) => {
  1872. if (!this.state.dragging) return !1;
  1873. (0, y.default)("Draggable: onDrag: %j", l);
  1874. const g = (0, c.createDraggableData)(this, l), f = {
  1875. x: g.x,
  1876. y: g.y,
  1877. slackX: 0,
  1878. slackY: 0
  1879. };
  1880. if (this.props.bounds) {
  1881. const {
  1882. x: P,
  1883. y: M
  1884. } = f;
  1885. f.x += this.state.slackX, f.y += this.state.slackY;
  1886. const [j, N] = (0, c.getBoundPosition)(this, f.x, f.y);
  1887. f.x = j, f.y = N, f.slackX = this.state.slackX + (P - f.x), f.slackY = this.state.slackY + (M - f.y), g.x = f.x, g.y = f.y, g.deltaX = f.x - this.state.x, g.deltaY = f.y - this.state.y;
  1888. }
  1889. if (this.props.onDrag(b, g) === !1) return !1;
  1890. this.setState(f);
  1891. }), S(this, "onDragStop", (b, l) => {
  1892. if (!this.state.dragging || this.props.onStop(b, (0, c.createDraggableData)(this, l)) === !1) return !1;
  1893. (0, y.default)("Draggable: onDragStop: %j", l);
  1894. const f = {
  1895. dragging: !1,
  1896. slackX: 0,
  1897. slackY: 0
  1898. };
  1899. if (!!this.props.position) {
  1900. const {
  1901. x: P,
  1902. y: M
  1903. } = this.props.position;
  1904. f.x = P, f.y = M;
  1905. }
  1906. this.setState(f);
  1907. }), this.state = {
  1908. // Whether or not we are currently dragging.
  1909. dragging: !1,
  1910. // Whether or not we have been dragged before.
  1911. dragged: !1,
  1912. // Current transform x and y.
  1913. x: u.position ? u.position.x : u.defaultPosition.x,
  1914. y: u.position ? u.position.y : u.defaultPosition.y,
  1915. prevPropsPosition: {
  1916. ...u.position
  1917. },
  1918. // Used for compensating for out-of-bounds drags
  1919. slackX: 0,
  1920. slackY: 0,
  1921. // Can only determine if SVG after mounting
  1922. isElementSVG: !1
  1923. }, 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.");
  1924. }
  1925. componentDidMount() {
  1926. typeof window.SVGElement < "u" && this.findDOMNode() instanceof window.SVGElement && this.setState({
  1927. isElementSVG: !0
  1928. });
  1929. }
  1930. componentWillUnmount() {
  1931. this.setState({
  1932. dragging: !1
  1933. });
  1934. }
  1935. // React Strict Mode compatibility: if `nodeRef` is passed, we will use it instead of trying to find
  1936. // the underlying DOM node ourselves. See the README for more information.
  1937. findDOMNode() {
  1938. var u, b;
  1939. 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);
  1940. }
  1941. render() {
  1942. const {
  1943. axis: u,
  1944. bounds: b,
  1945. children: l,
  1946. defaultPosition: g,
  1947. defaultClassName: f,
  1948. defaultClassNameDragging: m,
  1949. defaultClassNameDragged: P,
  1950. position: M,
  1951. positionOffset: j,
  1952. scale: N,
  1953. ...I
  1954. } = this.props;
  1955. let O = {}, z = null;
  1956. const k = !!!M || this.state.dragging, ie = M || g, ee = {
  1957. // Set left if horizontal drag is enabled
  1958. x: (0, c.canDragX)(this) && k ? this.state.x : ie.x,
  1959. // Set top if vertical drag is enabled
  1960. y: (0, c.canDragY)(this) && k ? this.state.y : ie.y
  1961. };
  1962. this.state.isElementSVG ? z = (0, o.createSVGTransform)(ee, j) : O = (0, o.createCSSTransform)(ee, j);
  1963. const A = (0, i.default)(l.props.className || "", f, {
  1964. [m]: this.state.dragging,
  1965. [P]: this.state.dragged
  1966. });
  1967. return /* @__PURE__ */ e.createElement(d.default, w({}, I, {
  1968. onStart: this.onDragStart,
  1969. onDrag: this.onDrag,
  1970. onStop: this.onDragStop
  1971. }), /* @__PURE__ */ e.cloneElement(e.Children.only(l), {
  1972. className: A,
  1973. style: {
  1974. ...l.props.style,
  1975. ...O
  1976. },
  1977. transform: z
  1978. }));
  1979. }
  1980. }
  1981. t.default = s, S(s, "displayName", "Draggable"), S(s, "propTypes", {
  1982. // Accepts all props <DraggableCore> accepts.
  1983. ...d.default.propTypes,
  1984. /**
  1985. * `axis` determines which axis the draggable can move.
  1986. *
  1987. * Note that all callbacks will still return data as normal. This only
  1988. * controls flushing to the DOM.
  1989. *
  1990. * 'both' allows movement horizontally and vertically.
  1991. * 'x' limits movement to horizontal axis.
  1992. * 'y' limits movement to vertical axis.
  1993. * 'none' limits all movement.
  1994. *
  1995. * Defaults to 'both'.
  1996. */
  1997. axis: r.default.oneOf(["both", "x", "y", "none"]),
  1998. /**
  1999. * `bounds` determines the range of movement available to the element.
  2000. * Available values are:
  2001. *
  2002. * 'parent' restricts movement within the Draggable's parent node.
  2003. *
  2004. * Alternatively, pass an object with the following properties, all of which are optional:
  2005. *
  2006. * {left: LEFT_BOUND, right: RIGHT_BOUND, bottom: BOTTOM_BOUND, top: TOP_BOUND}
  2007. *
  2008. * All values are in px.
  2009. *
  2010. * Example:
  2011. *
  2012. * ```jsx
  2013. * let App = React.createClass({
  2014. * render: function () {
  2015. * return (
  2016. * <Draggable bounds={{right: 300, bottom: 300}}>
  2017. * <div>Content</div>
  2018. * </Draggable>
  2019. * );
  2020. * }
  2021. * });
  2022. * ```
  2023. */
  2024. bounds: r.default.oneOfType([r.default.shape({
  2025. left: r.default.number,
  2026. right: r.default.number,
  2027. top: r.default.number,
  2028. bottom: r.default.number
  2029. }), r.default.string, r.default.oneOf([!1])]),
  2030. defaultClassName: r.default.string,
  2031. defaultClassNameDragging: r.default.string,
  2032. defaultClassNameDragged: r.default.string,
  2033. /**
  2034. * `defaultPosition` specifies the x and y that the dragged item should start at
  2035. *
  2036. * Example:
  2037. *
  2038. * ```jsx
  2039. * let App = React.createClass({
  2040. * render: function () {
  2041. * return (
  2042. * <Draggable defaultPosition={{x: 25, y: 25}}>
  2043. * <div>I start with transformX: 25px and transformY: 25px;</div>
  2044. * </Draggable>
  2045. * );
  2046. * }
  2047. * });
  2048. * ```
  2049. */
  2050. defaultPosition: r.default.shape({
  2051. x: r.default.number,
  2052. y: r.default.number
  2053. }),
  2054. positionOffset: r.default.shape({
  2055. x: r.default.oneOfType([r.default.number, r.default.string]),
  2056. y: r.default.oneOfType([r.default.number, r.default.string])
  2057. }),
  2058. /**
  2059. * `position`, if present, defines the current position of the element.
  2060. *
  2061. * This is similar to how form elements in React work - if no `position` is supplied, the component
  2062. * is uncontrolled.
  2063. *
  2064. * Example:
  2065. *
  2066. * ```jsx
  2067. * let App = React.createClass({
  2068. * render: function () {
  2069. * return (
  2070. * <Draggable position={{x: 25, y: 25}}>
  2071. * <div>I start with transformX: 25px and transformY: 25px;</div>
  2072. * </Draggable>
  2073. * );
  2074. * }
  2075. * });
  2076. * ```
  2077. */
  2078. position: r.default.shape({
  2079. x: r.default.number,
  2080. y: r.default.number
  2081. }),
  2082. /**
  2083. * These properties should be defined on the child, not here.
  2084. */
  2085. className: v.dontSetMe,
  2086. style: v.dontSetMe,
  2087. transform: v.dontSetMe
  2088. }), S(s, "defaultProps", {
  2089. ...d.default.defaultProps,
  2090. axis: "both",
  2091. bounds: !1,
  2092. defaultClassName: "react-draggable",
  2093. defaultClassNameDragging: "react-draggable-dragging",
  2094. defaultClassNameDragged: "react-draggable-dragged",
  2095. defaultPosition: {
  2096. x: 0,
  2097. y: 0
  2098. },
  2099. scale: 1
  2100. });
  2101. }(Bn)), Bn;
  2102. }
  2103. var Ar;
  2104. function pr() {
  2105. if (Ar) return xt.exports;
  2106. Ar = 1;
  2107. const {
  2108. default: t,
  2109. DraggableCore: e
  2110. } = Ks();
  2111. return xt.exports = t, xt.exports.default = t, xt.exports.DraggableCore = e, xt.exports;
  2112. }
  2113. var Et = { exports: {} }, Tt = {}, tn = {}, Wr;
  2114. function Zs() {
  2115. if (Wr) return tn;
  2116. Wr = 1, tn.__esModule = !0, tn.cloneElement = v;
  2117. var t = e(Le);
  2118. function e(d) {
  2119. return d && d.__esModule ? d : { default: d };
  2120. }
  2121. function r(d, y) {
  2122. var p = Object.keys(d);
  2123. if (Object.getOwnPropertySymbols) {
  2124. var C = Object.getOwnPropertySymbols(d);
  2125. y && (C = C.filter(function(_) {
  2126. return Object.getOwnPropertyDescriptor(d, _).enumerable;
  2127. })), p.push.apply(p, C);
  2128. }
  2129. return p;
  2130. }
  2131. function n(d) {
  2132. for (var y = 1; y < arguments.length; y++) {
  2133. var p = arguments[y] != null ? arguments[y] : {};
  2134. y % 2 ? r(Object(p), !0).forEach(function(C) {
  2135. i(d, C, p[C]);
  2136. }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(d, Object.getOwnPropertyDescriptors(p)) : r(Object(p)).forEach(function(C) {
  2137. Object.defineProperty(d, C, Object.getOwnPropertyDescriptor(p, C));
  2138. });
  2139. }
  2140. return d;
  2141. }
  2142. function i(d, y, p) {
  2143. return y = o(y), y in d ? Object.defineProperty(d, y, { value: p, enumerable: !0, configurable: !0, writable: !0 }) : d[y] = p, d;
  2144. }
  2145. function o(d) {
  2146. var y = c(d, "string");
  2147. return typeof y == "symbol" ? y : String(y);
  2148. }
  2149. function c(d, y) {
  2150. if (typeof d != "object" || d === null) return d;
  2151. var p = d[Symbol.toPrimitive];
  2152. if (p !== void 0) {
  2153. var C = p.call(d, y || "default");
  2154. if (typeof C != "object") return C;
  2155. throw new TypeError("@@toPrimitive must return a primitive value.");
  2156. }
  2157. return (y === "string" ? String : Number)(d);
  2158. }
  2159. function v(d, y) {
  2160. return y.style && d.props.style && (y.style = n(n({}, d.props.style), y.style)), y.className && d.props.className && (y.className = d.props.className + " " + y.className), /* @__PURE__ */ t.default.cloneElement(d, y);
  2161. }
  2162. return tn;
  2163. }
  2164. var Pt = {}, Hr;
  2165. function Xi() {
  2166. if (Hr) return Pt;
  2167. Hr = 1, Pt.__esModule = !0, Pt.resizableProps = void 0;
  2168. var t = e(/* @__PURE__ */ Qe());
  2169. pr();
  2170. function e(n) {
  2171. return n && n.__esModule ? n : { default: n };
  2172. }
  2173. var r = {
  2174. /*
  2175. * Restricts resizing to a particular axis (default: 'both')
  2176. * 'both' - allows resizing by width or height
  2177. * 'x' - only allows the width to be changed
  2178. * 'y' - only allows the height to be changed
  2179. * 'none' - disables resizing altogether
  2180. * */
  2181. axis: t.default.oneOf(["both", "x", "y", "none"]),
  2182. className: t.default.string,
  2183. /*
  2184. * Require that one and only one child be present.
  2185. * */
  2186. children: t.default.element.isRequired,
  2187. /*
  2188. * These will be passed wholesale to react-draggable's DraggableCore
  2189. * */
  2190. draggableOpts: t.default.shape({
  2191. allowAnyClick: t.default.bool,
  2192. cancel: t.default.string,
  2193. children: t.default.node,
  2194. disabled: t.default.bool,
  2195. enableUserSelectHack: t.default.bool,
  2196. offsetParent: t.default.node,
  2197. grid: t.default.arrayOf(t.default.number),
  2198. handle: t.default.string,
  2199. nodeRef: t.default.object,
  2200. onStart: t.default.func,
  2201. onDrag: t.default.func,
  2202. onStop: t.default.func,
  2203. onMouseDown: t.default.func,
  2204. scale: t.default.number
  2205. }),
  2206. /*
  2207. * Initial height
  2208. * */
  2209. height: function() {
  2210. for (var i = arguments.length, o = new Array(i), c = 0; c < i; c++)
  2211. o[c] = arguments[c];
  2212. var v = o[0];
  2213. if (v.axis === "both" || v.axis === "y") {
  2214. var d;
  2215. return (d = t.default.number).isRequired.apply(d, o);
  2216. }
  2217. return t.default.number.apply(t.default, o);
  2218. },
  2219. /*
  2220. * Customize cursor resize handle
  2221. * */
  2222. handle: t.default.oneOfType([t.default.node, t.default.func]),
  2223. /*
  2224. * If you change this, be sure to update your css
  2225. * */
  2226. handleSize: t.default.arrayOf(t.default.number),
  2227. lockAspectRatio: t.default.bool,
  2228. /*
  2229. * Max X & Y measure
  2230. * */
  2231. maxConstraints: t.default.arrayOf(t.default.number),
  2232. /*
  2233. * Min X & Y measure
  2234. * */
  2235. minConstraints: t.default.arrayOf(t.default.number),
  2236. /*
  2237. * Called on stop resize event
  2238. * */
  2239. onResizeStop: t.default.func,
  2240. /*
  2241. * Called on start resize event
  2242. * */
  2243. onResizeStart: t.default.func,
  2244. /*
  2245. * Called on resize event
  2246. * */
  2247. onResize: t.default.func,
  2248. /*
  2249. * Defines which resize handles should be rendered (default: 'se')
  2250. * 's' - South handle (bottom-center)
  2251. * 'w' - West handle (left-center)
  2252. * 'e' - East handle (right-center)
  2253. * 'n' - North handle (top-center)
  2254. * 'sw' - Southwest handle (bottom-left)
  2255. * 'nw' - Northwest handle (top-left)
  2256. * 'se' - Southeast handle (bottom-right)
  2257. * 'ne' - Northeast handle (top-center)
  2258. * */
  2259. resizeHandles: t.default.arrayOf(t.default.oneOf(["s", "w", "e", "n", "sw", "nw", "se", "ne"])),
  2260. /*
  2261. * If `transform: scale(n)` is set on the parent, this should be set to `n`.
  2262. * */
  2263. transformScale: t.default.number,
  2264. /*
  2265. * Initial width
  2266. */
  2267. width: function() {
  2268. for (var i = arguments.length, o = new Array(i), c = 0; c < i; c++)
  2269. o[c] = arguments[c];
  2270. var v = o[0];
  2271. if (v.axis === "both" || v.axis === "x") {
  2272. var d;
  2273. return (d = t.default.number).isRequired.apply(d, o);
  2274. }
  2275. return t.default.number.apply(t.default, o);
  2276. }
  2277. };
  2278. return Pt.resizableProps = r, Pt;
  2279. }
  2280. var Ur;
  2281. function Yi() {
  2282. if (Ur) return Tt;
  2283. Ur = 1, Tt.__esModule = !0, Tt.default = void 0;
  2284. var t = c(Le), e = pr(), r = Zs(), n = Xi(), i = ["children", "className", "draggableOpts", "width", "height", "handle", "handleSize", "lockAspectRatio", "axis", "minConstraints", "maxConstraints", "onResize", "onResizeStop", "onResizeStart", "resizeHandles", "transformScale"];
  2285. function o(s) {
  2286. if (typeof WeakMap != "function") return null;
  2287. var a = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new WeakMap();
  2288. return (o = function(l) {
  2289. return l ? u : a;
  2290. })(s);
  2291. }
  2292. function c(s, a) {
  2293. if (s && s.__esModule)
  2294. return s;
  2295. if (s === null || typeof s != "object" && typeof s != "function")
  2296. return { default: s };
  2297. var u = o(a);
  2298. if (u && u.has(s))
  2299. return u.get(s);
  2300. var b = {}, l = Object.defineProperty && Object.getOwnPropertyDescriptor;
  2301. for (var g in s)
  2302. if (g !== "default" && Object.prototype.hasOwnProperty.call(s, g)) {
  2303. var f = l ? Object.getOwnPropertyDescriptor(s, g) : null;
  2304. f && (f.get || f.set) ? Object.defineProperty(b, g, f) : b[g] = s[g];
  2305. }
  2306. return b.default = s, u && u.set(s, b), b;
  2307. }
  2308. function v() {
  2309. return v = Object.assign ? Object.assign.bind() : function(s) {
  2310. for (var a = 1; a < arguments.length; a++) {
  2311. var u = arguments[a];
  2312. for (var b in u)
  2313. Object.prototype.hasOwnProperty.call(u, b) && (s[b] = u[b]);
  2314. }
  2315. return s;
  2316. }, v.apply(this, arguments);
  2317. }
  2318. function d(s, a) {
  2319. if (s == null) return {};
  2320. var u = {}, b = Object.keys(s), l, g;
  2321. for (g = 0; g < b.length; g++)
  2322. l = b[g], !(a.indexOf(l) >= 0) && (u[l] = s[l]);
  2323. return u;
  2324. }
  2325. function y(s, a) {
  2326. var u = Object.keys(s);
  2327. if (Object.getOwnPropertySymbols) {
  2328. var b = Object.getOwnPropertySymbols(s);
  2329. a && (b = b.filter(function(l) {
  2330. return Object.getOwnPropertyDescriptor(s, l).enumerable;
  2331. })), u.push.apply(u, b);
  2332. }
  2333. return u;
  2334. }
  2335. function p(s) {
  2336. for (var a = 1; a < arguments.length; a++) {
  2337. var u = arguments[a] != null ? arguments[a] : {};
  2338. a % 2 ? y(Object(u), !0).forEach(function(b) {
  2339. C(s, b, u[b]);
  2340. }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(s, Object.getOwnPropertyDescriptors(u)) : y(Object(u)).forEach(function(b) {
  2341. Object.defineProperty(s, b, Object.getOwnPropertyDescriptor(u, b));
  2342. });
  2343. }
  2344. return s;
  2345. }
  2346. function C(s, a, u) {
  2347. return a = _(a), a in s ? Object.defineProperty(s, a, { value: u, enumerable: !0, configurable: !0, writable: !0 }) : s[a] = u, s;
  2348. }
  2349. function _(s) {
  2350. var a = w(s, "string");
  2351. return typeof a == "symbol" ? a : String(a);
  2352. }
  2353. function w(s, a) {
  2354. if (typeof s != "object" || s === null) return s;
  2355. var u = s[Symbol.toPrimitive];
  2356. if (u !== void 0) {
  2357. var b = u.call(s, a || "default");
  2358. if (typeof b != "object") return b;
  2359. throw new TypeError("@@toPrimitive must return a primitive value.");
  2360. }
  2361. return (a === "string" ? String : Number)(s);
  2362. }
  2363. function S(s, a) {
  2364. s.prototype = Object.create(a.prototype), s.prototype.constructor = s, R(s, a);
  2365. }
  2366. function R(s, a) {
  2367. return R = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(b, l) {
  2368. return b.__proto__ = l, b;
  2369. }, R(s, a);
  2370. }
  2371. var h = /* @__PURE__ */ function(s) {
  2372. S(a, s);
  2373. function a() {
  2374. for (var b, l = arguments.length, g = new Array(l), f = 0; f < l; f++)
  2375. g[f] = arguments[f];
  2376. return b = s.call.apply(s, [this].concat(g)) || this, b.handleRefs = {}, b.lastHandleRect = null, b.slack = null, b;
  2377. }
  2378. var u = a.prototype;
  2379. return u.componentWillUnmount = function() {
  2380. this.resetData();
  2381. }, u.resetData = function() {
  2382. this.lastHandleRect = this.slack = null;
  2383. }, u.runConstraints = function(l, g) {
  2384. var f = this.props, m = f.minConstraints, P = f.maxConstraints, M = f.lockAspectRatio;
  2385. if (!m && !P && !M) return [l, g];
  2386. if (M) {
  2387. var j = this.props.width / this.props.height, N = l - this.props.width, I = g - this.props.height;
  2388. Math.abs(N) > Math.abs(I * j) ? g = l / j : l = g * j;
  2389. }
  2390. var O = l, z = g, U = this.slack || [0, 0], k = U[0], ie = U[1];
  2391. 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];
  2392. }, u.resizeHandler = function(l, g) {
  2393. var f = this;
  2394. return function(m, P) {
  2395. var M = P.node, j = P.deltaX, N = P.deltaY;
  2396. l === "onResizeStart" && f.resetData();
  2397. 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";
  2398. if (!(!I && !O)) {
  2399. var z = g[0], U = g[g.length - 1], k = M.getBoundingClientRect();
  2400. if (f.lastHandleRect != null) {
  2401. if (U === "w") {
  2402. var ie = k.left - f.lastHandleRect.left;
  2403. j += ie;
  2404. }
  2405. if (z === "n") {
  2406. var ee = k.top - f.lastHandleRect.top;
  2407. N += ee;
  2408. }
  2409. }
  2410. f.lastHandleRect = k, U === "w" && (j = -j), z === "n" && (N = -N);
  2411. var A = f.props.width + (I ? j / f.props.transformScale : 0), F = f.props.height + (O ? N / f.props.transformScale : 0), oe = f.runConstraints(A, F);
  2412. A = oe[0], F = oe[1];
  2413. var se = A !== f.props.width || F !== f.props.height, de = typeof f.props[l] == "function" ? f.props[l] : null, ye = l === "onResize" && !se;
  2414. de && !ye && (m.persist == null || m.persist(), de(m, {
  2415. node: M,
  2416. size: {
  2417. width: A,
  2418. height: F
  2419. },
  2420. handle: g
  2421. })), l === "onResizeStop" && f.resetData();
  2422. }
  2423. };
  2424. }, u.renderResizeHandle = function(l, g) {
  2425. var f = this.props.handle;
  2426. if (!f)
  2427. return /* @__PURE__ */ t.createElement("span", {
  2428. className: "react-resizable-handle react-resizable-handle-" + l,
  2429. ref: g
  2430. });
  2431. if (typeof f == "function")
  2432. return f(l, g);
  2433. var m = typeof f.type == "string", P = p({
  2434. ref: g
  2435. }, m ? {} : {
  2436. handleAxis: l
  2437. });
  2438. return /* @__PURE__ */ t.cloneElement(f, P);
  2439. }, u.render = function() {
  2440. var l = this, g = this.props, f = g.children, m = g.className, P = g.draggableOpts;
  2441. g.width, g.height, g.handle, g.handleSize, g.lockAspectRatio, g.axis, g.minConstraints, g.maxConstraints, g.onResize, g.onResizeStop, g.onResizeStart;
  2442. var M = g.resizeHandles;
  2443. g.transformScale;
  2444. var j = d(g, i);
  2445. return (0, r.cloneElement)(f, p(p({}, j), {}, {
  2446. className: (m ? m + " " : "") + "react-resizable",
  2447. children: [].concat(f.props.children, M.map(function(N) {
  2448. var I, O = (I = l.handleRefs[N]) != null ? I : l.handleRefs[N] = /* @__PURE__ */ t.createRef();
  2449. return /* @__PURE__ */ t.createElement(e.DraggableCore, v({}, P, {
  2450. nodeRef: O,
  2451. key: "resizableHandle-" + N,
  2452. onStop: l.resizeHandler("onResizeStop", N),
  2453. onStart: l.resizeHandler("onResizeStart", N),
  2454. onDrag: l.resizeHandler("onResize", N)
  2455. }), l.renderResizeHandle(N, O));
  2456. }))
  2457. }));
  2458. }, a;
  2459. }(t.Component);
  2460. return Tt.default = h, h.propTypes = n.resizableProps, h.defaultProps = {
  2461. axis: "both",
  2462. handleSize: [20, 20],
  2463. lockAspectRatio: !1,
  2464. minConstraints: [20, 20],
  2465. maxConstraints: [1 / 0, 1 / 0],
  2466. resizeHandles: ["se"],
  2467. transformScale: 1
  2468. }, Tt;
  2469. }
  2470. var Ot = {}, kr;
  2471. function Js() {
  2472. if (kr) return Ot;
  2473. kr = 1, Ot.__esModule = !0, Ot.default = void 0;
  2474. var t = v(Le), e = o(/* @__PURE__ */ Qe()), r = o(Yi()), n = Xi(), i = ["handle", "handleSize", "onResize", "onResizeStart", "onResizeStop", "draggableOpts", "minConstraints", "maxConstraints", "lockAspectRatio", "axis", "width", "height", "resizeHandles", "style", "transformScale"];
  2475. function o(a) {
  2476. return a && a.__esModule ? a : { default: a };
  2477. }
  2478. function c(a) {
  2479. if (typeof WeakMap != "function") return null;
  2480. var u = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap();
  2481. return (c = function(g) {
  2482. return g ? b : u;
  2483. })(a);
  2484. }
  2485. function v(a, u) {
  2486. if (a && a.__esModule)
  2487. return a;
  2488. if (a === null || typeof a != "object" && typeof a != "function")
  2489. return { default: a };
  2490. var b = c(u);
  2491. if (b && b.has(a))
  2492. return b.get(a);
  2493. var l = {}, g = Object.defineProperty && Object.getOwnPropertyDescriptor;
  2494. for (var f in a)
  2495. if (f !== "default" && Object.prototype.hasOwnProperty.call(a, f)) {
  2496. var m = g ? Object.getOwnPropertyDescriptor(a, f) : null;
  2497. m && (m.get || m.set) ? Object.defineProperty(l, f, m) : l[f] = a[f];
  2498. }
  2499. return l.default = a, b && b.set(a, l), l;
  2500. }
  2501. function d() {
  2502. return d = Object.assign ? Object.assign.bind() : function(a) {
  2503. for (var u = 1; u < arguments.length; u++) {
  2504. var b = arguments[u];
  2505. for (var l in b)
  2506. Object.prototype.hasOwnProperty.call(b, l) && (a[l] = b[l]);
  2507. }
  2508. return a;
  2509. }, d.apply(this, arguments);
  2510. }
  2511. function y(a, u) {
  2512. var b = Object.keys(a);
  2513. if (Object.getOwnPropertySymbols) {
  2514. var l = Object.getOwnPropertySymbols(a);
  2515. u && (l = l.filter(function(g) {
  2516. return Object.getOwnPropertyDescriptor(a, g).enumerable;
  2517. })), b.push.apply(b, l);
  2518. }
  2519. return b;
  2520. }
  2521. function p(a) {
  2522. for (var u = 1; u < arguments.length; u++) {
  2523. var b = arguments[u] != null ? arguments[u] : {};
  2524. u % 2 ? y(Object(b), !0).forEach(function(l) {
  2525. C(a, l, b[l]);
  2526. }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(a, Object.getOwnPropertyDescriptors(b)) : y(Object(b)).forEach(function(l) {
  2527. Object.defineProperty(a, l, Object.getOwnPropertyDescriptor(b, l));
  2528. });
  2529. }
  2530. return a;
  2531. }
  2532. function C(a, u, b) {
  2533. return u = _(u), u in a ? Object.defineProperty(a, u, { value: b, enumerable: !0, configurable: !0, writable: !0 }) : a[u] = b, a;
  2534. }
  2535. function _(a) {
  2536. var u = w(a, "string");
  2537. return typeof u == "symbol" ? u : String(u);
  2538. }
  2539. function w(a, u) {
  2540. if (typeof a != "object" || a === null) return a;
  2541. var b = a[Symbol.toPrimitive];
  2542. if (b !== void 0) {
  2543. var l = b.call(a, u || "default");
  2544. if (typeof l != "object") return l;
  2545. throw new TypeError("@@toPrimitive must return a primitive value.");
  2546. }
  2547. return (u === "string" ? String : Number)(a);
  2548. }
  2549. function S(a, u) {
  2550. if (a == null) return {};
  2551. var b = {}, l = Object.keys(a), g, f;
  2552. for (f = 0; f < l.length; f++)
  2553. g = l[f], !(u.indexOf(g) >= 0) && (b[g] = a[g]);
  2554. return b;
  2555. }
  2556. function R(a, u) {
  2557. a.prototype = Object.create(u.prototype), a.prototype.constructor = a, h(a, u);
  2558. }
  2559. function h(a, u) {
  2560. return h = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(l, g) {
  2561. return l.__proto__ = g, l;
  2562. }, h(a, u);
  2563. }
  2564. var s = /* @__PURE__ */ function(a) {
  2565. R(u, a);
  2566. function u() {
  2567. for (var l, g = arguments.length, f = new Array(g), m = 0; m < g; m++)
  2568. f[m] = arguments[m];
  2569. return l = a.call.apply(a, [this].concat(f)) || this, l.state = {
  2570. width: l.props.width,
  2571. height: l.props.height,
  2572. propsWidth: l.props.width,
  2573. propsHeight: l.props.height
  2574. }, l.onResize = function(P, M) {
  2575. var j = M.size;
  2576. l.props.onResize ? (P.persist == null || P.persist(), l.setState(j, function() {
  2577. return l.props.onResize && l.props.onResize(P, M);
  2578. })) : l.setState(j);
  2579. }, l;
  2580. }
  2581. u.getDerivedStateFromProps = function(g, f) {
  2582. return f.propsWidth !== g.width || f.propsHeight !== g.height ? {
  2583. width: g.width,
  2584. height: g.height,
  2585. propsWidth: g.width,
  2586. propsHeight: g.height
  2587. } : null;
  2588. };
  2589. var b = u.prototype;
  2590. return b.render = function() {
  2591. var g = this.props, f = g.handle, m = g.handleSize;
  2592. g.onResize;
  2593. var P = g.onResizeStart, M = g.onResizeStop, j = g.draggableOpts, N = g.minConstraints, I = g.maxConstraints, O = g.lockAspectRatio, z = g.axis;
  2594. g.width, g.height;
  2595. var U = g.resizeHandles, k = g.style, ie = g.transformScale, ee = S(g, i);
  2596. return /* @__PURE__ */ t.createElement(r.default, {
  2597. axis: z,
  2598. draggableOpts: j,
  2599. handle: f,
  2600. handleSize: m,
  2601. height: this.state.height,
  2602. lockAspectRatio: O,
  2603. maxConstraints: I,
  2604. minConstraints: N,
  2605. onResizeStart: P,
  2606. onResize: this.onResize,
  2607. onResizeStop: M,
  2608. resizeHandles: U,
  2609. transformScale: ie,
  2610. width: this.state.width
  2611. }, /* @__PURE__ */ t.createElement("div", d({}, ee, {
  2612. style: p(p({}, k), {}, {
  2613. width: this.state.width + "px",
  2614. height: this.state.height + "px"
  2615. })
  2616. })));
  2617. }, u;
  2618. }(t.Component);
  2619. return Ot.default = s, s.propTypes = p(p({}, n.resizableProps), {}, {
  2620. children: e.default.element
  2621. }), Ot;
  2622. }
  2623. var Br;
  2624. function Qs() {
  2625. return Br || (Br = 1, Et.exports = function() {
  2626. throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable");
  2627. }, Et.exports.Resizable = Yi().default, Et.exports.ResizableBox = Js().default), Et.exports;
  2628. }
  2629. var Ue = {}, Gr;
  2630. function Ki() {
  2631. if (Gr) return Ue;
  2632. Gr = 1, Object.defineProperty(Ue, "__esModule", {
  2633. value: !0
  2634. }), Ue.resizeHandleType = Ue.resizeHandleAxesType = Ue.default = void 0;
  2635. var t = r(/* @__PURE__ */ Qe()), e = r(Le);
  2636. function r(o) {
  2637. return o && o.__esModule ? o : { default: o };
  2638. }
  2639. 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]);
  2640. return Ue.default = {
  2641. //
  2642. // Basic props
  2643. //
  2644. className: t.default.string,
  2645. style: t.default.object,
  2646. // This can be set explicitly. If it is not set, it will automatically
  2647. // be set to the container width. Note that resizes will *not* cause this to adjust.
  2648. // If you need that behavior, use WidthProvider.
  2649. width: t.default.number,
  2650. // If true, the container height swells and contracts to fit contents
  2651. autoSize: t.default.bool,
  2652. // # of cols.
  2653. cols: t.default.number,
  2654. // A selector that will not be draggable.
  2655. draggableCancel: t.default.string,
  2656. // A selector for the draggable handler
  2657. draggableHandle: t.default.string,
  2658. // Deprecated
  2659. verticalCompact: function(o) {
  2660. o.verticalCompact;
  2661. },
  2662. // Choose vertical or hotizontal compaction
  2663. compactType: t.default.oneOf(["vertical", "horizontal"]),
  2664. // layout is an array of object with the format:
  2665. // {x: Number, y: Number, w: Number, h: Number, i: String}
  2666. layout: function(o) {
  2667. var c = o.layout;
  2668. c !== void 0 && St().validateLayout(c, "layout");
  2669. },
  2670. //
  2671. // Grid Dimensions
  2672. //
  2673. // Margin between items [x, y] in px
  2674. margin: t.default.arrayOf(t.default.number),
  2675. // Padding inside the container [x, y] in px
  2676. containerPadding: t.default.arrayOf(t.default.number),
  2677. // Rows have a static height, but you can change this based on breakpoints if you like
  2678. rowHeight: t.default.number,
  2679. // Default Infinity, but you can specify a max here if you like.
  2680. // Note that this isn't fully fleshed out and won't error if you specify a layout that
  2681. // extends beyond the row capacity. It will, however, not allow users to drag/resize
  2682. // an item past the barrier. They can push items beyond the barrier, though.
  2683. // Intentionally not documented for this reason.
  2684. maxRows: t.default.number,
  2685. //
  2686. // Flags
  2687. //
  2688. isBounded: t.default.bool,
  2689. isDraggable: t.default.bool,
  2690. isResizable: t.default.bool,
  2691. // If true, grid can be placed one over the other.
  2692. allowOverlap: t.default.bool,
  2693. // If true, grid items won't change position when being dragged over.
  2694. preventCollision: t.default.bool,
  2695. // Use CSS transforms instead of top/left
  2696. useCSSTransforms: t.default.bool,
  2697. // parent layout transform scale
  2698. transformScale: t.default.number,
  2699. // If true, an external element can trigger onDrop callback with a specific grid position as a parameter
  2700. isDroppable: t.default.bool,
  2701. // Resize handle options
  2702. resizeHandles: n,
  2703. resizeHandle: i,
  2704. //
  2705. // Callbacks
  2706. //
  2707. // Callback so you can save the layout. Calls after each drag & resize stops.
  2708. onLayoutChange: t.default.func,
  2709. // Calls when drag starts. Callback is of the signature (layout, oldItem, newItem, placeholder, e, ?node).
  2710. // All callbacks below have the same signature. 'start' and 'stop' callbacks omit the 'placeholder'.
  2711. onDragStart: t.default.func,
  2712. // Calls on each drag movement.
  2713. onDrag: t.default.func,
  2714. // Calls when drag is complete.
  2715. onDragStop: t.default.func,
  2716. //Calls when resize starts.
  2717. onResizeStart: t.default.func,
  2718. // Calls when resize movement happens.
  2719. onResize: t.default.func,
  2720. // Calls when resize is complete.
  2721. onResizeStop: t.default.func,
  2722. // Calls when some element is dropped.
  2723. onDrop: t.default.func,
  2724. //
  2725. // Other validations
  2726. //
  2727. droppingItem: t.default.shape({
  2728. i: t.default.string.isRequired,
  2729. w: t.default.number.isRequired,
  2730. h: t.default.number.isRequired
  2731. }),
  2732. // Children must not have duplicate keys.
  2733. children: function(o, c) {
  2734. const v = o[c], d = {};
  2735. e.default.Children.forEach(v, function(y) {
  2736. if ((y == null ? void 0 : y.key) != null) {
  2737. if (d[y.key])
  2738. throw new Error('Duplicate child key "' + y.key + '" found! This will cause problems in ReactGridLayout.');
  2739. d[y.key] = !0;
  2740. }
  2741. });
  2742. },
  2743. // Optional ref for getting a reference for the wrapping div.
  2744. innerRef: t.default.any
  2745. }, Ue;
  2746. }
  2747. var Xr;
  2748. function ea() {
  2749. if (Xr) return _t;
  2750. Xr = 1, Object.defineProperty(_t, "__esModule", {
  2751. value: !0
  2752. }), _t.default = void 0;
  2753. var t = d(Le), e = d(/* @__PURE__ */ Qe()), r = pr(), n = Qs(), i = St(), o = fr(), c = Ki(), v = d(dr());
  2754. function d(w) {
  2755. return w && w.__esModule ? w : { default: w };
  2756. }
  2757. function y(w, S, R) {
  2758. return S = p(S), S in w ? Object.defineProperty(w, S, { value: R, enumerable: !0, configurable: !0, writable: !0 }) : w[S] = R, w;
  2759. }
  2760. function p(w) {
  2761. var S = C(w, "string");
  2762. return typeof S == "symbol" ? S : String(S);
  2763. }
  2764. function C(w, S) {
  2765. if (typeof w != "object" || w === null) return w;
  2766. var R = w[Symbol.toPrimitive];
  2767. if (R !== void 0) {
  2768. var h = R.call(w, S || "default");
  2769. if (typeof h != "object") return h;
  2770. throw new TypeError("@@toPrimitive must return a primitive value.");
  2771. }
  2772. return (S === "string" ? String : Number)(w);
  2773. }
  2774. let _ = class extends t.default.Component {
  2775. constructor() {
  2776. super(...arguments), y(this, "state", {
  2777. resizing: null,
  2778. dragging: null,
  2779. className: ""
  2780. }), y(this, "elementRef", /* @__PURE__ */ t.default.createRef()), y(this, "onDragStart", (S, R) => {
  2781. let {
  2782. node: h
  2783. } = R;
  2784. const {
  2785. onDragStart: s,
  2786. transformScale: a
  2787. } = this.props;
  2788. if (!s) return;
  2789. const u = {
  2790. top: 0,
  2791. left: 0
  2792. }, {
  2793. offsetParent: b
  2794. } = h;
  2795. if (!b) return;
  2796. const l = b.getBoundingClientRect(), g = h.getBoundingClientRect(), f = g.left / a, m = l.left / a, P = g.top / a, M = l.top / a;
  2797. u.left = f - m + b.scrollLeft, u.top = P - M + b.scrollTop, this.setState({
  2798. dragging: u
  2799. });
  2800. const {
  2801. x: j,
  2802. y: N
  2803. } = (0, o.calcXY)(this.getPositionParams(), u.top, u.left, this.props.w, this.props.h);
  2804. return s.call(this, this.props.i, j, N, {
  2805. e: S,
  2806. node: h,
  2807. newPosition: u
  2808. });
  2809. }), y(this, "onDrag", (S, R) => {
  2810. let {
  2811. node: h,
  2812. deltaX: s,
  2813. deltaY: a
  2814. } = R;
  2815. const {
  2816. onDrag: u
  2817. } = this.props;
  2818. if (!u) return;
  2819. if (!this.state.dragging)
  2820. throw new Error("onDrag called before onDragStart.");
  2821. let b = this.state.dragging.top + a, l = this.state.dragging.left + s;
  2822. const {
  2823. isBounded: g,
  2824. i: f,
  2825. w: m,
  2826. h: P,
  2827. containerWidth: M
  2828. } = this.props, j = this.getPositionParams();
  2829. if (g) {
  2830. const {
  2831. offsetParent: U
  2832. } = h;
  2833. if (U) {
  2834. const {
  2835. margin: k,
  2836. rowHeight: ie,
  2837. containerPadding: ee
  2838. } = this.props, A = U.clientHeight - (0, o.calcGridItemWHPx)(P, ie, k[1]);
  2839. b = (0, o.clamp)(b - ee[1], 0, A);
  2840. const F = (0, o.calcGridColWidth)(j), oe = M - (0, o.calcGridItemWHPx)(m, F, k[0]);
  2841. l = (0, o.clamp)(l - ee[0], 0, oe);
  2842. }
  2843. }
  2844. const N = {
  2845. top: b,
  2846. left: l
  2847. };
  2848. this.setState({
  2849. dragging: N
  2850. });
  2851. const {
  2852. containerPadding: I
  2853. } = this.props, {
  2854. x: O,
  2855. y: z
  2856. } = (0, o.calcXY)(j, b - I[1], l - I[0], m, P);
  2857. return u.call(this, f, O, z, {
  2858. e: S,
  2859. node: h,
  2860. newPosition: N
  2861. });
  2862. }), y(this, "onDragStop", (S, R) => {
  2863. let {
  2864. node: h
  2865. } = R;
  2866. const {
  2867. onDragStop: s
  2868. } = this.props;
  2869. if (!s) return;
  2870. if (!this.state.dragging)
  2871. throw new Error("onDragEnd called before onDragStart.");
  2872. const {
  2873. w: a,
  2874. h: u,
  2875. i: b,
  2876. containerPadding: l
  2877. } = this.props, {
  2878. left: g,
  2879. top: f
  2880. } = this.state.dragging, m = {
  2881. top: f,
  2882. left: g
  2883. };
  2884. this.setState({
  2885. dragging: null
  2886. });
  2887. const {
  2888. x: P,
  2889. y: M
  2890. } = (0, o.calcXY)(this.getPositionParams(), f - l[1], g - l[0], a, u);
  2891. return s.call(this, b, P, M, {
  2892. e: S,
  2893. node: h,
  2894. newPosition: m
  2895. });
  2896. }), y(this, "onResizeStop", (S, R, h) => this.onResizeHandler(S, R, h, "onResizeStop")), y(this, "onResizeStart", (S, R, h) => this.onResizeHandler(S, R, h, "onResizeStart")), y(this, "onResize", (S, R, h) => this.onResizeHandler(S, R, h, "onResize"));
  2897. }
  2898. shouldComponentUpdate(S, R) {
  2899. if (this.props.children !== S.children || this.props.droppingPosition !== S.droppingPosition) return !0;
  2900. 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, R);
  2901. return !(0, i.fastPositionEqual)(h, s) || this.props.useCSSTransforms !== S.useCSSTransforms;
  2902. }
  2903. componentDidMount() {
  2904. this.moveDroppingItem({});
  2905. }
  2906. componentDidUpdate(S) {
  2907. this.moveDroppingItem(S);
  2908. }
  2909. // When a droppingPosition is present, this means we should fire a move event, as if we had moved
  2910. // this element by `x, y` pixels.
  2911. moveDroppingItem(S) {
  2912. const {
  2913. droppingPosition: R
  2914. } = this.props;
  2915. if (!R) return;
  2916. const h = this.elementRef.current;
  2917. if (!h) return;
  2918. const s = S.droppingPosition || {
  2919. left: 0,
  2920. top: 0
  2921. }, {
  2922. dragging: a
  2923. } = this.state, u = a && R.left !== s.left || R.top !== s.top;
  2924. if (!a)
  2925. this.onDragStart(R.e, {
  2926. node: h,
  2927. deltaX: R.left,
  2928. deltaY: R.top
  2929. });
  2930. else if (u) {
  2931. const b = R.left - a.left, l = R.top - a.top;
  2932. this.onDrag(R.e, {
  2933. node: h,
  2934. deltaX: b,
  2935. deltaY: l
  2936. });
  2937. }
  2938. }
  2939. getPositionParams() {
  2940. let S = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.props;
  2941. return {
  2942. cols: S.cols,
  2943. containerPadding: S.containerPadding,
  2944. containerWidth: S.containerWidth,
  2945. margin: S.margin,
  2946. maxRows: S.maxRows,
  2947. rowHeight: S.rowHeight
  2948. };
  2949. }
  2950. /**
  2951. * This is where we set the grid item's absolute placement. It gets a little tricky because we want to do it
  2952. * well when server rendering, and the only way to do that properly is to use percentage width/left because
  2953. * we don't know exactly what the browser viewport is.
  2954. * Unfortunately, CSS Transforms, which are great for performance, break in this instance because a percentage
  2955. * left is relative to the item itself, not its container! So we cannot use them on the server rendering pass.
  2956. *
  2957. * @param {Object} pos Position object with width, height, left, top.
  2958. * @return {Object} Style object.
  2959. */
  2960. createStyle(S) {
  2961. const {
  2962. usePercentages: R,
  2963. containerWidth: h,
  2964. useCSSTransforms: s
  2965. } = this.props;
  2966. let a;
  2967. return s ? a = (0, i.setTransform)(S) : (a = (0, i.setTopLeft)(S), R && (a.left = (0, i.perc)(S.left / h), a.width = (0, i.perc)(S.width / h))), a;
  2968. }
  2969. /**
  2970. * Mix a Draggable instance into a child.
  2971. * @param {Element} child Child element.
  2972. * @return {Element} Child wrapped in Draggable.
  2973. */
  2974. mixinDraggable(S, R) {
  2975. return /* @__PURE__ */ t.default.createElement(r.DraggableCore, {
  2976. disabled: !R,
  2977. onStart: this.onDragStart,
  2978. onDrag: this.onDrag,
  2979. onStop: this.onDragStop,
  2980. handle: this.props.handle,
  2981. cancel: ".react-resizable-handle" + (this.props.cancel ? "," + this.props.cancel : ""),
  2982. scale: this.props.transformScale,
  2983. nodeRef: this.elementRef
  2984. }, S);
  2985. }
  2986. /**
  2987. * Utility function to setup callback handler definitions for
  2988. * similarily structured resize events.
  2989. */
  2990. curryResizeHandler(S, R) {
  2991. return (h, s) => (
  2992. /*: Function*/
  2993. R(h, s, S)
  2994. );
  2995. }
  2996. /**
  2997. * Mix a Resizable instance into a child.
  2998. * @param {Element} child Child element.
  2999. * @param {Object} position Position object (pixel values)
  3000. * @return {Element} Child wrapped in Resizable.
  3001. */
  3002. mixinResizable(S, R, h) {
  3003. const {
  3004. cols: s,
  3005. minW: a,
  3006. minH: u,
  3007. maxW: b,
  3008. maxH: l,
  3009. transformScale: g,
  3010. resizeHandles: f,
  3011. resizeHandle: m
  3012. } = this.props, P = this.getPositionParams(), M = (0, o.calcGridItemPosition)(P, 0, 0, s, 0).width, j = (0, o.calcGridItemPosition)(P, 0, 0, a, u), N = (0, o.calcGridItemPosition)(P, 0, 0, b, l), I = [j.width, j.height], O = [Math.min(N.width, M), Math.min(N.height, 1 / 0)];
  3013. return /* @__PURE__ */ t.default.createElement(
  3014. n.Resizable,
  3015. {
  3016. draggableOpts: {
  3017. disabled: !h
  3018. },
  3019. className: h ? void 0 : "react-resizable-hide",
  3020. width: R.width,
  3021. height: R.height,
  3022. minConstraints: I,
  3023. maxConstraints: O,
  3024. onResizeStop: this.curryResizeHandler(R, this.onResizeStop),
  3025. onResizeStart: this.curryResizeHandler(R, this.onResizeStart),
  3026. onResize: this.curryResizeHandler(R, this.onResize),
  3027. transformScale: g,
  3028. resizeHandles: f,
  3029. handle: m
  3030. },
  3031. S
  3032. );
  3033. }
  3034. /**
  3035. * Wrapper around resize events to provide more useful data.
  3036. */
  3037. onResizeHandler(S, R, h, s) {
  3038. let {
  3039. node: a,
  3040. size: u,
  3041. handle: b
  3042. } = R;
  3043. const l = this.props[s];
  3044. if (!l) return;
  3045. const {
  3046. x: g,
  3047. y: f,
  3048. i: m,
  3049. maxH: P,
  3050. minH: M,
  3051. containerWidth: j
  3052. } = this.props, {
  3053. minW: N,
  3054. maxW: I
  3055. } = this.props;
  3056. let O = u;
  3057. a && (O = (0, i.resizeItemInDirection)(b, h, u, j), this.setState({
  3058. resizing: s === "onResizeStop" ? null : O
  3059. }));
  3060. let {
  3061. w: z,
  3062. h: U
  3063. } = (0, o.calcWH)(this.getPositionParams(), O.width, O.height, g, f, b);
  3064. z = (0, o.clamp)(z, Math.max(N, 1), I), U = (0, o.clamp)(U, M, P), l.call(this, m, z, U, {
  3065. e: S,
  3066. node: a,
  3067. size: O,
  3068. handle: b
  3069. });
  3070. }
  3071. render() {
  3072. const {
  3073. x: S,
  3074. y: R,
  3075. w: h,
  3076. h: s,
  3077. isDraggable: a,
  3078. isResizable: u,
  3079. droppingPosition: b,
  3080. useCSSTransforms: l
  3081. } = this.props, g = (0, o.calcGridItemPosition)(this.getPositionParams(), S, R, h, s, this.state), f = t.default.Children.only(this.props.children);
  3082. let m = /* @__PURE__ */ t.default.cloneElement(f, {
  3083. ref: this.elementRef,
  3084. className: (0, v.default)("react-grid-item", f.props.className, this.props.className, {
  3085. static: this.props.static,
  3086. resizing: !!this.state.resizing,
  3087. "react-draggable": a,
  3088. "react-draggable-dragging": !!this.state.dragging,
  3089. dropping: !!b,
  3090. cssTransforms: l
  3091. }),
  3092. // We can set the width and height on the child, but unfortunately we can't set the position.
  3093. style: {
  3094. ...this.props.style,
  3095. ...f.props.style,
  3096. ...this.createStyle(g)
  3097. }
  3098. });
  3099. return m = this.mixinResizable(m, g, u), m = this.mixinDraggable(m, a), m;
  3100. }
  3101. };
  3102. return _t.default = _, y(_, "propTypes", {
  3103. // Children must be only a single element
  3104. children: e.default.element,
  3105. // General grid attributes
  3106. cols: e.default.number.isRequired,
  3107. containerWidth: e.default.number.isRequired,
  3108. rowHeight: e.default.number.isRequired,
  3109. margin: e.default.array.isRequired,
  3110. maxRows: e.default.number.isRequired,
  3111. containerPadding: e.default.array.isRequired,
  3112. // These are all in grid units
  3113. x: e.default.number.isRequired,
  3114. y: e.default.number.isRequired,
  3115. w: e.default.number.isRequired,
  3116. h: e.default.number.isRequired,
  3117. // All optional
  3118. minW: function(w, S) {
  3119. const R = w[S];
  3120. if (typeof R != "number") return new Error("minWidth not Number");
  3121. if (R > w.w || R > w.maxW) return new Error("minWidth larger than item width/maxWidth");
  3122. },
  3123. maxW: function(w, S) {
  3124. const R = w[S];
  3125. if (typeof R != "number") return new Error("maxWidth not Number");
  3126. if (R < w.w || R < w.minW) return new Error("maxWidth smaller than item width/minWidth");
  3127. },
  3128. minH: function(w, S) {
  3129. const R = w[S];
  3130. if (typeof R != "number") return new Error("minHeight not Number");
  3131. if (R > w.h || R > w.maxH) return new Error("minHeight larger than item height/maxHeight");
  3132. },
  3133. maxH: function(w, S) {
  3134. const R = w[S];
  3135. if (typeof R != "number") return new Error("maxHeight not Number");
  3136. if (R < w.h || R < w.minH) return new Error("maxHeight smaller than item height/minHeight");
  3137. },
  3138. // ID is nice to have for callbacks
  3139. i: e.default.string.isRequired,
  3140. // Resize handle options
  3141. resizeHandles: c.resizeHandleAxesType,
  3142. resizeHandle: c.resizeHandleType,
  3143. // Functions
  3144. onDragStop: e.default.func,
  3145. onDragStart: e.default.func,
  3146. onDrag: e.default.func,
  3147. onResizeStop: e.default.func,
  3148. onResizeStart: e.default.func,
  3149. onResize: e.default.func,
  3150. // Flags
  3151. isDraggable: e.default.bool.isRequired,
  3152. isResizable: e.default.bool.isRequired,
  3153. isBounded: e.default.bool.isRequired,
  3154. static: e.default.bool,
  3155. // Use CSS transforms instead of top/left
  3156. useCSSTransforms: e.default.bool.isRequired,
  3157. transformScale: e.default.number,
  3158. // Others
  3159. className: e.default.string,
  3160. // Selector for draggable handle
  3161. handle: e.default.string,
  3162. // Selector for draggable cancel (see react-draggable)
  3163. cancel: e.default.string,
  3164. // Current position of a dropping element
  3165. droppingPosition: e.default.shape({
  3166. e: e.default.object.isRequired,
  3167. left: e.default.number.isRequired,
  3168. top: e.default.number.isRequired
  3169. })
  3170. }), y(_, "defaultProps", {
  3171. className: "",
  3172. cancel: "",
  3173. handle: "",
  3174. minH: 1,
  3175. minW: 1,
  3176. maxH: 1 / 0,
  3177. maxW: 1 / 0,
  3178. transformScale: 1
  3179. }), _t;
  3180. }
  3181. var Yr;
  3182. function Zi() {
  3183. if (Yr) return Rt;
  3184. Yr = 1, Object.defineProperty(Rt, "__esModule", {
  3185. value: !0
  3186. }), Rt.default = void 0;
  3187. var t = y(Le), e = /* @__PURE__ */ ur(), r = v(dr()), n = St(), i = fr(), o = v(ea()), c = v(Ki());
  3188. function v(h) {
  3189. return h && h.__esModule ? h : { default: h };
  3190. }
  3191. function d(h) {
  3192. if (typeof WeakMap != "function") return null;
  3193. var s = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap();
  3194. return (d = function(u) {
  3195. return u ? a : s;
  3196. })(h);
  3197. }
  3198. function y(h, s) {
  3199. if (h && h.__esModule) return h;
  3200. if (h === null || typeof h != "object" && typeof h != "function") return { default: h };
  3201. var a = d(s);
  3202. if (a && a.has(h)) return a.get(h);
  3203. var u = { __proto__: null }, b = Object.defineProperty && Object.getOwnPropertyDescriptor;
  3204. for (var l in h) if (l !== "default" && Object.prototype.hasOwnProperty.call(h, l)) {
  3205. var g = b ? Object.getOwnPropertyDescriptor(h, l) : null;
  3206. g && (g.get || g.set) ? Object.defineProperty(u, l, g) : u[l] = h[l];
  3207. }
  3208. return u.default = h, a && a.set(h, u), u;
  3209. }
  3210. function p(h, s, a) {
  3211. return s = C(s), s in h ? Object.defineProperty(h, s, { value: a, enumerable: !0, configurable: !0, writable: !0 }) : h[s] = a, h;
  3212. }
  3213. function C(h) {
  3214. var s = _(h, "string");
  3215. return typeof s == "symbol" ? s : String(s);
  3216. }
  3217. function _(h, s) {
  3218. if (typeof h != "object" || h === null) return h;
  3219. var a = h[Symbol.toPrimitive];
  3220. if (a !== void 0) {
  3221. var u = a.call(h, s || "default");
  3222. if (typeof u != "object") return u;
  3223. throw new TypeError("@@toPrimitive must return a primitive value.");
  3224. }
  3225. return (s === "string" ? String : Number)(h);
  3226. }
  3227. const w = "react-grid-layout";
  3228. let S = !1;
  3229. try {
  3230. S = /firefox/i.test(navigator.userAgent);
  3231. } catch {
  3232. }
  3233. let R = class extends t.Component {
  3234. constructor() {
  3235. super(...arguments), p(this, "state", {
  3236. activeDrag: null,
  3237. layout: (0, n.synchronizeLayoutWithChildren)(
  3238. this.props.layout,
  3239. this.props.children,
  3240. this.props.cols,
  3241. // Legacy support for verticalCompact: false
  3242. (0, n.compactType)(this.props),
  3243. this.props.allowOverlap
  3244. ),
  3245. mounted: !1,
  3246. oldDragItem: null,
  3247. oldLayout: null,
  3248. oldResizeItem: null,
  3249. resizing: !1,
  3250. droppingDOMNode: null,
  3251. children: []
  3252. }), p(this, "dragEnterCounter", 0), p(this, "onDragStart", (s, a, u, b) => {
  3253. let {
  3254. e: l,
  3255. node: g
  3256. } = b;
  3257. const {
  3258. layout: f
  3259. } = this.state, m = (0, n.getLayoutItem)(f, s);
  3260. if (!m) return;
  3261. const P = {
  3262. w: m.w,
  3263. h: m.h,
  3264. x: m.x,
  3265. y: m.y,
  3266. placeholder: !0,
  3267. i: s
  3268. };
  3269. return this.setState({
  3270. oldDragItem: (0, n.cloneLayoutItem)(m),
  3271. oldLayout: f,
  3272. activeDrag: P
  3273. }), this.props.onDragStart(f, m, m, null, l, g);
  3274. }), p(this, "onDrag", (s, a, u, b) => {
  3275. let {
  3276. e: l,
  3277. node: g
  3278. } = b;
  3279. const {
  3280. oldDragItem: f
  3281. } = this.state;
  3282. let {
  3283. layout: m
  3284. } = this.state;
  3285. const {
  3286. cols: P,
  3287. allowOverlap: M,
  3288. preventCollision: j
  3289. } = this.props, N = (0, n.getLayoutItem)(m, s);
  3290. if (!N) return;
  3291. const I = {
  3292. w: N.w,
  3293. h: N.h,
  3294. x: N.x,
  3295. y: N.y,
  3296. placeholder: !0,
  3297. i: s
  3298. };
  3299. m = (0, n.moveElement)(m, N, a, u, !0, j, (0, n.compactType)(this.props), P, M), this.props.onDrag(m, f, N, I, l, g), this.setState({
  3300. layout: M ? m : (0, n.compact)(m, (0, n.compactType)(this.props), P),
  3301. activeDrag: I
  3302. });
  3303. }), p(this, "onDragStop", (s, a, u, b) => {
  3304. let {
  3305. e: l,
  3306. node: g
  3307. } = b;
  3308. if (!this.state.activeDrag) return;
  3309. const {
  3310. oldDragItem: f
  3311. } = this.state;
  3312. let {
  3313. layout: m
  3314. } = this.state;
  3315. const {
  3316. cols: P,
  3317. preventCollision: M,
  3318. allowOverlap: j
  3319. } = this.props, N = (0, n.getLayoutItem)(m, s);
  3320. if (!N) return;
  3321. m = (0, n.moveElement)(m, N, a, u, !0, M, (0, n.compactType)(this.props), P, j);
  3322. const O = j ? m : (0, n.compact)(m, (0, n.compactType)(this.props), P);
  3323. this.props.onDragStop(O, f, N, null, l, g);
  3324. const {
  3325. oldLayout: z
  3326. } = this.state;
  3327. this.setState({
  3328. activeDrag: null,
  3329. layout: O,
  3330. oldDragItem: null,
  3331. oldLayout: null
  3332. }), this.onLayoutMaybeChanged(O, z);
  3333. }), p(this, "onResizeStart", (s, a, u, b) => {
  3334. let {
  3335. e: l,
  3336. node: g
  3337. } = b;
  3338. const {
  3339. layout: f
  3340. } = this.state, m = (0, n.getLayoutItem)(f, s);
  3341. m && (this.setState({
  3342. oldResizeItem: (0, n.cloneLayoutItem)(m),
  3343. oldLayout: this.state.layout,
  3344. resizing: !0
  3345. }), this.props.onResizeStart(f, m, m, null, l, g));
  3346. }), p(this, "onResize", (s, a, u, b) => {
  3347. let {
  3348. e: l,
  3349. node: g,
  3350. size: f,
  3351. handle: m
  3352. } = b;
  3353. const {
  3354. oldResizeItem: P
  3355. } = this.state, {
  3356. layout: M
  3357. } = this.state, {
  3358. cols: j,
  3359. preventCollision: N,
  3360. allowOverlap: I
  3361. } = this.props;
  3362. let O = !1, z, U, k;
  3363. const [ie, ee] = (0, n.withLayoutItem)(M, s, (F) => {
  3364. let oe;
  3365. return U = F.x, k = F.y, ["sw", "w", "nw", "n", "ne"].indexOf(m) !== -1 && (["sw", "nw", "w"].indexOf(m) !== -1 && (U = F.x + (F.w - a), a = F.x !== U && U < 0 ? F.w : a, U = U < 0 ? 0 : U), ["ne", "n", "nw"].indexOf(m) !== -1 && (k = F.y + (F.h - u), u = F.y !== k && k < 0 ? F.h : u, k = k < 0 ? 0 : k), O = !0), N && !I && (oe = (0, n.getAllCollisions)(M, {
  3366. ...F,
  3367. w: a,
  3368. h: u,
  3369. x: U,
  3370. y: k
  3371. }).filter((de) => de.i !== F.i).length > 0, oe && (k = F.y, u = F.h, U = F.x, a = F.w, O = !1)), F.w = a, F.h = u, F;
  3372. });
  3373. if (!ee) return;
  3374. z = ie, O && (z = (0, n.moveElement)(ie, ee, U, k, !0, this.props.preventCollision, (0, n.compactType)(this.props), j, I));
  3375. const A = {
  3376. w: ee.w,
  3377. h: ee.h,
  3378. x: ee.x,
  3379. y: ee.y,
  3380. static: !0,
  3381. i: s
  3382. };
  3383. this.props.onResize(z, P, ee, A, l, g), this.setState({
  3384. layout: I ? z : (0, n.compact)(z, (0, n.compactType)(this.props), j),
  3385. activeDrag: A
  3386. });
  3387. }), p(this, "onResizeStop", (s, a, u, b) => {
  3388. let {
  3389. e: l,
  3390. node: g
  3391. } = b;
  3392. const {
  3393. layout: f,
  3394. oldResizeItem: m
  3395. } = this.state, {
  3396. cols: P,
  3397. allowOverlap: M
  3398. } = this.props, j = (0, n.getLayoutItem)(f, s), N = M ? f : (0, n.compact)(f, (0, n.compactType)(this.props), P);
  3399. this.props.onResizeStop(N, m, j, null, l, g);
  3400. const {
  3401. oldLayout: I
  3402. } = this.state;
  3403. this.setState({
  3404. activeDrag: null,
  3405. layout: N,
  3406. oldResizeItem: null,
  3407. oldLayout: null,
  3408. resizing: !1
  3409. }), this.onLayoutMaybeChanged(N, I);
  3410. }), p(this, "onDragOver", (s) => {
  3411. var ie;
  3412. if (s.preventDefault(), s.stopPropagation(), S && // $FlowIgnore can't figure this out
  3413. !((ie = s.nativeEvent.target) != null && ie.classList.contains(w)))
  3414. return !1;
  3415. const {
  3416. droppingItem: a,
  3417. onDropDragOver: u,
  3418. margin: b,
  3419. cols: l,
  3420. rowHeight: g,
  3421. maxRows: f,
  3422. width: m,
  3423. containerPadding: P,
  3424. transformScale: M
  3425. } = this.props, j = u == null ? void 0 : u(s);
  3426. if (j === !1)
  3427. return this.state.droppingDOMNode && this.removeDroppingPlaceholder(), !1;
  3428. const N = {
  3429. ...a,
  3430. ...j
  3431. }, {
  3432. layout: I
  3433. } = this.state, O = s.currentTarget.getBoundingClientRect(), z = s.clientX - O.left, U = s.clientY - O.top, k = {
  3434. left: z / M,
  3435. top: U / M,
  3436. e: s
  3437. };
  3438. if (this.state.droppingDOMNode) {
  3439. if (this.state.droppingPosition) {
  3440. const {
  3441. left: ee,
  3442. top: A
  3443. } = this.state.droppingPosition;
  3444. (ee != z || A != U) && this.setState({
  3445. droppingPosition: k
  3446. });
  3447. }
  3448. } else {
  3449. const ee = {
  3450. cols: l,
  3451. margin: b,
  3452. maxRows: f,
  3453. rowHeight: g,
  3454. containerWidth: m,
  3455. containerPadding: P || b
  3456. }, A = (0, i.calcXY)(ee, U, z, N.w, N.h);
  3457. this.setState({
  3458. droppingDOMNode: /* @__PURE__ */ t.createElement("div", {
  3459. key: N.i
  3460. }),
  3461. droppingPosition: k,
  3462. layout: [...I, {
  3463. ...N,
  3464. x: A.x,
  3465. y: A.y,
  3466. static: !1,
  3467. isDraggable: !0
  3468. }]
  3469. });
  3470. }
  3471. }), p(this, "removeDroppingPlaceholder", () => {
  3472. const {
  3473. droppingItem: s,
  3474. cols: a
  3475. } = this.props, {
  3476. layout: u
  3477. } = this.state, b = (0, n.compact)(u.filter((l) => l.i !== s.i), (0, n.compactType)(this.props), a, this.props.allowOverlap);
  3478. this.setState({
  3479. layout: b,
  3480. droppingDOMNode: null,
  3481. activeDrag: null,
  3482. droppingPosition: void 0
  3483. });
  3484. }), p(this, "onDragLeave", (s) => {
  3485. s.preventDefault(), s.stopPropagation(), this.dragEnterCounter--, this.dragEnterCounter === 0 && this.removeDroppingPlaceholder();
  3486. }), p(this, "onDragEnter", (s) => {
  3487. s.preventDefault(), s.stopPropagation(), this.dragEnterCounter++;
  3488. }), p(this, "onDrop", (s) => {
  3489. s.preventDefault(), s.stopPropagation();
  3490. const {
  3491. droppingItem: a
  3492. } = this.props, {
  3493. layout: u
  3494. } = this.state, b = u.find((l) => l.i === a.i);
  3495. this.dragEnterCounter = 0, this.removeDroppingPlaceholder(), this.props.onDrop(u, b, s);
  3496. });
  3497. }
  3498. componentDidMount() {
  3499. this.setState({
  3500. mounted: !0
  3501. }), this.onLayoutMaybeChanged(this.state.layout, this.props.layout);
  3502. }
  3503. static getDerivedStateFromProps(s, a) {
  3504. let u;
  3505. 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 ? {
  3506. layout: (0, n.synchronizeLayoutWithChildren)(u, s.children, s.cols, (0, n.compactType)(s), s.allowOverlap),
  3507. // We need to save these props to state for using
  3508. // getDerivedStateFromProps instead of componentDidMount (in which we would get extra rerender)
  3509. compactType: s.compactType,
  3510. children: s.children,
  3511. propsLayout: s.layout
  3512. } : null);
  3513. }
  3514. shouldComponentUpdate(s, a) {
  3515. return (
  3516. // NOTE: this is almost always unequal. Therefore the only way to get better performance
  3517. // from SCU is if the user intentionally memoizes children. If they do, and they can
  3518. // handle changes properly, performance will increase.
  3519. 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
  3520. );
  3521. }
  3522. componentDidUpdate(s, a) {
  3523. if (!this.state.activeDrag) {
  3524. const u = this.state.layout, b = a.layout;
  3525. this.onLayoutMaybeChanged(u, b);
  3526. }
  3527. }
  3528. /**
  3529. * Calculates a pixel value for the container.
  3530. * @return {String} Container height in pixels.
  3531. */
  3532. containerHeight() {
  3533. if (!this.props.autoSize) return;
  3534. const s = (0, n.bottom)(this.state.layout), a = this.props.containerPadding ? this.props.containerPadding[1] : this.props.margin[1];
  3535. return s * this.props.rowHeight + (s - 1) * this.props.margin[1] + a * 2 + "px";
  3536. }
  3537. onLayoutMaybeChanged(s, a) {
  3538. a || (a = this.state.layout), (0, e.deepEqual)(a, s) || this.props.onLayoutChange(s);
  3539. }
  3540. /**
  3541. * Create a placeholder object.
  3542. * @return {Element} Placeholder div.
  3543. */
  3544. placeholder() {
  3545. const {
  3546. activeDrag: s
  3547. } = this.state;
  3548. if (!s) return null;
  3549. const {
  3550. width: a,
  3551. cols: u,
  3552. margin: b,
  3553. containerPadding: l,
  3554. rowHeight: g,
  3555. maxRows: f,
  3556. useCSSTransforms: m,
  3557. transformScale: P
  3558. } = this.props;
  3559. return /* @__PURE__ */ t.createElement(o.default, {
  3560. w: s.w,
  3561. h: s.h,
  3562. x: s.x,
  3563. y: s.y,
  3564. i: s.i,
  3565. className: `react-grid-placeholder ${this.state.resizing ? "placeholder-resizing" : ""}`,
  3566. containerWidth: a,
  3567. cols: u,
  3568. margin: b,
  3569. containerPadding: l || b,
  3570. maxRows: f,
  3571. rowHeight: g,
  3572. isDraggable: !1,
  3573. isResizable: !1,
  3574. isBounded: !1,
  3575. useCSSTransforms: m,
  3576. transformScale: P
  3577. }, /* @__PURE__ */ t.createElement("div", null));
  3578. }
  3579. /**
  3580. * Given a grid item, set its style attributes & surround in a <Draggable>.
  3581. * @param {Element} child React element.
  3582. * @return {Element} Element wrapped in draggable and properly placed.
  3583. */
  3584. processGridItem(s, a) {
  3585. if (!s || !s.key) return;
  3586. const u = (0, n.getLayoutItem)(this.state.layout, String(s.key));
  3587. if (!u) return null;
  3588. const {
  3589. width: b,
  3590. cols: l,
  3591. margin: g,
  3592. containerPadding: f,
  3593. rowHeight: m,
  3594. maxRows: P,
  3595. isDraggable: M,
  3596. isResizable: j,
  3597. isBounded: N,
  3598. useCSSTransforms: I,
  3599. transformScale: O,
  3600. draggableCancel: z,
  3601. draggableHandle: U,
  3602. resizeHandles: k,
  3603. resizeHandle: ie
  3604. } = this.props, {
  3605. mounted: ee,
  3606. droppingPosition: A
  3607. } = this.state, F = typeof u.isDraggable == "boolean" ? u.isDraggable : !u.static && M, oe = typeof u.isResizable == "boolean" ? u.isResizable : !u.static && j, se = u.resizeHandles || k, de = F && N && u.isBounded !== !1;
  3608. return /* @__PURE__ */ t.createElement(o.default, {
  3609. containerWidth: b,
  3610. cols: l,
  3611. margin: g,
  3612. containerPadding: f || g,
  3613. maxRows: P,
  3614. rowHeight: m,
  3615. cancel: z,
  3616. handle: U,
  3617. onDragStop: this.onDragStop,
  3618. onDragStart: this.onDragStart,
  3619. onDrag: this.onDrag,
  3620. onResizeStart: this.onResizeStart,
  3621. onResize: this.onResize,
  3622. onResizeStop: this.onResizeStop,
  3623. isDraggable: F,
  3624. isResizable: oe,
  3625. isBounded: de,
  3626. useCSSTransforms: I && ee,
  3627. usePercentages: !ee,
  3628. transformScale: O,
  3629. w: u.w,
  3630. h: u.h,
  3631. x: u.x,
  3632. y: u.y,
  3633. i: u.i,
  3634. minH: u.minH,
  3635. minW: u.minW,
  3636. maxH: u.maxH,
  3637. maxW: u.maxW,
  3638. static: u.static,
  3639. droppingPosition: a ? A : void 0,
  3640. resizeHandles: se,
  3641. resizeHandle: ie
  3642. }, s);
  3643. }
  3644. render() {
  3645. const {
  3646. className: s,
  3647. style: a,
  3648. isDroppable: u,
  3649. innerRef: b
  3650. } = this.props, l = (0, r.default)(w, s), g = {
  3651. height: this.containerHeight(),
  3652. ...a
  3653. };
  3654. return /* @__PURE__ */ t.createElement("div", {
  3655. ref: b,
  3656. className: l,
  3657. style: g,
  3658. onDrop: u ? this.onDrop : n.noop,
  3659. onDragLeave: u ? this.onDragLeave : n.noop,
  3660. onDragEnter: u ? this.onDragEnter : n.noop,
  3661. onDragOver: u ? this.onDragOver : n.noop
  3662. }, t.Children.map(this.props.children, (f) => this.processGridItem(f)), u && this.state.droppingDOMNode && this.processGridItem(this.state.droppingDOMNode, !0), this.placeholder());
  3663. }
  3664. };
  3665. return Rt.default = R, p(R, "displayName", "ReactGridLayout"), p(R, "propTypes", c.default), p(R, "defaultProps", {
  3666. autoSize: !0,
  3667. cols: 12,
  3668. className: "",
  3669. style: {},
  3670. draggableHandle: "",
  3671. draggableCancel: "",
  3672. containerPadding: null,
  3673. rowHeight: 150,
  3674. maxRows: 1 / 0,
  3675. // infinite vertical growth
  3676. layout: [],
  3677. margin: [10, 10],
  3678. isBounded: !1,
  3679. isDraggable: !0,
  3680. isResizable: !0,
  3681. allowOverlap: !1,
  3682. isDroppable: !1,
  3683. useCSSTransforms: !0,
  3684. transformScale: 1,
  3685. verticalCompact: !0,
  3686. compactType: "vertical",
  3687. preventCollision: !1,
  3688. droppingItem: {
  3689. i: "__dropping-elem__",
  3690. h: 1,
  3691. w: 1
  3692. },
  3693. resizeHandles: ["se"],
  3694. onLayoutChange: n.noop,
  3695. onDragStart: n.noop,
  3696. onDrag: n.noop,
  3697. onDragStop: n.noop,
  3698. onResizeStart: n.noop,
  3699. onResize: n.noop,
  3700. onResizeStop: n.noop,
  3701. onDrop: n.noop,
  3702. onDropDragOver: n.noop
  3703. }), Rt;
  3704. }
  3705. var Dt = {}, rt = {}, Kr;
  3706. function Ji() {
  3707. if (Kr) return rt;
  3708. Kr = 1, Object.defineProperty(rt, "__esModule", {
  3709. value: !0
  3710. }), rt.findOrGenerateResponsiveLayout = n, rt.getBreakpointFromWidth = e, rt.getColsFromBreakpoint = r, rt.sortBreakpoints = i;
  3711. var t = St();
  3712. function e(o, c) {
  3713. const v = i(o);
  3714. let d = v[0];
  3715. for (let y = 1, p = v.length; y < p; y++) {
  3716. const C = v[y];
  3717. c > o[C] && (d = C);
  3718. }
  3719. return d;
  3720. }
  3721. function r(o, c) {
  3722. if (!c[o])
  3723. throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint " + o + " is missing!");
  3724. return c[o];
  3725. }
  3726. function n(o, c, v, d, y, p) {
  3727. if (o[v]) return (0, t.cloneLayout)(o[v]);
  3728. let C = o[d];
  3729. const _ = i(c), w = _.slice(_.indexOf(v));
  3730. for (let S = 0, R = w.length; S < R; S++) {
  3731. const h = w[S];
  3732. if (o[h]) {
  3733. C = o[h];
  3734. break;
  3735. }
  3736. }
  3737. return C = (0, t.cloneLayout)(C || []), (0, t.compact)((0, t.correctBounds)(C, {
  3738. cols: y
  3739. }), p, y);
  3740. }
  3741. function i(o) {
  3742. return Object.keys(o).sort(function(v, d) {
  3743. return o[v] - o[d];
  3744. });
  3745. }
  3746. return rt;
  3747. }
  3748. var Zr;
  3749. function ta() {
  3750. if (Zr) return Dt;
  3751. Zr = 1, Object.defineProperty(Dt, "__esModule", {
  3752. value: !0
  3753. }), Dt.default = void 0;
  3754. var t = d(Le), e = c(/* @__PURE__ */ Qe()), r = /* @__PURE__ */ ur(), n = St(), i = Ji(), o = c(Zi());
  3755. function c(h) {
  3756. return h && h.__esModule ? h : { default: h };
  3757. }
  3758. function v(h) {
  3759. if (typeof WeakMap != "function") return null;
  3760. var s = /* @__PURE__ */ new WeakMap(), a = /* @__PURE__ */ new WeakMap();
  3761. return (v = function(u) {
  3762. return u ? a : s;
  3763. })(h);
  3764. }
  3765. function d(h, s) {
  3766. if (h && h.__esModule) return h;
  3767. if (h === null || typeof h != "object" && typeof h != "function") return { default: h };
  3768. var a = v(s);
  3769. if (a && a.has(h)) return a.get(h);
  3770. var u = { __proto__: null }, b = Object.defineProperty && Object.getOwnPropertyDescriptor;
  3771. for (var l in h) if (l !== "default" && Object.prototype.hasOwnProperty.call(h, l)) {
  3772. var g = b ? Object.getOwnPropertyDescriptor(h, l) : null;
  3773. g && (g.get || g.set) ? Object.defineProperty(u, l, g) : u[l] = h[l];
  3774. }
  3775. return u.default = h, a && a.set(h, u), u;
  3776. }
  3777. function y() {
  3778. return y = Object.assign ? Object.assign.bind() : function(h) {
  3779. for (var s = 1; s < arguments.length; s++) {
  3780. var a = arguments[s];
  3781. for (var u in a)
  3782. Object.prototype.hasOwnProperty.call(a, u) && (h[u] = a[u]);
  3783. }
  3784. return h;
  3785. }, y.apply(this, arguments);
  3786. }
  3787. function p(h, s, a) {
  3788. return s = C(s), s in h ? Object.defineProperty(h, s, { value: a, enumerable: !0, configurable: !0, writable: !0 }) : h[s] = a, h;
  3789. }
  3790. function C(h) {
  3791. var s = _(h, "string");
  3792. return typeof s == "symbol" ? s : String(s);
  3793. }
  3794. function _(h, s) {
  3795. if (typeof h != "object" || h === null) return h;
  3796. var a = h[Symbol.toPrimitive];
  3797. if (a !== void 0) {
  3798. var u = a.call(h, s || "default");
  3799. if (typeof u != "object") return u;
  3800. throw new TypeError("@@toPrimitive must return a primitive value.");
  3801. }
  3802. return (s === "string" ? String : Number)(h);
  3803. }
  3804. const w = (h) => Object.prototype.toString.call(h);
  3805. function S(h, s) {
  3806. return h == null ? null : Array.isArray(h) ? h : h[s];
  3807. }
  3808. let R = class extends t.Component {
  3809. constructor() {
  3810. super(...arguments), p(this, "state", this.generateInitialState()), p(this, "onLayoutChange", (s) => {
  3811. this.props.onLayoutChange(s, {
  3812. ...this.props.layouts,
  3813. [this.state.breakpoint]: s
  3814. });
  3815. });
  3816. }
  3817. generateInitialState() {
  3818. const {
  3819. width: s,
  3820. breakpoints: a,
  3821. layouts: u,
  3822. cols: b
  3823. } = this.props, l = (0, i.getBreakpointFromWidth)(a, s), g = (0, i.getColsFromBreakpoint)(l, b), f = this.props.verticalCompact === !1 ? null : this.props.compactType;
  3824. return {
  3825. layout: (0, i.findOrGenerateResponsiveLayout)(u, a, l, l, g, f),
  3826. breakpoint: l,
  3827. cols: g
  3828. };
  3829. }
  3830. static getDerivedStateFromProps(s, a) {
  3831. if (!(0, r.deepEqual)(s.layouts, a.layouts)) {
  3832. const {
  3833. breakpoint: u,
  3834. cols: b
  3835. } = a;
  3836. return {
  3837. layout: (0, i.findOrGenerateResponsiveLayout)(s.layouts, s.breakpoints, u, u, b, s.compactType),
  3838. layouts: s.layouts
  3839. };
  3840. }
  3841. return null;
  3842. }
  3843. componentDidUpdate(s) {
  3844. (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);
  3845. }
  3846. /**
  3847. * When the width changes work through breakpoints and reset state with the new width & breakpoint.
  3848. * Width changes are necessary to figure out the widget widths.
  3849. */
  3850. onWidthChange(s) {
  3851. const {
  3852. breakpoints: a,
  3853. cols: u,
  3854. layouts: b,
  3855. compactType: l
  3856. } = 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 = {
  3857. ...b
  3858. };
  3859. if (f !== g || s.breakpoints !== a || s.cols !== u) {
  3860. f in P || (P[f] = (0, n.cloneLayout)(this.state.layout));
  3861. let N = (0, i.findOrGenerateResponsiveLayout)(P, a, g, f, m, l);
  3862. N = (0, n.synchronizeLayoutWithChildren)(N, this.props.children, m, l, this.props.allowOverlap), P[g] = N, this.props.onLayoutChange(N, P), this.props.onBreakpointChange(g, m), this.setState({
  3863. breakpoint: g,
  3864. layout: N,
  3865. cols: m
  3866. });
  3867. }
  3868. const M = S(this.props.margin, g), j = S(this.props.containerPadding, g);
  3869. this.props.onWidthChange(this.props.width, M, m, j);
  3870. }
  3871. render() {
  3872. const {
  3873. breakpoint: s,
  3874. breakpoints: a,
  3875. cols: u,
  3876. layouts: b,
  3877. margin: l,
  3878. containerPadding: g,
  3879. onBreakpointChange: f,
  3880. onLayoutChange: m,
  3881. onWidthChange: P,
  3882. ...M
  3883. } = this.props;
  3884. return /* @__PURE__ */ t.createElement(o.default, y({}, M, {
  3885. // $FlowIgnore should allow nullable here due to DefaultProps
  3886. margin: S(l, this.state.breakpoint),
  3887. containerPadding: S(g, this.state.breakpoint),
  3888. onLayoutChange: this.onLayoutChange,
  3889. layout: this.state.layout,
  3890. cols: this.state.cols
  3891. }));
  3892. }
  3893. };
  3894. return Dt.default = R, p(R, "propTypes", {
  3895. //
  3896. // Basic props
  3897. //
  3898. // Optional, but if you are managing width yourself you may want to set the breakpoint
  3899. // yourself as well.
  3900. breakpoint: e.default.string,
  3901. // {name: pxVal}, e.g. {lg: 1200, md: 996, sm: 768, xs: 480}
  3902. breakpoints: e.default.object,
  3903. allowOverlap: e.default.bool,
  3904. // # of cols. This is a breakpoint -> cols map
  3905. cols: e.default.object,
  3906. // # of margin. This is a breakpoint -> margin map
  3907. // e.g. { lg: [5, 5], md: [10, 10], sm: [15, 15] }
  3908. // Margin between items [x, y] in px
  3909. // e.g. [10, 10]
  3910. margin: e.default.oneOfType([e.default.array, e.default.object]),
  3911. // # of containerPadding. This is a breakpoint -> containerPadding map
  3912. // e.g. { lg: [5, 5], md: [10, 10], sm: [15, 15] }
  3913. // Padding inside the container [x, y] in px
  3914. // e.g. [10, 10]
  3915. containerPadding: e.default.oneOfType([e.default.array, e.default.object]),
  3916. // layouts is an object mapping breakpoints to layouts.
  3917. // e.g. {lg: Layout, md: Layout, ...}
  3918. layouts(h, s) {
  3919. if (w(h[s]) !== "[object Object]")
  3920. throw new Error("Layout property must be an object. Received: " + w(h[s]));
  3921. Object.keys(h[s]).forEach((a) => {
  3922. if (!(a in h.breakpoints))
  3923. throw new Error("Each key in layouts must align with a key in breakpoints.");
  3924. (0, n.validateLayout)(h.layouts[a], "layouts." + a);
  3925. });
  3926. },
  3927. // The width of this component.
  3928. // Required in this propTypes stanza because generateInitialState() will fail without it.
  3929. width: e.default.number.isRequired,
  3930. //
  3931. // Callbacks
  3932. //
  3933. // Calls back with breakpoint and new # cols
  3934. onBreakpointChange: e.default.func,
  3935. // Callback so you can save the layout.
  3936. // Calls back with (currentLayout, allLayouts). allLayouts are keyed by breakpoint.
  3937. onLayoutChange: e.default.func,
  3938. // Calls back with (containerWidth, margin, cols, containerPadding)
  3939. onWidthChange: e.default.func
  3940. }), p(R, "defaultProps", {
  3941. breakpoints: {
  3942. lg: 1200,
  3943. md: 996,
  3944. sm: 768,
  3945. xs: 480,
  3946. xxs: 0
  3947. },
  3948. cols: {
  3949. lg: 12,
  3950. md: 10,
  3951. sm: 6,
  3952. xs: 4,
  3953. xxs: 2
  3954. },
  3955. containerPadding: {
  3956. lg: null,
  3957. md: null,
  3958. sm: null,
  3959. xs: null,
  3960. xxs: null
  3961. },
  3962. layouts: {},
  3963. margin: [10, 10],
  3964. allowOverlap: !1,
  3965. onBreakpointChange: n.noop,
  3966. onLayoutChange: n.noop,
  3967. onWidthChange: n.noop
  3968. }), Dt;
  3969. }
  3970. var nn = {}, Qi = function() {
  3971. if (typeof Map < "u")
  3972. return Map;
  3973. function t(e, r) {
  3974. var n = -1;
  3975. return e.some(function(i, o) {
  3976. return i[0] === r ? (n = o, !0) : !1;
  3977. }), n;
  3978. }
  3979. return (
  3980. /** @class */
  3981. function() {
  3982. function e() {
  3983. this.__entries__ = [];
  3984. }
  3985. return Object.defineProperty(e.prototype, "size", {
  3986. /**
  3987. * @returns {boolean}
  3988. */
  3989. get: function() {
  3990. return this.__entries__.length;
  3991. },
  3992. enumerable: !0,
  3993. configurable: !0
  3994. }), e.prototype.get = function(r) {
  3995. var n = t(this.__entries__, r), i = this.__entries__[n];
  3996. return i && i[1];
  3997. }, e.prototype.set = function(r, n) {
  3998. var i = t(this.__entries__, r);
  3999. ~i ? this.__entries__[i][1] = n : this.__entries__.push([r, n]);
  4000. }, e.prototype.delete = function(r) {
  4001. var n = this.__entries__, i = t(n, r);
  4002. ~i && n.splice(i, 1);
  4003. }, e.prototype.has = function(r) {
  4004. return !!~t(this.__entries__, r);
  4005. }, e.prototype.clear = function() {
  4006. this.__entries__.splice(0);
  4007. }, e.prototype.forEach = function(r, n) {
  4008. n === void 0 && (n = null);
  4009. for (var i = 0, o = this.__entries__; i < o.length; i++) {
  4010. var c = o[i];
  4011. r.call(n, c[1], c[0]);
  4012. }
  4013. }, e;
  4014. }()
  4015. );
  4016. }(), er = typeof window < "u" && typeof document < "u" && window.document === document, vn = function() {
  4017. 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")();
  4018. }(), na = function() {
  4019. return typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(vn) : function(t) {
  4020. return setTimeout(function() {
  4021. return t(Date.now());
  4022. }, 1e3 / 60);
  4023. };
  4024. }(), ra = 2;
  4025. function ia(t, e) {
  4026. var r = !1, n = !1, i = 0;
  4027. function o() {
  4028. r && (r = !1, t()), n && v();
  4029. }
  4030. function c() {
  4031. na(o);
  4032. }
  4033. function v() {
  4034. var d = Date.now();
  4035. if (r) {
  4036. if (d - i < ra)
  4037. return;
  4038. n = !0;
  4039. } else
  4040. r = !0, n = !1, setTimeout(c, e);
  4041. i = d;
  4042. }
  4043. return v;
  4044. }
  4045. var oa = 20, sa = ["top", "right", "bottom", "left", "width", "height", "size", "weight"], aa = typeof MutationObserver < "u", la = (
  4046. /** @class */
  4047. function() {
  4048. function t() {
  4049. this.connected_ = !1, this.mutationEventsAdded_ = !1, this.mutationsObserver_ = null, this.observers_ = [], this.onTransitionEnd_ = this.onTransitionEnd_.bind(this), this.refresh = ia(this.refresh.bind(this), oa);
  4050. }
  4051. return t.prototype.addObserver = function(e) {
  4052. ~this.observers_.indexOf(e) || this.observers_.push(e), this.connected_ || this.connect_();
  4053. }, t.prototype.removeObserver = function(e) {
  4054. var r = this.observers_, n = r.indexOf(e);
  4055. ~n && r.splice(n, 1), !r.length && this.connected_ && this.disconnect_();
  4056. }, t.prototype.refresh = function() {
  4057. var e = this.updateObservers_();
  4058. e && this.refresh();
  4059. }, t.prototype.updateObservers_ = function() {
  4060. var e = this.observers_.filter(function(r) {
  4061. return r.gatherActive(), r.hasActive();
  4062. });
  4063. return e.forEach(function(r) {
  4064. return r.broadcastActive();
  4065. }), e.length > 0;
  4066. }, t.prototype.connect_ = function() {
  4067. !er || this.connected_ || (document.addEventListener("transitionend", this.onTransitionEnd_), window.addEventListener("resize", this.refresh), aa ? (this.mutationsObserver_ = new MutationObserver(this.refresh), this.mutationsObserver_.observe(document, {
  4068. attributes: !0,
  4069. childList: !0,
  4070. characterData: !0,
  4071. subtree: !0
  4072. })) : (document.addEventListener("DOMSubtreeModified", this.refresh), this.mutationEventsAdded_ = !0), this.connected_ = !0);
  4073. }, t.prototype.disconnect_ = function() {
  4074. !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_ = !1, this.connected_ = !1);
  4075. }, t.prototype.onTransitionEnd_ = function(e) {
  4076. var r = e.propertyName, n = r === void 0 ? "" : r, i = sa.some(function(o) {
  4077. return !!~n.indexOf(o);
  4078. });
  4079. i && this.refresh();
  4080. }, t.getInstance = function() {
  4081. return this.instance_ || (this.instance_ = new t()), this.instance_;
  4082. }, t.instance_ = null, t;
  4083. }()
  4084. ), eo = function(t, e) {
  4085. for (var r = 0, n = Object.keys(e); r < n.length; r++) {
  4086. var i = n[r];
  4087. Object.defineProperty(t, i, {
  4088. value: e[i],
  4089. enumerable: !1,
  4090. writable: !1,
  4091. configurable: !0
  4092. });
  4093. }
  4094. return t;
  4095. }, gt = function(t) {
  4096. var e = t && t.ownerDocument && t.ownerDocument.defaultView;
  4097. return e || vn;
  4098. }, to = Nn(0, 0, 0, 0);
  4099. function yn(t) {
  4100. return parseFloat(t) || 0;
  4101. }
  4102. function Jr(t) {
  4103. for (var e = [], r = 1; r < arguments.length; r++)
  4104. e[r - 1] = arguments[r];
  4105. return e.reduce(function(n, i) {
  4106. var o = t["border-" + i + "-width"];
  4107. return n + yn(o);
  4108. }, 0);
  4109. }
  4110. function ca(t) {
  4111. for (var e = ["top", "right", "bottom", "left"], r = {}, n = 0, i = e; n < i.length; n++) {
  4112. var o = i[n], c = t["padding-" + o];
  4113. r[o] = yn(c);
  4114. }
  4115. return r;
  4116. }
  4117. function ua(t) {
  4118. var e = t.getBBox();
  4119. return Nn(0, 0, e.width, e.height);
  4120. }
  4121. function da(t) {
  4122. var e = t.clientWidth, r = t.clientHeight;
  4123. if (!e && !r)
  4124. return to;
  4125. 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);
  4126. 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)) {
  4127. var y = Math.round(v + o) - e, p = Math.round(d + c) - r;
  4128. Math.abs(y) !== 1 && (v -= y), Math.abs(p) !== 1 && (d -= p);
  4129. }
  4130. return Nn(i.left, i.top, v, d);
  4131. }
  4132. var fa = /* @__PURE__ */ function() {
  4133. return typeof SVGGraphicsElement < "u" ? function(t) {
  4134. return t instanceof gt(t).SVGGraphicsElement;
  4135. } : function(t) {
  4136. return t instanceof gt(t).SVGElement && typeof t.getBBox == "function";
  4137. };
  4138. }();
  4139. function ha(t) {
  4140. return t === gt(t).document.documentElement;
  4141. }
  4142. function pa(t) {
  4143. return er ? fa(t) ? ua(t) : da(t) : to;
  4144. }
  4145. function ga(t) {
  4146. var e = t.x, r = t.y, n = t.width, i = t.height, o = typeof DOMRectReadOnly < "u" ? DOMRectReadOnly : Object, c = Object.create(o.prototype);
  4147. return eo(c, {
  4148. x: e,
  4149. y: r,
  4150. width: n,
  4151. height: i,
  4152. top: r,
  4153. right: e + n,
  4154. bottom: i + r,
  4155. left: e
  4156. }), c;
  4157. }
  4158. function Nn(t, e, r, n) {
  4159. return { x: t, y: e, width: r, height: n };
  4160. }
  4161. var ma = (
  4162. /** @class */
  4163. function() {
  4164. function t(e) {
  4165. this.broadcastWidth = 0, this.broadcastHeight = 0, this.contentRect_ = Nn(0, 0, 0, 0), this.target = e;
  4166. }
  4167. return t.prototype.isActive = function() {
  4168. var e = pa(this.target);
  4169. return this.contentRect_ = e, e.width !== this.broadcastWidth || e.height !== this.broadcastHeight;
  4170. }, t.prototype.broadcastRect = function() {
  4171. var e = this.contentRect_;
  4172. return this.broadcastWidth = e.width, this.broadcastHeight = e.height, e;
  4173. }, t;
  4174. }()
  4175. ), va = (
  4176. /** @class */
  4177. /* @__PURE__ */ function() {
  4178. function t(e, r) {
  4179. var n = ga(r);
  4180. eo(this, { target: e, contentRect: n });
  4181. }
  4182. return t;
  4183. }()
  4184. ), ya = (
  4185. /** @class */
  4186. function() {
  4187. function t(e, r, n) {
  4188. if (this.activeObservations_ = [], this.observations_ = new Qi(), typeof e != "function")
  4189. throw new TypeError("The callback provided as parameter 1 is not a function.");
  4190. this.callback_ = e, this.controller_ = r, this.callbackCtx_ = n;
  4191. }
  4192. return t.prototype.observe = function(e) {
  4193. if (!arguments.length)
  4194. throw new TypeError("1 argument required, but only 0 present.");
  4195. if (!(typeof Element > "u" || !(Element instanceof Object))) {
  4196. if (!(e instanceof gt(e).Element))
  4197. throw new TypeError('parameter 1 is not of type "Element".');
  4198. var r = this.observations_;
  4199. r.has(e) || (r.set(e, new ma(e)), this.controller_.addObserver(this), this.controller_.refresh());
  4200. }
  4201. }, t.prototype.unobserve = function(e) {
  4202. if (!arguments.length)
  4203. throw new TypeError("1 argument required, but only 0 present.");
  4204. if (!(typeof Element > "u" || !(Element instanceof Object))) {
  4205. if (!(e instanceof gt(e).Element))
  4206. throw new TypeError('parameter 1 is not of type "Element".');
  4207. var r = this.observations_;
  4208. r.has(e) && (r.delete(e), r.size || this.controller_.removeObserver(this));
  4209. }
  4210. }, t.prototype.disconnect = function() {
  4211. this.clearActive(), this.observations_.clear(), this.controller_.removeObserver(this);
  4212. }, t.prototype.gatherActive = function() {
  4213. var e = this;
  4214. this.clearActive(), this.observations_.forEach(function(r) {
  4215. r.isActive() && e.activeObservations_.push(r);
  4216. });
  4217. }, t.prototype.broadcastActive = function() {
  4218. if (this.hasActive()) {
  4219. var e = this.callbackCtx_, r = this.activeObservations_.map(function(n) {
  4220. return new va(n.target, n.broadcastRect());
  4221. });
  4222. this.callback_.call(e, r, e), this.clearActive();
  4223. }
  4224. }, t.prototype.clearActive = function() {
  4225. this.activeObservations_.splice(0);
  4226. }, t.prototype.hasActive = function() {
  4227. return this.activeObservations_.length > 0;
  4228. }, t;
  4229. }()
  4230. ), no = typeof WeakMap < "u" ? /* @__PURE__ */ new WeakMap() : new Qi(), ro = (
  4231. /** @class */
  4232. /* @__PURE__ */ function() {
  4233. function t(e) {
  4234. if (!(this instanceof t))
  4235. throw new TypeError("Cannot call a class as a function.");
  4236. if (!arguments.length)
  4237. throw new TypeError("1 argument required, but only 0 present.");
  4238. var r = la.getInstance(), n = new ya(e, r, this);
  4239. no.set(this, n);
  4240. }
  4241. return t;
  4242. }()
  4243. );
  4244. [
  4245. "observe",
  4246. "unobserve",
  4247. "disconnect"
  4248. ].forEach(function(t) {
  4249. ro.prototype[t] = function() {
  4250. var e;
  4251. return (e = no.get(this))[t].apply(e, arguments);
  4252. };
  4253. });
  4254. var ba = function() {
  4255. return typeof vn.ResizeObserver < "u" ? vn.ResizeObserver : ro;
  4256. }();
  4257. const Sa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  4258. __proto__: null,
  4259. default: ba
  4260. }, Symbol.toStringTag, { value: "Module" })), Ca = /* @__PURE__ */ Ai(Sa);
  4261. var Qr;
  4262. function wa() {
  4263. if (Qr) return nn;
  4264. Qr = 1, Object.defineProperty(nn, "__esModule", {
  4265. value: !0
  4266. }), nn.default = _;
  4267. var t = c(Le), e = i(/* @__PURE__ */ Qe()), r = i(Ca), n = i(dr());
  4268. function i(w) {
  4269. return w && w.__esModule ? w : { default: w };
  4270. }
  4271. function o(w) {
  4272. if (typeof WeakMap != "function") return null;
  4273. var S = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap();
  4274. return (o = function(h) {
  4275. return h ? R : S;
  4276. })(w);
  4277. }
  4278. function c(w, S) {
  4279. if (w && w.__esModule) return w;
  4280. if (w === null || typeof w != "object" && typeof w != "function") return { default: w };
  4281. var R = o(S);
  4282. if (R && R.has(w)) return R.get(w);
  4283. var h = { __proto__: null }, s = Object.defineProperty && Object.getOwnPropertyDescriptor;
  4284. for (var a in w) if (a !== "default" && Object.prototype.hasOwnProperty.call(w, a)) {
  4285. var u = s ? Object.getOwnPropertyDescriptor(w, a) : null;
  4286. u && (u.get || u.set) ? Object.defineProperty(h, a, u) : h[a] = w[a];
  4287. }
  4288. return h.default = w, R && R.set(w, h), h;
  4289. }
  4290. function v() {
  4291. return v = Object.assign ? Object.assign.bind() : function(w) {
  4292. for (var S = 1; S < arguments.length; S++) {
  4293. var R = arguments[S];
  4294. for (var h in R)
  4295. Object.prototype.hasOwnProperty.call(R, h) && (w[h] = R[h]);
  4296. }
  4297. return w;
  4298. }, v.apply(this, arguments);
  4299. }
  4300. function d(w, S, R) {
  4301. return S = y(S), S in w ? Object.defineProperty(w, S, { value: R, enumerable: !0, configurable: !0, writable: !0 }) : w[S] = R, w;
  4302. }
  4303. function y(w) {
  4304. var S = p(w, "string");
  4305. return typeof S == "symbol" ? S : String(S);
  4306. }
  4307. function p(w, S) {
  4308. if (typeof w != "object" || w === null) return w;
  4309. var R = w[Symbol.toPrimitive];
  4310. if (R !== void 0) {
  4311. var h = R.call(w, S || "default");
  4312. if (typeof h != "object") return h;
  4313. throw new TypeError("@@toPrimitive must return a primitive value.");
  4314. }
  4315. return (S === "string" ? String : Number)(w);
  4316. }
  4317. const C = "react-grid-layout";
  4318. function _(w) {
  4319. var S;
  4320. return S = class extends t.Component {
  4321. constructor() {
  4322. super(...arguments), d(this, "state", {
  4323. width: 1280
  4324. }), d(this, "elementRef", /* @__PURE__ */ t.createRef()), d(this, "mounted", !1), d(this, "resizeObserver", void 0);
  4325. }
  4326. componentDidMount() {
  4327. this.mounted = !0, this.resizeObserver = new r.default((s) => {
  4328. if (this.elementRef.current instanceof HTMLElement) {
  4329. const u = s[0].contentRect.width;
  4330. this.setState({
  4331. width: u
  4332. });
  4333. }
  4334. });
  4335. const h = this.elementRef.current;
  4336. h instanceof HTMLElement && this.resizeObserver.observe(h);
  4337. }
  4338. componentWillUnmount() {
  4339. this.mounted = !1;
  4340. const h = this.elementRef.current;
  4341. h instanceof HTMLElement && this.resizeObserver.unobserve(h), this.resizeObserver.disconnect();
  4342. }
  4343. render() {
  4344. const {
  4345. measureBeforeMount: h,
  4346. ...s
  4347. } = this.props;
  4348. return h && !this.mounted ? /* @__PURE__ */ t.createElement("div", {
  4349. className: (0, n.default)(this.props.className, C),
  4350. style: this.props.style,
  4351. ref: this.elementRef
  4352. }) : /* @__PURE__ */ t.createElement(w, v({
  4353. innerRef: this.elementRef
  4354. }, s, this.state));
  4355. }
  4356. }, d(S, "defaultProps", {
  4357. measureBeforeMount: !1
  4358. }), d(S, "propTypes", {
  4359. // If true, will not render children until mounted. Useful for getting the exact width before
  4360. // rendering, to prevent any unsightly resizing.
  4361. measureBeforeMount: e.default.bool
  4362. }), S;
  4363. }
  4364. return nn;
  4365. }
  4366. var ei;
  4367. function Ra() {
  4368. return ei || (ei = 1, function(t) {
  4369. t.exports = Zi().default, t.exports.utils = St(), t.exports.calculateUtils = fr(), t.exports.Responsive = ta().default, t.exports.Responsive.utils = Ji(), t.exports.WidthProvider = wa().default;
  4370. }(An)), An.exports;
  4371. }
  4372. var _a = Ra();
  4373. const xa = /* @__PURE__ */ hs(_a);
  4374. var Ia = Object.defineProperty, Ea = Object.getOwnPropertyDescriptor, Ta = (t, e, r, n) => {
  4375. for (var i = n > 1 ? void 0 : n ? Ea(e, r) : e, o = t.length - 1, c; o >= 0; o--)
  4376. (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
  4377. return n && i && Ia(e, r, i), i;
  4378. }, Pa = (t, e) => (r, n) => e(r, n, t);
  4379. let mt = class extends je {
  4380. constructor(e) {
  4381. super();
  4382. Xe(this, "_initLocal", () => {
  4383. });
  4384. Xe(this, "_findReplaceIndex", (e) => {
  4385. const r = /\{([^}]+)?\}/g, n = [];
  4386. let i = r.exec(e);
  4387. for (; i; )
  4388. n.push({
  4389. startIndex: i.index,
  4390. key: Number(i[1]),
  4391. endIndex: i.index + i[0].length - 1
  4392. }), i = r.exec(e);
  4393. return n;
  4394. });
  4395. this._localeService = e, this._initLocal();
  4396. }
  4397. tWithReactNode(e, ...r) {
  4398. const n = this._localeService.getLocales(), i = e.split("."), o = n && this._localeService.resolveKeyPath(n, i);
  4399. if (typeof o == "string") {
  4400. const c = [];
  4401. return this._findReplaceIndex(o).forEach((v, d, y) => {
  4402. const p = y[d - 1] || { startIndex: 0, endIndex: -1 };
  4403. if (p.endIndex + 1 < v.startIndex) {
  4404. const C = o.slice(p.endIndex + 1, v.startIndex);
  4405. C && c.push(C);
  4406. }
  4407. if (r[v.key] && c.push(r[v.key]), d === y.length - 1) {
  4408. const C = o.slice(v.endIndex + 1);
  4409. C && c.push(C);
  4410. }
  4411. }), c;
  4412. }
  4413. return [];
  4414. }
  4415. };
  4416. mt = Ta([
  4417. Pa(0, Q(Ie))
  4418. ], mt);
  4419. const Oa = "univer-cf-preview", rn = {
  4420. cfPreview: Oa
  4421. }, Ct = (t) => {
  4422. var i, o;
  4423. const e = t.rule;
  4424. if (!e)
  4425. return null;
  4426. const r = Se(() => {
  4427. if (e.type === K.colorScale) {
  4428. const c = e.config.map((y, p) => ({ color: new hi(y.color), value: p })), v = c.length - 1;
  4429. return new Array(5).fill("").map((y, p, C) => p * v / (C.length - 1)).map((y) => Ro(c, y));
  4430. }
  4431. return null;
  4432. }, [e]), n = Se(() => {
  4433. if (e.type === K.iconSet)
  4434. return e.config.map((c) => {
  4435. const v = st[c.iconType];
  4436. return v && v[Number(c.iconId)];
  4437. });
  4438. }, [e]);
  4439. switch (e.type) {
  4440. case K.dataBar: {
  4441. const { isGradient: c } = e.config, v = { width: "50%", height: "100%" }, d = c ? `linear-gradient(to right, ${e.config.positiveColor || Ft}, rgb(255 255 255))` : e.config.positiveColor, y = c ? `linear-gradient(to right, rgb(255 255 255),${e.config.nativeColor || Vt})` : e.config.nativeColor;
  4442. return /* @__PURE__ */ x.jsxs("div", { className: rn.cfPreview, children: [
  4443. /* @__PURE__ */ x.jsx("div", { style: { ...v, background: y, border: `1px solid ${e.config.nativeColor || Vt}` } }),
  4444. /* @__PURE__ */ x.jsx("div", { style: { ...v, background: d, border: `1px solid ${e.config.positiveColor || Ft}` } })
  4445. ] });
  4446. }
  4447. case K.colorScale:
  4448. return r && /* @__PURE__ */ x.jsx("div", { className: rn.cfPreview, children: r.map((c, v) => /* @__PURE__ */ x.jsx("div", { style: { width: `${100 / r.length}%`, height: "100%", background: c } }, v)) });
  4449. case K.iconSet:
  4450. return n && /* @__PURE__ */ x.jsx("div", { className: rn.cfPreview, children: n.map((c, v) => c ? /* @__PURE__ */ x.jsx("img", { style: { height: "100%" }, src: c }, v) : /* @__PURE__ */ x.jsx(Zt, {}, v)) });
  4451. case K.highlightCell: {
  4452. const { ul: c, st: v, it: d, bl: y, bg: p, cl: C } = e.style, _ = (c == null ? void 0 : c.s) === De.TRUE, w = (v == null ? void 0 : v.s) === De.TRUE, S = d === De.TRUE, R = y === De.TRUE, h = (i = p == null ? void 0 : p.rgb) != null ? i : _o, s = (o = C == null ? void 0 : C.rgb) != null ? o : xo, a = {
  4453. fontWeight: R ? "bold" : void 0,
  4454. fontStyle: S ? "italic" : void 0,
  4455. textDecoration: `${_ ? "underline" : ""} ${w ? "line-through" : ""}`.replace(/^ /, "") || void 0,
  4456. backgroundColor: h,
  4457. color: s
  4458. };
  4459. return /* @__PURE__ */ x.jsx("div", { style: a, className: rn.cfPreview, children: "123" });
  4460. }
  4461. }
  4462. return null;
  4463. }, Da = "univer-cf-rule-list", Ma = "univer-rule-selector", Na = "univer-select", ja = "univer-select-selector", La = "univer-select-selection-item", $a = "univer-select-selection-search-input", za = "univer-btn-list", Fa = "univer-gap", Va = "univer-icon", qa = "univer-disabled", Aa = "univer-rule-item", Wa = "univer-rule-describe", Ha = "univer-rule-type", Ua = "univer-rule-range", ka = "univer-active", Ba = "univer-draggableHandle", Ga = "univer-delete-item", Xa = "univer-grid-layout-wrap", Ya = "univer-react-grid-item", be = {
  4464. cfRuleList: Da,
  4465. ruleSelector: Ma,
  4466. select: Na,
  4467. selectSelector: ja,
  4468. selectSelectionItem: La,
  4469. selectSelectionSearchInput: $a,
  4470. btnList: za,
  4471. gap: Fa,
  4472. icon: Va,
  4473. disabled: qa,
  4474. ruleItem: Aa,
  4475. ruleDescribe: Wa,
  4476. ruleType: Ha,
  4477. ruleRange: Ua,
  4478. active: ka,
  4479. draggableHandle: Ba,
  4480. deleteItem: Ga,
  4481. gridLayoutWrap: Xa,
  4482. reactGridItem: Ya
  4483. }, Ka = (t, e) => {
  4484. const r = t.rule;
  4485. switch (r.type) {
  4486. case K.colorScale:
  4487. return e.t("sheet.cf.ruleType.colorScale");
  4488. case K.dataBar:
  4489. return e.t("sheet.cf.ruleType.dataBar");
  4490. case K.iconSet:
  4491. return e.t("sheet.cf.ruleType.iconSet");
  4492. case K.highlightCell:
  4493. switch (r.subType) {
  4494. case G.average: {
  4495. const n = r.operator;
  4496. return e.t(`sheet.cf.preview.describe.${n}`, e.t("sheet.cf.subRuleType.average"));
  4497. }
  4498. case G.duplicateValues:
  4499. return e.t("sheet.cf.subRuleType.duplicateValues");
  4500. case G.uniqueValues:
  4501. return e.t("sheet.cf.subRuleType.uniqueValues");
  4502. case G.number: {
  4503. const n = r.operator;
  4504. return e.t(`sheet.cf.preview.describe.${n}`, ...Array.isArray(r.value) ? r.value.map((i) => String(i)) : [String(r.value || "")]);
  4505. }
  4506. case G.text: {
  4507. const n = r.operator;
  4508. return e.t(`sheet.cf.preview.describe.${n}`, r.value || "");
  4509. }
  4510. case G.timePeriod: {
  4511. const n = r.operator;
  4512. return e.t(`sheet.cf.preview.describe.${n}`);
  4513. }
  4514. case G.rank:
  4515. 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));
  4516. case G.formula:
  4517. return e.t("sheet.cf.ruleType.formula");
  4518. }
  4519. }
  4520. };
  4521. let ti = 0;
  4522. const Za = (t) => {
  4523. const { onClick: e } = t, r = he(me), n = he(ue), i = he(ct), o = he(ge), c = he(Ie), v = he(We), d = he(mt), y = ko(() => n.getCurrentTypeOfUnit$(re.UNIVER_SHEET), void 0, void 0, []), p = y.getUnitId(), C = y.getActiveSheet();
  4524. if (!C)
  4525. throw new Error("No active sheet found");
  4526. const _ = C.getSheetId(), [w, S] = H([]), [R, h] = H("2"), [s, a] = H(0), [u, b] = H(-1), [l, g] = H(ti), f = Fe(null), m = [
  4527. { label: c.t("sheet.cf.panel.workSheet"), value: "2" },
  4528. { label: c.t("sheet.cf.panel.selectedRange"), value: "1" }
  4529. ], P = () => {
  4530. const A = r.getSubunitRules(p, _);
  4531. if (!A || !A.length)
  4532. return [];
  4533. if (R === "1") {
  4534. const F = i.getCurrentLastSelection();
  4535. if (!F)
  4536. return [];
  4537. const oe = F.range;
  4538. return A.filter((de) => de.ranges.some((ye) => Be.intersects(ye, oe)));
  4539. } else if (R === "2")
  4540. return [...A];
  4541. return [];
  4542. }, [M, j] = H(P);
  4543. rs(w), we(() => {
  4544. const A = o.onCommandExecuted((F) => {
  4545. F.id === rr.id && a(Math.random());
  4546. });
  4547. return () => A.dispose();
  4548. }), we(() => {
  4549. j(P);
  4550. }, [R, s, p, _]), we(() => {
  4551. if (R === "2")
  4552. return;
  4553. const A = new ot((F) => {
  4554. const oe = [jo.id, _e.id, Ve.id, Ne.id, fn.id], se = o.onCommandExecuted((de) => {
  4555. const { id: ye, params: Ee } = de, $e = n.getCurrentUnitForType(re.UNIVER_SHEET).getUnitId();
  4556. oe.includes(ye) && Ee.unitId === $e && F.next(null);
  4557. });
  4558. return () => se.dispose();
  4559. }).pipe(Sr(16)).subscribe(() => {
  4560. j(P);
  4561. });
  4562. return () => {
  4563. A.unsubscribe();
  4564. };
  4565. }, [n, R, p, _]), we(() => {
  4566. const A = r.$ruleChange.subscribe(() => {
  4567. a(Math.random());
  4568. });
  4569. return () => A.unsubscribe();
  4570. }, [r]), we(() => {
  4571. const A = () => {
  4572. var de;
  4573. const se = Math.max(0, (((de = f.current) == null ? void 0 : de.getBoundingClientRect().width) || 0) - 8);
  4574. return ti = se, se;
  4575. }, oe = new ot((se) => {
  4576. const de = document.querySelector(".univer-sidebar");
  4577. if (de) {
  4578. let ye = setTimeout(() => {
  4579. se.next();
  4580. }, 150);
  4581. const Ee = () => {
  4582. ye && clearTimeout(ye), ye = null;
  4583. }, $e = (V) => {
  4584. V.propertyName === "width" && (Ee(), se.next());
  4585. };
  4586. return de.addEventListener("transitionend", $e), () => {
  4587. Ee(), de.removeEventListener("transitionend", $e);
  4588. };
  4589. }
  4590. }).pipe(Sr(16)).subscribe(() => {
  4591. g(A());
  4592. });
  4593. return () => {
  4594. oe.unsubscribe();
  4595. };
  4596. }, []);
  4597. const N = (A) => {
  4598. var se;
  4599. const F = n.getCurrentUnitForType(re.UNIVER_SHEET).getUnitId(), oe = (se = n.getCurrentUnitForType(re.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : se.getSheetId();
  4600. if (!F || !oe)
  4601. throw new Error("No active sheet found");
  4602. o.executeCommand(mn.id, { unitId: F, subUnitId: oe, cfId: A.cfId });
  4603. }, I = (A, F) => {
  4604. b(F.y);
  4605. }, O = (A, F, oe) => {
  4606. var V;
  4607. b(-1);
  4608. const se = n.getCurrentUnitForType(re.UNIVER_SHEET).getUnitId(), de = (V = n.getCurrentUnitForType(re.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : V.getSheetId();
  4609. if (!se || !de)
  4610. throw new Error("No active sheet found");
  4611. const ye = (Z) => {
  4612. const ce = M.length;
  4613. return Math.min(ce - 1, Math.max(0, Z));
  4614. }, Ee = M[ye(F.y)].cfId, $e = M[ye(oe.y)].cfId;
  4615. Ee !== $e && o.executeCommand(lr.id, { unitId: se, subUnitId: de, start: { id: Ee, type: "self" }, end: { id: $e, type: oe.y > F.y ? "after" : "before" } });
  4616. }, z = () => {
  4617. t.onCreate();
  4618. }, U = () => {
  4619. R === "2" ? o.executeCommand(On.id) : R === "1" && M.map((F) => ({ unitId: p, subUnitId: _, cfId: F.cfId })).forEach((F) => {
  4620. o.executeCommand(mn.id, F);
  4621. });
  4622. }, k = Se(() => {
  4623. const A = n.getCurrentUnitForType(re.UNIVER_SHEET), F = A.getActiveSheet();
  4624. return M.filter((oe) => {
  4625. const se = oe.ranges;
  4626. return pn(v, A.getUnitId(), F.getSheetId(), se);
  4627. });
  4628. }, [M]), ie = k.map((A, F) => ({ i: A.cfId, x: 0, w: 12, y: F, h: 1, isResizable: !1 })), ee = Se(() => {
  4629. const A = n.getCurrentUnitForType(re.UNIVER_SHEET), F = A.getActiveSheet();
  4630. return M.every((oe) => {
  4631. const se = oe.ranges;
  4632. return pn(v, A.getUnitId(), F.getSheetId(), se);
  4633. });
  4634. }, [M]);
  4635. return /* @__PURE__ */ x.jsxs("div", { className: be.cfRuleList, children: [
  4636. /* @__PURE__ */ x.jsxs("div", { className: be.ruleSelector, children: [
  4637. /* @__PURE__ */ x.jsx("div", { children: d.tWithReactNode(
  4638. "sheet.cf.panel.managerRuleSelect",
  4639. /* @__PURE__ */ x.jsx(Me, { className: be.select, options: m, value: R, onChange: (A) => {
  4640. h(A);
  4641. } })
  4642. ).map((A, F) => /* @__PURE__ */ x.jsx("span", { children: A }, F)) }),
  4643. /* @__PURE__ */ x.jsxs("div", { className: be.btnList, children: [
  4644. /* @__PURE__ */ x.jsx(mr, { title: c.t("sheet.cf.panel.createRule"), placement: "bottom", children: /* @__PURE__ */ x.jsx(
  4645. "div",
  4646. {
  4647. className: `
  4648. ${be.icon}
  4649. `,
  4650. onClick: z,
  4651. children: /* @__PURE__ */ x.jsx(Hi, {})
  4652. }
  4653. ) }),
  4654. M.length && ee ? /* @__PURE__ */ x.jsx(mr, { title: c.t("sheet.cf.panel.clear"), placement: "bottom", children: /* @__PURE__ */ x.jsx(
  4655. "div",
  4656. {
  4657. className: `
  4658. ${be.gap}
  4659. ${be.icon}
  4660. `,
  4661. onClick: U,
  4662. children: /* @__PURE__ */ x.jsx(dn, {})
  4663. }
  4664. ) }) : /* @__PURE__ */ x.jsx(
  4665. "div",
  4666. {
  4667. className: `
  4668. ${be.gap}
  4669. ${be.disabled}
  4670. `,
  4671. children: /* @__PURE__ */ x.jsx(dn, {})
  4672. }
  4673. )
  4674. ] })
  4675. ] }),
  4676. /* @__PURE__ */ x.jsx("div", { ref: f, className: be.gridLayoutWrap, children: l ? /* @__PURE__ */ x.jsx(
  4677. xa,
  4678. {
  4679. onDragStop: O,
  4680. onDragStart: I,
  4681. layout: ie,
  4682. cols: 12,
  4683. rowHeight: 60,
  4684. width: l,
  4685. margin: [0, 10],
  4686. draggableHandle: ".draggableHandle",
  4687. children: k == null ? void 0 : k.map((A, F) => /* @__PURE__ */ x.jsx("div", { children: /* @__PURE__ */ x.jsxs(
  4688. "div",
  4689. {
  4690. onMouseMove: () => {
  4691. A.ranges !== w && S(A.ranges);
  4692. },
  4693. onMouseLeave: () => S([]),
  4694. onClick: () => {
  4695. e(A);
  4696. },
  4697. className: `
  4698. ${be.ruleItem}
  4699. ${u === F ? be.active : ""}
  4700. `,
  4701. children: [
  4702. /* @__PURE__ */ x.jsx(
  4703. "div",
  4704. {
  4705. className: `
  4706. ${be.draggableHandle}
  4707. draggableHandle
  4708. `,
  4709. onClick: (oe) => oe.stopPropagation(),
  4710. children: /* @__PURE__ */ x.jsx(Ui, {})
  4711. }
  4712. ),
  4713. /* @__PURE__ */ x.jsxs("div", { className: be.ruleDescribe, children: [
  4714. /* @__PURE__ */ x.jsx("div", { className: be.ruleType, children: Ka(A, c) }),
  4715. /* @__PURE__ */ x.jsx("div", { className: be.ruleRange, children: A.ranges.map((oe) => Ii(oe)).join(",") })
  4716. ] }),
  4717. /* @__PURE__ */ x.jsx("div", { className: be.preview, children: /* @__PURE__ */ x.jsx(Ct, { rule: A.rule }) }),
  4718. /* @__PURE__ */ x.jsx(
  4719. "div",
  4720. {
  4721. className: `
  4722. ${be.deleteItem}
  4723. ${u === F ? be.active : ""}
  4724. `,
  4725. onClick: (oe) => {
  4726. oe.stopPropagation(), N(A), S([]);
  4727. },
  4728. children: /* @__PURE__ */ x.jsx(dn, {})
  4729. }
  4730. )
  4731. ]
  4732. }
  4733. ) }, `${A.cfId}`))
  4734. }
  4735. ) : null })
  4736. ] });
  4737. }, Ja = "univer-cf-color-picker", Qa = "univer-cf-color-picker-icon", el = "univer-icon-dropdown", Gn = {
  4738. cfColorPicker: Ja,
  4739. cfColorPickerIcon: Qa,
  4740. iconDropdown: el
  4741. }, lt = (t) => {
  4742. const { color: e, onChange: r, disable: n = !1, iconId: i = "PaintBucket", className: o, isNeedDropdownIcon: c = !0 } = t, v = he(or), d = Se(() => new hi(e), [e]), y = v.get(i);
  4743. return y && (n ? /* @__PURE__ */ x.jsx(y, { className: o, extend: { colorChannel1: d.isValid ? e : "rgb(var(--primary-color))" } }) : /* @__PURE__ */ x.jsx(
  4744. sr,
  4745. {
  4746. overlay: /* @__PURE__ */ x.jsx(
  4747. "div",
  4748. {
  4749. className: `
  4750. ${Gn.cfColorPicker}
  4751. `,
  4752. children: /* @__PURE__ */ x.jsx(Qo, { value: e, onChange: r })
  4753. }
  4754. ),
  4755. children: /* @__PURE__ */ x.jsxs(
  4756. "span",
  4757. {
  4758. className: `
  4759. ${Gn.cfColorPickerIcon}
  4760. ${o}
  4761. `,
  4762. children: [
  4763. /* @__PURE__ */ x.jsx(y, { extend: { colorChannel1: d.isValid ? e : "rgb(var(--primary-color))" } }),
  4764. c && /* @__PURE__ */ x.jsx(Dn, { className: Gn.iconDropdown })
  4765. ]
  4766. }
  4767. )
  4768. }
  4769. ));
  4770. }, tl = "univer-cf-rule-style-editor", nl = "univer-cf-preview-wrap", rl = "univer-text", il = "univer-position-relative", ol = "univer-btn-list", sl = "univer-util-item", al = "univer-icon-set", ll = "univer-render-config", cl = "univer-flex", ul = "univer-width45", dl = "univer-icon-wrap", fl = "univer-icon", hl = "univer-dropdown-icon", pl = "univer-error-input", gl = "univer-error-text", ml = "univer-icon-group-list", vl = "univer-title", yl = "univer-group", bl = "univer-item-content", Sl = "univer-item-wrap", Cl = "univer-item", wl = "univer-icon-item-list-wrap", Rl = "univer-none", _l = "univer-icon-item-list", xl = "univer-width100", Il = "univer-stress", W = {
  4771. cfRuleStyleEditor: tl,
  4772. cfPreviewWrap: nl,
  4773. text: rl,
  4774. positionRelative: il,
  4775. btnList: ol,
  4776. utilItem: sl,
  4777. iconSet: al,
  4778. renderConfig: ll,
  4779. flex: cl,
  4780. width45: ul,
  4781. iconWrap: dl,
  4782. icon: fl,
  4783. dropdownIcon: hl,
  4784. errorInput: pl,
  4785. errorText: gl,
  4786. iconGroupList: ml,
  4787. title: vl,
  4788. group: yl,
  4789. itemContent: bl,
  4790. itemWrap: Sl,
  4791. item: Cl,
  4792. iconItemListWrap: wl,
  4793. none: Rl,
  4794. iconItemList: _l,
  4795. width100: xl,
  4796. stress: Il
  4797. }, it = (t, e) => ({ label: e.t(`sheet.cf.valueType.${t}`), value: t }), Xn = (t) => {
  4798. var S;
  4799. const { type: e, className: r, onChange: n, id: i, value: o } = t, c = he(ue), v = c.getCurrentUnitForType(re.UNIVER_SHEET).getUnitId(), d = (S = c.getCurrentUnitForType(re.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : S.getSheetId(), y = Se(() => String(o).startsWith("=") ? String(o) : "=", [o]), p = Se(() => [te.max, te.min, "none"].includes(e) ? { disabled: !0 } : [te.percent, te.percentile].includes(e) ? {
  4800. min: 0,
  4801. max: 100
  4802. } : {
  4803. min: Number.MIN_SAFE_INTEGER,
  4804. max: Number.MAX_SAFE_INTEGER
  4805. }, [e]), C = Fe({}), [_, w] = H(!1);
  4806. return Kt((R) => {
  4807. var s;
  4808. const h = (s = C.current) == null ? void 0 : s.handleOutClick;
  4809. h && h(R, () => w(!1));
  4810. }), e === te.formula ? /* @__PURE__ */ x.jsx("div", { style: { width: "100%", marginLeft: 4 }, children: /* @__PURE__ */ x.jsx(
  4811. Tn,
  4812. {
  4813. initValue: y,
  4814. unitId: v,
  4815. subUnitId: d,
  4816. isFocus: _,
  4817. onChange: (R = "") => {
  4818. n(R || "");
  4819. },
  4820. onFocus: () => w(!0),
  4821. actions: C.current
  4822. }
  4823. ) }) : /* @__PURE__ */ x.jsx(at, { className: r, value: Number(t.value) || 0, onChange: (R) => t.onChange(R || 0), ...p });
  4824. }, El = (t) => {
  4825. var N;
  4826. const { interceptorManager: e } = t, r = he(Ie), n = ((N = t.rule) == null ? void 0 : N.type) === K.colorScale ? t.rule : void 0, i = [it(te.num, r), it(te.percent, r), it(te.percentile, r), it(te.formula, r)], o = [it(te.min, r), ...i], c = [it("none", r), ...i], v = [it(te.max, r), ...i], [d, y] = H(() => {
  4827. var O;
  4828. const I = te.min;
  4829. return n && ((O = n.config[0]) == null ? void 0 : O.value.type) || I;
  4830. }), [p, C] = H(() => {
  4831. var O;
  4832. const I = "none";
  4833. return !n || n.config.length !== 3 ? I : ((O = n.config[1]) == null ? void 0 : O.value.type) || I;
  4834. }), [_, w] = H(() => {
  4835. var O;
  4836. const I = te.max;
  4837. return n && ((O = n.config[n.config.length - 1]) == null ? void 0 : O.value.type) || I;
  4838. }), [S, R] = H(() => {
  4839. if (!n)
  4840. return 10;
  4841. const O = n.config[0];
  4842. return (O == null ? void 0 : O.value.value) === void 0 ? 10 : O == null ? void 0 : O.value.value;
  4843. }), [h, s] = H(() => {
  4844. var z;
  4845. if (!n || n.config.length !== 3)
  4846. return 50;
  4847. const O = (z = n.config[1]) == null ? void 0 : z.value.value;
  4848. return O === void 0 ? 50 : O;
  4849. }), [a, u] = H(() => {
  4850. var z;
  4851. if (!n)
  4852. return 90;
  4853. const O = (z = n.config[n.config.length - 1]) == null ? void 0 : z.value.value;
  4854. return O === void 0 ? 90 : O;
  4855. }), [b, l] = H(() => {
  4856. var O;
  4857. const I = "#d0d9fb";
  4858. return n && ((O = n.config[0]) == null ? void 0 : O.color) || I;
  4859. }), [g, f] = H(() => {
  4860. var O;
  4861. const I = "#7790f3";
  4862. return !n || n.config.length !== 3 ? I : ((O = n.config[1]) == null ? void 0 : O.color) || I;
  4863. }), [m, P] = H(() => {
  4864. var O;
  4865. const I = "#2e55ef";
  4866. return n && ((O = n.config[n.config.length - 1]) == null ? void 0 : O.color) || I;
  4867. }), M = Se(() => (I) => {
  4868. const {
  4869. minType: O,
  4870. medianType: z,
  4871. maxType: U,
  4872. minValue: k,
  4873. medianValue: ie,
  4874. maxValue: ee,
  4875. minColor: A,
  4876. medianColor: F,
  4877. maxColor: oe
  4878. } = I, se = [];
  4879. return se.push({ color: A, value: { type: O, value: k } }), z !== "none" && se.push({ color: F, value: { type: z, value: ie } }), se.push({ color: oe, value: { type: U, value: ee } }), { config: se.map((ye, Ee) => ({ ...ye, index: Ee })), type: K.colorScale };
  4880. }, []);
  4881. we(() => e.intercept(e.getInterceptPoints().submit, {
  4882. handler() {
  4883. return M({ minType: d, medianType: p, maxType: _, minValue: S, medianValue: h, maxValue: a, minColor: b, medianColor: g, maxColor: m });
  4884. }
  4885. }), [M, d, p, _, S, h, a, b, g, m, e]);
  4886. const j = (I) => {
  4887. t.onChange(M(I));
  4888. };
  4889. return /* @__PURE__ */ x.jsxs("div", { children: [
  4890. /* @__PURE__ */ x.jsx("div", { className: $.title, children: r.t("sheet.cf.panel.styleRule") }),
  4891. /* @__PURE__ */ x.jsx(
  4892. "div",
  4893. {
  4894. className: `
  4895. ${W.cfPreviewWrap}
  4896. `,
  4897. children: /* @__PURE__ */ x.jsx(Ct, { rule: M({ minType: d, medianType: p, maxType: _, minValue: S, medianValue: h, maxValue: a, minColor: b, medianColor: g, maxColor: m }) })
  4898. }
  4899. ),
  4900. /* @__PURE__ */ x.jsx("div", { className: $.label, children: r.t("sheet.cf.valueType.min") }),
  4901. /* @__PURE__ */ x.jsxs(
  4902. "div",
  4903. {
  4904. className: `
  4905. ${$.labelContainer}
  4906. ${$.mTSm}
  4907. `,
  4908. children: [
  4909. /* @__PURE__ */ x.jsx(
  4910. Me,
  4911. {
  4912. style: { flexShrink: 0 },
  4913. options: o,
  4914. value: d,
  4915. onChange: (I) => {
  4916. y(I);
  4917. const O = qt(I, 10);
  4918. R(O), j({ minType: I, medianType: p, maxType: _, minValue: O, medianValue: h, maxValue: a, minColor: b, medianColor: g, maxColor: m });
  4919. }
  4920. }
  4921. ),
  4922. /* @__PURE__ */ x.jsx(
  4923. Xn,
  4924. {
  4925. id: "min",
  4926. className: `
  4927. ${$.mLXxs}
  4928. `,
  4929. value: S,
  4930. type: d,
  4931. onChange: (I) => {
  4932. R(I), j({ minType: d, medianType: p, maxType: _, minValue: I, medianValue: h, maxValue: a, minColor: b, medianColor: g, maxColor: m });
  4933. }
  4934. }
  4935. ),
  4936. /* @__PURE__ */ x.jsx(
  4937. lt,
  4938. {
  4939. className: $.mLXxs,
  4940. color: b,
  4941. onChange: (I) => {
  4942. l(I), j({ minType: d, medianType: p, maxType: _, minValue: S, medianValue: h, maxValue: a, minColor: I, medianColor: g, maxColor: m });
  4943. }
  4944. }
  4945. )
  4946. ]
  4947. }
  4948. ),
  4949. /* @__PURE__ */ x.jsx("div", { className: $.label, children: r.t("sheet.cf.panel.medianValue") }),
  4950. /* @__PURE__ */ x.jsxs(
  4951. "div",
  4952. {
  4953. className: `
  4954. ${$.labelContainer}
  4955. ${$.mTSm}
  4956. `,
  4957. children: [
  4958. /* @__PURE__ */ x.jsx(
  4959. Me,
  4960. {
  4961. style: { flexShrink: 0 },
  4962. options: c,
  4963. value: p,
  4964. onChange: (I) => {
  4965. C(I);
  4966. const O = qt(I, 50);
  4967. s(O), j({ minType: d, medianType: I, maxType: _, minValue: S, medianValue: O, maxValue: a, minColor: b, medianColor: g, maxColor: m });
  4968. }
  4969. }
  4970. ),
  4971. /* @__PURE__ */ x.jsx(
  4972. Xn,
  4973. {
  4974. id: "median",
  4975. className: `
  4976. ${$.mLXxs}
  4977. `,
  4978. value: h,
  4979. type: p,
  4980. onChange: (I) => {
  4981. s(I), j({ minType: d, medianType: p, maxType: _, minValue: S, medianValue: I, maxValue: a, minColor: b, medianColor: g, maxColor: m });
  4982. }
  4983. }
  4984. ),
  4985. p !== "none" && /* @__PURE__ */ x.jsx(
  4986. lt,
  4987. {
  4988. className: $.mLXxs,
  4989. color: g,
  4990. onChange: (I) => {
  4991. f(I), j({ minType: d, medianType: p, maxType: _, minValue: S, medianValue: h, maxValue: a, minColor: b, medianColor: I, maxColor: m });
  4992. }
  4993. }
  4994. )
  4995. ]
  4996. }
  4997. ),
  4998. /* @__PURE__ */ x.jsx("div", { className: $.label, children: r.t("sheet.cf.valueType.max") }),
  4999. /* @__PURE__ */ x.jsxs(
  5000. "div",
  5001. {
  5002. className: `
  5003. ${$.labelContainer}
  5004. ${$.mTSm}
  5005. `,
  5006. children: [
  5007. /* @__PURE__ */ x.jsx(
  5008. Me,
  5009. {
  5010. style: { flexShrink: 0 },
  5011. options: v,
  5012. value: _,
  5013. onChange: (I) => {
  5014. w(I);
  5015. const O = qt(I, 90);
  5016. u(O), j({ minType: d, medianType: p, maxType: I, minValue: S, medianValue: h, maxValue: O, minColor: b, medianColor: g, maxColor: m });
  5017. }
  5018. }
  5019. ),
  5020. /* @__PURE__ */ x.jsx(
  5021. Xn,
  5022. {
  5023. id: "max",
  5024. className: `
  5025. ${$.mLXxs}
  5026. `,
  5027. value: a,
  5028. type: _,
  5029. onChange: (I) => {
  5030. u(I), j({ minType: d, medianType: p, maxType: _, minValue: S, medianValue: h, maxValue: I, minColor: b, medianColor: g, maxColor: m });
  5031. }
  5032. }
  5033. ),
  5034. /* @__PURE__ */ x.jsx(
  5035. lt,
  5036. {
  5037. className: $.mLXxs,
  5038. color: m,
  5039. onChange: (I) => {
  5040. P(I), j({ minType: d, medianType: p, maxType: _, minValue: S, medianValue: h, maxValue: a, minColor: b, medianColor: g, maxColor: I });
  5041. }
  5042. }
  5043. )
  5044. ]
  5045. }
  5046. )
  5047. ] });
  5048. }, ft = (t, e) => ({ label: e.t(`sheet.cf.valueType.${t}`), value: t }), ni = (t) => {
  5049. var R;
  5050. const { onChange: e, className: r, value: n, type: i, id: o, disabled: c = !1 } = t, v = he(ue), d = v.getCurrentUnitForType(re.UNIVER_SHEET).getUnitId(), y = (R = v.getCurrentUnitForType(re.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : R.getSheetId(), p = Fe({}), [C, _] = H(!1);
  5051. Kt((h) => {
  5052. var a;
  5053. const s = (a = p.current) == null ? void 0 : a.handleOutClick;
  5054. s && s(h, () => _(!1));
  5055. });
  5056. const w = Fe(n), S = Se(() => [te.percentile, te.percent].includes(i) ? {
  5057. max: 100,
  5058. min: 0
  5059. } : {
  5060. min: Number.MIN_SAFE_INTEGER,
  5061. max: Number.MAX_SAFE_INTEGER
  5062. }, [i]);
  5063. if (i === te.formula) {
  5064. const h = String(w.current).startsWith("=") ? String(w.current) || "" : "=";
  5065. return /* @__PURE__ */ x.jsx("div", { style: { width: "100%", marginLeft: 12 }, children: /* @__PURE__ */ x.jsx(
  5066. Tn,
  5067. {
  5068. initValue: h,
  5069. unitId: d,
  5070. subUnitId: y,
  5071. isFocus: C,
  5072. onChange: (s = "") => {
  5073. e(s || "");
  5074. },
  5075. onFocus: () => _(!0),
  5076. actions: p.current
  5077. }
  5078. ) });
  5079. }
  5080. return /* @__PURE__ */ x.jsx(
  5081. at,
  5082. {
  5083. className: r,
  5084. value: Number(n) || 0,
  5085. disabled: c,
  5086. onChange: (h) => {
  5087. e(h || 0);
  5088. },
  5089. ...S
  5090. }
  5091. );
  5092. }, Tl = (t) => {
  5093. var N;
  5094. const { interceptorManager: e } = t, r = he(Ie), n = ((N = t.rule) == null ? void 0 : N.type) === K.dataBar ? t.rule : void 0, [i, o] = H(() => {
  5095. var O;
  5096. const I = "0";
  5097. return n ? (O = n.config) != null && O.isGradient ? "1" : "0" : I;
  5098. }), [c, v] = H(() => {
  5099. var I;
  5100. return n ? ((I = n.config) == null ? void 0 : I.positiveColor) || Ft : Ft;
  5101. }), [d, y] = H(() => {
  5102. var I;
  5103. return n ? ((I = n.config) == null ? void 0 : I.nativeColor) || Vt : Vt;
  5104. }), p = [ft(te.num, r), ft(te.percent, r), ft(te.percentile, r), ft(te.formula, r)], C = [ft(te.min, r), ...p], _ = [ft(te.max, r), ...p], [w, S] = H(() => {
  5105. var O;
  5106. const I = C[0].value;
  5107. return n && ((O = n.config) == null ? void 0 : O.min.type) || I;
  5108. }), [R, h] = H(() => {
  5109. var O;
  5110. const I = _[0].value;
  5111. return n && ((O = n.config) == null ? void 0 : O.max.type) || I;
  5112. }), [s, a] = H(() => {
  5113. var z;
  5114. if (!n)
  5115. return 0;
  5116. const O = ((z = n.config) == null ? void 0 : z.min) || {};
  5117. return O.type === te.formula ? O.value || "=" : O.value || 0;
  5118. }), [u, b] = H(() => {
  5119. var z;
  5120. if (!n)
  5121. return 100;
  5122. const O = ((z = n.config) == null ? void 0 : z.max) || {};
  5123. return O.type === te.formula ? O.value || "=" : O.value === void 0 ? 100 : O.value;
  5124. }), [l, g] = H(() => n ? n.isShowValue === void 0 ? !0 : !!n.isShowValue : !0), f = (I) => ({ config: {
  5125. min: { type: I.minValueType, value: I.minValue },
  5126. max: { type: I.maxValueType, value: I.maxValue },
  5127. isGradient: I.isGradient === "1",
  5128. positiveColor: I.positiveColor || Ft,
  5129. nativeColor: I.nativeColor || Vt
  5130. }, type: K.dataBar, isShowValue: I.isShowValue });
  5131. we(() => e.intercept(e.getInterceptPoints().submit, {
  5132. handler() {
  5133. return f({ isGradient: i, minValue: s, minValueType: w, maxValue: u, maxValueType: R, positiveColor: c, nativeColor: d, isShowValue: l });
  5134. }
  5135. }), [i, s, w, u, R, c, d, e, l]);
  5136. const m = (I) => {
  5137. t.onChange(f(I));
  5138. }, P = (I) => {
  5139. v(I), m({ isGradient: i, minValue: s, minValueType: w, maxValue: u, maxValueType: R, positiveColor: I, nativeColor: d, isShowValue: l });
  5140. }, M = (I) => {
  5141. y(I), m({ isGradient: i, minValue: s, minValueType: w, maxValue: u, maxValueType: R, positiveColor: c, nativeColor: I, isShowValue: l });
  5142. }, j = (I) => p.map((O) => O.value).includes(I);
  5143. return /* @__PURE__ */ x.jsxs("div", { children: [
  5144. /* @__PURE__ */ x.jsx("div", { className: $.title, children: r.t("sheet.cf.panel.styleRule") }),
  5145. /* @__PURE__ */ x.jsx(
  5146. "div",
  5147. {
  5148. className: `
  5149. ${W.cfPreviewWrap}
  5150. `,
  5151. children: /* @__PURE__ */ x.jsx(Ct, { rule: f({ isGradient: i, minValue: s, minValueType: w, maxValue: u, maxValueType: R, positiveColor: c, nativeColor: d, isShowValue: l }) })
  5152. }
  5153. ),
  5154. /* @__PURE__ */ x.jsxs("div", { children: [
  5155. /* @__PURE__ */ x.jsx("div", { className: $.label, children: r.t("sheet.cf.panel.fillType") }),
  5156. /* @__PURE__ */ x.jsxs(
  5157. "div",
  5158. {
  5159. className: `
  5160. ${$.mTSm}
  5161. ${$.mLXxs}
  5162. ${$.labelContainer}
  5163. `,
  5164. children: [
  5165. /* @__PURE__ */ x.jsxs(
  5166. es,
  5167. {
  5168. value: i,
  5169. onChange: (I) => {
  5170. o(I), m({ isGradient: I, minValue: s, minValueType: w, maxValue: u, maxValueType: R, positiveColor: c, nativeColor: d, isShowValue: l });
  5171. },
  5172. children: [
  5173. /* @__PURE__ */ x.jsx(vr, { value: "0", children: /* @__PURE__ */ x.jsx("span", { className: W.text, children: r.t("sheet.cf.panel.pureColor") }) }),
  5174. /* @__PURE__ */ x.jsx(vr, { value: "1", children: /* @__PURE__ */ x.jsx("span", { className: W.text, children: r.t("sheet.cf.panel.gradient") }) })
  5175. ]
  5176. }
  5177. ),
  5178. /* @__PURE__ */ x.jsxs(
  5179. "div",
  5180. {
  5181. className: `
  5182. ${W.utilItem}
  5183. ${$.mLXl}
  5184. `,
  5185. children: [
  5186. /* @__PURE__ */ x.jsx(
  5187. gn,
  5188. {
  5189. checked: !l,
  5190. onChange: (I) => {
  5191. g(!I), m({ isGradient: I, minValue: s, minValueType: w, maxValue: u, maxValueType: R, positiveColor: c, nativeColor: d, isShowValue: !I });
  5192. }
  5193. }
  5194. ),
  5195. r.t("sheet.cf.panel.onlyShowDataBar")
  5196. ]
  5197. }
  5198. )
  5199. ]
  5200. }
  5201. )
  5202. ] }),
  5203. /* @__PURE__ */ x.jsxs("div", { children: [
  5204. /* @__PURE__ */ x.jsx("div", { className: $.label, children: r.t("sheet.cf.panel.colorSet") }),
  5205. /* @__PURE__ */ x.jsxs(
  5206. "div",
  5207. {
  5208. className: `
  5209. ${$.labelContainer}
  5210. ${$.mTSm}
  5211. ${$.mLXxs}
  5212. `,
  5213. children: [
  5214. /* @__PURE__ */ x.jsxs(
  5215. "div",
  5216. {
  5217. className: `
  5218. ${$.labelContainer}
  5219. `,
  5220. children: [
  5221. /* @__PURE__ */ x.jsx(
  5222. "div",
  5223. {
  5224. className: `
  5225. ${W.text}
  5226. `,
  5227. children: r.t("sheet.cf.panel.native")
  5228. }
  5229. ),
  5230. /* @__PURE__ */ x.jsx(
  5231. lt,
  5232. {
  5233. color: d,
  5234. onChange: M
  5235. }
  5236. )
  5237. ]
  5238. }
  5239. ),
  5240. /* @__PURE__ */ x.jsxs(
  5241. "div",
  5242. {
  5243. className: `
  5244. ${$.labelContainer}
  5245. ${$.mLSm}
  5246. `,
  5247. children: [
  5248. /* @__PURE__ */ x.jsx(
  5249. "div",
  5250. {
  5251. className: `
  5252. ${W.text}
  5253. `,
  5254. children: r.t("sheet.cf.panel.positive")
  5255. }
  5256. ),
  5257. /* @__PURE__ */ x.jsx(
  5258. lt,
  5259. {
  5260. color: c,
  5261. onChange: P
  5262. }
  5263. )
  5264. ]
  5265. }
  5266. )
  5267. ]
  5268. }
  5269. )
  5270. ] }),
  5271. /* @__PURE__ */ x.jsxs("div", { children: [
  5272. /* @__PURE__ */ x.jsx("div", { className: $.label, children: r.t("sheet.cf.valueType.min") }),
  5273. /* @__PURE__ */ x.jsxs(
  5274. "div",
  5275. {
  5276. className: `
  5277. ${$.mTSm}
  5278. ${$.labelContainer}
  5279. `,
  5280. children: [
  5281. /* @__PURE__ */ x.jsx(
  5282. Me,
  5283. {
  5284. style: { width: "50%", flexShrink: 0 },
  5285. options: C,
  5286. value: w,
  5287. onChange: (I) => {
  5288. S(I);
  5289. const O = qt(I, 10);
  5290. a(O), m({ isGradient: i, minValue: O, minValueType: I, maxValue: u, maxValueType: R, positiveColor: c, nativeColor: d, isShowValue: l });
  5291. }
  5292. }
  5293. ),
  5294. /* @__PURE__ */ x.jsx(
  5295. ni,
  5296. {
  5297. disabled: !j(w),
  5298. id: "min",
  5299. type: w,
  5300. className: $.mLSm,
  5301. value: s,
  5302. onChange: (I) => {
  5303. a(I || 0), m({ isGradient: i, minValue: I || 0, minValueType: w, maxValue: u, maxValueType: R, positiveColor: c, nativeColor: d, isShowValue: l });
  5304. }
  5305. }
  5306. )
  5307. ]
  5308. }
  5309. ),
  5310. /* @__PURE__ */ x.jsx("div", { className: $.label, children: r.t("sheet.cf.valueType.max") }),
  5311. /* @__PURE__ */ x.jsxs(
  5312. "div",
  5313. {
  5314. className: `
  5315. ${$.mTSm}
  5316. ${$.labelContainer}
  5317. `,
  5318. children: [
  5319. /* @__PURE__ */ x.jsx(
  5320. Me,
  5321. {
  5322. style: { width: "50%", flexShrink: 0 },
  5323. options: _,
  5324. value: R,
  5325. onChange: (I) => {
  5326. h(I);
  5327. const O = qt(I, 90);
  5328. b(O), m({ isGradient: i, minValue: s, minValueType: w, maxValue: O, maxValueType: I, positiveColor: c, nativeColor: d, isShowValue: l });
  5329. }
  5330. }
  5331. ),
  5332. /* @__PURE__ */ x.jsx(
  5333. ni,
  5334. {
  5335. disabled: !j(R),
  5336. id: "max",
  5337. type: R,
  5338. className: $.mLSm,
  5339. value: u,
  5340. onChange: (I) => {
  5341. b(I || 0), m({ isGradient: i, minValue: s, minValueType: w, maxValue: I || 0, maxValueType: R, positiveColor: c, nativeColor: d, isShowValue: l });
  5342. }
  5343. }
  5344. )
  5345. ]
  5346. }
  5347. )
  5348. ] })
  5349. ] });
  5350. };
  5351. function io(t) {
  5352. var e, r, n = "";
  5353. if (typeof t == "string" || typeof t == "number") n += t;
  5354. else if (typeof t == "object") if (Array.isArray(t)) {
  5355. var i = t.length;
  5356. for (e = 0; e < i; e++) t[e] && (r = io(t[e])) && (n && (n += " "), n += r);
  5357. } else for (r in t) t[r] && (n && (n += " "), n += r);
  5358. return n;
  5359. }
  5360. function on() {
  5361. for (var t, e, r = 0, n = "", i = arguments.length; r < i; r++) (t = arguments[r]) && (e = io(t)) && (n && (n += " "), n += e);
  5362. return n;
  5363. }
  5364. const Pl = "univer-cf-style-edit", Ol = "univer-button-item", Dl = "univer-isActive", ke = {
  5365. cfStyleEdit: Pl,
  5366. buttonItem: Ol,
  5367. isActive: Dl
  5368. }, sn = (t) => [De.FALSE, void 0].includes(t) ? De.TRUE : De.FALSE, an = (t) => t !== De.FALSE, gr = (t) => {
  5369. const { style: e, onChange: r, className: n } = t, i = he(or), [o, c] = H(() => {
  5370. if (e != null && e.bl)
  5371. return e.bl;
  5372. }), [v, d] = H(() => {
  5373. if (e != null && e.it)
  5374. return e.it;
  5375. }), [y, p] = H(() => {
  5376. if (e != null && e.ul)
  5377. return e.ul.s;
  5378. }), [C, _] = H(() => {
  5379. if (e != null && e.st)
  5380. return e.st.s;
  5381. }), [w, S] = H(() => {
  5382. var g;
  5383. const l = "#2f56ef";
  5384. return (g = e == null ? void 0 : e.cl) != null && g.rgb ? e.cl.rgb : l;
  5385. }), [R, h] = H(() => {
  5386. var g;
  5387. const l = "#e8ecfc";
  5388. return (g = e == null ? void 0 : e.bg) != null && g.rgb ? e.bg.rgb : l;
  5389. }), s = i.get("BoldSingle"), a = i.get("ItalicSingle"), u = i.get("UnderlineSingle"), b = i.get("StrikethroughSingle");
  5390. return we(() => {
  5391. const l = {
  5392. bl: o,
  5393. it: v
  5394. };
  5395. w !== void 0 && (l.cl = { rgb: w }), R !== void 0 && (l.bg = { rgb: R }), C !== void 0 && (l.st = { s: C }), y !== void 0 && (l.ul = { s: y }), r(Io(l));
  5396. }, [o, v, y, C, w, R]), /* @__PURE__ */ x.jsxs(
  5397. "div",
  5398. {
  5399. className: `
  5400. ${ke.cfStyleEdit}
  5401. ${n}
  5402. `,
  5403. children: [
  5404. s && /* @__PURE__ */ x.jsx("div", { className: on({ [ke.isActive]: an(o || De.FALSE) }, ke.buttonItem), onClick: () => c(sn(o)), children: /* @__PURE__ */ x.jsx(s, {}) }),
  5405. a && /* @__PURE__ */ x.jsx("div", { className: on({ [ke.isActive]: an(v || De.FALSE) }, ke.buttonItem), onClick: () => d(sn(v)), children: /* @__PURE__ */ x.jsx(a, {}) }),
  5406. u && /* @__PURE__ */ x.jsx("div", { className: on({ [ke.isActive]: an(y || De.FALSE) }, ke.buttonItem), onClick: () => p(sn(y)), children: /* @__PURE__ */ x.jsx(u, {}) }),
  5407. b && /* @__PURE__ */ x.jsx("div", { className: on({ [ke.isActive]: an(C || De.FALSE) }, ke.buttonItem), onClick: () => _(sn(C)), children: /* @__PURE__ */ x.jsx(b, {}) }),
  5408. /* @__PURE__ */ x.jsx(lt, { color: w, onChange: S, iconId: "FontColor" }),
  5409. /* @__PURE__ */ x.jsx(lt, { color: R, onChange: h, iconId: "PaintBucket" })
  5410. ]
  5411. }
  5412. );
  5413. }, Ml = (t) => {
  5414. var b;
  5415. const { onChange: e, interceptorManager: r } = t, n = he(Ie), o = he(ue).getCurrentUnitForType(re.UNIVER_SHEET), c = o.getActiveSheet(), v = ((b = t.rule) == null ? void 0 : b.type) === K.highlightCell ? t.rule : void 0, d = Fe(null), [y, p] = H(!1), C = Fe({}), [_, w] = H({}), [S, R] = H(() => (v == null ? void 0 : v.subType) === G.formula ? v.value : "="), [h, s] = H(void 0), a = (l) => ({
  5416. style: l.style,
  5417. value: S,
  5418. type: K.highlightCell,
  5419. subType: G.formula
  5420. });
  5421. we(() => r.intercept(r.getInterceptPoints().submit, {
  5422. handler() {
  5423. return a({ style: _, formula: S });
  5424. }
  5425. }), [_, S, r]), we(() => r.intercept(r.getInterceptPoints().beforeSubmit, {
  5426. handler: (g, f, m) => h || S.length === 1 || !S.startsWith("=") ? (s(n.t("sheet.cf.errorMessage.formulaError")), !1) : m(g)
  5427. }), [h, S]);
  5428. const u = (l) => {
  5429. e(a(l));
  5430. };
  5431. return Kt((l) => {
  5432. var f;
  5433. const g = (f = C.current) == null ? void 0 : f.handleOutClick;
  5434. g && g(l, () => p(!1));
  5435. }), /* @__PURE__ */ x.jsxs("div", { ref: d, children: [
  5436. /* @__PURE__ */ x.jsx(
  5437. "div",
  5438. {
  5439. className: `
  5440. ${$.title}
  5441. ${$.mTBase}
  5442. `,
  5443. children: n.t("sheet.cf.panel.styleRule")
  5444. }
  5445. ),
  5446. /* @__PURE__ */ x.jsx(
  5447. "div",
  5448. {
  5449. className: `
  5450. ${$.mTSm}
  5451. `,
  5452. children: /* @__PURE__ */ x.jsx(
  5453. Tn,
  5454. {
  5455. onChange: (l) => {
  5456. R(l), u({ style: _, formula: l });
  5457. },
  5458. onVerify: (l, g) => {
  5459. !l || g.length === 1 ? s(n.t("sheet.cf.errorMessage.formulaError")) : s(void 0);
  5460. },
  5461. errorText: h,
  5462. onFocus: () => {
  5463. p(!0);
  5464. },
  5465. actions: C.current,
  5466. isFocus: y,
  5467. initValue: S,
  5468. unitId: o.getUnitId(),
  5469. subUnitId: c == null ? void 0 : c.getSheetId()
  5470. }
  5471. )
  5472. }
  5473. ),
  5474. /* @__PURE__ */ x.jsx(
  5475. "div",
  5476. {
  5477. className: `
  5478. ${W.cfPreviewWrap}
  5479. `,
  5480. children: /* @__PURE__ */ x.jsx(Ct, { rule: a({ style: _, formula: S }) })
  5481. }
  5482. ),
  5483. /* @__PURE__ */ x.jsx(
  5484. gr,
  5485. {
  5486. style: v == null ? void 0 : v.style,
  5487. className: `
  5488. ${$.mTSm}
  5489. `,
  5490. onChange: (l) => {
  5491. w(l), u({ style: l, formula: S });
  5492. }
  5493. }
  5494. )
  5495. ] });
  5496. }, ln = (t) => /* @__PURE__ */ x.jsxs("div", { style: { position: "relative" }, children: [
  5497. /* @__PURE__ */ x.jsx(
  5498. "div",
  5499. {
  5500. style: {
  5501. position: "absolute",
  5502. zIndex: 999,
  5503. bottom: "-13px",
  5504. fontSize: "10px",
  5505. color: "red"
  5506. },
  5507. children: t.errorText
  5508. }
  5509. ),
  5510. t.children
  5511. ] }), fe = (t, e) => ({ label: e.t(`sheet.cf.operator.${t}`), value: t }), Nl = (t) => {
  5512. const { type: e, operator: r, onChange: n, value: i, interceptorManager: o } = t, c = he(Ie), [v, d] = H(() => typeof i == "number" ? i : 0), [y, p] = H(""), [C, _] = H(() => typeof i == "string" ? i : ""), [w, S] = H(""), [R, h] = H(() => Array.isArray(i) ? i[0] === void 0 ? 0 : i[0] : 0), [s, a] = H(""), [u, b] = H(() => Array.isArray(i) ? i[1] === void 0 ? 100 : i[1] : 100), [l, g] = H("");
  5513. switch (we(() => {
  5514. switch (e) {
  5515. case G.text: {
  5516. [
  5517. le.beginsWith,
  5518. le.endsWith,
  5519. le.containsText,
  5520. le.notContainsText,
  5521. le.equal,
  5522. le.notEqual
  5523. ].includes(r) && n(C);
  5524. break;
  5525. }
  5526. case G.number: {
  5527. [
  5528. J.equal,
  5529. J.notEqual,
  5530. J.greaterThan,
  5531. J.greaterThanOrEqual,
  5532. J.lessThan,
  5533. J.lessThanOrEqual
  5534. ].includes(r) && n(v), [J.between, J.notBetween].includes(r) && n([R, u]);
  5535. break;
  5536. }
  5537. }
  5538. }, [e]), we(() => {
  5539. const f = o.intercept(o.getInterceptPoints().beforeSubmit, {
  5540. handler: (m, P, M) => {
  5541. switch (e) {
  5542. case G.text:
  5543. if ([
  5544. le.beginsWith,
  5545. le.containsText,
  5546. le.endsWith,
  5547. le.notEqual,
  5548. le.notContainsText,
  5549. le.equal
  5550. ].includes(r))
  5551. return C ? M(m) : (S(c.t("sheet.cf.errorMessage.notBlank")), !1);
  5552. }
  5553. return M(m);
  5554. }
  5555. });
  5556. return () => {
  5557. f();
  5558. };
  5559. }, [e, v, C, r]), e) {
  5560. case G.text: {
  5561. if ([
  5562. le.beginsWith,
  5563. le.endsWith,
  5564. le.containsText,
  5565. le.notContainsText,
  5566. le.equal,
  5567. le.notEqual
  5568. ].includes(r)) {
  5569. const f = (m) => {
  5570. _(m), n(m);
  5571. };
  5572. return /* @__PURE__ */ x.jsx(
  5573. "div",
  5574. {
  5575. className: `
  5576. ${$.mTSm}
  5577. `,
  5578. children: /* @__PURE__ */ x.jsx(ln, { errorText: w, children: /* @__PURE__ */ x.jsx(
  5579. ts,
  5580. {
  5581. className: W.width100,
  5582. value: C,
  5583. onChange: (m) => {
  5584. S(""), f(m);
  5585. }
  5586. }
  5587. ) })
  5588. }
  5589. );
  5590. }
  5591. break;
  5592. }
  5593. case G.number: {
  5594. if ([
  5595. J.equal,
  5596. J.notEqual,
  5597. J.greaterThan,
  5598. J.greaterThanOrEqual,
  5599. J.lessThan,
  5600. J.lessThanOrEqual
  5601. ].includes(r)) {
  5602. const f = (m) => {
  5603. d(m || 0), n(m || 0), p("");
  5604. };
  5605. return /* @__PURE__ */ x.jsx(
  5606. "div",
  5607. {
  5608. className: `
  5609. ${$.mTSm}
  5610. `,
  5611. children: /* @__PURE__ */ x.jsx(ln, { errorText: y, children: /* @__PURE__ */ x.jsx(at, { min: Number.MIN_SAFE_INTEGER, max: Number.MAX_SAFE_INTEGER, className: W.width100, value: v, onChange: f }) })
  5612. }
  5613. );
  5614. }
  5615. if ([J.between, J.notBetween].includes(r)) {
  5616. const f = (P) => {
  5617. h(P || 0), n([P || 0, u]), a("");
  5618. }, m = (P) => {
  5619. b(P || 0), n([R, P || 0]), g("");
  5620. };
  5621. return /* @__PURE__ */ x.jsxs(
  5622. "div",
  5623. {
  5624. className: `
  5625. ${$.mTSm}
  5626. ${$.labelContainer}
  5627. `,
  5628. children: [
  5629. /* @__PURE__ */ x.jsx(ln, { errorText: s, children: /* @__PURE__ */ x.jsx(at, { min: Number.MIN_SAFE_INTEGER, max: Number.MAX_SAFE_INTEGER, value: R, onChange: f }) }),
  5630. /* @__PURE__ */ x.jsx(ln, { errorText: l, children: /* @__PURE__ */ x.jsx(
  5631. at,
  5632. {
  5633. min: Number.MIN_SAFE_INTEGER,
  5634. max: Number.MAX_SAFE_INTEGER,
  5635. className: `
  5636. ${$.mLSm}
  5637. `,
  5638. value: u,
  5639. onChange: m
  5640. }
  5641. ) })
  5642. ]
  5643. }
  5644. );
  5645. }
  5646. }
  5647. }
  5648. return null;
  5649. }, ri = (t, e) => {
  5650. switch (t) {
  5651. case G.text:
  5652. return [
  5653. fe(le.containsText, e),
  5654. fe(le.notContainsText, e),
  5655. fe(le.beginsWith, e),
  5656. fe(le.endsWith, e),
  5657. fe(le.equal, e),
  5658. fe(le.notEqual, e),
  5659. fe(le.containsBlanks, e),
  5660. fe(le.notContainsBlanks, e),
  5661. fe(le.containsErrors, e),
  5662. fe(le.notContainsErrors, e)
  5663. ];
  5664. case G.number:
  5665. return [
  5666. fe(J.between, e),
  5667. fe(J.notBetween, e),
  5668. fe(J.equal, e),
  5669. fe(J.notEqual, e),
  5670. fe(J.greaterThan, e),
  5671. fe(J.greaterThanOrEqual, e),
  5672. fe(J.lessThan, e),
  5673. fe(J.lessThanOrEqual, e)
  5674. ];
  5675. case G.timePeriod:
  5676. return [
  5677. fe(qe.yesterday, e),
  5678. fe(qe.today, e),
  5679. fe(qe.tomorrow, e),
  5680. fe(qe.last7Days, e),
  5681. fe(qe.lastWeek, e),
  5682. fe(qe.thisWeek, e),
  5683. fe(qe.nextWeek, e),
  5684. fe(qe.lastMonth, e),
  5685. fe(qe.thisMonth, e),
  5686. fe(qe.nextMonth, e)
  5687. ];
  5688. }
  5689. }, ii = (t) => {
  5690. var b;
  5691. const { interceptorManager: e, onChange: r } = t, n = he(Ie), i = ((b = t.rule) == null ? void 0 : b.type) === K.highlightCell ? t.rule : void 0, [o, c] = H(() => {
  5692. const l = G.text;
  5693. return i && i.subType || l;
  5694. }), v = [
  5695. {
  5696. value: G.text,
  5697. label: n.t("sheet.cf.subRuleType.text")
  5698. },
  5699. {
  5700. value: G.number,
  5701. label: n.t("sheet.cf.subRuleType.number")
  5702. },
  5703. {
  5704. value: G.timePeriod,
  5705. label: n.t("sheet.cf.subRuleType.timePeriod")
  5706. },
  5707. {
  5708. value: G.duplicateValues,
  5709. label: n.t("sheet.cf.subRuleType.duplicateValues")
  5710. },
  5711. {
  5712. value: G.uniqueValues,
  5713. label: n.t("sheet.cf.subRuleType.uniqueValues")
  5714. }
  5715. ], d = Se(() => ri(o, n), [o]), [y, p] = H(() => {
  5716. const l = d ? d[0].value : void 0;
  5717. return i && i.operator || l;
  5718. }), [C, _] = H(() => {
  5719. var f;
  5720. const l = "";
  5721. return i ? (f = i.value) != null ? f : hn(i.subType, i.operator) : l;
  5722. }), [w, S] = H({}), R = Se(() => (l) => {
  5723. var g, f, m, P, M, j, N, I, O, z, U, k, ie, ee, A;
  5724. switch (l.subType || o) {
  5725. case G.text: {
  5726. if ([
  5727. le.beginsWith,
  5728. le.endsWith,
  5729. le.containsText,
  5730. le.notContainsText,
  5731. le.equal,
  5732. le.notEqual
  5733. ].includes(y))
  5734. return {
  5735. type: K.highlightCell,
  5736. subType: (g = l.subType) != null ? g : o,
  5737. operator: (f = l.operator) != null ? f : y,
  5738. style: (m = l.style) != null ? m : w,
  5739. value: (P = l.value) != null ? P : C
  5740. };
  5741. break;
  5742. }
  5743. case G.number: {
  5744. if ([
  5745. J.equal,
  5746. J.notEqual,
  5747. J.greaterThan,
  5748. J.greaterThanOrEqual,
  5749. J.lessThan,
  5750. J.lessThanOrEqual
  5751. ].includes(y))
  5752. return {
  5753. type: K.highlightCell,
  5754. subType: (M = l.subType) != null ? M : o,
  5755. operator: (j = l.operator) != null ? j : y,
  5756. style: (N = l.style) != null ? N : w,
  5757. value: (I = l.value) != null ? I : C
  5758. };
  5759. if ([J.between, J.notBetween].includes(y))
  5760. return {
  5761. type: K.highlightCell,
  5762. subType: (O = l.subType) != null ? O : o,
  5763. operator: (z = l.operator) != null ? z : y,
  5764. style: (U = l.style) != null ? U : w,
  5765. value: (k = l.value) != null ? k : C
  5766. };
  5767. break;
  5768. }
  5769. }
  5770. return {
  5771. type: K.highlightCell,
  5772. subType: (ie = l.subType) != null ? ie : o,
  5773. operator: (ee = l.operator) != null ? ee : y,
  5774. style: (A = l.style) != null ? A : w
  5775. };
  5776. }, [o, y, C, w]);
  5777. we(() => e.intercept(e.getInterceptPoints().submit, {
  5778. handler() {
  5779. return R({});
  5780. }
  5781. }), [R, e]), we(() => {
  5782. v.some((l) => l.value === o) || c(v[0].value);
  5783. }, [v]);
  5784. const h = (l) => {
  5785. const g = l, f = ri(g, n), m = f && f[0].value;
  5786. c(g), p(m), m && _(hn(g, m)), r(R({ subType: g, operator: m }));
  5787. }, s = (l) => {
  5788. const g = l;
  5789. p(g), r(R({ operator: g }));
  5790. }, a = (l) => {
  5791. _(l), r(R({ value: l }));
  5792. }, u = Se(() => `${o}_${y}_${Math.random()}`, [o, y]);
  5793. return /* @__PURE__ */ x.jsxs("div", { children: [
  5794. /* @__PURE__ */ x.jsx(
  5795. "div",
  5796. {
  5797. className: `
  5798. ${$.title}
  5799. ${$.mTBase}
  5800. `,
  5801. children: n.t("sheet.cf.panel.styleRule")
  5802. }
  5803. ),
  5804. /* @__PURE__ */ x.jsx(
  5805. Me,
  5806. {
  5807. className: `
  5808. ${$.mTSm}
  5809. ${W.width100}
  5810. `,
  5811. onChange: h,
  5812. value: o,
  5813. options: v
  5814. }
  5815. ),
  5816. (d == null ? void 0 : d.length) && /* @__PURE__ */ x.jsx(
  5817. Me,
  5818. {
  5819. className: `
  5820. ${$.mTSm}
  5821. ${W.width100}
  5822. `,
  5823. onChange: s,
  5824. value: y || "",
  5825. options: d
  5826. }
  5827. ),
  5828. /* @__PURE__ */ x.jsx(Nl, { value: C, interceptorManager: e, type: o, operator: y, rule: i, onChange: a }, u),
  5829. /* @__PURE__ */ x.jsx(
  5830. "div",
  5831. {
  5832. className: `
  5833. ${W.cfPreviewWrap}
  5834. `,
  5835. children: /* @__PURE__ */ x.jsx(Ct, { rule: R({}) })
  5836. }
  5837. ),
  5838. /* @__PURE__ */ x.jsx(
  5839. gr,
  5840. {
  5841. style: i == null ? void 0 : i.style,
  5842. className: `
  5843. ${$.mLXxs}
  5844. `,
  5845. onChange: (l) => {
  5846. S(l), r(R({ style: l }));
  5847. }
  5848. }
  5849. )
  5850. ] });
  5851. }, oo = (t, e) => (st[t] || [])[Number(e)] || "", jl = (t) => {
  5852. var d;
  5853. const e = he(ue), r = e.getCurrentUnitForType(re.UNIVER_SHEET).getUnitId(), n = (d = e.getCurrentUnitForType(re.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : d.getSheetId(), i = Se(() => t.error ? W.errorInput : "", [t.error]), o = Fe({}), [c, v] = H(!1);
  5854. return Kt((y) => {
  5855. var C;
  5856. const p = (C = o.current) == null ? void 0 : C.handleOutClick;
  5857. p && p(y, () => v(!1));
  5858. }), /* @__PURE__ */ x.jsx("div", { className: W.positionRelative, children: t.type !== te.formula ? /* @__PURE__ */ x.jsxs(x.Fragment, { children: [
  5859. /* @__PURE__ */ x.jsx(at, { className: i, value: Number(t.value) || 0, onChange: (y) => t.onChange(y != null ? y : 0) }),
  5860. t.error && /* @__PURE__ */ x.jsx("div", { className: W.errorText, children: t.error })
  5861. ] }) : /* @__PURE__ */ x.jsx("div", { style: { width: "100%" }, children: /* @__PURE__ */ x.jsx(
  5862. Tn,
  5863. {
  5864. initValue: String(t.value),
  5865. unitId: r,
  5866. subUnitId: n,
  5867. isFocus: c,
  5868. onChange: (y = "") => {
  5869. const p = y || "";
  5870. t.onChange(p);
  5871. },
  5872. onFocus: () => v(!0),
  5873. actions: o.current
  5874. }
  5875. ) }) });
  5876. }, oi = (t, e, r) => ({
  5877. operator: J.greaterThan,
  5878. value: { type: te.num, value: (r.length - 1 - e) * 10 },
  5879. iconType: t,
  5880. iconId: String(e)
  5881. }), Ll = ut((t, e) => {
  5882. const r = he(Ie), n = (i) => {
  5883. t.onClick(i);
  5884. };
  5885. return /* @__PURE__ */ x.jsx("div", { ref: e, className: W.iconGroupList, children: Eo.map((i, o) => /* @__PURE__ */ x.jsxs("div", { className: W.group, children: [
  5886. /* @__PURE__ */ x.jsx("div", { className: W.title, children: r.t(i.title) }),
  5887. /* @__PURE__ */ x.jsx("div", { className: W.itemContent, children: i.group.map((c) => /* @__PURE__ */ x.jsx("div", { className: W.itemWrap, onClick: () => {
  5888. n(c.name);
  5889. }, children: /* @__PURE__ */ x.jsx("div", { className: W.item, children: c.list.map((v, d) => /* @__PURE__ */ x.jsx("img", { className: W.icon, src: v }, d)) }) }, c.name)) })
  5890. ] }, o)) });
  5891. }), $l = (t) => {
  5892. const e = Se(() => {
  5893. const n = [];
  5894. for (const i in st) {
  5895. const o = st[i], c = i;
  5896. o.forEach((v, d) => {
  5897. n.push({
  5898. iconType: c,
  5899. base64: v,
  5900. iconId: String(d)
  5901. });
  5902. });
  5903. }
  5904. return n;
  5905. }, []), r = (n) => {
  5906. t.onClick(n.iconType, n.iconId);
  5907. };
  5908. return /* @__PURE__ */ x.jsxs("div", { className: W.iconItemListWrap, children: [
  5909. /* @__PURE__ */ x.jsxs("div", { className: W.none, onClick: () => r({ iconType: Po, iconId: "", base64: "" }), children: [
  5910. /* @__PURE__ */ x.jsx(Zt, { className: W.icon }),
  5911. /* @__PURE__ */ x.jsx("span", { children: "无单元格图标" })
  5912. ] }),
  5913. /* @__PURE__ */ x.jsx("div", { className: W.iconItemList, children: e.map((n) => /* @__PURE__ */ x.jsx("div", { className: W.item, children: /* @__PURE__ */ x.jsx(
  5914. "img",
  5915. {
  5916. onClick: () => r(n),
  5917. className: `
  5918. ${W.icon}
  5919. `,
  5920. src: n.base64
  5921. }
  5922. ) }, `${n.iconType}_${n.iconId}`)) })
  5923. ] });
  5924. }, zl = (t) => {
  5925. const { onChange: e, configList: r, errorMap: n = {} } = t, i = he(Ie), o = [
  5926. { label: i.t(`sheet.cf.symbol.${J.greaterThan}`), value: J.greaterThan },
  5927. { label: i.t(`sheet.cf.symbol.${J.greaterThanOrEqual}`), value: J.greaterThanOrEqual }
  5928. ], c = [
  5929. { label: i.t(`sheet.cf.valueType.${te.num}`), value: te.num },
  5930. { label: i.t(`sheet.cf.valueType.${te.percent}`), value: te.percent },
  5931. { label: i.t(`sheet.cf.valueType.${te.percentile}`), value: te.percentile },
  5932. { label: i.t(`sheet.cf.valueType.${te.formula}`), value: te.formula }
  5933. ], v = (C, _) => {
  5934. e([String(_), "value", "value"], C);
  5935. }, d = (C, _) => {
  5936. e([String(_), "operator"], C);
  5937. const w = hn(G.number, C);
  5938. v(w, _);
  5939. }, y = (C, _) => {
  5940. e([String(_), "value", "type"], C);
  5941. const w = r[_], S = hn(G.number, w.operator);
  5942. v(S, _);
  5943. };
  5944. return Se(() => r.map((C, _) => {
  5945. const w = n[_], S = oo(C.iconType, C.iconId), R = _ === r.length - 1, h = _ === 0, s = r[_ - 1], a = (s == null ? void 0 : s.value.type) === te.formula ? i.t("sheet.cf.valueType.formula") : s == null ? void 0 : s.value.value, u = (b, l) => {
  5946. const g = { ...C, iconId: l, iconType: b };
  5947. e([String(_)], g);
  5948. };
  5949. return /* @__PURE__ */ x.jsxs(
  5950. "div",
  5951. {
  5952. className: `
  5953. ${_ ? $.mTXl : $.mTSm}
  5954. `,
  5955. children: [
  5956. /* @__PURE__ */ x.jsxs(
  5957. "div",
  5958. {
  5959. className: `
  5960. ${$.label}
  5961. ${W.flex}
  5962. `,
  5963. children: [
  5964. /* @__PURE__ */ x.jsxs(
  5965. "div",
  5966. {
  5967. className: `
  5968. ${W.width45}
  5969. `,
  5970. children: [
  5971. i.t("sheet.cf.iconSet.icon"),
  5972. _ + 1
  5973. ]
  5974. }
  5975. ),
  5976. /* @__PURE__ */ x.jsx(
  5977. "div",
  5978. {
  5979. className: `
  5980. ${W.width45}
  5981. `,
  5982. children: /* @__PURE__ */ x.jsxs(x.Fragment, { children: [
  5983. !h && !R && i.t("sheet.cf.iconSet.rule"),
  5984. !h && !R && /* @__PURE__ */ x.jsxs("span", { className: W.stress, children: [
  5985. "(",
  5986. i.t("sheet.cf.iconSet.when"),
  5987. i.t(`sheet.cf.symbol.${Qn(s.operator)}`),
  5988. a,
  5989. R ? "" : ` ${i.t("sheet.cf.iconSet.and")} `,
  5990. ")"
  5991. ] })
  5992. ] })
  5993. }
  5994. )
  5995. ]
  5996. }
  5997. ),
  5998. /* @__PURE__ */ x.jsxs(
  5999. "div",
  6000. {
  6001. className: `
  6002. ${W.flex}
  6003. ${$.mTSm}
  6004. `,
  6005. children: [
  6006. /* @__PURE__ */ x.jsx(
  6007. "div",
  6008. {
  6009. className: `
  6010. ${W.iconWrap}
  6011. ${W.width45}
  6012. `,
  6013. children: /* @__PURE__ */ x.jsx(sr, { overlay: /* @__PURE__ */ x.jsx($l, { onClick: u, iconId: C.iconId, iconType: C.iconType }), children: /* @__PURE__ */ x.jsxs("div", { className: W.dropdownIcon, children: [
  6014. S ? /* @__PURE__ */ x.jsx("img", { src: S, className: W.icon }) : /* @__PURE__ */ x.jsx(Zt, { className: W.icon }),
  6015. /* @__PURE__ */ x.jsx(Dn, {})
  6016. ] }) })
  6017. }
  6018. ),
  6019. R ? /* @__PURE__ */ x.jsxs(
  6020. "div",
  6021. {
  6022. className: `
  6023. ${W.width45}
  6024. ${$.label}
  6025. `,
  6026. style: { marginTop: 0 },
  6027. children: [
  6028. i.t("sheet.cf.iconSet.rule"),
  6029. /* @__PURE__ */ x.jsxs("span", { className: W.stress, children: [
  6030. "(",
  6031. i.t("sheet.cf.iconSet.when"),
  6032. i.t(`sheet.cf.symbol.${Qn(s.operator)}`),
  6033. a,
  6034. R ? "" : ` ${i.t("sheet.cf.iconSet.and")} `,
  6035. ")"
  6036. ] })
  6037. ]
  6038. }
  6039. ) : /* @__PURE__ */ x.jsx(
  6040. Me,
  6041. {
  6042. className: `
  6043. ${$.mL0}
  6044. ${W.width45}
  6045. ${$.mR0}
  6046. `,
  6047. options: o,
  6048. value: C.operator,
  6049. onChange: (b) => {
  6050. d(b, _);
  6051. }
  6052. }
  6053. )
  6054. ]
  6055. }
  6056. ),
  6057. R ? /* @__PURE__ */ x.jsx("div", {}) : /* @__PURE__ */ x.jsxs(x.Fragment, { children: [
  6058. /* @__PURE__ */ x.jsxs(
  6059. "div",
  6060. {
  6061. className: `
  6062. ${$.mTSm}
  6063. ${$.label}
  6064. ${W.flex}
  6065. `,
  6066. children: [
  6067. /* @__PURE__ */ x.jsx(
  6068. "div",
  6069. {
  6070. className: `
  6071. ${W.width45}
  6072. `,
  6073. children: i.t("sheet.cf.iconSet.type")
  6074. }
  6075. ),
  6076. /* @__PURE__ */ x.jsx(
  6077. "div",
  6078. {
  6079. className: `
  6080. ${W.width45}
  6081. `,
  6082. children: i.t("sheet.cf.iconSet.value")
  6083. }
  6084. )
  6085. ]
  6086. }
  6087. ),
  6088. /* @__PURE__ */ x.jsxs(
  6089. "div",
  6090. {
  6091. className: `
  6092. ${$.mTSm}
  6093. ${W.flex}
  6094. `,
  6095. children: [
  6096. /* @__PURE__ */ x.jsx(
  6097. Me,
  6098. {
  6099. style: { flexShrink: 0 },
  6100. className: `
  6101. ${W.width45}
  6102. ${$.mL0}
  6103. `,
  6104. options: c,
  6105. value: C.value.type,
  6106. onChange: (b) => {
  6107. y(b, _);
  6108. }
  6109. }
  6110. ),
  6111. /* @__PURE__ */ x.jsx(
  6112. "div",
  6113. {
  6114. className: `
  6115. ${$.mL0}
  6116. ${W.width45}
  6117. `,
  6118. children: /* @__PURE__ */ x.jsx(
  6119. jl,
  6120. {
  6121. id: _,
  6122. type: C.value.type,
  6123. error: w,
  6124. value: C.value.value || "",
  6125. onChange: (b) => v(b, _)
  6126. }
  6127. )
  6128. }
  6129. )
  6130. ]
  6131. }
  6132. )
  6133. ] })
  6134. ]
  6135. },
  6136. _
  6137. );
  6138. }), [r, n]);
  6139. }, Fl = (t) => {
  6140. var b;
  6141. const { interceptorManager: e } = t, r = ((b = t.rule) == null ? void 0 : b.type) === K.iconSet ? t.rule : void 0, n = he(Ie), [i, o] = H({}), [c, v] = H(() => {
  6142. const l = Object.keys(st)[0];
  6143. if (r && r.config.length) {
  6144. const g = r.config[0].iconType;
  6145. if (!r.config.some((m) => m.iconType !== g))
  6146. return g;
  6147. }
  6148. return l;
  6149. }), [d, y] = H(() => {
  6150. if (r && r.config.length)
  6151. return tr.deepClone(r == null ? void 0 : r.config);
  6152. const l = st[c] || [];
  6153. return new Array(l.length).fill("").map((g, f, m) => f === m.length - 1 ? {
  6154. operator: J.lessThanOrEqual,
  6155. value: { type: te.num, value: Number.MAX_SAFE_INTEGER },
  6156. iconType: c,
  6157. iconId: String(f)
  6158. } : oi(c, f, m));
  6159. }), [p, C] = H(() => r ? !!r.isShowValue : !0), _ = Se(() => {
  6160. const l = d.map((g) => oo(g.iconType, g.iconId));
  6161. return /* @__PURE__ */ x.jsx("div", { className: W.iconWrap, children: l.map((g, f) => g ? /* @__PURE__ */ x.jsx(
  6162. "img",
  6163. {
  6164. className: W.icon,
  6165. src: g
  6166. },
  6167. f
  6168. ) : /* @__PURE__ */ x.jsx(Zt, { className: W.icon }, f)) });
  6169. }, [d]), w = (l) => {
  6170. if (l.reduce((f, m, P) => f.preType && !f.result || l.length - 1 === P ? f : m.value.type === te.formula ? {
  6171. preType: te.formula,
  6172. result: !1
  6173. } : f.preType ? {
  6174. result: f.preType === m.value.type,
  6175. preType: m.value.type
  6176. } : {
  6177. result: !0,
  6178. preType: m.value.type
  6179. }, { result: !0, preType: "" }).result && [te.num, te.percent, te.percentile].includes(l[0].value.type)) {
  6180. const f = {};
  6181. return l.forEach((m, P, M) => {
  6182. if (P - 1 < 0 || P === M.length - 1)
  6183. return;
  6184. const N = l[P - 1], I = Qn(N.operator);
  6185. To({ operator: I, value: N.value.value }, m.value.value) || (f[P] = `${n.t(`sheet.cf.form.${I}`, String(N.value.value))} `);
  6186. }), f;
  6187. }
  6188. return {};
  6189. }, S = (l, g) => {
  6190. go(d, l) !== g && (mo(d, l, g), y([...d]), o(w(d)));
  6191. }, R = (l) => {
  6192. v(l);
  6193. const g = st[l] || [], f = new Array(g.length).fill("").map((m, P, M) => oi(l, P, M));
  6194. y(f), o(w(f));
  6195. };
  6196. we(() => {
  6197. const l = e.intercept(e.getInterceptPoints().submit, {
  6198. handler() {
  6199. return { type: K.iconSet, isShowValue: p, config: d };
  6200. }
  6201. });
  6202. return () => {
  6203. l();
  6204. };
  6205. }, [p, d, e]), we(() => {
  6206. const l = e.intercept(e.getInterceptPoints().beforeSubmit, {
  6207. handler() {
  6208. return Object.keys(i).length === 0;
  6209. }
  6210. });
  6211. return () => {
  6212. l();
  6213. };
  6214. }, [p, d, e, i]);
  6215. const h = () => {
  6216. const l = d.map((g) => ({ ...g }));
  6217. d.forEach((g, f) => {
  6218. const m = d.length - 1 - f, P = l[m];
  6219. g.iconId = P.iconId, g.iconType = P.iconType;
  6220. }), y([...d]);
  6221. }, s = he(Bo), [a, u] = H();
  6222. return Go(a, s.rootContainerElement), /* @__PURE__ */ x.jsxs("div", { className: W.iconSet, children: [
  6223. /* @__PURE__ */ x.jsx("div", { className: $.title, children: n.t("sheet.cf.panel.styleRule") }),
  6224. /* @__PURE__ */ x.jsx(
  6225. "div",
  6226. {
  6227. className: `
  6228. ${$.mTSm}
  6229. `,
  6230. children: /* @__PURE__ */ x.jsx(
  6231. sr,
  6232. {
  6233. placement: "bottomLeft",
  6234. overlay: /* @__PURE__ */ x.jsx(
  6235. Ll,
  6236. {
  6237. ref: (l) => !a && l && u(l),
  6238. iconType: c,
  6239. onClick: R
  6240. }
  6241. ),
  6242. children: /* @__PURE__ */ x.jsxs("div", { className: W.dropdownIcon, style: { width: "unset" }, children: [
  6243. _,
  6244. /* @__PURE__ */ x.jsx(Dn, {})
  6245. ] })
  6246. }
  6247. )
  6248. }
  6249. ),
  6250. /* @__PURE__ */ x.jsxs(
  6251. "div",
  6252. {
  6253. className: `
  6254. ${$.mTSm}
  6255. ${W.renderConfig}
  6256. `,
  6257. children: [
  6258. /* @__PURE__ */ x.jsxs("div", { className: W.utilItem, children: [
  6259. /* @__PURE__ */ x.jsx(gn, { onChange: h }),
  6260. n.t("sheet.cf.iconSet.reverseIconOrder")
  6261. ] }),
  6262. /* @__PURE__ */ x.jsxs(
  6263. "div",
  6264. {
  6265. className: `
  6266. ${W.utilItem}
  6267. ${$.mLXl}
  6268. `,
  6269. children: [
  6270. /* @__PURE__ */ x.jsx(gn, { checked: !p, onChange: (l) => {
  6271. C(!l);
  6272. } }),
  6273. n.t("sheet.cf.iconSet.onlyShowIcon")
  6274. ]
  6275. }
  6276. )
  6277. ]
  6278. }
  6279. ),
  6280. /* @__PURE__ */ x.jsx(zl, { errorMap: i, onChange: S, configList: d })
  6281. ] });
  6282. }, Vl = (t) => {
  6283. var h;
  6284. const { onChange: e, interceptorManager: r } = t, n = he(Ie), i = ((h = t.rule) == null ? void 0 : h.type) === K.highlightCell ? t.rule : void 0, o = [
  6285. { label: n.t("sheet.cf.panel.isNotBottom"), value: "isNotBottom" },
  6286. { label: n.t("sheet.cf.panel.isBottom"), value: "isBottom" },
  6287. { label: n.t("sheet.cf.panel.greaterThanAverage"), value: "greaterThanAverage" },
  6288. { label: n.t("sheet.cf.panel.lessThanAverage"), value: "lessThanAverage" }
  6289. ], [c, v] = H(() => {
  6290. const s = o[0].value, a = i == null ? void 0 : i.type;
  6291. if (!i)
  6292. return s;
  6293. switch (a) {
  6294. case K.highlightCell:
  6295. switch (i.subType) {
  6296. case G.average:
  6297. return [J.greaterThan, J.greaterThanOrEqual].includes(i.operator) ? "greaterThanAverage" : [J.lessThan, J.lessThanOrEqual].includes(i.operator) ? "lessThanAverage" : s;
  6298. case G.rank:
  6299. return i.isBottom ? "isBottom" : "isNotBottom";
  6300. }
  6301. }
  6302. return s;
  6303. }), [d, y] = H(() => {
  6304. const a = i == null ? void 0 : i.type;
  6305. if (!i)
  6306. return 10;
  6307. switch (a) {
  6308. case K.highlightCell:
  6309. switch (i.subType) {
  6310. case G.rank:
  6311. return i.value || 10;
  6312. }
  6313. }
  6314. return 10;
  6315. }), [p, C] = H(() => {
  6316. const a = i == null ? void 0 : i.type;
  6317. if (!i)
  6318. return !1;
  6319. switch (a) {
  6320. case K.highlightCell:
  6321. switch (i.subType) {
  6322. case G.rank:
  6323. return i.isPercent || !1;
  6324. }
  6325. }
  6326. return !1;
  6327. }), [_, w] = H({}), S = (s) => {
  6328. const { type: a, isPercent: u, value: b, style: l } = s;
  6329. if (a === "isNotBottom")
  6330. return { type: K.highlightCell, subType: G.rank, isPercent: u, isBottom: !1, value: b, style: l };
  6331. if (a === "isBottom")
  6332. return { type: K.highlightCell, subType: G.rank, isPercent: u, isBottom: !0, value: b, style: l };
  6333. if (a === "greaterThanAverage")
  6334. return { type: K.highlightCell, subType: G.average, operator: J.greaterThan, style: l };
  6335. if (a === "lessThanAverage")
  6336. return { type: K.highlightCell, subType: G.average, operator: J.lessThan, style: l };
  6337. };
  6338. we(() => r.intercept(r.getInterceptPoints().submit, {
  6339. handler() {
  6340. return S({ type: c, isPercent: p, value: d, style: _ });
  6341. }
  6342. }), [c, p, d, _, r]);
  6343. const R = (s) => {
  6344. e(S(s));
  6345. };
  6346. return /* @__PURE__ */ x.jsxs("div", { children: [
  6347. /* @__PURE__ */ x.jsx(
  6348. "div",
  6349. {
  6350. className: `
  6351. ${$.title}
  6352. ${$.mTBase}
  6353. `,
  6354. children: n.t("sheet.cf.panel.styleRule")
  6355. }
  6356. ),
  6357. /* @__PURE__ */ x.jsx(
  6358. Me,
  6359. {
  6360. className: `
  6361. ${W.width100}
  6362. ${$.mTSm}
  6363. `,
  6364. value: c,
  6365. options: o,
  6366. onChange: (s) => {
  6367. v(s), R({ type: s, isPercent: p, value: d, style: _ });
  6368. }
  6369. }
  6370. ),
  6371. ["isNotBottom", "isBottom"].includes(c) && /* @__PURE__ */ x.jsxs(
  6372. "div",
  6373. {
  6374. className: `
  6375. ${$.labelContainer}
  6376. ${$.mTSm}
  6377. `,
  6378. children: [
  6379. /* @__PURE__ */ x.jsx(
  6380. at,
  6381. {
  6382. min: 1,
  6383. max: 1e3,
  6384. value: d,
  6385. onChange: (s) => {
  6386. const a = s || 0;
  6387. y(a), R({ type: c, isPercent: p, value: a, style: _ });
  6388. }
  6389. }
  6390. ),
  6391. /* @__PURE__ */ x.jsxs(
  6392. "div",
  6393. {
  6394. className: `
  6395. ${$.mLSm}
  6396. ${$.labelContainer}
  6397. ${W.text}
  6398. `,
  6399. children: [
  6400. /* @__PURE__ */ x.jsx(
  6401. gn,
  6402. {
  6403. checked: p,
  6404. onChange: (s) => {
  6405. C(!!s), R({ type: c, isPercent: !!s, value: d, style: _ });
  6406. }
  6407. }
  6408. ),
  6409. n.t("sheet.cf.valueType.percent")
  6410. ]
  6411. }
  6412. )
  6413. ]
  6414. }
  6415. ),
  6416. /* @__PURE__ */ x.jsx(
  6417. "div",
  6418. {
  6419. className: `
  6420. ${W.cfPreviewWrap}
  6421. `,
  6422. children: /* @__PURE__ */ x.jsx(Ct, { rule: S({ type: c, isPercent: p, value: d, style: _ }) })
  6423. }
  6424. ),
  6425. /* @__PURE__ */ x.jsx(
  6426. gr,
  6427. {
  6428. style: i == null ? void 0 : i.style,
  6429. className: `
  6430. ${$.mTSm}
  6431. `,
  6432. onChange: (s) => {
  6433. w(s), R({ type: c, isPercent: p, value: d, style: s });
  6434. }
  6435. }
  6436. )
  6437. ] });
  6438. }, ql = pi("beforeSubmit"), Al = pi("submit"), si = (t) => t.getCurrentUnitForType(re.UNIVER_SHEET).getUnitId(), ai = (t) => {
  6439. var e;
  6440. return (e = t.getCurrentUnitForType(re.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : e.getSheetId();
  6441. }, Wl = (t) => {
  6442. var M, j, N;
  6443. const e = he(Ie), r = he(ge), n = he(ue), i = he(me), o = he(ct), c = si(n), v = ai(n), [d, y] = H(!0), p = Fe({}), [C, _] = H(void 0), w = Fe((j = (M = t.rule) == null ? void 0 : M.ranges) != null ? j : []), S = Se(() => {
  6444. var O, z, U;
  6445. let I = (O = t.rule) == null ? void 0 : O.ranges;
  6446. return I != null && I.length || (I = (U = (z = o.getCurrentSelections()) == null ? void 0 : z.map((k) => k.range)) != null ? U : []), w.current = I, I != null && I.length ? I.map((k) => {
  6447. const ie = Ii(k);
  6448. return ie === "NaN" ? "" : ie;
  6449. }).filter((k) => !!k).join(",") : "";
  6450. }, [t.rule]), R = [
  6451. { label: e.t("sheet.cf.ruleType.highlightCell"), value: "1" },
  6452. { label: e.t("sheet.cf.panel.rankAndAverage"), value: "2" },
  6453. { label: e.t("sheet.cf.ruleType.dataBar"), value: "3" },
  6454. { label: e.t("sheet.cf.ruleType.colorScale"), value: "4" },
  6455. { label: e.t("sheet.cf.ruleType.formula"), value: "5" },
  6456. { label: e.t("sheet.cf.ruleType.iconSet"), value: "6" }
  6457. ], [h, s] = H(() => {
  6458. var z, U;
  6459. const I = (z = t.rule) == null ? void 0 : z.rule.type, O = R[0].value;
  6460. if (!I)
  6461. return O;
  6462. switch (I) {
  6463. case K.highlightCell: {
  6464. switch ((U = t.rule) == null ? void 0 : U.rule.subType) {
  6465. case G.number:
  6466. case G.text:
  6467. case G.duplicateValues:
  6468. case G.uniqueValues:
  6469. case G.timePeriod:
  6470. return "1";
  6471. case G.average:
  6472. case G.rank:
  6473. return "2";
  6474. case G.formula:
  6475. return "5";
  6476. }
  6477. break;
  6478. }
  6479. case K.dataBar:
  6480. return "3";
  6481. case K.colorScale:
  6482. return "4";
  6483. case K.iconSet:
  6484. return "6";
  6485. }
  6486. return O;
  6487. }), a = Fe(), u = Se(() => new vo({ beforeSubmit: ql, submit: Al }), []), b = Se(() => {
  6488. switch (h) {
  6489. case "1":
  6490. return ii;
  6491. case "2":
  6492. return Vl;
  6493. case "3":
  6494. return Tl;
  6495. case "4":
  6496. return El;
  6497. case "5":
  6498. return Ml;
  6499. case "6":
  6500. return Fl;
  6501. default:
  6502. return ii;
  6503. }
  6504. }, [h]);
  6505. we(() => {
  6506. const I = r.onCommandExecuted((O) => {
  6507. if (O.id === Lo.id) {
  6508. const z = O.params;
  6509. z.subUnitId === v && z.unitId === c && t.onCancel();
  6510. }
  6511. O.id === rr.id && t.onCancel();
  6512. });
  6513. return () => I.dispose();
  6514. }, []);
  6515. const l = (I) => {
  6516. a.current = I;
  6517. }, g = (I) => {
  6518. const O = I.split(",").filter((z) => !!z).map(ns).map((z) => z.range);
  6519. w.current = O;
  6520. }, f = () => {
  6521. if (C)
  6522. return;
  6523. const O = (() => {
  6524. const U = n.getCurrentUnitForType(re.UNIVER_SHEET).getActiveSheet();
  6525. if (!U)
  6526. throw new Error("No active sheet found");
  6527. return w.current.map((ee) => $o(ee, U.getRowCount(), U.getColumnCount())).filter((ee) => !(Number.isNaN(ee.startRow) || Number.isNaN(ee.startColumn)));
  6528. })();
  6529. if (u.fetchThroughInterceptors(u.getInterceptPoints().beforeSubmit)(!0, null)) {
  6530. const U = u.fetchThroughInterceptors(u.getInterceptPoints().submit)(null, null);
  6531. if (U) {
  6532. const k = si(n), ie = ai(n);
  6533. if (!k || !ie)
  6534. throw new Error("No active sheet found");
  6535. let ee = {};
  6536. 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: !1 }, r.executeCommand(Pn.id, { unitId: k, subUnitId: ie, rule: ee }), t.onCancel());
  6537. }
  6538. }
  6539. }, m = () => {
  6540. t.onCancel();
  6541. }, P = (I, O) => {
  6542. I ? O.length < 1 ? _(e.t("sheet.cf.errorMessage.rangeError")) : _(void 0) : _(e.t("sheet.cf.errorMessage.rangeError"));
  6543. };
  6544. return Kt((I) => {
  6545. var z;
  6546. const O = (z = p.current) == null ? void 0 : z.handleOutClick;
  6547. O && O(I, () => y(!1));
  6548. }), /* @__PURE__ */ x.jsxs("div", { className: W.cfRuleStyleEditor, children: [
  6549. /* @__PURE__ */ x.jsx("div", { className: $.title, children: e.t("sheet.cf.panel.range") }),
  6550. /* @__PURE__ */ x.jsx(
  6551. "div",
  6552. {
  6553. className: `
  6554. ${$.mTBase}
  6555. `,
  6556. children: /* @__PURE__ */ x.jsx(
  6557. ds,
  6558. {
  6559. unitId: c,
  6560. errorText: C,
  6561. subUnitId: v,
  6562. initValue: S,
  6563. onChange: g,
  6564. onVerify: P,
  6565. onFocus: () => y(!0),
  6566. isFocus: d,
  6567. actions: p.current
  6568. }
  6569. )
  6570. }
  6571. ),
  6572. /* @__PURE__ */ x.jsx("div", { className: $.title, children: e.t("sheet.cf.panel.styleType") }),
  6573. /* @__PURE__ */ x.jsx("div", { className: $.mTBase, children: /* @__PURE__ */ x.jsx(Me, { className: W.width100, value: h, options: R, onChange: (I) => s(I) }) }),
  6574. /* @__PURE__ */ x.jsx(b, { interceptorManager: u, rule: (N = t.rule) == null ? void 0 : N.rule, onChange: l }),
  6575. /* @__PURE__ */ x.jsxs(
  6576. "div",
  6577. {
  6578. className: `
  6579. ${$.mTBase}
  6580. ${W.btnList}
  6581. `,
  6582. children: [
  6583. /* @__PURE__ */ x.jsx(yr, { size: "small", onClick: m, children: e.t("sheet.cf.panel.cancel") }),
  6584. /* @__PURE__ */ x.jsx(yr, { className: $.mLSm, size: "small", type: "primary", onClick: f, children: e.t("sheet.cf.panel.submit") })
  6585. ]
  6586. }
  6587. )
  6588. ] });
  6589. }, Hl = (t) => {
  6590. const [e, r] = H(t.rule), [n, i] = H(!!t.rule), o = () => {
  6591. i(!0);
  6592. }, c = () => {
  6593. i(!1), r(void 0);
  6594. }, v = (d) => {
  6595. r(d), i(!0);
  6596. };
  6597. return /* @__PURE__ */ x.jsx("div", { className: $.conditionalFormattingWrap, children: n ? /* @__PURE__ */ x.jsx(Wl, { onCancel: c, rule: e }) : /* @__PURE__ */ x.jsx(Za, { onClick: v, onCreate: o }) });
  6598. };
  6599. var Ul = Object.defineProperty, kl = Object.getOwnPropertyDescriptor, Bl = (t, e, r, n) => {
  6600. for (var i = n > 1 ? void 0 : n ? kl(e, r) : e, o = t.length - 1, c; o >= 0; o--)
  6601. (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
  6602. return n && i && Ul(e, r, i), i;
  6603. }, Mt = (t, e) => (r, n) => e(r, n, t);
  6604. const cn = "sheet.conditional.formatting.panel";
  6605. let Ht = class extends je {
  6606. constructor(e, r, n, i, o) {
  6607. super();
  6608. Xe(this, "_sidebarDisposable", null);
  6609. this._univerInstanceService = e, this._injector = r, this._componentManager = n, this._sidebarService = i, this._localeService = o, this._initPanel(), this.disposeWithMe(
  6610. this._univerInstanceService.getCurrentTypeOfUnit$(re.UNIVER_SHEET).subscribe((c) => {
  6611. var v;
  6612. c || (v = this._sidebarDisposable) == null || v.dispose();
  6613. })
  6614. ), this.disposeWithMe(this._sidebarService.sidebarOptions$.subscribe((c) => {
  6615. c.id === cn && (c.visible || setTimeout(() => {
  6616. this._sidebarService.sidebarOptions$.next({ visible: !1 });
  6617. }));
  6618. }));
  6619. }
  6620. openPanel(e) {
  6621. const r = {
  6622. id: cn,
  6623. header: { title: this._localeService.t("sheet.cf.title") },
  6624. children: {
  6625. label: cn,
  6626. rule: e,
  6627. key: yo(4)
  6628. },
  6629. onClose: () => this._sidebarDisposable = null
  6630. };
  6631. this._sidebarDisposable = this._sidebarService.open(r);
  6632. }
  6633. _initPanel() {
  6634. this._componentManager.register(cn, Hl);
  6635. }
  6636. };
  6637. Ht = Bl([
  6638. Mt(0, ue),
  6639. Mt(1, Q(We)),
  6640. Mt(2, Q(or)),
  6641. Mt(3, Q(Xo)),
  6642. Mt(4, Q(Ie))
  6643. ], Ht);
  6644. var Te = /* @__PURE__ */ ((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))(Te || {});
  6645. const jn = {
  6646. id: "sheet.operation.open.conditional.formatting.panel",
  6647. type: Re.OPERATION,
  6648. handler: (t, e) => {
  6649. var v;
  6650. const r = t.get(Ht), n = t.get(ct), i = t.get(ge), o = ((v = n.getCurrentSelections()) == null ? void 0 : v.map((d) => d.range)) || [];
  6651. switch (e.value) {
  6652. case 3: {
  6653. r.openPanel({ ...nt(), ranges: o });
  6654. break;
  6655. }
  6656. case 4: {
  6657. const d = {
  6658. ...nt,
  6659. ranges: o,
  6660. rule: {
  6661. type: K.highlightCell,
  6662. subType: G.rank
  6663. }
  6664. };
  6665. r.openPanel(d);
  6666. break;
  6667. }
  6668. case 5: {
  6669. const d = {
  6670. ...nt,
  6671. ranges: o,
  6672. rule: {
  6673. type: K.highlightCell,
  6674. subType: G.formula,
  6675. value: "="
  6676. }
  6677. };
  6678. r.openPanel(d);
  6679. break;
  6680. }
  6681. case 6: {
  6682. const d = {
  6683. ...nt,
  6684. ranges: o,
  6685. rule: {
  6686. type: K.colorScale,
  6687. config: []
  6688. }
  6689. };
  6690. r.openPanel(d);
  6691. break;
  6692. }
  6693. case 7: {
  6694. const d = {
  6695. ...nt,
  6696. ranges: o,
  6697. rule: {
  6698. type: K.dataBar,
  6699. isShowValue: !0
  6700. }
  6701. };
  6702. r.openPanel(d);
  6703. break;
  6704. }
  6705. case 8: {
  6706. const d = {
  6707. ...nt,
  6708. ranges: o,
  6709. rule: {
  6710. type: K.iconSet,
  6711. config: [],
  6712. isShowValue: !0
  6713. }
  6714. };
  6715. r.openPanel(d);
  6716. break;
  6717. }
  6718. case 2: {
  6719. r.openPanel();
  6720. break;
  6721. }
  6722. case 1: {
  6723. r.openPanel({ ...nt(), ranges: o });
  6724. break;
  6725. }
  6726. case 9: {
  6727. i.executeCommand(ar.id, { ranges: o });
  6728. break;
  6729. }
  6730. case 10: {
  6731. i.executeCommand(On.id);
  6732. break;
  6733. }
  6734. }
  6735. return !0;
  6736. }
  6737. };
  6738. var Gl = Object.defineProperty, Xl = Object.getOwnPropertyDescriptor, Yl = (t, e, r, n) => {
  6739. for (var i = n > 1 ? void 0 : n ? Xl(e, r) : e, o = t.length - 1, c; o >= 0; o--)
  6740. (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
  6741. return n && i && Gl(e, r, i), i;
  6742. }, Nt = (t, e) => (r, n) => e(r, n, t);
  6743. let Ut = class extends je {
  6744. constructor(e, r, n, i, o) {
  6745. super();
  6746. Xe(this, "_copyInfo");
  6747. this._sheetClipboardService = e, this._conditionalFormattingRuleModel = r, this._injector = n, this._conditionalFormattingViewModel = i, this._univerInstanceService = o, this._initClipboardHook();
  6748. }
  6749. _initClipboardHook() {
  6750. this.disposeWithMe(
  6751. this._sheetClipboardService.addClipboardHook({
  6752. id: Yt,
  6753. onBeforeCopy: (e, r, n) => this._collectConditionalRule(e, r, n),
  6754. onPasteCells: (e, r, n, i) => {
  6755. const { copyType: o = br.COPY, pasteType: c } = i, { range: v } = e || {}, { range: d } = r;
  6756. return this._generateConditionalFormattingMutations(d, { copyType: o, pasteType: c, copyRange: v });
  6757. }
  6758. })
  6759. );
  6760. }
  6761. _collectConditionalRule(e, r, n) {
  6762. const i = new Ze(), o = {};
  6763. this._copyInfo = {
  6764. matrix: i,
  6765. info: {
  6766. unitId: e,
  6767. subUnitId: r,
  6768. cfMap: o
  6769. }
  6770. };
  6771. const c = this._injector.invoke((p) => os(n, p, e, r));
  6772. if (!c)
  6773. return;
  6774. const { rows: v, cols: d } = c, y = /* @__PURE__ */ new Set();
  6775. v.forEach((p, C) => {
  6776. d.forEach((_, w) => {
  6777. const S = this._conditionalFormattingViewModel.getCellCfs(e, r, p, _);
  6778. S && (S.forEach((R) => y.add(R.cfId)), i.setValue(C, w, S.map((R) => R.cfId)));
  6779. });
  6780. }), y.forEach((p) => {
  6781. const C = this._conditionalFormattingRuleModel.getRule(e, r, p);
  6782. C && (o[p] = C.rule);
  6783. });
  6784. }
  6785. // eslint-disable-next-line max-lines-per-function
  6786. _generateConditionalFormattingMutations(e, r) {
  6787. const n = this._univerInstanceService.getCurrentUnitForType(re.UNIVER_SHEET), i = n.getActiveSheet(), o = n.getUnitId();
  6788. if (!i) return { redos: [], undos: [] };
  6789. const c = i.getSheetId();
  6790. if (r.copyType === br.CUT)
  6791. return this._copyInfo = null, { redos: [], undos: [] };
  6792. if (!this._copyInfo || !r.copyRange)
  6793. return { redos: [], undos: [] };
  6794. if (![
  6795. zn.SPECIAL_PASTE_FORMAT,
  6796. zn.DEFAULT_PASTE,
  6797. zn.SPECIAL_PASTE_BESIDES_BORDER
  6798. ].includes(
  6799. r.pasteType
  6800. ))
  6801. return { redos: [], undos: [] };
  6802. const { ranges: [d, y], mapFunc: p } = Ei([r.copyRange, e]), C = ss(d, y, !0), _ = {};
  6803. ze.foreach(y, (l, g) => {
  6804. const { row: f, col: m } = p(l, g), P = this._conditionalFormattingViewModel.getCellCfs(o, c, f, m);
  6805. P && P.forEach((M) => {
  6806. if (!_[M.cfId]) {
  6807. const j = new Ze();
  6808. _[M.cfId] = j;
  6809. const N = this._conditionalFormattingRuleModel.getRule(o, c, M.cfId);
  6810. N == null || N.ranges.forEach((I) => {
  6811. ze.foreach(I, (O, z) => {
  6812. j.setValue(O, z, 1);
  6813. });
  6814. });
  6815. }
  6816. _[M.cfId].realDeleteValue(f, m);
  6817. });
  6818. });
  6819. const { matrix: w, info: S } = this._copyInfo, R = [];
  6820. let h = this._conditionalFormattingRuleModel.createCfId(o, c);
  6821. const s = {}, a = (l) => {
  6822. if (s[l])
  6823. return s[l];
  6824. const g = S == null ? void 0 : S.cfMap[l], f = [...this._conditionalFormattingRuleModel.getSubunitRules(o, c) || [], ...R].find((m) => tr.diffValue(m.rule, g));
  6825. if (f)
  6826. return s[l] = f, f;
  6827. {
  6828. const m = {
  6829. rule: g,
  6830. cfId: h,
  6831. ranges: [],
  6832. stopIfTrue: !1
  6833. };
  6834. return s[l] = m, R.push(m), h = `${Number(h) + 1}`, m;
  6835. }
  6836. };
  6837. C.forEach((l) => {
  6838. w && w.forValue((g, f, m) => {
  6839. const P = Be.getPositionRange(
  6840. {
  6841. startRow: g,
  6842. endRow: g,
  6843. startColumn: f,
  6844. endColumn: f
  6845. },
  6846. l.startRange
  6847. ), { row: M, col: j } = p(P.startRow, P.startColumn);
  6848. m.forEach((N) => {
  6849. if (!_[N]) {
  6850. const I = a(N), O = new Ze();
  6851. _[N] = O, I.ranges.forEach((z) => {
  6852. ze.foreach(z, (U, k) => {
  6853. O.setValue(U, k, 1);
  6854. });
  6855. });
  6856. }
  6857. _[N].setValue(M, j, 1);
  6858. });
  6859. });
  6860. });
  6861. const u = [], b = [];
  6862. for (const l in _) {
  6863. const g = _[l], f = At(Wt(g));
  6864. if (!f.length) {
  6865. const m = {
  6866. unitId: o,
  6867. subUnitId: c,
  6868. cfId: l
  6869. };
  6870. u.push({ id: Ne.id, params: m }), b.push(...Ge(this._injector, m));
  6871. }
  6872. if (R.some((m) => m.cfId === l)) {
  6873. const m = a(l), P = {
  6874. unitId: o,
  6875. subUnitId: c,
  6876. rule: { ...m, ranges: f }
  6877. };
  6878. u.push({ id: _e.id, params: P }), b.push(nr(this._injector, P));
  6879. } else {
  6880. const m = this._conditionalFormattingRuleModel.getRule(o, c, l);
  6881. if (!m)
  6882. continue;
  6883. const P = {
  6884. unitId: o,
  6885. subUnitId: c,
  6886. rule: { ...m, ranges: f }
  6887. };
  6888. u.push({ id: Ve.id, params: P }), b.push(...Je(this._injector, P));
  6889. }
  6890. }
  6891. return {
  6892. redos: u,
  6893. undos: b
  6894. };
  6895. }
  6896. };
  6897. Ut = Yl([
  6898. Nt(0, Q(is)),
  6899. Nt(1, Q(me)),
  6900. Nt(2, Q(We)),
  6901. Nt(3, Q(Xt)),
  6902. Nt(4, Q(ue))
  6903. ], Ut);
  6904. var Kl = Object.defineProperty, Zl = Object.getOwnPropertyDescriptor, Jl = (t, e, r, n) => {
  6905. for (var i = n > 1 ? void 0 : n ? Zl(e, r) : e, o = t.length - 1, c; o >= 0; o--)
  6906. (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
  6907. return n && i && Kl(e, r, i), i;
  6908. }, Yn = (t, e) => (r, n) => e(r, n, t);
  6909. let kt = class extends je {
  6910. constructor(t, e, r) {
  6911. super(), this._localeService = t, this._commandService = e, this._sheetPermissionCheckController = r, this._commandExecutedListener();
  6912. }
  6913. _commandExecutedListener() {
  6914. this.disposeWithMe(
  6915. this._commandService.beforeCommandExecuted((t) => {
  6916. t.id === Pn.id && (this._sheetPermissionCheckController.permissionCheckWithRanges({
  6917. workbookTypes: [wi],
  6918. rangeTypes: [Ri],
  6919. worksheetTypes: [_i, xi]
  6920. }, t.params.rule.ranges) || this._sheetPermissionCheckController.blockExecuteWithoutPermission(this._localeService.t("permission.dialog.setStyleErr")));
  6921. })
  6922. );
  6923. }
  6924. };
  6925. kt = Jl([
  6926. Yn(0, Q(Ie)),
  6927. Yn(1, ge),
  6928. Yn(2, Q(zo))
  6929. ], kt);
  6930. var Ql = Object.defineProperty, ec = Object.getOwnPropertyDescriptor, tc = (t, e, r, n) => {
  6931. for (var i = n > 1 ? void 0 : n ? ec(e, r) : e, o = t.length - 1, c; o >= 0; o--)
  6932. (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
  6933. return n && i && Ql(e, r, i), i;
  6934. }, un = (t, e) => (r, n) => e(r, n, t);
  6935. let Bt = class extends je {
  6936. constructor(t, e, r, n) {
  6937. super(), this._conditionalFormattingRuleModel = t, this._univerInstanceService = e, this._injector = r, this._refRangeService = n, this._initRefRange();
  6938. }
  6939. _initRefRange() {
  6940. const t = /* @__PURE__ */ new Map(), e = (n, i, o) => `${n}_${i}_${o}`, r = (n, i, o) => {
  6941. const c = (d) => {
  6942. const y = [...o.ranges], p = y.map((_) => Vo(_, d)).filter((_) => !!_);
  6943. if (Oo(p, y))
  6944. return { redos: [], undos: [] };
  6945. if (p.length) {
  6946. const _ = { unitId: n, subUnitId: i, rule: { ...o, ranges: p } }, w = [{ id: Ve.id, params: _ }], S = Je(this._injector, _);
  6947. return { redos: w, undos: S };
  6948. } else {
  6949. const _ = { unitId: n, subUnitId: i, cfId: o.cfId }, w = [{ id: Ne.id, params: _ }], S = Ge(this._injector, _);
  6950. return { redos: w, undos: S };
  6951. }
  6952. }, v = [];
  6953. o.ranges.forEach((d) => {
  6954. const y = this._refRangeService.registerRefRange(d, c);
  6955. v.push(() => y.dispose());
  6956. }), t.set(e(n, i, o.cfId), () => v.forEach((d) => d()));
  6957. };
  6958. this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe((n) => {
  6959. const { unitId: i, subUnitId: o, rule: c } = n, v = this._univerInstanceService.getCurrentUnitForType(re.UNIVER_SHEET), d = v.getActiveSheet();
  6960. if (!(n.unitId !== v.getUnitId() || n.subUnitId !== (d == null ? void 0 : d.getSheetId())))
  6961. switch (n.type) {
  6962. case "add": {
  6963. r(n.unitId, n.subUnitId, n.rule);
  6964. break;
  6965. }
  6966. case "delete": {
  6967. const y = t.get(e(i, o, c.cfId));
  6968. y && y();
  6969. break;
  6970. }
  6971. case "set": {
  6972. const y = t.get(e(i, o, c.cfId));
  6973. y && y(), r(n.unitId, n.subUnitId, n.rule);
  6974. }
  6975. }
  6976. })), this.disposeWithMe(gi(() => {
  6977. t.forEach((n) => {
  6978. n();
  6979. }), t.clear();
  6980. }));
  6981. }
  6982. };
  6983. Bt = tc([
  6984. un(0, Q(me)),
  6985. un(1, Q(ue)),
  6986. un(2, Q(We)),
  6987. un(3, Q(Fo))
  6988. ], Bt);
  6989. var nc = Object.defineProperty, rc = Object.getOwnPropertyDescriptor, ic = (t, e, r, n) => {
  6990. for (var i = n > 1 ? void 0 : n ? rc(e, r) : e, o = t.length - 1, c; o >= 0; o--)
  6991. (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
  6992. return n && i && nc(e, r, i), i;
  6993. }, ht = (t, e) => (r, n) => e(r, n, t);
  6994. let Gt = class extends je {
  6995. constructor(e, r, n, i, o, c) {
  6996. super();
  6997. /**
  6998. * When a set operation is triggered multiple times over a short period of time, it may result in some callbacks not being disposed,and caused a render cache exception.
  6999. * The solution here is to store all the asynchronous tasks and focus on processing after the last callback
  7000. */
  7001. Xe(this, "_ruleChangeCacheMap", /* @__PURE__ */ new Map());
  7002. this._sheetInterceptorService = e, this._conditionalFormattingService = r, this._univerInstanceService = n, this._renderManagerService = i, this._conditionalFormattingViewModel = o, this._conditionalFormattingRuleModel = c, this._initViewModelInterceptor(), this._initSkeleton(), this.disposeWithMe(() => {
  7003. this._ruleChangeCacheMap.clear();
  7004. });
  7005. }
  7006. _markDirtySkeleton() {
  7007. var r, n, i;
  7008. const e = this._univerInstanceService.getCurrentUnitForType(re.UNIVER_SHEET).getUnitId();
  7009. (r = this._renderManagerService.getRenderById(e)) == null || r.with(Ti).reCalculate(), (i = (n = this._renderManagerService.getRenderById(e)) == null ? void 0 : n.mainComponent) == null || i.makeDirty();
  7010. }
  7011. _initSkeleton() {
  7012. this.disposeWithMe(Oi(this._conditionalFormattingRuleModel.$ruleChange, this._conditionalFormattingViewModel.markDirty$).pipe(
  7013. fs(16),
  7014. Cr((e) => !!e.length),
  7015. Cr((e) => {
  7016. const r = this._univerInstanceService.getCurrentUnitForType(re.UNIVER_SHEET);
  7017. if (!r) return !1;
  7018. const n = r.getActiveSheet();
  7019. return n ? e.filter((i) => i.unitId === r.getUnitId() && i.subUnitId === n.getSheetId()).length > 0 : !1;
  7020. })
  7021. ).subscribe(() => this._markDirtySkeleton()));
  7022. }
  7023. _initViewModelInterceptor() {
  7024. this.disposeWithMe(this._sheetInterceptorService.intercept(qo.CELL_CONTENT, {
  7025. effect: bo.Style,
  7026. handler: (e, r, n) => {
  7027. const i = this._conditionalFormattingService.composeStyle(r.unitId, r.subUnitId, r.row, r.col);
  7028. if (!i)
  7029. return n(e);
  7030. 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 };
  7031. 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 = Do + Mo), n(d);
  7032. },
  7033. priority: 10
  7034. }));
  7035. }
  7036. };
  7037. Gt = ic([
  7038. ht(0, Q(ir)),
  7039. ht(1, Q(Si)),
  7040. ht(2, Q(ue)),
  7041. ht(3, Q(Di)),
  7042. ht(4, Q(Xt)),
  7043. ht(5, Q(me))
  7044. ], Gt);
  7045. const so = "sheets-conditional-formatting-ui.config", bn = {};
  7046. var ao = Object.defineProperty, oc = Object.getOwnPropertyDescriptor, sc = (t, e, r) => e in t ? ao(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, ac = (t, e, r, n) => {
  7047. for (var i = n > 1 ? void 0 : n ? oc(e, r) : e, o = t.length - 1, c; o >= 0; o--)
  7048. (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
  7049. return n && i && ao(e, r, i), i;
  7050. }, Kn = (t, e) => (r, n) => e(r, n, t), lo = (t, e, r) => sc(t, typeof e != "symbol" ? e + "" : e, r);
  7051. let Sn = class extends vi {
  7052. constructor(t = bn, e, r, n) {
  7053. super(), this._config = t, this._injector = e, this._commandService = r, this._configService = n;
  7054. const { menu: i, ...o } = yi(
  7055. {},
  7056. bn,
  7057. this._config
  7058. );
  7059. i && this._configService.setConfig("menu", i, { merge: !0 }), this._configService.setConfig(so, o), this._initCommand(), this._injector.add([Gt]), this._injector.add([Bt]), this._injector.add([Ut]), this._injector.add([kt]), this._injector.add([mt]);
  7060. }
  7061. _initCommand() {
  7062. [
  7063. Mi,
  7064. Ni,
  7065. ji,
  7066. Li,
  7067. $i,
  7068. zi,
  7069. Fi,
  7070. Vi,
  7071. qi,
  7072. jn,
  7073. mn,
  7074. cr,
  7075. lr,
  7076. Pn,
  7077. ar,
  7078. On
  7079. ].forEach((t) => {
  7080. this._commandService.registerCommand(t);
  7081. });
  7082. }
  7083. };
  7084. lo(Sn, "pluginName", `${Yt}_MOBILE_UI_PLUGIN`);
  7085. lo(Sn, "type", re.UNIVER_SHEET);
  7086. Sn = ac([
  7087. mi(Ci),
  7088. Kn(1, Q(We)),
  7089. Kn(2, Q(ge)),
  7090. Kn(3, bi)
  7091. ], Sn);
  7092. var lc = Object.defineProperty, cc = Object.getOwnPropertyDescriptor, uc = (t, e, r, n) => {
  7093. for (var i = n > 1 ? void 0 : n ? cc(e, r) : e, o = t.length - 1, c; o >= 0; o--)
  7094. (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
  7095. return n && i && lc(e, r, i), i;
  7096. }, jt = (t, e) => (r, n) => e(r, n, t);
  7097. let Cn = class extends je {
  7098. constructor(t, e, r, n, i) {
  7099. super(), this._injector = t, this._univerInstanceService = e, this._autoFillService = r, this._conditionalFormattingRuleModel = n, this._conditionalFormattingViewModel = i, this._initAutoFill();
  7100. }
  7101. // eslint-disable-next-line max-lines-per-function
  7102. _initAutoFill() {
  7103. const t = () => ({ redos: [], undos: [] }), e = (i, o, c, v, d) => {
  7104. var w;
  7105. const y = this._univerInstanceService.getCurrentUnitForType(re.UNIVER_SHEET).getUnitId(), p = (w = this._univerInstanceService.getCurrentUnitForType(re.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : w.getSheetId();
  7106. if (!y || !p)
  7107. return;
  7108. const C = {
  7109. startRow: i.row,
  7110. startColumn: i.col,
  7111. endColumn: i.col,
  7112. endRow: i.row
  7113. }, _ = {
  7114. startRow: o.row,
  7115. startColumn: o.col,
  7116. endColumn: o.col,
  7117. endRow: o.row
  7118. };
  7119. ze.foreach(c, (S, R) => {
  7120. const h = Be.getPositionRange(
  7121. {
  7122. startRow: S,
  7123. startColumn: R,
  7124. endColumn: R,
  7125. endRow: S
  7126. },
  7127. C
  7128. ), s = Be.getPositionRange(
  7129. {
  7130. startRow: S,
  7131. startColumn: R,
  7132. endColumn: R,
  7133. endRow: S
  7134. },
  7135. _
  7136. ), { row: a, col: u } = d(h.startRow, h.startColumn), b = this._conditionalFormattingViewModel.getCellCfs(
  7137. y,
  7138. p,
  7139. a,
  7140. u
  7141. ), { row: l, col: g } = d(s.startRow, s.startColumn), f = this._conditionalFormattingViewModel.getCellCfs(
  7142. y,
  7143. p,
  7144. l,
  7145. g
  7146. );
  7147. f && f.forEach((m) => {
  7148. let P = v.get(m.cfId);
  7149. if (!v.get(m.cfId)) {
  7150. const M = this._conditionalFormattingRuleModel.getRule(y, p, m.cfId);
  7151. if (!M)
  7152. return;
  7153. P = new Ze(), M.ranges.forEach((j) => {
  7154. ze.foreach(j, (N, I) => {
  7155. P.setValue(N, I, 1);
  7156. });
  7157. }), v.set(m.cfId, P);
  7158. }
  7159. P.realDeleteValue(l, g);
  7160. }), b && b.forEach((m) => {
  7161. let P = v.get(m.cfId);
  7162. if (!v.get(m.cfId)) {
  7163. const M = this._conditionalFormattingRuleModel.getRule(y, p, m.cfId);
  7164. if (!M)
  7165. return;
  7166. P = new Ze(), M.ranges.forEach((j) => {
  7167. ze.foreach(j, (N, I) => {
  7168. P.setValue(N, I, 1);
  7169. });
  7170. }), v.set(m.cfId, P);
  7171. }
  7172. P.setValue(l, g, 1);
  7173. });
  7174. });
  7175. }, r = (i, o) => {
  7176. var s, a, u;
  7177. const c = (s = this._univerInstanceService.getCurrentUnitForType(re.UNIVER_SHEET)) == null ? void 0 : s.getUnitId(), v = (u = (a = this._univerInstanceService.getCurrentUnitForType(re.UNIVER_SHEET)) == null ? void 0 : a.getActiveSheet()) == null ? void 0 : u.getSheetId(), d = /* @__PURE__ */ new Map(), y = [], p = [];
  7178. if (!c || !v)
  7179. return t();
  7180. const C = Ei([i, o]), [_, w] = C.ranges, { mapFunc: S } = C, R = {
  7181. row: _.startRow,
  7182. col: _.startColumn
  7183. };
  7184. return ls(_, w).forEach((b) => {
  7185. e(R, b.repeatStartCell, b.relativeRange, d, S);
  7186. }), d.forEach((b, l) => {
  7187. const g = this._conditionalFormattingRuleModel.getRule(c, v, l);
  7188. if (!g)
  7189. return;
  7190. const f = At(Wt(b));
  7191. if (f.length) {
  7192. const m = {
  7193. unitId: c,
  7194. subUnitId: v,
  7195. rule: { ...g, ranges: f }
  7196. };
  7197. y.push({ id: Ve.id, params: m }), p.push(...Je(this._injector, m));
  7198. } else {
  7199. const m = {
  7200. unitId: c,
  7201. subUnitId: v,
  7202. cfId: g.cfId
  7203. };
  7204. y.push({ id: Ne.id, params: m }), p.push(...Ge(this._injector, m));
  7205. }
  7206. }), {
  7207. undos: p,
  7208. redos: y
  7209. };
  7210. }, n = {
  7211. id: Yt,
  7212. onFillData: (i, o, c) => {
  7213. if (c === Fn.COPY || c === Fn.ONLY_FORMAT || c === Fn.SERIES) {
  7214. const { source: v, target: d } = i;
  7215. return r(v, d);
  7216. }
  7217. return t();
  7218. }
  7219. };
  7220. this.disposeWithMe(this._autoFillService.addHook(n));
  7221. }
  7222. };
  7223. Cn = uc([
  7224. jt(0, Q(We)),
  7225. jt(1, Q(ue)),
  7226. jt(2, Q(as)),
  7227. jt(3, Q(me)),
  7228. jt(4, Q(Xt))
  7229. ], Cn);
  7230. var dc = Object.defineProperty, fc = Object.getOwnPropertyDescriptor, hc = (t, e, r, n) => {
  7231. for (var i = n > 1 ? void 0 : n ? fc(e, r) : e, o = t.length - 1, c; o >= 0; o--)
  7232. (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
  7233. return n && i && dc(e, r, i), i;
  7234. }, Lt = (t, e) => (r, n) => e(r, n, t);
  7235. let wn = class extends je {
  7236. constructor(t, e, r, n, i) {
  7237. super(), this._injector = t, this._univerInstanceService = e, this._sheetInterceptorService = r, this._selectionManagerService = n, this._conditionalFormattingRuleModel = i, this._init();
  7238. }
  7239. _init() {
  7240. this.disposeWithMe(this._sheetInterceptorService.interceptCommand({
  7241. getMutations: (t) => {
  7242. var i;
  7243. const e = [], r = [], n = { redos: e, undos: r };
  7244. if ([Ao.id, Wo.id].includes(t.id)) {
  7245. const o = (i = this._selectionManagerService.getCurrentSelections()) == null ? void 0 : i.map((w) => w.range);
  7246. if (!o)
  7247. return n;
  7248. const c = this._univerInstanceService.getCurrentUnitForType(re.UNIVER_SHEET), v = c.getActiveSheet();
  7249. if (!v)
  7250. return n;
  7251. const d = c.getUnitId(), y = v.getSheetId(), p = this._conditionalFormattingRuleModel.getSubunitRules(d, y);
  7252. if (!p || !p.length)
  7253. return n;
  7254. const { redos: C, undos: _ } = li(this._injector, p, o, d, y);
  7255. e.push(...C), r.push(..._);
  7256. }
  7257. return n;
  7258. }
  7259. })), this.disposeWithMe(this._sheetInterceptorService.interceptRanges({
  7260. getMutations: ({ unitId: t, subUnitId: e, ranges: r }) => {
  7261. const n = [], i = [], o = { redos: n, undos: i };
  7262. if (!r || !r.length)
  7263. return o;
  7264. const c = this._conditionalFormattingRuleModel.getSubunitRules(t, e);
  7265. if (!c || !c.length)
  7266. return o;
  7267. const { redos: v, undos: d } = li(this._injector, c, r, t, e);
  7268. return n.push(...v), i.push(...d), o;
  7269. }
  7270. }));
  7271. }
  7272. };
  7273. wn = hc([
  7274. Lt(0, Q(We)),
  7275. Lt(1, Q(ue)),
  7276. Lt(2, Q(ir)),
  7277. Lt(3, Q(ct)),
  7278. Lt(4, Q(me))
  7279. ], wn);
  7280. function li(t, e, r, n, i) {
  7281. const o = [], c = [];
  7282. return e.filter((v) => r.some((d) => v.ranges.some((y) => Be.getIntersects(y, d)))).forEach((v) => {
  7283. const y = new Ho().add(...v.ranges).subtract(...r).merge();
  7284. if (y.length) {
  7285. const p = {
  7286. id: Ve.id,
  7287. params: {
  7288. unitId: n,
  7289. subUnitId: i,
  7290. rule: { ...v, ranges: y }
  7291. }
  7292. }, C = Je(t, p.params);
  7293. o.push(p), c.push(...C);
  7294. } else {
  7295. const p = {
  7296. id: Ne.id,
  7297. params: {
  7298. unitId: n,
  7299. subUnitId: i,
  7300. cfId: v.cfId
  7301. }
  7302. }, C = Ge(t, p.params);
  7303. o.push(p), c.push(...C);
  7304. }
  7305. }), { redos: o, undos: c };
  7306. }
  7307. var pc = Object.defineProperty, gc = Object.getOwnPropertyDescriptor, mc = (t, e, r, n) => {
  7308. for (var i = n > 1 ? void 0 : n ? gc(e, r) : e, o = t.length - 1, c; o >= 0; o--)
  7309. (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
  7310. return n && i && pc(e, r, i), i;
  7311. }, ci = (t, e) => (r, n) => e(r, n, t);
  7312. let Rn = class extends je {
  7313. constructor(t, e) {
  7314. super(), this._sheetInterceptorService = t, this._conditionalFormattingService = e, this._initInterceptorEditorEnd();
  7315. }
  7316. /**
  7317. * Process the values after edit
  7318. * @private
  7319. * @memberof NumfmtService
  7320. */
  7321. _initInterceptorEditorEnd() {
  7322. this.disposeWithMe(
  7323. gi(
  7324. this._sheetInterceptorService.writeCellInterceptor.intercept(
  7325. Uo,
  7326. {
  7327. handler: (t, e, r) => {
  7328. var c, v, d;
  7329. t || r(t);
  7330. 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);
  7331. if (t != null && t.p)
  7332. return (d = (v = t.p.body) == null ? void 0 : v.textRuns) == null || d.forEach((y) => {
  7333. y.ts && o.forEach((p) => {
  7334. var C;
  7335. (C = y.ts) == null || delete C[p];
  7336. });
  7337. }), r(t);
  7338. {
  7339. const y = { ...(typeof (t == null ? void 0 : t.s) == "string" ? e.workbook.getStyles().get(t.s) : t == null ? void 0 : t.s) || {} };
  7340. o.forEach((C) => {
  7341. delete y[C];
  7342. });
  7343. const p = { ...t, s: { ...y } };
  7344. return r(p);
  7345. }
  7346. }
  7347. }
  7348. )
  7349. )
  7350. );
  7351. }
  7352. };
  7353. Rn = mc([
  7354. ci(0, Q(ir)),
  7355. ci(1, Q(Si))
  7356. ], Rn);
  7357. const ui = [
  7358. rr.id,
  7359. _e.id,
  7360. Ve.id,
  7361. Ne.id,
  7362. fn.id
  7363. ], $t = [
  7364. {
  7365. label: "sheet.cf.ruleType.highlightCell",
  7366. value: Te.highlightCell
  7367. },
  7368. {
  7369. label: "sheet.cf.panel.rankAndAverage",
  7370. value: Te.rank
  7371. },
  7372. {
  7373. label: "sheet.cf.ruleType.formula",
  7374. value: Te.formula
  7375. },
  7376. {
  7377. label: "sheet.cf.ruleType.colorScale",
  7378. value: Te.colorScale
  7379. },
  7380. {
  7381. label: "sheet.cf.ruleType.dataBar",
  7382. value: Te.dataBar
  7383. },
  7384. {
  7385. label: "sheet.cf.ruleType.iconSet",
  7386. value: Te.icon
  7387. },
  7388. {
  7389. label: "sheet.cf.menu.manageConditionalFormatting",
  7390. value: Te.viewRule
  7391. },
  7392. {
  7393. label: "sheet.cf.menu.createConditionalFormatting",
  7394. value: Te.createRule
  7395. },
  7396. {
  7397. label: "sheet.cf.menu.clearRangeRules",
  7398. value: Te.clearRangeRules,
  7399. disabled: !1
  7400. },
  7401. {
  7402. label: "sheet.cf.menu.clearWorkSheetRules",
  7403. value: Te.clearWorkSheetRules
  7404. }
  7405. ], vc = (t) => {
  7406. const e = t.get(ct), r = t.get(ge), n = t.get(ue), i = t.get(me), o = new ot((d) => Oi(
  7407. e.selectionMoveEnd$,
  7408. e.selectionSet$,
  7409. new ot((y) => {
  7410. const p = r.onCommandExecuted((C) => {
  7411. var R;
  7412. const { id: _, params: w } = C, S = (R = n.getCurrentUnitForType(re.UNIVER_SHEET)) == null ? void 0 : R.getUnitId();
  7413. ui.includes(_) && w.unitId === S && y.next(null);
  7414. });
  7415. return () => p.dispose();
  7416. })
  7417. ).pipe(wr(16)).subscribe(() => {
  7418. var R;
  7419. const y = ((R = e.getCurrentSelections()) == null ? void 0 : R.map((h) => h.range)) || [], p = n.getCurrentUnitForType(re.UNIVER_SHEET);
  7420. if (!p) return;
  7421. const C = p.getActiveSheet();
  7422. if (!C) return;
  7423. const S = (i.getSubunitRules(p.getUnitId(), C.getSheetId()) || []).filter((h) => h.ranges.some((s) => y.some((a) => Be.intersects(a, s)))).map((h) => h.ranges).every((h) => pn(t, p.getUnitId(), C.getSheetId(), h));
  7424. d.next(S);
  7425. })), c = new ot(
  7426. (d) => new ot((y) => {
  7427. const p = r.onCommandExecuted((C) => {
  7428. var R;
  7429. const { id: _, params: w } = C, S = (R = n.getCurrentUnitForType(re.UNIVER_SHEET)) == null ? void 0 : R.getUnitId();
  7430. ui.includes(_) && w.unitId === S && y.next(null);
  7431. });
  7432. return () => p.dispose();
  7433. }).pipe(wr(16)).subscribe(() => {
  7434. const y = n.getCurrentUnitForType(re.UNIVER_SHEET);
  7435. if (!y) return;
  7436. const p = y.getActiveSheet();
  7437. if (!p) return;
  7438. const C = i.getSubunitRules(y.getUnitId(), p.getSheetId()) || [];
  7439. if (!C.length)
  7440. return d.next(!1), !1;
  7441. const _ = C.map((w) => w.ranges).every((w) => pn(t, y.getUnitId(), p.getSheetId(), w));
  7442. d.next(_);
  7443. })
  7444. ), v = new ot((d) => {
  7445. o.subscribe((y) => {
  7446. const p = $t.find((C) => C.value === Te.clearRangeRules);
  7447. p && (p.disabled = !y, d.next($t));
  7448. }), c.subscribe((y) => {
  7449. const p = $t.find((C) => C.value === Te.clearWorkSheetRules);
  7450. p && (p.disabled = !y, d.next($t));
  7451. }), d.next($t);
  7452. });
  7453. return {
  7454. id: jn.id,
  7455. type: Yo.SELECTOR,
  7456. icon: "Conditions",
  7457. tooltip: "sheet.cf.title",
  7458. selections: v,
  7459. hidden$: Ko(t, re.UNIVER_SHEET),
  7460. disabled$: cs(t, { workbookTypes: [wi], worksheetTypes: [xi, _i], rangeTypes: [Ri] })
  7461. };
  7462. }, yc = {
  7463. [Zo.FORMULAS_INSERT]: {
  7464. [jn.id]: {
  7465. order: 0,
  7466. menuItemFactory: vc
  7467. }
  7468. }
  7469. };
  7470. var bc = Object.defineProperty, Sc = Object.getOwnPropertyDescriptor, Cc = (t, e, r, n) => {
  7471. for (var i = n > 1 ? void 0 : n ? Sc(e, r) : e, o = t.length - 1, c; o >= 0; o--)
  7472. (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
  7473. return n && i && bc(e, r, i), i;
  7474. }, di = (t, e) => (r, n) => e(r, n, t);
  7475. let _n = class extends je {
  7476. constructor(e, r) {
  7477. super();
  7478. Xe(this, "_sidebarDisposable", null);
  7479. this._injector = e, this._menuManagerService = r, this._menuManagerService.mergeMenu(yc);
  7480. }
  7481. };
  7482. _n = Cc([
  7483. di(0, Q(We)),
  7484. di(1, Jo)
  7485. ], _n);
  7486. var wc = Object.defineProperty, Rc = Object.getOwnPropertyDescriptor, _c = (t, e, r, n) => {
  7487. for (var i = n > 1 ? void 0 : n ? Rc(e, r) : e, o = t.length - 1, c; o >= 0; o--)
  7488. (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
  7489. return n && i && wc(e, r, i), i;
  7490. }, pt = (t, e) => (r, n) => e(r, n, t);
  7491. const xc = (t, e) => {
  7492. 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 = [], y = {
  7493. startRow: 0,
  7494. endRow: r(t) - 1,
  7495. startColumn: 0,
  7496. endColumn: n(t) - 1
  7497. };
  7498. if (r(e) === 1 && n(e) === 1) {
  7499. const p = {
  7500. startRow: e.startRow,
  7501. endRow: e.startRow,
  7502. startColumn: e.startColumn,
  7503. endColumn: e.startColumn
  7504. };
  7505. return d.push({ repeatRelativeRange: y, startRange: p }), d;
  7506. }
  7507. for (let p = 0; p < c + (i ? 0.1 : 0); p++)
  7508. for (let C = 0; C < v + (o ? 0.1 : 0); C++) {
  7509. const _ = r(t) * p, w = n(t) * C, S = {
  7510. startRow: _ + e.startRow,
  7511. endRow: _ + e.startRow,
  7512. startColumn: w + e.startColumn,
  7513. endColumn: w + e.startColumn
  7514. };
  7515. let R = y;
  7516. p === c && i && (R = { ...R }, R.endRow = R.endRow - (r(t) - i)), C === v && o && (R = { ...R }, R.endColumn = R.endColumn - (n(t) - o)), d.push({ repeatRelativeRange: R, startRange: S });
  7517. }
  7518. return d;
  7519. };
  7520. let xn = class extends je {
  7521. constructor(e, r, n, i, o, c) {
  7522. super();
  7523. Xe(this, "_painterConfig", null);
  7524. this._injector = e, this._univerInstanceService = r, this._formatPainterService = n, this._sheetsSelectionsService = i, this._conditionalFormattingRuleModel = o, this._conditionalFormattingViewModel = c, this._initFormattingPainter();
  7525. }
  7526. // eslint-disable-next-line max-lines-per-function
  7527. _initFormattingPainter() {
  7528. const e = () => ({ redos: [], undos: [] }), r = (o, c, v, d, y) => {
  7529. const { unitId: p, subUnitId: C } = this._painterConfig, { targetUnitId: _, targetSubUnitId: w } = y, S = {
  7530. startRow: o.row,
  7531. startColumn: o.col,
  7532. endColumn: o.col,
  7533. endRow: o.row
  7534. }, R = {
  7535. startRow: c.row,
  7536. startColumn: c.col,
  7537. endColumn: c.col,
  7538. endRow: c.row
  7539. };
  7540. ze.foreach(v, (h, s) => {
  7541. const a = Be.getPositionRange(
  7542. {
  7543. startRow: h,
  7544. startColumn: s,
  7545. endColumn: s,
  7546. endRow: h
  7547. },
  7548. S
  7549. ), u = Be.getPositionRange(
  7550. {
  7551. startRow: h,
  7552. startColumn: s,
  7553. endColumn: s,
  7554. endRow: h
  7555. },
  7556. R
  7557. ), b = this._conditionalFormattingViewModel.getCellCfs(
  7558. p,
  7559. C,
  7560. a.startRow,
  7561. a.startColumn
  7562. ), l = this._conditionalFormattingViewModel.getCellCfs(
  7563. _,
  7564. w,
  7565. u.startRow,
  7566. u.startColumn
  7567. );
  7568. l && l.forEach((g) => {
  7569. let f = d.get(g.cfId);
  7570. if (!d.get(g.cfId)) {
  7571. const m = this._conditionalFormattingRuleModel.getRule(_, w, g.cfId);
  7572. if (!m)
  7573. return;
  7574. f = new Ze(), m.ranges.forEach((P) => {
  7575. ze.foreach(P, (M, j) => {
  7576. f.setValue(M, j, 1);
  7577. });
  7578. }), d.set(g.cfId, f);
  7579. }
  7580. f.realDeleteValue(u.startRow, u.startColumn);
  7581. }), b && b.forEach((g) => {
  7582. const f = d.get(g.cfId);
  7583. f && f.setValue(u.startRow, u.startColumn, 1);
  7584. });
  7585. });
  7586. }, n = (o, c, v) => {
  7587. var a;
  7588. const { range: d, unitId: y, subUnitId: p } = this._painterConfig, C = o !== y || p !== c, _ = /* @__PURE__ */ new Map(), w = [], S = [];
  7589. if (!o || !c || !y || !p)
  7590. return e();
  7591. const R = (a = this._conditionalFormattingRuleModel.getSubunitRules(y, p)) != null ? a : [];
  7592. R == null || R.forEach((u) => {
  7593. const { ranges: b, cfId: l } = u;
  7594. if (b.some((g) => Be.intersects(d, g))) {
  7595. const g = new Ze();
  7596. C || b.forEach((f) => {
  7597. ze.foreach(f, (m, P) => {
  7598. g.setValue(m, P, 1);
  7599. });
  7600. }), _.set(l, g);
  7601. }
  7602. });
  7603. const h = {
  7604. row: d.startRow,
  7605. col: d.startColumn
  7606. };
  7607. return xc(d, v).forEach((u) => {
  7608. r(h, { row: u.startRange.startRow, col: u.startRange.startColumn }, u.repeatRelativeRange, _, { targetUnitId: o, targetSubUnitId: c });
  7609. }), _.forEach((u, b) => {
  7610. if (C) {
  7611. const l = this._conditionalFormattingRuleModel.getRule(o, c, b), g = At(Wt(u));
  7612. if (l)
  7613. if (g.length) {
  7614. const f = {
  7615. unitId: o,
  7616. subUnitId: c,
  7617. rule: { ...l, ranges: g }
  7618. };
  7619. w.push({ id: Ve.id, params: f }), S.push(...Je(this._injector, f));
  7620. } else {
  7621. const f = {
  7622. unitId: o,
  7623. subUnitId: c,
  7624. cfId: l.cfId
  7625. };
  7626. w.push({ id: Ne.id, params: f }), S.push(...Ge(this._injector, f));
  7627. }
  7628. else if (g.length) {
  7629. const f = this._conditionalFormattingRuleModel.getRule(y, p, b);
  7630. if (f) {
  7631. const m = {
  7632. unitId: o,
  7633. subUnitId: c,
  7634. rule: {
  7635. ...tr.deepClone(f),
  7636. cfId: this._conditionalFormattingRuleModel.createCfId(o, c),
  7637. ranges: g
  7638. }
  7639. };
  7640. w.push({ id: _e.id, params: m }), S.push(nr(this._injector, m));
  7641. }
  7642. }
  7643. } else {
  7644. const l = this._conditionalFormattingRuleModel.getRule(y, p, b);
  7645. if (!l)
  7646. return;
  7647. const g = At(Wt(u));
  7648. if (g.length) {
  7649. const f = {
  7650. unitId: y,
  7651. subUnitId: p,
  7652. rule: { ...l, ranges: g }
  7653. };
  7654. w.push({ id: Ve.id, params: f }), S.push(...Je(this._injector, f));
  7655. } else {
  7656. const f = {
  7657. unitId: y,
  7658. subUnitId: p,
  7659. cfId: l.cfId
  7660. };
  7661. w.push({ id: Ne.id, params: f }), S.push(...Ge(this._injector, f));
  7662. }
  7663. }
  7664. }), {
  7665. undos: S,
  7666. redos: w
  7667. };
  7668. }, i = {
  7669. id: Yt,
  7670. onStatusChange: (o) => {
  7671. var c, v, d;
  7672. switch (o) {
  7673. case Vn.INFINITE:
  7674. case Vn.ONCE: {
  7675. const y = (c = this._univerInstanceService.getCurrentUnitForType(re.UNIVER_SHEET)) == null ? void 0 : c.getUnitId(), p = (d = (v = this._univerInstanceService.getCurrentUnitForType(re.UNIVER_SHEET)) == null ? void 0 : v.getActiveSheet()) == null ? void 0 : d.getSheetId(), C = this._sheetsSelectionsService.getCurrentLastSelection(), _ = C == null ? void 0 : C.range;
  7676. y && p && _ && (this._painterConfig = { unitId: y, subUnitId: p, range: _ });
  7677. break;
  7678. }
  7679. case Vn.OFF: {
  7680. this._painterConfig = null;
  7681. break;
  7682. }
  7683. }
  7684. },
  7685. onApply: (o, c, v) => this._painterConfig ? n(o, c, v) : {
  7686. redos: [],
  7687. undos: []
  7688. }
  7689. };
  7690. this._formatPainterService.addHook(i);
  7691. }
  7692. };
  7693. xn = _c([
  7694. pt(0, Q(We)),
  7695. pt(1, Q(ue)),
  7696. pt(2, Q(us)),
  7697. pt(3, Q(ct)),
  7698. pt(4, Q(me)),
  7699. pt(5, Q(Xt))
  7700. ], xn);
  7701. var Ic = Object.defineProperty, Ec = Object.getOwnPropertyDescriptor, Tc = (t, e, r, n) => {
  7702. for (var i = n > 1 ? void 0 : n ? Ec(e, r) : e, o = t.length - 1, c; o >= 0; o--)
  7703. (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
  7704. return n && i && Ic(e, r, i), i;
  7705. }, Zn = (t, e) => (r, n) => e(r, n, t);
  7706. let In = class extends je {
  7707. constructor(t, e, r) {
  7708. super(), this._conditionalFormattingViewModel = t, this._univerInstanceService = e, this._renderManagerService = r, this._init();
  7709. }
  7710. _init() {
  7711. const t = this._univerInstanceService.getCurrentUnitForType(re.UNIVER_SHEET), e = (r) => {
  7712. const n = r.getUnitId(), i = this._renderManagerService.getRenderById(n);
  7713. if (!i)
  7714. return;
  7715. const o = i.with(Ti);
  7716. this.disposeWithMe(o.currentSkeleton$.subscribe((c) => {
  7717. if (c) {
  7718. const v = c.skeleton.rowColumnSegment, d = v.endColumn - v.startColumn + 1, p = (v.endRow - v.startRow + 1) * d * 9, C = Math.max(No, p);
  7719. this._conditionalFormattingViewModel.setCacheLength(C);
  7720. }
  7721. }));
  7722. };
  7723. t && e(t), this._univerInstanceService.getCurrentTypeOfUnit$(re.UNIVER_SHEET).subscribe((r) => {
  7724. r && e(r);
  7725. });
  7726. }
  7727. };
  7728. In = Tc([
  7729. Zn(0, Q(Xt)),
  7730. Zn(1, ue),
  7731. Zn(2, Di)
  7732. ], In);
  7733. var co = Object.defineProperty, Pc = Object.getOwnPropertyDescriptor, Oc = (t, e, r) => e in t ? co(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r, Dc = (t, e, r, n) => {
  7734. for (var i = n > 1 ? void 0 : n ? Pc(e, r) : e, o = t.length - 1, c; o >= 0; o--)
  7735. (c = t[o]) && (i = (n ? c(e, r, i) : c(i)) || i);
  7736. return n && i && co(e, r, i), i;
  7737. }, Jn = (t, e) => (r, n) => e(r, n, t), uo = (t, e, r) => Oc(t, typeof e != "symbol" ? e + "" : e, r);
  7738. let En = class extends vi {
  7739. constructor(t = bn, e, r, n) {
  7740. super(), this._config = t, this._injector = e, this._commandService = r, this._configService = n;
  7741. const { menu: i, ...o } = yi(
  7742. {},
  7743. bn,
  7744. this._config
  7745. );
  7746. i && this._configService.setConfig("menu", i, { merge: !0 }), this._configService.setConfig(so, o), this._initCommand();
  7747. }
  7748. onStarting() {
  7749. So(this._injector, [
  7750. [Gt],
  7751. [Bt],
  7752. [Ut],
  7753. [Cn],
  7754. [kt],
  7755. [Ht],
  7756. [_n],
  7757. [mt],
  7758. [Rn],
  7759. [wn],
  7760. [xn],
  7761. [In]
  7762. ]), $n(this._injector, [
  7763. [Gt]
  7764. ]);
  7765. }
  7766. onReady() {
  7767. $n(this._injector, [
  7768. [_n],
  7769. [Ht]
  7770. ]);
  7771. }
  7772. onRendered() {
  7773. $n(this._injector, [
  7774. [Cn],
  7775. [wn],
  7776. [Ut],
  7777. [Rn],
  7778. [mt],
  7779. [xn],
  7780. [kt],
  7781. [Bt],
  7782. [In]
  7783. ]);
  7784. }
  7785. _initCommand() {
  7786. [
  7787. Mi,
  7788. Ni,
  7789. ji,
  7790. Li,
  7791. $i,
  7792. zi,
  7793. Fi,
  7794. Vi,
  7795. qi,
  7796. jn,
  7797. mn,
  7798. cr,
  7799. lr,
  7800. Pn,
  7801. ar,
  7802. On
  7803. ].forEach((t) => {
  7804. this._commandService.registerCommand(t);
  7805. });
  7806. }
  7807. };
  7808. uo(En, "pluginName", `${Yt}_UI_PLUGIN`);
  7809. uo(En, "type", re.UNIVER_SHEET);
  7810. En = Dc([
  7811. mi(Ci),
  7812. Jn(1, Q(We)),
  7813. Jn(2, Q(ge)),
  7814. Jn(3, bi)
  7815. ], En);
  7816. export {
  7817. Mi as AddAverageCfCommand,
  7818. Pn as AddCfCommand,
  7819. Ni as AddColorScaleConditionalRuleCommand,
  7820. ji as AddDataBarConditionalRuleCommand,
  7821. Li as AddDuplicateValuesCfCommand,
  7822. $i as AddNumberCfCommand,
  7823. zi as AddRankCfCommand,
  7824. Fi as AddTextCfCommand,
  7825. Vi as AddTimePeriodCfCommand,
  7826. qi as AddUniqueValuesCfCommand,
  7827. ar as ClearRangeCfCommand,
  7828. On as ClearWorksheetCfCommand,
  7829. wn as ConditionalFormattingClearController,
  7830. mn as DeleteCfCommand,
  7831. lr as MoveCfCommand,
  7832. jn as OpenConditionalFormattingOperator,
  7833. cr as SetCfCommand,
  7834. Sn as UniverSheetsConditionalFormattingMobileUIPlugin,
  7835. En as UniverSheetsConditionalFormattingUIPlugin
  7836. };