From b64979301378ffa4f40f93745600956a4fe1b549 Mon Sep 17 00:00:00 2001 From: michael Date: Tue, 5 Aug 2025 17:38:13 -0500 Subject: [PATCH] added gpt-4.1 support among other things --- .DS_Store | Bin 14340 -> 14340 bytes backend/.DS_Store | Bin 14340 -> 14340 bytes backend/app/.DS_Store | Bin 14340 -> 14340 bytes .../__pycache__/focus_group.cpython-313.pyc | Bin 37947 -> 40222 bytes backend/app/models/focus_group.py | 36 + .../__pycache__/ai_personas.cpython-313.pyc | Bin 39694 -> 41989 bytes .../focus_group_ai.cpython-313.pyc | Bin 51470 -> 51962 bytes backend/app/routes/ai_personas.py | 55 +- backend/app/routes/focus_group_ai.py | 37 +- backend/app/routes/focus_groups.py | 59 +- .../ai_moderator_service.cpython-313.pyc | Bin 27318 -> 27807 bytes .../ai_persona_service.cpython-313.pyc | Bin 26037 -> 27383 bytes ...us_conversation_controller.cpython-313.pyc | Bin 52017 -> 52369 bytes ...versation_decision_service.cpython-313.pyc | Bin 14831 -> 15278 bytes ...cus_group_response_service.cpython-313.pyc | Bin 22328 -> 22571 bytes .../focus_group_service.cpython-313.pyc | Bin 14255 -> 18759 bytes .../image_description_service.cpython-313.pyc | Bin 8204 -> 8866 bytes .../key_theme_service.cpython-313.pyc | Bin 17823 -> 18591 bytes .../__pycache__/llm_service.cpython-313.pyc | Bin 21386 -> 26005 bytes backend/app/services/ai_moderator_service.py | 21 +- backend/app/services/ai_persona_service.py | 45 +- .../autonomous_conversation_controller.py | 7 +- .../services/conversation_decision_service.py | 16 +- .../services/focus_group_response_service.py | 11 +- backend/app/services/focus_group_service.py | 81 +- .../app/services/image_description_service.py | 82 +- backend/app/services/key_theme_service.py | 22 +- backend/app/services/llm_service.py | 309 ++++++-- backend/prompts/image-description.md | 1 + backend/requirements.txt | 1 + dist/assets/index-Bk-FPBaP.js | 732 ------------------ dist/assets/index-Dod4tGHl.js | 732 ++++++++++++++++++ dist/index.html | 2 +- src/components/AIRecruiter.tsx | 15 +- src/components/FocusGroupModerator.tsx | 58 +- .../ai-recruiter/AIRecruiterForm.tsx | 35 + .../DiscussionGuideViewer.tsx | 30 +- src/components/focus-group-session/types.ts | 1 + src/lib/api.ts | 40 +- src/pages/FocusGroupSession.tsx | 140 +++- src/pages/SyntheticUsers.tsx | 91 ++- src/utils/personaGenerator.ts | 10 +- 42 files changed, 1741 insertions(+), 928 deletions(-) delete mode 100644 dist/assets/index-Bk-FPBaP.js create mode 100644 dist/assets/index-Dod4tGHl.js diff --git a/.DS_Store b/.DS_Store index b9d19637cb606e97107e601de6e6fcfd51d233a4..8f805800322417aac4509af60256b1ab49b0749d 100644 GIT binary patch delta 90 zcmZoEXerp>D8RU5a+O3Omqc~7skx4ViG|tZeF8F!U6XGM$TN0t{w*NDznM!xoe{sX T*NQTHo7oJ$vuysS!p;l;JfC@{G~qLjnX)KEvk*wSM1UICfOf|4qm{|fN(Z{}7|W5h1~R#B2~GrPez Kmd$@u*qH%QcNTmA diff --git a/backend/.DS_Store b/backend/.DS_Store index 52cc02f1ed7badef9a5f8ade377e4c159cdd1242..1c50d7296f473c00d5b8776049310e1a3de10874 100644 GIT binary patch delta 79 zcmZoEXerpB$39t~{RS5UBLf(4aBmjm5M$Y_#=@&fTfHSy|db8{U96LZU29ffKO6C)to#H6;ClS5Ql-#REhJ0~|U XzjJb-qC8{Q=I0s;?3>vP{;>l9g7zI3Xw5{{QdF zmM|tElMlc9z3%`0{lEWrdFxg2#UF{8*Ue^=0KXUNpC2iF{*6qFhA2$Z3_E&teL^!4 z1fNb2di8xmudWJ~^@*%>uZ``u<*;{FXRx1W783(|Pg7Z_q>YV@4~z%>^4L`7usl8* z7+rE-?TRH6G{~~Fx5y+j>DJh1^g>2nytwvadhOMkmUu?dvHs}{7hA9UuqGR*E5@PG zfPWwukf{c`)C%CzD49dS!ANLemWKm82;4y8a1bcH&9{)#6*( z%wx=J#&;FHZ(>3Y_+5Hx!x_|o+W8uUJOD+<$%gdMmiUi47&9&+RqU^fd$ffx%u0&w zu?Nx|T2js)HJ1}7d(Ql31D7{zFc=Ah2mB!4xEu(F6z$k(C`>DmdL;sKR5W99fa^l5 z*<@x%4i{r7&gjR2!^1KKjpCWkG9<}`qAr{yatK|cN`(lLWo1cZd2DIc6~cbvO%pS9 ztW@J*i!8?qz(<;9SneAagkquB(2us@Kk!&Cd);Dc%oKW!eVSf9cvOIPS|6fmxgntK zPfM&7deeI|R)}g(6auUZ5pI-HsZ`N^ckvE4ua1DZy9-iONzkOJ|m3e zButa`nN8F7iKfY2nA39ote{|^gvQaVrY8iUTqqT4gjwDEV8$U)5=y|3lHes><*PL% z!VoEiUJ3Rcv;Dih)73S*qQ59%Fu@@BfKwn1qGkaD)qpu{eQ7*Wbf4KA(L2r2?YO&2 z-KJUbP@!&(+DnNoJ4&)#Oq#0%;xLfrN$dK#`Wzxdg8G&#uZud_N~<$UGeOk|?(mrt zM^8!pQ}=C`I=Wl?dL?g9ci$#yV|QEo2B~jTn`d)-lhiAR!=r&=X)d2h;hI*D8KwjWVjYKwnBW7I$#>*TvHi-GOJtK@{k;+xCv*4 zJ_JHnZkIN7_ikRIzASBN@9FI5Z1rsJ?Cxrk+ILULgJIbZf*Px8q~Tx~T6$IFXav&< z2yy7%2z>7DjHC`v=Z5ySCMkm1?Gs7PEp;u+;(1xo4hARoP)t4)lZB!ULT*-clXNsJ zE4rbvNN9vM;cPbBZ7ttHi?Q8+uoA#!q9yQ9w0>XM$CJ2X9vU4B%T)Fc;Fw|nn-7eK z!0tn8YEO?$zywYQ2bB!pU^wC%Q;#U>W)D>7z!CEI)?&kEARGEfWY?|ZQGP%jTXHeI zYDP4eZC8uRUTHkF_T{w~KUW_wTM=I|93P3y2*M;;C%!KTqoh@Y-Uw;KN1M0>9}kK$ zKDLNM_!tsL@KHD_9yVOF<;M#e&S);#TF#QIxwaR)N4&?pmvYM!?W3JdH+6!2^$opX zvBw?W^XB*#-}L%N;@-jdpvtx#iR~gC_{j5$Hw3}5UYs!s)?Bt@aX$N#oXltj9I;%3 zS39oMc&2MSXFV5d+Gj+IxsCi&v2-GMJb0zJVY;~CjPA#~&u3m-`(S+KLl=v;9!~$w z+WU{~JrO+~eRc1plIHlP&4)AYFhGBN+i3jJ$n>^d@&3v9WEAA^h#OHHx7dY`XqUJd zpMByWJ~oSfeE3ys6b|2$8B(p_IlCmjsegLiwzy||e7hVUqH#GC5A6Y>dr2qKo+9_- zBk%Lv9MKKpj9tjKU&$(;&MH6o*mPEP+*p0Hm4IR2wY7XWVvVSOhcg!Bdn@z|1mVw$YrRh4?Tj*Sy5{ZLB541@rF^7}w=2X>m+nGU4z5|N0}8R1a{f_I8rXq?+;lvC)SbDK zoh-1E683|Fon$L>6fSkRar2k~pgu|dpi3YYFoUxRD0iksWd*GqfI`B+C; zM637XxRd>?vWDzp|5f>iXekcx1jCa`0J~9yYyiasm8%?4#!%MOy&o zM8E+Ffpe0vHH0vQuopoU4O&>pv4^TNBnNa9y~;|lbl_p)#j>_m9r}IjiRz^yRG8me zbs$u2C*!P|uY}R^y5hLLuZEmP3jm(V}jka9dFheI;X9 z4i6+&u>QINQXbn?7uA+?`HmsauOfUM0mY@?KzI@11k0~qv;t*zsmBpD;4qH~9u9No zlBxz&kpj&@u(I9t&TR|nVN{)wk&uX=LhAKG!WS6=Iz}UM`Giv_KV4gpyl|2lYP{@SVrsK9uX8L?;#>|sz4}) zqE}OcqT^3h7SxH$0>(Pj(nNN%^DQy$pTj77-D{71W%Un@H z9pMdxH`ylliXt8X+4D`vBf!dDa@&1anourxG6WWKzG_3o#HF0?`qz-iT};Uwo((^oNq7q8_Xdon0 z*fqYuo&{qeT@B)N)#~#V`3t;zC~2yaqy7**gG7z9eVU>uvvlM_MOE3+M7|yKb-XC* zRWC4IXZ?dbG&)>H)$rWBUqrcil3mEWiHP_qF0vyet(h7OhdbAh%dvMlFN${L29l1# zUJLuiCuRfl%!Y<4H83+%QdJm9CIhnyyH;k~D3vZG%xwvaZP{3Cal;F@r6=~}#uoCs z*xMVQ)sl1UfgTAWk@mEda2uRM^6wx_Bm4^CBEn_%cRlMC^O&?O7?Vktp2zi8*3?@R z<-*@nbY@c72j>J_XXZIp$x6<^hYPwV#lClJ{2ZU(KagC{F85aGKZ27WG{%1GtBcib zUZbh_7K(={i#7r%hEQa15R$q}lTZ|A+S&6Du2!>Hhbu$Xm+O*DUi0Gkt{F`Ah?0?% z3R3H3WHK*U^f0DoF*S)5u&#$ZaBdua=w(q&6a1i1vlzbL#=QND5~(&lC1OH2IX_}> z>{9~<7Ad+wFbv0=79VO#n=e=zo^9%?+zvL=p93d?cH03h#L>Z>jm;QBuzh$q{RguB z1HvB>{u6t=t1%XoGs$G^arrA^9#1MJc^B-Ff$$!vy11QfY|+Sl zs!8uSjgvbzg1ouWc(TsH?n1$m@aj#R=btIL&=Pc^aDWf01Dt(|7DkwoB;#yYvws<> zC0~kJM_)@sG?(!RlH=7x8~fE4mTpjUU}{8j`Tk!K&AP@M7B?`sJq1pVEhVq8SI2%y z{+)eXlOH=Y{;veC2{gET)mD^-K+d2df(Aj0z$NsW%)wzbtMF4WZ0Mdl#n?%Ci?>LsX(2jj{yXyNm^V5kv#d-6OEPPKjpo|N|XX4J0QrNm-W$J}t$7Cb<@7N2I z2XyL@?_|aMLZv8S*J=EIFV-&Q2IVFRAu~zZ50%`T``X1U4f|lO0j(hI%Dcmq z$4wI_g1`$s9zk5`v{h9pGpEdzrVdI52?Bl zQ1v@5#cqB8(UYwHKo$8Yw(Y=8jp`aZ+xlcv0e20}M)fQJsrLQLC)-4?h8>&qu=<1D zVlH9-TjPj*<6vQG9j@+ocK*x$IwumT0qCL*KsbZ*aRg(UUrLfLz>xyh|5Pg(W+$F{ zMh#9^YN5mpTY>BFPN$^F0r;N|3g?S@y~9jST|iyY+^xV&q_-+u$piLzcKGQ$ha3A0 zAoVf?Hex@0x`*_|tk3*jEa8!BN7;|#YIQSB>B}Qf(}rO`Ii7uVC%0RN>(llV_j@uo zB)zTPsOKLPTHuG<8|3-tXPXFR&gU*eaeMu_hoku@N-4r31P?+VLI5F(@TUk*BRq?6 z6yci)rx3o4@I!>N2){u1TZC%}zeV^rgc*bz2p=GPj9?;Q6KY12SP@R*AljeSBdlca z9WGpnPN#)9gZDP|qKl5gb0hSOC&YF*`%Wl-U5@XPs z36t2L9Vr*#8^Rl`x|SR5`$)2Xj_&Qe6k`jVSdlS#4Q*wHqZL{E%q0JR1Vk>-{{gbg BP=x>h delta 5342 zcmbVQdvH|M8Q**Nk8@2O$(cT+6dNPy3mo#tv234G zO25wjw&J0EIVHtD%u)rwq^7-J5Al+snqJ6RlgBH~M~kaJ+}o=Qkxzx5vP`h$bwv#= z_Y^3Fw9(^L<{P(q-cacL!gRGFxS_)zwKi zclol?ns?i5KAYxVFG?v?Q0AL(_#%2#sB!_#&8{&WJ>kJ2;lz?T01quG@-5VyqFnwm z9RYvT&)zVzw*>p6y3hk%TnE2IFl^EvuNIZ3U5m;mY;?A0KsimV^(9q#cYgk4R^>-d z`^=0n*O?64jDj~jzEd9GquWk-YEHUqM6n!V++O;YtFb|rOqaeR7>Pzqm(T~o+jUVb zE5#DPVl=1q%ho_pm`*VuzqD*oPWM-KD;+dZSy#4Pc8O$5U`~@D3Nf;T!oCu^*;k|7 zV%*_-(6JcyX{tFhNl0DMK7Bxsu<5cXH@PVkj-rJ&Yh_9~4Qmydn1Ed=uBFGd2MecC z)iQV*8Pbil-I*=u3zv!Ibi6jt#gx2~Qa*iH+oU{h)La#FxNbs+Qu^BbtCfB_Isg3; zFDlr2I7b8kF#roXBcS)|Q9ZFg!f2`oz*(XhuvEeYE~uyg@JgFd+6)*3Yy(&vWho+e zFuh!xCDpffLAml1W6Od%RjT{YB5f%PbS=8`wp=GmM;w-5G6r=K35Wb$!GN`iFku9n z5aE#9=KP{M^#dEtt>2&&(`fxuwb-WH8j zWVqNcx2#2^@R8Aat))iEH$HA@vlk*xmV4S|NmDHoR@26nOXD8TPNmO$*J2#&Bw+{? zGi?CUtQGDN9o&0V23pOzq>8x;jvvLC+Z8wxJ8(&znTg`8ijT6?WxpGu6+OLaoI=604 zKI;O_;v0Y`08i4wYZ};<+Kg0BvJm*Ra>Qc6fawI*C#7w+Cn1gLL}B^X%wYDZk~j+Jj=T7JDxN^RWPORdDfRjZdHnb|o zjAI*KQwy+~Bp#G|GU^`~oD}c_or|k20p}#8w5^yoAz)5fxpc16J9|1ZQxY3BZ7k2d zD2-9?#%0QJ5w`2Hgq(AMPKpFfPohN+Ma59k zsWwH|a#b_W9|&|M`qQ(UtCZgwzuzqERS$txJD?Fg(;~5+9(f#S_PBj$SxwRI7Aya) z(XuQv*@U%d<+PU~^mS;sbd1cb1R0r>PoQ^-d{PgeVyg46lqZhxKc-rlg^w63|6zO^ zX@T01rJ>9u4F%Dds-gc(FL6CKoqQ!S9r(KVRHWkppFBF=3G8wxynhl}I{llU; zjaA+T{1Nac!1HuGILq}56n{x?2CJjqoSvM+6$r}P+S zw>=e?EOXq8>G-12M&F6nedc1xGQa;zvQ!rEmgOVrFmADtKG9A;+R?Z!9`bljsKz)C zAdwgnUcY2ckZz{sL-{M=T{EYrU-yUP1I!m|SbcXp?fn7#iK>v<~&sgL@*g zL2&&Mn`SrFd3Eeg_DKBygi$%{?mg}5`zpP;XQz9f?5sIN2X*iL67wA{rxjxb^sl|? zZX6PtV|c!-sG|C@zFhcJoCk2}V;em^wnDjJ1?&ATJ(jR@T!ehhA55==J+<8Yu!5FF*sV0DKw{0K@=8fKkA1z<$8} zfQJE(0iFST5AYn|$ADh}-T?d#@DAWTz=wdd0GlHBvarJ?Zos{$L`Xy}U@o1wzoZd5 z;J<||5pvi7aCBt9JZbmXe&fvjo0{dU{>W}~%{+tBnNliyV3nuHsm1GL=}f&5e!!>7 v{~7LnsAeAfjGrIZVO5@X>QbhAnLN5;{d%idLhn6P<+(9ix#I6OAoKY*oeFhH diff --git a/backend/app/models/focus_group.py b/backend/app/models/focus_group.py index 1cc5d1e4..b71b07df 100644 --- a/backend/app/models/focus_group.py +++ b/backend/app/models/focus_group.py @@ -18,6 +18,10 @@ class FocusGroup: if "status" not in focus_group_data: focus_group_data["status"] = "new" + # Set default LLM model if not provided + if "llm_model" not in focus_group_data: + focus_group_data["llm_model"] = "gemini-2.5-pro" + result = db.focus_groups.insert_one(focus_group_data) return str(result.inserted_id) @@ -97,11 +101,43 @@ class FocusGroup: # Set the updated timestamp filtered_data["updated_at"] = datetime.utcnow() + # Debug logging for llm_model updates (force to file) + if 'llm_model' in filtered_data: + try: + log_msg = f"๐Ÿ”ง [{datetime.utcnow()}] FOCUS GROUP MODEL UPDATE: Setting llm_model to '{filtered_data['llm_model']}' for focus group {focus_group_id}\n" + with open('/tmp/focus_group_debug.log', 'a') as f: + f.write(log_msg) + f.flush() + print(f"๐Ÿ”ง FOCUS GROUP UPDATE: Setting llm_model to '{filtered_data['llm_model']}' for focus group {focus_group_id}") + except: + pass + result = db.focus_groups.update_one( {"_id": ObjectId(focus_group_id)}, {"$set": filtered_data} ) + # Debug: Verify the update worked (force to file) + if 'llm_model' in filtered_data and result.modified_count > 0: + try: + # Re-read the document to verify the update + updated_doc = db.focus_groups.find_one({"_id": ObjectId(focus_group_id)}) + actual_model = updated_doc.get('llm_model') if updated_doc else None + log_msg = f"๐Ÿ” [{datetime.utcnow()}] POST-UPDATE VERIFICATION: Expected '{filtered_data['llm_model']}', got '{actual_model}' for {focus_group_id}\n" + with open('/tmp/focus_group_debug.log', 'a') as f: + f.write(log_msg) + f.flush() + print(f"๐Ÿ” POST-UPDATE VERIFICATION: Expected '{filtered_data['llm_model']}', got '{actual_model}' for {focus_group_id}") + except Exception as e: + try: + log_msg = f"๐Ÿ” [{datetime.utcnow()}] POST-UPDATE VERIFICATION FAILED: {e}\n" + with open('/tmp/focus_group_debug.log', 'a') as f: + f.write(log_msg) + f.flush() + except: + pass + print(f"๐Ÿ” POST-UPDATE VERIFICATION FAILED: {e}") + return result.modified_count > 0 @staticmethod diff --git a/backend/app/routes/__pycache__/ai_personas.cpython-313.pyc b/backend/app/routes/__pycache__/ai_personas.cpython-313.pyc index 6a837c16d2a8cf72f0d0421cc332b7ea3dd9584a..a7e5159df4a697518644b5944e2fc4aa745fab6e 100644 GIT binary patch delta 8394 zcmbVR32+f@)7YI( z|Nr46B{^=F!;kO%@BZKazW4s0U;BaTp;?vX6SKL9fp5>rClAM7_`c;2oY4STHT-_^ z2Q|5{K16!%+(2H@{+e9XI@Xs8Wt}Rl&oGkC&5Rh+X@(KXMV*CdS9P*!3D1m}vSq^- z;(emtXB9OTMzGO(nu2=e*?OW%RErvs6SbmFuy52#`hxx)BR29&y;Yy>fLtB4sVmaL z%|d0mS5YrGTXJ&{Tpg-9#>E6C z7!L%e0u%h9fE1AZ@j&xIe=InTwI_q2K#Z3I#}a{9oIf6nALePVUHr7MKV3U09pa~} zdD?_eH|d2oi5M1SDmQ553K&-QAn*t)5$X|E0VL`Ge)Zf#`8kn@$w9&5p@{s@yhV}jXeq+_-{E>F@mgRhMp~U)({=EKK zm$Gu*T*>+~1B;p}?kM}Q-mH`e%Dw}NFsfL_=Joen*Oy<@JFn`U*YuvNde2LZ7XugX zP&)Q1!z0Sx{R)3zUO)P&mT|T%xEdBbZ3|_Ng^JpR72OMV&+pATXVD{;Ppyo>qLg&J zD!k^N>)ft%3@8Illggo}GI>m~$n*Nx$Hn%A$~CW+Uml%n+p4VTQ~Ji0iLf#*DUQfO z#Y(cuv-^RXD=Izp={&niNT|V`;I`unl7BcVDnGxH%`rFi38c}kk zjq6`G6DwKCu}$Qgwm!C*d}P}owm>&>D?o!u)?-?Oum+(GfkQy;r8SLvA-5x-&gFFo z>j7ZQK{p8K$1-qTw27<|%f3UyIs;pcAnN*OG(iS50JB&qH zB9JslFyyFY)JmM25mlsgqrFS8j8h3l>qE({q zW<3aei#n@#!Fv;y-1P-qR!O<3gJ6g9Y4tgcVErgAv+R3iV4! z`4;_W*V3?R=EbUws^k_}jogFaL%=ITMy^S7VK1ies+4OGaK9)u$_{V%E{?d zTJrCnVsgdPU6w$GSjzolHV3KZOEoadR+7n-Wae>6Emz|NwvzSy0ZlU`32U~K@9|Z` zdA2IMHCrJw(n}*vR2`V53}(g@&LyQg?w2J{gS?JZdR?uiLh`~&D-m)VlwUdSk=#f2 zc)e9$!77yFkYdstmt(rKUQg)(5I+aMv7f`9pJ6^-Lyk38k!#-lH@k1T;J*3DQFqO; z>Z)VaMf>H-Imf0)OxN)S8k#*hD=GVrC`aSUk%VHIn%5s+b`dEx>n@+XEWNQib6N3t zS;0l*ZCh~G=dU0G=Pgq7)vm>oQp0}sx~qMmdhJ40{erXh_c~3L<&j;B780mAw+dR~ zCDlJ`dgHVrPACCMnTRNs=)C?Iy`8qtR?Zp~$3F7MnicE{QeC^7T|>gPPfw1)a^I@( zS^I04A2s{fZ3gDYEj}mY-Z2#Qd(`ig`&9i-^%WZjqAN}gL{~g&OxG0c(5bI9`PADx z)w8WEWM(_ffbXihcBs_vZbr#ZR2<;6p_Saf-bPxR4KokdMY$FnQ@#hmk8luS9AN?> zfIuH6bW3|l-RefT|MsljszbvX0&Dd?WhJkywk7knWnOMu$ZP5AklGOv`*l?96221zqyXu6Pof zq(|$;6j)(~c@9D9l1ip?plTV!B6tQf@@|AZ2-^_`5cVPr0}ROmpi16H?r(2PiYUGV zA&77UfifN{Rz8Z5SLqGMb(u=dSe+hRJf8)p_fE{xX9nKT@?8j2|AV=gUxT6G_=d0o zT@+p32xj*q!^=J}4T#z9oskoOjGnhMwNoV zhvD=dqvu}8He@b|`yib%W^bn8L`=SeT-dyy8pr8GphkHDQzsEl zA)H1?BAh|EAAz#KS26Vf!YwxH!~N8PZY7c zNcDjpBXU4W?FWmyha5g|s03}HfJY+a!vmXvO{+$CrP*|PO@>YNsTP!?Nua!KD<4fic5I4~0$J7-{f$)65;;G9(k z*TSrJ1$Qi&)%Szd1@>UMwLPFIq&V;Ofv|_Z9Tqrq0o(wx&F7O|4>GTtF z!3+qf7)jGXckc*V82v=mh$WlOdJL;Ff(dxf6m+8-Db3ad&+3B9QSf@#3kKpGZy>I_ zjM{LeVA@wnn(nGng)7k^8?*?;*}lUS1wEFGplQ=j%uN!UveJDO%bYSi-t-%`lXR@* z{B~>iEt;1vZ|-JV8A%Pl8c|iwZ1012J?AEFrJxC)kL&dva8uIcnSJE!PPj<_Brk@=IJ2x^g<(q7{R8}C(xs+0Qfz*&)v}7%i=A79A8TI7R z6=G16l1-=;tuVDZu?%oUJ13Tj<)T$A)NjuD7gn}#qCu!956UZ&t6Ef|U1-1!6s>}( z3z*msrzY!`gVdg#l&~7D0D3L!D*J+3jaciZ?VB>*GY^B&Psfz`cf#~_Bg@PM{ab?- z-EuII6=X4PBgvR0ZNjbs(*Q5pF6n%_e$^n*ykIA<$9x{7%uM(G0PQ``5zVwW@6GmD z-I6XVIPR?=d2Yh99u`hRnsh8U2=p&_(R^kg2K@9#mW{OL3r1?AWqgHT66`yxBu4>P ztQ8%@o5)88oupr1T%13V?Lr4_WM8x7VBTV8Isd!UADJ0S46r;u6yXz5cnmB0wP^EC#XdhELgJ-g855gZ%8Ec6PbP7K8?UZIri!eGi0OipOpV5|{Uf}ur2L-yKiZ(xN3V1;U-C|mVQ^t3K-d}5B31Y?Va zTD(b8`_y3Z^lv^!)nF#;rq{W)!^qSXO5jU;X&?iG*wY?UvR>YSwcwaD`{;X>zFZqL zDP1fvJ|2k0(hkVoSm|kiZ4Dav+nD(Z0u|#!XsCfpJDSuN!n-{Ey2Qf{F;@Dt%k@DY z6X_6ADZV#is3Lqt*e0hB;5~ z6Q=7WHl<=s4L+vWL^*vHOI3*P1hzHz}_5Agw4*%P`&6FGL`aW96n9`M!r z>X|p|i+a1%Z?@gm+o^u5m4)55i+ZJ`EDYg{9()ALU~FX zkmU%tNJ#I$eIHvi0VFWHAgNN}r(5pK=n`S4F;k z%G!{?Xws4@+Y+G=AD8{(frIcLk}jS)s?%<=(_FQ)i*In>^leCY1Wh_s6omhL#NvKw zJdo0ag0Xl?gXcW$L*O1{0#9V|lr4Dz^VCD2uYcUgw8wE0Q+XGIIu?1K0*!$_JX40; zL{mj@T*LnO7&vYX&Vpwr5?RWeVXas?K8NZBJ21kiY-xAbZb~57;Zz+}$h<%waFyf1G^nPQ|iqUf)lg5A;@Y+*G=7 z=X-e9?%5d=|sq_;ICSHw4*gTLvptZ)@TtSlO8;eJ-T z1vu#a8XZX9Z{R@kev2B@ZP>~C>xy=34IePr_5(wapjUrT?sM*GS1ZjdWR!L@;8n)g zEvVK1(v6}yH3v9tYfVH$Gvb3s3*0Ce+O=f~gxs#USCISZ&htmJL`e*1;rbmsQRo$ULoE}lNKNONXu&|S~ zoogJR2a$T5n)FGc4X`aPZ0+>NM3_*gzKrb1@33YAm5{lAbg! zCcP|pl-}SpYh*g{4Om3yaFZq2#+{jtmo7qqM&FzH^;2#Ydy;U^{9=DM_OcD(074i6 zBV+R82pA-gzlHD;0v>4@^&n$EmzYlgnY7OIo8f=MiBRA+`6H0QGlGe|M>anja^B9e zN7+x*jH(1-E4!$nlEqyr^2W1!onuRiw?Q$LEN)fLH2&oQwsOCUoys@wgK{caJWVcq KGpP9x#`$0Nj4+=7 delta 6274 zcmb7IYj7Lab>0USAOHd&9wfjgz^4ShpO!>DA(511n-ZlJB#j}FS%MG+nOxAjBqh_a zDOr|ZifdWNN*%X~BD;@qlQeB7jrFplRxUmA4;Im6+K&4pGj>bc%1p<7q~~0K z03=0uEQcS?J$LWjyXSo8+;jKT2f`oxK(K#lvspO2ZjHQrc>Oouv40_13$Q8T|Cg=e z+1I=fSQmzWDI0?KjUP5vaSajb4z3yW!u5+u-nUwbR!v=z^b%$N6Wzaj^(orr~ z$cDVp_uNZk4)KS$^`f6U#0M*ryrozaf)WfnN`klnDc@?P{Ql5!v0g<2A|uj zy0k)EPD-4Jsag?Anvt5uiNyGLOw%e@pFXXn%>Borv8m~JLJgW>r(>lrWgk`acywe+ zOB{+%#Pk#&)9JP0oa3~04GLBGufNShQ_Tlx0->Vm7onmK3_FGhP}1cNm3U=(5Q8j+(WPy=6r$XRVeCYr~tdP)hMQlqKV0= ziP&^(WGbfV302WHqxxX-n(u91=r-i|^PP!%xg%TGh^mBo8;)TYvPqN+*9fW+S!I(@ z7nWq(3i>t5_DtKJX*)7)2el&(HUWZM6qZ0S7Q@>nEBw%GFOo~b(pv0LkkmL`34GR7 zYaQwl(gV~2a6aI{TVyYrC&ywR&VyYIa%roWTatEP}?$7|`|99MA;BFpj|J8%v&boBV)*hV)z6}N%8$_qn& zt5^{!g%xIhurd=T#i}`E#yDZWhxj{I(w{$zL9U9Fo~;VdEZu%Na7QHFXSQr4RV!Tr zR2Q#JUibeu-$&-t))A~HC?}xRYYhY&2*{jT4FQ=kC~6x?X8ojiOMr_tZun8nh$CfC zmC0Dj6jmQq6Gv6>)s72uE8&&emFBlZt&)aqf?w7iG&Z3)*9Pyr>Vb*6ik&$gJMZB! z4I(;dl*}~ZQ%aiB;_5VGGmCGHXr3}1RWvoOj%%Hesw=OsA`uGE`d@3M!ZEMdkzit@5tL z%Fe}#6`xCDh5h-5mkQy{hHscZag;22LyO*Kc%pX>K3?&%GK_OxGFtmPxl67P*H_A2 zc7=@Cx>9QCZxgT7hJ^k`@oK$s;;()BzIc2dBv;iLgH3Qyta|Y#`}_u(AB%m zC4Nvynh#vkHgEFk%Cl1IBls9CLU4fKAOSsE8zJ}_fsY{VW;oT_gqh`?);<%tX2(}6 znQw~Pisy5_vEA((+Ay>>0_Gd$rEJn=PWcVFCuNJy=+lYG_?$v%IK2>LdB!J3l*k*k zCSC^^FyJM*6i$%CUQtntcQV1X~HV5o{-T zkl-N#ObVPfh_FM$*ygmI2y;#FAFG<@hp4@qV2mI}z(R_wsvRQ8+0*q~>`7eLWCF_D zIi_oSsL2w#o1`!SGd_H4b>X^Pb|0q>_NL6Pd#SmPAV+=5iDYJWA@l!rwcmOKbq%r(j3Faqf02bQG0C`@Vh2SGIn)aDIZO&eG`jH4P1( zBv1*W1XBc$5&SM3^w5n&!aNREQ&9xHt1JOc!ye4kEamDbr>vP>d?Y@mYrCN+yg%)S zRT)3{;Pr4}Ua(i**B9C}J++;HC4d={W(kfG93yy~V22HS(=Uc;3<;k362w-0Clf#_0uGtBzT746akBbXGtQnXfF`l9T@QAy?%Z* z{CsbNbQ=3VPMY^UVd4AXl(NZ6X&@yk$i)aODC5Nx7kN2^TsPOi{16=tm>Q{BGX$TG zmcp-|F~i%Vby&K6G`cF1WBom8HOG3xkwjc&dtR=X{k3`3oM)MSh(Bo3IG1-an`tIa|Y{6wvs#Z4S7Hz*j zJ=)=bTDGTy?7||G`IKB9EXZ3W+kE_V6Z796qLi{uC#IE&k!WHDcXzgSDr%Pl6T|Yl zT5owBRWH)g8=$eME7_bF7L0Xx->?_{(scy>=P@s|xNEp!KB~eM3t3SiJ!%hLbvd%4U^0cC+7y4_aW)bZI}ij9s!zcHglg53L9b z#DX>~D)HYE_IC4fNf~#fK($7yv*TynmR0WMOPnTXrnKr`_{P&T;z1#;;cUf@)F*yiT;8g-$a(*-xT ztr*KyW7rOlZSugoGv(I1M#JQc2l!bJT%2*A9WQ|PS;<{SiGJBJ3Pyd{3>TX`a9}oV zoCC9kaO&kM_;kiIFPDd%as>^b^`l&wmb(nO6%S%+wQ^{2C;ct^C%|px2hl3jllR_P z&#JCGZT4`Wy7RQ=9zRA6U8*NfZCQRantu3bX;)R)gNyTrU5J4$DeMZn!=7+)-iYjC z##?*_3lR+VM@%=G+eU$B)OjGfU~-KUBBV321es7 zsq)6JpdLK0l(5%9FmWygiyS=j-^Coh5;{z7vm-2##Upz-Jd8r05WI&z$htjN2fuWRn%c_Z}~VrQH@=FhXg8U11Y+n2USxE!lSj z_6Vdu`^EE7-l`SM>-T#=;P!|zj|XX97Q)fjJ#BQu;#wY)A76a>4S5-!fq+Z^DRad78ZRXl^wyk6Bb9L?bKkKDD66|P)02hgkvMw&O#dGzvASh3(1fSDa@QHtk_B!({ZfF+s*@W-BKMwX*<2#NXWOvZDPFSjC|`0) zn@ixulK~^E?7j`(KiR@xfS;fIn;M!pWyH@=2~F4NK=6wX5j0jK1U4(v(Zg_Nv;qoF zRSI*<<*^ZVo$}1*9U98+yYZ$haXqf;(+V;wWtfQLXD(KxVJ78LmP2uMY-IFtEdMlC zurbr%?!=|*307$lnOSw0GQ`zGiEL3fl&R`iEtf0f*zS%SC>QkQZR`{uDcf=&jEpJM zibijqcGM=4R>7rb8@z9k_#FbO+fvdfSwMRle)X(({uHTMt@s8>ZxZ|o!Ji_eY+6j8 zN~n4)J$nP{bV^s~$zOMEN*^G7>;WU$W28PaIjLyzn6CW*$6lwBVkhzeU4I)cKGzAi zo~vKyC|Rg}U}1~$k$3c_Bf1bfyx=&zP;mGYljZrfH%;ExYHpe;ZqZHM3!%hE-l?08 z#}@S21;^|{!7Th|qRueEOOHbG`DaYOG`P*K+s(-hFSrCei|jf*$nS>>r%Mci^au|( zPH%?W?ZxoF+q>t2|Dnu9*iuN?YZ-J%|7h4aXpwG+Ce+-pNT|8t5J`5?95=j{!4>8k z)ik#8Mx$lOA>QZ?i96PdAFkrD@!@(K;y+n>hb-cPfiw#iX~>b>@{-Mnh4L;~#ZSWv z@Sc|S3+ivzgZ5Zq_NoO%y{}6=8tfq^f_0e zDNWV}y5;nhku9BvwFX0zC5#!2=3-jM_Eq9!|b~ zuHMN1HT>j{rmQTHWR|-2k3Ytx7M<_R`?{Jb(X&g{F2V5mvMp>Kw7&F8T_mxf$X^v( z3tJj{%3Z61zdc_rUB`hhC4Y9lO5kVVs|!CnK;N6$=T;3je@;70aD;%)q#B(`G^*e= zs)ZSQ*(+%@&s*G=h+LZT1?wggV>1)64O$9yw1w!`q2uC&ua|$6|5D_HB7#1C$v}#w uIUas^aaY+MKEHPWdzofQ6_Pb?9OO%P3ig2QA&21LZ;$s9$Pd@4X zJ9}9YvuIU~bqQ9`M>VzpMv#vO9g}?$w_xLQ5HlFVQ^TbuRq^<~wbef# zrfNjtd>H+!Q~DL9rc@(U4KMC5qDX-N?*fEJy0^MW{j>SFnsp^8o?obvleC790gbK7 zN{9XuRwOlZDXDz66eUasQe)?;4Ypp?p4Da-GpXIn+8u39F$?xZc@j}-f7yksLWW-~ z*abbvD@UCDl?q?qbArB>lWTkhU&&Wh=#?eViw+^Pry3X1?@&|}(gXuvU8fbDoy%3A zuTww^HL7)}QKk`$Fu57VYGL$}I=$#rsShj8*LJe}QZZX4ahZ?}=36f4aO*45y>+Qp zzMihFUNxVKbXgrs1Sh{*(D98Goaj~w3<~bKyH3@&hRg(dP`b-tCJu+;f$6P!YhpcAxwdxcI>h2MZ& zQH>A&M9nbcXZn4LDbtux861xc6}ns@V=g*Auae>OtC;?x?aDC0oD}Zl3o7)Y&CBp! zF(a7Ktm){MOT+9ivy$^N!|c2Xcg~xzp}#gMHzT>}L21j1c|F-~*sI?5Jkh1XyHarV zG>{WVJmk@gOdSP5Ud+g6GpHv-F&pQJ@wa!VTav2GvusqOCmm+~ZnZDtO1b>4Q zQQrmgfxUHV1Hu!|{~3iGz%0P|Ql8V&6T4-AE3A*mIbq8=c`FJzN0 zzm^F8eRdHV{MeHQSobnB#d|d5<6}1jh!8U2&)2tEj)1=viAOB{}HHIn>wERwB?enA z>2!%8S6MvN1h1O^Bjn7bd%}n%%m5i9ypAYtH292xx* zOM8wE-B(I>zFHD>Uj@AP|Cf~V@&RA`jm2KpE#a9BaIz;r??D@+M)Fzt6Z$5sw~#{> z)uwSQ-iSmZXDh1h=q(cZ*v>E{iHEX=I z`p0Z|JILC1U2`7uN>Bsz#PUp_Cyi@tO)T?{$BT4jkb}=D*4UiGoiYWvW(RlL%0lI| zO$*GY9Xc%Ma9GYWwv=(FOX^!nxHCQ$%4bS+EoJe=HECS&1mdqiqOv$vcOi))iIL4q z7wT`qVjH<_X}w)uCa8CS>~T4a zIH;L0iiVlxEqD($BY7|$Zd|~c3{XUdFNZM~4Bmfa0r^94JQ_$PSgq&rwzKImvS4g}MT2`m=oRHQ4;zO|V{dgwmPe@Z_@FoFx z&^D9{knlS6U2>{Ou0H0@R#=run%U4}aN%Bk%*BB>CNDMFO|a15gVT8%(EXJ&E? zoN6HxG%G=kI=v(~R6zdaCMPL)&1};vT(AkM=57MkP2O!~}d8vjIfjEPMvCJBXU$@gsE-@&p^HZp|sTDOP}q^KoL{1|_;NA?qm+Z9yBP za$dQF;R3n0Ra{{DN&I|JHST-b!o;B3T0@pp|}hkHtpr=cNEVU2Ubp*x zC?@of_(JX{J&x^9Ao(HL&|AXZNTR((rcrEYMY5k9>-Bl4o=;nX{znc7a0J|@k%e$Eq1;Kjwyq%*#nzyC~KBqE**_{sNbV(4d6z0sr#a$NW ztQ`^$=B&et<-(u^D(_XTsqd;`&Mm^8b7e(Pe&34a_if9dd|r=C=N-l_BX_>Q-=*Wu zuhv7$lukDZO;bh=D;8r{6*uLwc9n5c3ut$l4qK{dZ%qd8}kABDIYa({aRvbJ1f*ou@mheD{~f0 zsDShyd3@YuqZ!i~tRuNQ{`PpOfjvQfvpa`J63EkjmBpR08Ny?aM(t9|ZBB2;5l26H%TgurnqQ7;k#>mCPx7M=k zIdbF&VTixkNfC@TKDlWf?u&p+wJoTR!*xwfE7`G{(*9>yr6x#V=>uZiTRQm*ET$}q zPH~R$Qg-_sIX^`55t5IQ%*T#xzee&Ikf;@iyv=|%;!oZadDK>+iC9D=>+i_YOJ4xv z=kc?9AJ^&+;pjFpdi!>Fa$|G^(q&y_{m3tGFI<}1m=v;B^5H;g!NXWWWKrBd2tb~; za7UQZm8C23SG;llL6NBSDcACPTxAB>Tt>hcB_;#2fEjZQWyj;g zQX6^rXqPLw)dLyoGfn<`%6=J!dQ=Vn{RskJQqxut;5-4RrsH_@!fmTKR=MldOEk1Fos> znU=|rbGRPsyv#kFW;fKfXXd=nJqF4*Kz(nH5m%_-qL19w<84)_LcsQa+(sxs4k)p7oUD7HzK?1|oss(b{S+C(NT})Q_Qhi$8(CJw6&8mE z=sz|F=sz|FqVRfyH;4x`>5c#Ng@A@#_43P&>8v3heEk#Fdkf0LQ7PB5U60T5uFvq8O&iGpXj2{sLMlxikLi8^7h)W$_=s2EACR z)0fZ(%MKDfkHjDZdb)6j(Uqh|p!d6s8)tnMk^$_;t2&Xs0%EC&(eNs%2ijQj{5!Y0 z+Bi1jOODaxBMGuIT5Oo7;+@e7if}CZv-P@*yOU2J#`0k9j-@8zi<#6EcL?@pT7< zoiRu`r3;Lrcd%wuRCIO*r?eEi*kv6@1yOJ;As{@_dUp2zpz+L4E)Z%cmK}nb0@9avosGI$;<y@AhDYI@`HpO8(#Sp0s+#W*th^KTwlch{kyB)N85Kh8?B=7juy+RG7QlAP`xHHe9*;~kdB@r&2Skxe%i4PMet=R zW@!(38SsLoI>jTrk5OAwuCg)B@2;ixxrz*{g|2|*sN9g(XBTaBX{t6j`kZ1e_@Xwg zrBPuj<_WoehOZX#1U>Kzpzfn}3f;&fg1(89d;Ai#c096 z*RJ41$6$-fIYC7fD4^DVtWGu1s7Mrypodv72wJ{=g-&#++yddiHw?1;GSR7G-zYf2 zt;+=+gq6yn3q(yeWr+A@8U}im@JwX4Ww3&SUn%JL_8=#^RpL4X_rmy9jjbXdSZn*; zii5;_)!1qwf8jhKUs>;owgv0mnbAQuf{3|JHbk!1IOo>zYx#A-^v>hE=uX8oqd&e| za0vN=4xHB$Oy>i>7pY>`0X7YS?`ZA$aaAvYa#%i9Lc zwzMu9bGblZ;f5m7rP6qX;Ce8(wt~uEAa#|(7t9=>QfUBE&g&O(_VxFvF=_i2xjUv& zEQNHMlDNQ~U5n&wP;&+Ad<`4<{>6*^?MAGoiv z^@+axyE!|T)XzxK-7|3sx2;qOfP7jwR;WuFW+GB7DuyLL4m2yHk~cA3bWo!QO&Mu5 z`KIJ^!g{;(5C@DDBpbc8c1aKIq<%U&IT?|X+9`2IlIPf6+GNm%Td@i-jj6 zV-w+cSn2^(437iy*=EOsTXbZT|A2EE`aT?Z0YZI0bE7=2(b>p#$xgoYA5VN*c8FzH zlYJGx$hl!)e7)=qM(fLa!184_sjsXzerDGD@{U-(%1caFRW51ejWXYnEwIXrkj3ZX*8q(?Xpob}{H^vnM$wXY@Xkz*^D_MqIc7ZYaT5LU zE;ve9-W^O=34A{44(Z67B4JXA!AO1dR*jSMjFyq#KJFu*)RVXUgk}t@Rd4zy?ZV;P74S!- z7=Q?Xja;&pO>JcVvUuSVqvHc-`Mb{6E6&#UN^9RMs`^aFxvckgf0>;)x9o4(G0YbS zmi3sJQy~q&Gb`3uyXu&8S)~YTLL7WvuQT-+xYt*NxE>AnMmr0gH#)RHd|so2_IU$` zZIh|j!<~1u^*XoQ+{VX zoV*gy9|)LJKEy%vYtk_piH}W2#E2A*M<&KnYXUW1%H`-%ns6oRaSS;LeI3xt9+sVp z*dHRe69M%yCTZEp8fh1~-s;dD08B^X>(-Asb{+Ys-S4DfkVQp~O-(3);OS_$b_3}^ zz^E+vc!zKM_bQ^3C;k{Eqc%xHY<7GcvbL-TT1oYw3!Su0M5ZJ0$k?vPUfEdbULcrE zeALm%vE9TKs!K&@EFO-}rlWHt)D22M9;ym`uO6JN$6?fidVrH9%K`QiL?bwyFs!Ly ziRG6@O|uE|;tq0b?Tm&ukcM@|<}Br4hrF13%xyOcTBQ!FN#z#u>t;U*Hd#V?o)h#d zfnyl9#i$t?^amv|+%NFQn*^Xi`zaNu!|O1^@MeU9p7^?)o@|9$k<-J5AHv*+qvXhA zX7V?^W(zDU}#!W?BD-shCL;orebBb_OB8MFD^wh>V8l!C0w;|)rJ6iuUc zswDuylxAigbt+iiPS|cI=MYTf(&HZD>dq|}%xOtKfNADBRy33_swpnPOeVYQ%;vP1 zY;wHYH>c;b(GMdpDc1$jGV*&qy9#i;8@!Z{t&ul)4}Mkr3KYe>KqqFYMoI+p!a5YV zP#JtF?}ZCO7Vit{pmN1+z>rW+LD5J~S}B{5l{N%6r(hs^d+GuP!IoApSIA9M!Up>BnauWkD&L=UhK+v;D&2U3kabK%c!^Nlp zE=2`oWlx!}Anox&xO#YmLeOkkPz!!(q<-0^_@!{U;DA!2NquD>Y!&Q4*-UQkYvEdC z>l@P619hvK8p80qwqOVOu+J@6Re@6|SQoC_Xu8M{tcvX*w+JU2 z!4%6aJjfei>x+3R?&U(>Lhf{4UMR1J9XJp3phb>u2(U$p<(3sH`9*lYsmbU=pDNJR zphX+%L%9`&iUwW;UhpNMjrJ6;qJD>E42s!}-w9@f3qK6FdTiIWb6a3q3FWIxH zuLuwFfLB!-sjH$7HZ`(?#3pp>@qCuHlWjt=S#?^GyM>wv+%utKLXeGs7EqXRB}g)i zR0beWET3bvh^j;^Jyi3iVq@XicvOt;j?Tu$c1Ph(bp%F}dMOf{osLV7AnBtB2=Q#L zWTT{WbD0^^G(&Gq(mh1n>@A?yJ&DM61QQ4%2zHVao12Z3(2U`0m2$rt@@uhtFl_NV zPXqb{9Br{KNC{A#dAG{fEC-o>D2Gfft09kWdB*-k_PgHt%ij9uUGI2X=iB?=@%EG6 zk&>nVVsp;t4_~!y`T!es^Yxu@eVKQyxoTTWF)gR9^DRB|uHLJ*_2k)+S4nj1J?wJw zr>zg;6)jNkGs_JJIrdl2u(y-G(MeV!FN}UX_wS(6flwj%^Gr!70H4>gGziUWg7A60 zE#w+#XU^MJL+65R>0lFcp`FEchZWjynnM=o{LZsx#ZV#hb{>wrZ7;)iGi|rDK>K14 zi7vLA2A6S{^uEDb?oyQ=Fqdj|gL8md#$l()G?dR>T5TP&bMqD)p111&GoO#6^M$tI z4sO0?#Z3Y3a=8vLmjf2STyAb3Zso2lL;5SNI>21%K>BwW)24jx9aD(gWaqA0Sm<1} z>j3U6ucPZ8jz^`snP@EWvztpeGupob19%ADC0pG4(KvWk|x}} zQgnJ69tB>7!K8LN8l8!ueqQhX{re%@MDZ5(>BJ@RFw1t4Z8LMQ{XUr4Q<=6bP^c=2 z=^oO;Z27jbk=$|Ht?XIy{%uX2REuYDh+3aEG--_7F&>$TPesLmRq`SMwfQo(evjZR zf;Y*KRK5}|m(@Rytyd9T01&eRki9`+XJ@DEl{b(A!4DJ9N!7-}SD?Ai!pEaCkfFlx z$qn7Ih=46!9OB+9Y8WS2J~a#sy*;Z1KBSs$`=5%HmMt*j>aPN zx+Sk3b+Un~MOR9qmQa1KlXG|0vb)IVciyb|A5G$>xh9rH#`$cf=w!1d3 z!*~g}RpCN28?JXotYpV-#z*gBmpbY_Y$eH8cU8~5kIjtVF%>RwamKsuvz?`-xKrj%oFWaB?phx#!mWbo2}a zvSd?a^T?HZ{LPtor5bDHpr8&sj4V*G7zPRT}O8bBli!3$bY`Sw&y!V!X!BSyzr5}Lhxq<-y!{L#3P82 zEk~}he@ZNU;1!NNMn3teUpDg;5_l2xl9HoC$}>d#XoqbBVrgJGu=OlCbJRYx37hGi zDL)|?WCnCkR^s?K2#|Bq0>|A?tXH}oetQ5O}#P6 ze>~YSw;jm}5cDI^A^6^PHL2W5C8ZUV*ZMh}jrBk>dptZnJ(hZMm8~`b9vqwc$)Rue z><){w;pwp{sKcZ^P>NxGvVb?PC0>1MTbWV_KrGK!$eXnSv9MX6-BerxOPDB?a^^rTE3Z9Vu6FPxxxuAQ31YaIvA0u-wJ9Bm+B|HGg;Eu#oFMrCh z&4~xjx>+CopI2%J0Pje&5^P2~KLUA(y!o16=CBo!2>yY5{n|?QUDAAxXFC!H&mCds zrg4nE-5tQzy$I+_3l@vCGN1>cgc(`-0s+llm_MX%5wNHS29AVFB%#%`6p{5tsZT?B zj##uNnbi&j(Cl<%l{5r6mi+vUAGz0YtnCYq(G(*Hu{X4cxUrGcp7*(jSk>5C7(>L3 c2@*Mf);+0FjSa&XB5n*PR$Vx)(W1!z1>Rsd5C8xG diff --git a/backend/app/routes/ai_personas.py b/backend/app/routes/ai_personas.py index 117f55f6..25f76a6b 100644 --- a/backend/app/routes/ai_personas.py +++ b/backend/app/routes/ai_personas.py @@ -66,19 +66,28 @@ def generate_basic_profiles(): temperature = 0.8 customer_data_session_id = data.get('customer_data_session_id') # Optional parameter + llm_model = data.get('llm_model', 'gemini-2.5-pro') # Optional parameter with default try: + # Log the request with model information + print(f"๐Ÿ”„ Backend: Received generate-basic-profiles request with model: {llm_model}") + current_app.logger.info(f"Generating {count} basic profiles using model: {llm_model}") + # Generate basic profiles basic_profiles = generate_basic_personas( audience_brief=audience_brief, research_objective=research_objective, count=count, temperature=temperature, - customer_data_session_id=customer_data_session_id + customer_data_session_id=customer_data_session_id, + llm_model=llm_model ) + # Log successful generation + print(f"โœ… Backend: Successfully generated {len(basic_profiles)} basic profiles using model: {llm_model}") + return jsonify({ - "message": f"Successfully generated {len(basic_profiles)} basic persona profiles", + "message": f"Successfully generated {len(basic_profiles)} basic persona profiles using {llm_model}", "profiles": basic_profiles }), 200 @@ -181,20 +190,28 @@ def complete_and_save_persona(): temperature = 0.7 customer_data_session_id = data.get('customer_data_session_id') # Optional parameter + llm_model = data.get('llm_model', 'gemini-2.5-pro') # Optional parameter with default try: + # Log the request with model information + persona_name = basic_profile.get('name', 'Unknown') + print(f"๐Ÿ”„ Backend: Received complete-and-save-persona request for '{persona_name}' with model: {llm_model}") + current_app.logger.info(f"Completing persona '{persona_name}' using model: {llm_model}") + # Complete the persona complete_persona_data = generate_persona( basic_persona=basic_profile, temperature=temperature, - customer_data_session_id=customer_data_session_id + customer_data_session_id=customer_data_session_id, + llm_model=llm_model ) # Generate AI summary for the persona try: summary_data = generate_persona_summary( persona_data=complete_persona_data, - temperature=temperature + temperature=temperature, + llm_model=llm_model ) # Add summary fields to the persona data @@ -219,8 +236,11 @@ def complete_and_save_persona(): # Add the database ID to the response complete_persona_data['_id'] = str(persona_id) + # Log successful completion + print(f"โœ… Backend: Successfully completed and saved persona '{persona_name}' using model: {llm_model}") + return jsonify({ - "message": "Successfully completed and saved persona", + "message": f"Successfully completed and saved persona using {llm_model}", "persona": complete_persona_data, "persona_id": str(persona_id) }), 201 @@ -719,7 +739,7 @@ def batch_generate_summaries(): This endpoint takes a list of persona IDs, fetches their complete data, and generates detailed summaries using LLM processing. Personas are processed in parallel batches of 10 - to optimize performance while staying within API limits. + to optimize performance while staying within API limits. No upper limit on persona count. Request body: { @@ -736,18 +756,23 @@ def batch_generate_summaries(): # Extract parameters persona_ids = data.get('persona_ids', []) if not persona_ids: + print("โŒ Backend: No persona IDs provided in request") return jsonify({"error": "Missing persona IDs", "message": "At least one persona ID is required"}), 400 if not isinstance(persona_ids, list): + print(f"โŒ Backend: Invalid persona_ids type: {type(persona_ids)}") return jsonify({"error": "Invalid persona IDs", "message": "persona_ids must be an array"}), 400 - if len(persona_ids) > 50: # Reasonable limit for batch processing - return jsonify({"error": "Too many personas", "message": "Maximum 50 personas can be processed at once"}), 400 - temperature = data.get('temperature', 0.7) if not (0 <= temperature <= 1): temperature = 0.7 + llm_model = data.get('llm_model', 'gemini-2.5-pro') # Optional parameter with default + + # Log the request with model information + print(f"๐Ÿ”„ Backend: Received batch-generate-summaries request for {len(persona_ids)} personas with model: {llm_model}") + current_app.logger.info(f"Batch generating summaries for {len(persona_ids)} personas using model: {llm_model}") + try: # Fetch all persona data first personas_data = [] @@ -778,9 +803,13 @@ def batch_generate_summaries(): def process_persona_summary(persona_data): """Helper function to process a single persona summary""" try: + persona_name = persona_data.get('name', 'Unknown') + print(f"โœ… Backend: Successfully generated summary for '{persona_name}' using model: {llm_model}") + summary = generate_persona_download_summary( persona_data=persona_data, - temperature=temperature + temperature=temperature, + llm_model=llm_model ) return { 'success': True, @@ -852,11 +881,15 @@ def batch_generate_summaries(): return jsonify(response_data), 200 # Complete success except PersonaGenerationError as e: + print(f"โŒ Backend: Batch summary generation error: {str(e)}") current_app.logger.error(f"Batch summary generation error: {str(e)}") return jsonify({"error": "Failed to generate summaries", "message": str(e)}), 500 except Exception as e: + print(f"โŒ Backend: Unexpected error in batch summary generation: {str(e)}") current_app.logger.error(f"Unexpected error in batch summary generation: {str(e)}") - return jsonify({"error": "Internal server error", "message": "An unexpected error occurred"}), 500 + import traceback + print(f"โŒ Backend: Full traceback: {traceback.format_exc()}") + return jsonify({"error": "Internal server error", "message": f"An unexpected error occurred: {str(e)}"}), 500 @ai_personas_bp.route('/upload-customer-data', methods=['POST']) diff --git a/backend/app/routes/focus_group_ai.py b/backend/app/routes/focus_group_ai.py index 5ffc2258..987a9194 100644 --- a/backend/app/routes/focus_group_ai.py +++ b/backend/app/routes/focus_group_ai.py @@ -70,6 +70,25 @@ def generate_ai_response(): if not focus_group: return jsonify({"error": "Focus group not found"}), 404 + # Get the LLM model for this focus group + llm_model = focus_group.get('llm_model') + + # Force debug logging to file + try: + import datetime + log_msg = f"๐Ÿค– [{datetime.datetime.now()}] AI RESPONSE - Focus group keys: {list(focus_group.keys())}\n" + log_msg += f"๐Ÿค– [{datetime.datetime.now()}] AI RESPONSE - Raw llm_model from DB: '{focus_group.get('llm_model')}' (type: {type(focus_group.get('llm_model'))})\n" + log_msg += f"๐Ÿค– [{datetime.datetime.now()}] AI RESPONSE - Using model: {llm_model or 'default (gemini-2.5-pro)'} for focus group {focus_group_id}\n" + with open('/tmp/focus_group_debug.log', 'a') as f: + f.write(log_msg) + f.flush() + except: + pass + + current_app.logger.info(f"๐Ÿ” DEBUG: Focus group data keys: {list(focus_group.keys())}") + current_app.logger.info(f"๐Ÿ” DEBUG: Raw llm_model value from DB: '{focus_group.get('llm_model')}' (type: {type(focus_group.get('llm_model'))})") + current_app.logger.info(f"๐Ÿค– Generating AI response using model: {llm_model or 'default (gemini-2.5-pro)'} for focus group {focus_group_id}") + # Validate persona exists persona = Persona.find_by_id(persona_id) if not persona: @@ -162,7 +181,8 @@ Be genuine and specific in your feedback, drawing on your personal experiences a response_text = LLMService.generate_contextual_response( prompt=prompt, conversation_context=multimodal_context['conversation_context'], - temperature=temperature + temperature=temperature, + model_name=llm_model ) else: print(f"๐Ÿ’ฌ Using standard response generation (no visual context)") @@ -173,7 +193,8 @@ Be genuine and specific in your feedback, drawing on your personal experiences a current_topic=current_topic, previous_messages=recent_messages, temperature=temperature, - focus_group_id=focus_group_id + focus_group_id=focus_group_id, + llm_model=llm_model ) # Log success @@ -262,11 +283,15 @@ def generate_key_themes(): if not focus_group: return jsonify({"error": "Focus group not found"}), 404 + # Get the LLM model for this focus group + llm_model = focus_group.get('llm_model') + # Generate key themes try: themes = KeyThemeService.generate_key_themes( focus_group_id=focus_group_id, - temperature=temperature + temperature=temperature, + llm_model=llm_model ) # Log success @@ -446,6 +471,9 @@ def advance_moderator_discussion(focus_group_id): if not focus_group: return jsonify({"error": "Focus group not found"}), 404 + # Get the LLM model for this focus group + llm_model = focus_group.get('llm_model') + is_autonomous_mode = focus_group.get('status', '').startswith('autonomous_') # Default: generate participant response for manual mode, not for autonomous mode @@ -551,7 +579,8 @@ def advance_moderator_discussion(focus_group_id): current_topic=topic_context, previous_messages=recent_messages, temperature=temperature, - focus_group_id=focus_group_id + focus_group_id=focus_group_id, + llm_model=llm_model ) # Save participant message diff --git a/backend/app/routes/focus_groups.py b/backend/app/routes/focus_groups.py index 7c15dfc1..1b7bf122 100644 --- a/backend/app/routes/focus_groups.py +++ b/backend/app/routes/focus_groups.py @@ -392,11 +392,52 @@ def create_focus_group(): print(f"Error creating focus group: {e}") return jsonify({"message": f"Failed to create focus group: {str(e)}"}), 500 +@focus_groups_bp.route('//test-logging', methods=['GET']) +@jwt_required(optional=True) +def test_logging_endpoint(focus_group_id): + """Test endpoint to verify Python logging is working""" + print(f"๐Ÿงช TEST ENDPOINT HIT: focus_group_id={focus_group_id}") + print(f"๐Ÿงช TEST: This should appear in server logs!") + return jsonify({"message": "Test endpoint reached", "focus_group_id": focus_group_id}) + @focus_groups_bp.route('/', methods=['PUT']) @jwt_required() def update_focus_group(focus_group_id): + import datetime + import os + + # Force logging to a file to bypass any log redirection + try: + log_msg = f"๐Ÿš€ [{datetime.datetime.now()}] FOCUS GROUP UPDATE: focus_group_id={focus_group_id}\n" + with open('/tmp/focus_group_debug.log', 'a') as f: + f.write(log_msg) + f.flush() + print(f"๐Ÿš€ FOCUS GROUP UPDATE ENDPOINT HIT: focus_group_id={focus_group_id}") + except: + pass # Don't let logging errors break the endpoint + data = request.get_json() + try: + log_msg = f"๐Ÿ”ง [{datetime.datetime.now()}] UPDATE DATA: {data}\n" + with open('/tmp/focus_group_debug.log', 'a') as f: + f.write(log_msg) + f.flush() + print(f"๐Ÿ”ง FOCUS GROUP UPDATE DATA: {data}") + except: + pass + + # Debug logging for model updates + if data and 'llm_model' in data: + try: + log_msg = f"๐Ÿ”ง [{datetime.datetime.now()}] LLM MODEL UPDATE: {data['llm_model']} for {focus_group_id}\n" + with open('/tmp/focus_group_debug.log', 'a') as f: + f.write(log_msg) + f.flush() + print(f"๐Ÿ”ง FOCUS GROUP API UPDATE: Received llm_model='{data['llm_model']}' for focus group {focus_group_id}") + except: + pass + if not data: return jsonify({"message": "No data provided"}), 400 @@ -734,6 +775,21 @@ def generate_discussion_guide(focus_group_id=None): else: formatted_topic = 'General Discussion' + # Get the LLM model for this focus group if it exists + llm_model = None + if focus_group_id: + try: + focus_group = FocusGroup.find_by_id(focus_group_id) + if focus_group: + llm_model = focus_group.get('llm_model') + logger.info(f"Using LLM model for focus group {focus_group_id}: {llm_model}") + except Exception as e: + logger.warning(f"Could not retrieve LLM model for focus group {focus_group_id}: {e}") + + # Use default model from request data if provided + if not llm_model: + llm_model = data.get('llm_model') + # Generate the discussion guide discussion_guide = FocusGroupService.generate_discussion_guide( focus_group_name=focus_group_name, @@ -741,7 +797,8 @@ def generate_discussion_guide(focus_group_id=None): discussion_topics=formatted_topic, duration=duration, temperature=0.7, - focus_group_id=focus_group_id + focus_group_id=focus_group_id, + llm_model=llm_model ) logger.info(f"Discussion guide successfully generated for '{focus_group_name}'") diff --git a/backend/app/services/__pycache__/ai_moderator_service.cpython-313.pyc b/backend/app/services/__pycache__/ai_moderator_service.cpython-313.pyc index 73c1c54466f75f1ac1b18559bde13c2b5f3be9ef..8e337576981ae50659c1fd09f0a1be51466dfe61 100644 GIT binary patch delta 1614 zcmbu9ZA@EL7{|}Km)`dFmRnv5{nYh$W238dl~CW4!dP3@C3Mw00X5a?3O! zM#iUMFgo^Z5t1!@G1(U5GOSahOU6nu5JOV8DcB`yqM6@JmH8RZxgF6Z7(e)Y_@C#T z^PF>@bARW#pMHxMzsKTsYN{3ydt7@d@aOE3xN{WW4U5hQhA%pcVXBu;*SIzNX#_EE zIzny@Ogpn+@c_@YVTlRy@TIXZqXfCtlHScrX$RS$)~$7Ag166ELUNKp}(k2muNF+%52qM!ucIKFx)ziczl`XJAGTYQ*jpE>qJ ztz%wT)Gz372#<1JUNg)zJ>^hN$)>UTfw6kaxNob#w3ToEU7eC6&Nve~kXmaCs~c@7 zYSSLcXQTG?BiZa~8Ycc~wu-0>;hU|S7+-`{TJFB4H6%fdD(p*|7cA7FdH}@PZ&Xo!sT7zgK*P*5`Q&VOJ!b~Np2{#R4 zrjdBJMxmBhC$W;Yk~O1ZWS$Jj?@=Mo2+8zjGX3Ck2NkkAlIc^F=crtwa)Qc9A{MP&L;YSV zK;;6J%T%5xDqo>v3QW3L(XPR777ji?@lxgpd3m8NGDYBO%Xsk@V=-JEEP{Nu#ZDmp zCukD?FPKH>b+?osE;(F=B4t_!&ql0zM+zG`go(eBq9PjSWS=)Q793*We5oP)v-=?< zEYO6HQJIJPUH9;HnC{NPAHw_HuM=PFc@cjEbv=`KK76O=6^#2qbXF7eLfG1?!f>th z1=7)}X=O4l0p_?&xGM0PBxg?=)K!~OIY}Uxbrdrx-+{g=J@3gSCn_eTx_MaatB20! zY%Icd-`Ds9xYz$yno=RJC4+vl%d;fA92gwv^(YJ#UVk&(i=0H(?vlGs{AAtjg^$*v zLJl5VavAv+R1DUL8V3hGwa4}%BT2$hVPy&%=c}Qv2hGSA^tjiOVJnO-2 zI`M1~@e-ZzG;r9WWI`4xnK+W|nq#jM22NMvb$Ivm2984SnH>BG&Yh{&H|Vha4@6Zi HA=ms1(=o1u delta 1332 zcmaizUrbw79LLYOw|{PL;g*84g%vIXmZccc;$Y5=ky4TYQVBhjF}k&u(iZts$Ss?3 z57P(Ze_{2PNMbTgOqMwHVWegcdvN8CidmL*OLSWk6CaGaXk1-iHF|!xBk^JC@8R?N zopaCcoZtEW&i&vvz4#4PN|lu|;dbZlTT|-mtIA)8>3CM@Tc?om)K@i;pqVMmwqHm| zK`CH|$bf3E#`S1s5_J)hvcU2{tyt9|z$=kvYR_I9_>!tWC3O3-`@B#vEok#|3yTHo zVtj5Pu0*X}2E)*k4Yb!lHVtxbtGKDydv}YQD#duW zkyFcL$A@lG3eY}$m}cPAu#2w1%5Vc+g3JC|xHi0#2H=;0p)0Pou5F>~q9BxVL z#P}E@gLoD34g$5+05Q&ymN?*cu&X91@X;zCafRhZi}HhG7lbDop?}ovFu7K6i zL6_I#-AmT?$~{hT?U1dfMqIC?JYKIc_BgY(NA3yM6+G=}#JlkD_+`gA46(q1JQq)= zqse&Wxk>Fj{5pP;o`YEE5&8)%hfdL@tbFVs75><6gEjl|aU+F0;U=rhth^8ApgFJu zpCaswRN16ZE#Ff&RuPn7G}7geypk?1_x}*L5JU3^j3 znRoC1bY^^s+fvq9ztB<4`ERkYk&WA?shIF7N5SLm_s>t_4>1paM)xQi*o(XT3-5(f zh4zWezqLRHA=a-N$Y(t^pMh)`WZwaCLuvALiW`qpj603K1KH`=w?b=<@8_l(Ud=6N zddXOAnxDmsDpzxf$Au@r)B6ydPN=j9?YQye&u?tWB||$hH7$rxw_Xpo42mjwLy>(-zi*Zs>p|L$EDi6MMg~ z0{gx@^2o?e3M7B+3H;pmecyZE_v7w9pYQ2MYxqBZfgPXN?HqzKbpE9$8_!;Gl;F!( zYL<;bBvxMesJz>Ayx_Q(g?7G%QgqsQ8Y`til>HN{M6W)I zC%w2ll^-Q9Mw?A6$&B~Y(PFh|%b!DZ9ruZ!HP$TpGGhb3Z7ggMmhWvdi=|{8`*98V z7EG2X|xw=}mf| zP+lOtRU2r`&X0>o$X3kQMtC}(zbG4Dwo7)=)&4X>@d`DJkGA)_^>&Bk$h6xK8vXb7 zKZ2eGVBG@0Cjtj#M6wM|Fn3nPl1(&=UL%6@;mK87gtzI@3S+QXtw@FBq&;jeiNUb&9bH2LUt9F63&SxU<-9$-9FV^0y{G`Ighk zROLpyw~P)~$KP0b-+2?a>KxE69GqX6o|EGD_}ALc=3|O7;Oa1~l?E*@-Brq!y zp=y8}E7^Xq*)ojNM#g>=|5B*CUBBmNLg!`sJr3Djw>`W6I()bN=aKt1d;Xmpe8onfW+Pa);jjF)g$+0^M$^uvAC>$!HXJjMXRE{H?@Q|p zBbfYP>?!h9|6r;O{jjvZ9bI)=2P)82e@{o$gqHbk&!7#h)a|oG+t530T(r@2(_o@# zE&$I>cQwU!Za`pGjr@S0S@pBj78vlaR&awBW;MbO8ksdC3-+3Yfv9UXPn2QSgy3Ko zv)09ez0NR=(6DaeqV>$WlaJOg>oqL3>&*~oy^R}cV%EDNLv_rpIu`6r54j+C$fba@ zT&HR{L?9wf8t%biW~6~7KMw3BGS~WuXp-0_tTTOqgmlV;fm9zviv%py%7A+4>>jTM z_26WSWFeDf5g%MddxXB^7IlO}vS=g7TV*~smp2Z`M#3XSlt0BH(UqO|AQs)SHRgt; zszvlj#s{>d7}nyItbly(H55?HlN~kUC0BP9_ZLV8P#2?E0_tLGgclen3m6;-$)OVx z@buhAl1-;05N62%bmYj;QK9Sr?rjM2KED_k@n>hqU7_^}Xf4xX#G!{6j0LjoBSBb+ zr({Q_PDK`2q^t(&l1*i;5OEZakh+kK%oJ|NCB*8Ke2z&}j$%SKNCAqsz>%6`733U9 zR*1w4TZ~~LK2G)sb@t?ZVtjgXIx#_C+of6Iu`f&u6d+unhE_mDkTOUi3b1LOnH!HUkT)vac!>N>MH?O_A5}E%a4GP( zA>|+ixM@fMAwfzJg+mmM0&KDqi?j2|O=c>wpgaZ+(q9=)ouDno#l`7~O_pMt@&p|q z0EC^&EVX3{^%No$G^V1~NeW{W;sBctl?qQz#24ZxlM9NnhdOPU&8h^b&__a9)rP(`4+hCWhOwVZN4jN|@;L%sMh{7UCtfBhYQ{hLR= zf9&V}y|<5yUyT0JR2l}C-w*y@@bbxtvuXTSV`YG3K@3W(8 zyct~ALYBUr#%uK^iY?vLb-jbzU(PJE{Qdy59AK$k&VYZplI!D`=llI zKr42xua#Nh`Mw5brGce(tGONqtaNY(b}={D$blB-Mhgq}I1rm&sN~c7CvTE}tqEX; zm}{HejL3+_-G)4(Gm>bn&tQ^B_mKCXMdY$fBp1Z!L!=hbDj6PNAvL4bSng9S1k9$D z5f5ddBBO*QlVlJJfrZSH8FETBM+K@JQPW4Co`vd!OOsuTmV8?E)=XVbMzuhY8bGp} z4W&2gp=i3B4W+j}um6JE=RUrl&j+1y6vBu;ee39n_OOig$_dOIZTnRX!3(I4vx z?>E6;Oy3zucrB2l=8n<}5@8Z~HH#`CW7~PiMB$ixdZs1YV&&N*lx(qWByKO`^^8pP z#c0~17Rd1-1)ljb%&wnP86>{BNhsG-j^0v$>mi-C=PeJC=?is{P%wKS37o%pF+}w@ zRtsD3k#E;ILc(YCQ*}DmuVP!SAC(CZ19NsMAO=7sGD`|~^O&XD!Z_`mvPe6tde%j)y#Sl|ca?5(tf|S= zLtVY(#ikcc!_@peQrTRCf1gB~>+v6ubIpgXebjw`!lPuPxi(dzRM3ip0+lo69EB}9 zcb@vFwkh;6Rz@fsrXW&~C>)_MNwF)SQvP2J%cx zU~r5!QqfaIPDxSg6oqjL6BH5vo3_m1sG|5O;mhgXKeRNsE>#mJfi^enAIwl+S?h3v>IVy)M|@o zFwCr(f`gUJS|v;EFl}9{=b~LMW^E@QwKMB>HtJ&5T{PT!F*j7itcM~)Hs+R%1^eL& z_yR-zt;YZVN&=hmbnCZBp!)eyNo7vcQ(fkCa{n9=ET!KrUyNZpwy+RzSt&fsYRR&6 z9v8Z{ve-kokS2-Q@igUU^ZqrUaiM!_ln1!b6TeQ9?H_+ZF8pbh18es*9Q}L_EY(tb zNd9N$;uAua3~4@}W5Dy)v9U2A$ukqsPh~YC2D8IXkE2*lN12X6nzu zQRb5L9A9k~&BlqR(`luYm4q)onuA9=n_bU?`5fh<{{^62)I{bx+f$)0K}E{#WD58v ziMuKPbQ@Gsa`&h-)N8nBLgjULg^u@xjxDKox#PC2EbTQm-8tsdp!Od!KKA2wn5;1iWtNdRv+6Jm1^ETyJ2h-O51k>pMA` zb0dB~&n)w-ntwCUe>ucK&b=Jw`w+8&ST+Bq{a4J~0VA{GiuCPeR`#-BZ(8D0iIYlP zo=PZqaOrz{pJjdUrlRvjT=(L{bV43a2>X=j#AG|CB$po9|EIvTjn zg>R4-MkARAcj@ZrE$rM+-T6BDt;c6lhp02Bj;dHbOd?f{RdrGoT7eGBiKVKO$EhzT zmN8nTUyos%5~lWc3hI+MMy)u7@WW)%m0X;fN+juj=8`ApPMuDSFDOrvzlwFSufdp# zrTeja><~NrAx$KwzWFLGAMPC<4zt6<|1znT4`|h({0Vdz4qJw^C5%;9SWrr!Wz#U1 z)N+TflKN9;t#qxKk7V+fr;1BwX#D~Os>cd_5fpj@l-I~Vo+{(s025vbl>9Hkj-N?w zgerb*{~E?3-th2gMzwxbBE0T?)t+Y6TH1tch3Nv#HX|3GwrDnoLN%`^U!6@`wYm*C zOI~3vJ(Jerr5(t`U97yAyxeo~?4^b~tnYrI*0I-!>KZp1S~h$Eo?c)H))N><@kZ&k z*IQqWq?r>WJ?>4ZKA0Y+EYNIoc1nv@=dx33Lmz#%XhYK#SJth#s&9;}f3_sCv|Z Ws+AW|t3y1?eT!xfFa5;?hyM>&C6Frs delta 5553 zcmb_gYitzP6~1@w&OT;$*6ZE%&OYq*uHVaIgYhf2F<`tlU>k!ynebQ>dy9>6z>75t zgpf22Rhy71N(i^9LZq}r{nPwNl*B|zC6o$cQ*0B7q^e?BNrfu45kJ~42`FltMm=}- z;k8ThBg#eoICJhf=bn4#o^Ou*)t~UY3)uRlC<+LMXXu5)`_vb$Zan;A5veSzm(LI7yuOFrU$z^iEpkdI(=4BU1t9)epphtGlx3IKN zkfpS@&yVDC*^+Ck*@?NDdcEvU+ZTSTy$h^7^lR)hSIFK>9@NdX(IGA%2Gjn2=1-sF zO2v}2rg)4CRZd^#o-uF-dAeJ0S}y4kdI>fq<2X+zg=QM?*U?V}PXjOOYjh19><>oV zz_uM_yVZtlYQQNeZi-scN;F`l*k6!uP>5oZ&CMh(C_>z}Pl+DxOwFUI|VbhklsEFwa$bavrEx!O014x%apI;3@btrCzJ$o{{lkJLG zHp&hivLZ;iMy&RjGfBj)(c+AqVvPpq9le`AC+3L-QCK!L6e~RwaMAZgk$k7cR5Y~g zl376Zw(Nxj%?L$JnOWJFnH|OV^HI1KJNS6PXL%Ea3J2*I-Ot{N>U0osOp6~t>yYg4 z$ML*qIJ2OVJ#+`!-i^=+xE*m@JYUIkpoi=UZXHT+Fe8H2uGp3QR=6W0V6zj_R_wdE zop}hEQ2@mqFz=w>SbgQiiY;~8kW@ep4zPn?HNbLHp3h({LqQbP)Bgs1^zl3keJap} z1^QZW!+Be!Xv{ek7bsmeS<>E?JN35ecv>6u(&IJ)0*|CWIuahPHqMd+?K?|V~OLV6GJK8^qU29m_8{z zpywym@%VB2uB2cmHM_mIj)vW9aWmcPK5cY@X8;E6Z*!Qk_ z4h|tRpa>Bh2m119z%(`K=;uYvQ@p}wsyzm@C36Z7cb1FmcJVR+2?ghXf&+$waP?cJZ~5iJ0SU zU+vwr!aKnQfK}oatzsdYY#dgxh8)&4(4;Lax>rZbUlA?jiIve$f?@r((TVZ+_;g-L zKc@W~D(L&APubQ%Y;`?@S_T_vUs+IJ$HaPiqHHPBz{ExdO$;IcA%oh<!596Nb(JU*I8s5|Ii%Ik4Al`7VUZ7SR$r1mg?cZpPBN2KO6 z=w%=SEb${JCMFZ~iHgwFKK86TabkRAiDy`^?q_BJfRI%kXYwNq7(c0uM^!END3b;m z8~|9d{wS6hKR7fJJ02TK99Pw5Hp9+UJ;>k?gE4>vONo(HX3*wJZ^0>0zQ<;(fYyPq z*0f{3mlk`v={uFDu$A#vQJS~5e(c-2nzz1i(l@G(aCU5#20V8OxR+&0C>#jEF8Md}F)r?MvtRXX2 zDN;^m%6TTQAxvK_bUMgPlhkP?vsNDDSqFhYvo4`?Bbg0IolRu6iD&XgW0y;ZuIYqr zh+MN)ceRphtvtvFIo2a_y?Xj}iw|?u-CFD5WFqUDxg1g?Vnu&rHUN%8F z>*+TGF0HXKD27y9Lhtpvuz|HTLWU9Gfo>iUC}z!KzsX>LCMaV)HITB-HQ<+n-DcCQ zpYd2S(Nc_*?RE_Grlnv{_M;s)0n>=uEO5%+m$NO;DbVM!8v`v5Ght!a5ib2-P z`PxU+UPm(P1W;5*H;Tm`Lq-!9a!OH1H9&pneT1Ut1yx(HyTWMEY zxNMi^RbwWdGz;o-&W4YQbaH=?*T;43Iy&4|gmv`EHi9iQ zAiR_0xaRj)i(Nm-Fp3I zrrJX9*1e#I))T2u&}Zu_@sH`-^=t8y^w0GVnzu4_2ZIQ0Yp9x%)Kd1KaVsNJHNjvN z%d(rJ?qslwK_7$N4Eh-iFnEwbfI$fZg#jaDwT!_-44|HnM#sR!8kqtK(|+bI7@wf|%?j?NW6g_GJ(cMB;Pz_twt0sOUG7-ly$Q&&y|5c7&}7=NS$EB)XIQw^ z2CD1T!VU+y-X!g?k~u36@|=S}ggKY6VEhP)J)xCal!_R}9B450L{->qz z2jN~j4Y9*t`Sr?oYw!*p$h zn-;e_r>x(%h_WT2l}^Z*tqY`1vAe&rGM4f)Sq!P8iOFN}#Hdy$e1aV_{jj~({!4ggDD257%7}4eSaHJMGi$=f?iiHSIJ_tz>L}m~V@(fSFdd4V3YRHUTiiF5ah-Y#Q z0sEO+p;IC=tx~6*%-VU7XC-Do>lM0OWVWojE1z7;=RsaF#l}X5)L49MRK?q-pO2j3 z@j7bjmhiFZs_x(DYP9}NADf&UjgN%P>d)9AX)Wc`OnQdFSq9HC_&NPopC3O!-Mi}e z=Rxt#^zL1M5SijYs9_5zPJ1GqTa|4sfsUi2vH0jnAakrO0X566>S-2>{RXN&PEQ`F zPG6Mi*AIM%ZS72*%c)Nf9i8fB%4N>f`0;+ksqw8woEqr{nA}Vi{s5w~FHx$QUA`)|)dWh<47>3NePwtPPr=?e{n_wczC+h{n|+PPUb(==?ah55 zU0>hlhqUoGc*5#SFdZ`WWkx8Vx4mdpXA|c-&YpU<<|E#7PfQt}A}G9Wv1Y@frx5Ut z=^>1J@uIinV%>%6B$?74Z#jG~M=m-p9=zzj(D#ueoa8k%EDj4AQnE3#U@AgVU<;O> zO`NSd^YA@$%H|}8yhV5TA&eiyi+0z!#LFG$PQ6%@B%0<{zAKrUgTQI$Hs)>6rjy%= c=DiUgSn13ZnlBTWtLdIW6SqwNeO$o*16Ws8$p8QV diff --git a/backend/app/services/__pycache__/autonomous_conversation_controller.cpython-313.pyc b/backend/app/services/__pycache__/autonomous_conversation_controller.cpython-313.pyc index b295a16f2035afc9986f7e907022facfb71dc480..83adf563f9a799d3f4a4c41363b0a3d577508056 100644 GIT binary patch delta 1429 zcmZ`(YfKzf6ux(6mwnFcQeI1W4O>z`SRRF?g-T>A1$m?xrW0(phGJPLxXi+AH&GIT ziEX560efss8zVuDX-YJ~5j8QUv^GFjql?r)(H|xVinhs?qWxha-n#^%Cf;Pe^PPLn zcka1oCNqAKeeDvWE5j0EXL-s zGUwKBr8cI*xHl(>bCO=@l6i^W?k^o7F%G_wbHVv+Y=#&wVaX`*VnUuqwn&x?l#bl- zn=*uSsO4#dV7$wLtx(u+*Nf32SI5a_a`znV4$0h@0^@x#P+-@=hMUjwAd!jzB zL*;B5YQv}0s$Yl>Smc)eZCUA|V2H}DAQHazm~MFB?hZS?_vhukhi zB4t9at<}@k67Zf9vf4de9dd_bPoC4!t@yHgqlGq~LY@-=ztFDu0^Nd=L<)7>-PqVT zqzn?89R+{+oQyID1>M*1JcPU7z|k$ckea8M`8G7F@v!AFBt_y_oNaG#Y70x7>!;3?dL z$A?-?zfihDVHG|ca%`!Vhl=r!uyc3-FRAYgGdyYHy|>Qe4z+aTJEL`(=AWi;CL)K_ zt8?VkwX62*CAv{TA@a`qD2tpCO@0?jKXvOVtU~$Nqfr*JxmW_DC+sjf7K_iRACL9w z$n6T%Oa=>ZWa2RXN&R5rxE9}4EuS6K<5*StLSlFSN=qE3@IHY>?WsVw*Q3yCN(u!( z4P~pLsY)j25Y}c*7KIVDGyY8*YI28;HHTVSL&sWYn>_20VE8yZc550tK^GLT9kPNA oR`OXP#YDkO;SYEzSc%KvtDp^6z;bYZbX7EN#A_&GltPm8H@)+TG5`Po delta 1220 zcmZvbZERCz6vv;Zx3};2wtH>KYS*rFYpHwDy=ceCXu?J+#wEME?n5!U&`q54cC-); zL_x)**#}rTg3iPM`h^4*C08^iGZEN2=J>EWWpx@!h_Dg%p>ych`J9fLKzx$>d(Juk z^Ok#aQ{&vF)10_22qwbLPoIwMo6KAiKOZt1nEL^H)^BRT9So>DxXcq@Tx_WRQ$n(oJQ(VsMd2$z}#qI9VebpnurmlFUI~G0H~C zDpSc;&ncD&j?JGQC%iXqXQN77vZY0{8B_#W@I6e3dI*t<6fK;KZG|u2EPJw8rm|5M zq>_5ABFbVl@sLRA!(^f-{Vx-um{@i|ute;IxNHKCV%H0jakoV=qsoi2xu*g$F<kQ><%O9`Z zVwbfdY0?y4shdduw_MW`kM%BW_$)U_{SNSq^cBY|*s8CuZftD47(dQTKM!joEfCm0 zNpHf+{*S2*j>f%kKHlN6#_L!@{Ch+Ov4FUY*nvobkceol%!IE}W$=FDdGlWOP41DS zB&Xd4i-}W^KJZMnMJWH>9n3nt*{a%XO-t78&3bDWy{#E<>zY~TDIODYF17OD+w@4- zPmhIYS0lN?Q)XY$h4jq1Dxh;!3>lbn&2I11k!$rKkvUWCs7!4~VLD$jtuuAianrVt zqszyoeLQp0bsUq^jizu7mu_p=)xgd8DYIv`@~n8KK|s4bR2lX-xY-I+W}T?adU&*J zxUgTXf6J+*w_*3;GgMXYAKoX@JJ35CqFMFy=qP7i#J7<}{Hg|y4^z4dpPXo;cVXeg zHeC+mYfw7YMSp|H*mJgZ3_L)Hh*kJvENWgx^A2JKic@uks?Jn1y#@ci;5VTdMf&t2|v+W0Rc*YE>^!$z07n zY|)FDU|8Z092^-Qh-0_76Olm4r#4>SsR@KB@B5)CNASL$*u3ZaBJ+D*neUIz?}=vm z1|He;h-JRd1G5qsEGE^zexUy IKh1Lf1;G0~`Tzg` diff --git a/backend/app/services/__pycache__/conversation_decision_service.cpython-313.pyc b/backend/app/services/__pycache__/conversation_decision_service.cpython-313.pyc index abdb2e5af5d8c0795f91fb64cf834050854fb485..d5bab016953e5a7bb299e9e4ea287c052c9a5003 100644 GIT binary patch delta 2856 zcma)8O>7&-72et9l3e~QNm(K#QjsW`vP{XMC0UeB#j+JS`m^FFA+=2m8lq`(MQuSX z)mh3#fYg$EXq^@b+DuWTz4R8uhdQZQ6hV<6+emEZ2Z)puu&@Y%1jr#l3RI1qqK6(j zZ^?D3R0q%Dn>RDxoA>6;o1cGZSAHzsb-Nu5Es?~FOCOB>NxZ0-WxVbV3%savAtB5w&T zYaVk(8A+~P7vN3#;%s$h)h)SG4I@u8Og2szygPqSKV$NDov*QOKJn2ymzpHE$fW#| zC^CmErdxC$T#mV_qosK*%gvcGCBN%4rwhOa+R8O5Vt&%4hB_n%+5GC|bovNLUwpCn?X*Pi&ESHh) zm@MU1wJBU$UD1VNaXGVG%FD&eoNisgrR9|}ZlyfkVf1Fy?6O?Rxz-W+%6$Sgkptq% znC{Q6ti+6QEw%`gWePAG?lcq^6*ZqZ_e@5~>s&!Dlk?&PxhC#MUh=h=nCSuzlB-;2 zz4l%hv13_VDXE&Q+w*cx(Ug*kyXgS#1vpGW^HKx_$MsPb^idB zZ`j9sCmqZ?LmrCnS{#!$?p<+clI3o)Je6cFQB;OgHylH%}Y*IJKBF^S|=ThR<0agh3auoYhLIq84xudA2Ez zqU35*!fAx4hZ67v`B&3<)I*m23+QL$L;rqzly*ls+)MuB&&3}DjtAfr1&yN+4zFXl z3h)yEPg3{=2uXkxz$E!i;Nr*wX}+*i^C@Ufk-6rj2Q&QQPW5T>_hxnNfein4hvt0L zsyk@%s9HIz=49QHS8`>1kaBchD`RCv=d#73ZYe5SIchV4t$VQiqg4gV`OKms7xNmP z1G@YCv20PvXR^66O-0SfMcsR!nwQI2rKn*Dy=J386O)#)YC!3&!;lwZZRBNt11eOe zgKu+jW2azC44rCP&qGrJI6)z5`M+Lrv@M8^lc(Bxd&hw01{el_HAQ(G0{MpkaCnUc z;iF`8-yU+U?G*ZbMQs0u^&6(A==glqb{eQ>h^MpVVZ$!3dueP61sP}Py5wA0&f_Wv zh!_BPlQfw$Xuzq!$4Ra;R`qHS+B;plY^l0d@6{WfY4j#(-urKqsQ4ns*b&382~ajN zcm|}C0QXJOknGZni{!a|2U^RNYK9;IYW2o8_bs8%DUL*TS)P)cZdB1H zgN3yem$J-qCoQUlzD1U#lg{wHQuim|CEk2+jXwdOgzfuYN%7|EMgIg=)tVMfLK3dx zorRq3x41d_C$Oe$^iN<*i)75&{;FZxD zl0dvdz-Lv3M}$SR$c%FB%p!^km0SIP;e7C-Vfatry%ZkD5prRuZ!PM^0`&C(!~psM z;B~?S07jzPKsp341Yn#dBYBM@<*3VBNGe^Vmx)qXDrahsq%qqlXo6{c3^;a!<6SCi z_$X~_4hr-(AWiWFaf)8%+I8Bo&TKb#k&E#owOJ*?#iTkt=AJTu5{yLS9ZB@h$Qwi@s%y3j3*({{>5}Q1So( delta 2365 zcma)8U2s!H6yD9vO_SUFHKj?~h9+(4Px?MhDQ0KjVy}RiF+tYT$*=)fvY(M;;8&2gmWjJvT{76=&Fo@1EWB zojqsIp547yPydlLJ~9{t#M-%EUYkh_eq?-!$7kv5{54|@3Yb9wZPG#?bX8Pn{MaY- zt0ZlaW&>ziwH};fO1gkGCo!wag7o<7*HL?klPhK4{kqBpeZfw|e%)mCV_re>8GJ^M zD%X<)zu+?s96~7MLFj+@<}Os=KXJaYqWMa92J&GeUT?os?+-ySs zX7#9w_0+0;3p;3yt{QKkKj`Xcmr#l;nB<~I1VI(3QB>A~ihirDWeN*@S7$4)DXg;u zg?tD}B>_x-)3#K(kgw9G+hdmWMZT;2`pJ5#6?*9RI+&syJJNH)gvxY9C2QtLVsX#N=E;N-`-T zhGWTCLL&7{N16aOGe{a3(2eE*4$(8_TI{8l&Eqv${YFCw|6JX0ue$ecb?-`b?TV}Q z0na%s7qzQ;+ER86_tBrq_TmBRw*0yfg*n>B%h3|D?zEsK+epi(9o631$V=- zWz@{wH1kZpS-~;tO}jA8M(R4o%-k)rfyuWvc8r&D%cVS%m(9RgF5fUQz%4fo8z(&6 zcOIT~h?n^auk9}Ds8RaOa#>Xd>ymXu3?&m%Op205de-W}4fMLTzf@UsBO{P)bk%wa zH_{Wfqj-_twl!-T*sz-;P4q8Y*fR`39y`FW<5IJOzGt)GPW?`&=D2O88e=>mYYxOoB>4+#Un`B4@^dg%wwWBBc~-gRGPRoo6S-Bix+6wv(C zP+vKy_~d0X%SSXSk|0}@7*2^1lH&mJ1OV{HSOLYMGY#OSq56(oM4ixIAJ!FhF0A5+ zzNio2&!~0NpSUM&YS^Y4P~zGK#!A(WfV2Z(%_U366Gn+hUu|l0%ra_W`8{A(?Ci&; z87!y0&G%JD6gS%$A-{a3AfE+;Nq~F`EHNo1l2ACsu8*K3iV>ECComxi^I(=w!a{4i z25tr-(T`iBs=raXy6v{=pyG3wjpuzn2NZVq7j{_|k~4|d8=0IkiG7nt^2O6d&SnU;%H)by4`qwVpX7* z`X;Qyj$tQSatb3nx8$~sAnqH)kMK0xSBcM2!P`CrQOW#tJP}F}j>$v~0B28DA5SFW z1kN^@0Z0H4fKvc30xZ(g-YuiMFnrMaw diff --git a/backend/app/services/__pycache__/focus_group_response_service.cpython-313.pyc b/backend/app/services/__pycache__/focus_group_response_service.cpython-313.pyc index dc4a0e861cec6d196d96911673d3ac4bf5ab3d2a..a0e1ea8987ff79e3621f8939c1df0fc2255efc97 100644 GIT binary patch delta 2492 zcmZuxYit|G5#Ht9QRI<4KE#(uNj%ef(H1RJFFz_-brO-XWlO0}2Ror`fss#&Qt2o! zDW?va*iFzjMq1R){t22Cb(#VR@@mmTf&6d_)UGWRXi*snT7f767x~iyK}sVo>J~xK zoueqxY7V%$Z@-z@Z+3R~K6oF$^K&eH?sAEUJtgbQPqt*QNMXEwrTuBX87a+IuI?M> zr+fnQD()#?ucUY)=qdgwO#F&{$};7f;(9HcUS9Enmjo2wlu+xfiKwTIIJpnzvMGKu zI-~@qeCF)D5;U1Gla6hhUt}>MdJ)GStJD$RsG~t~ZDu!^*%2jDtIcMP_VP;9^ffAt zX7t9I7~f>_O>s z$Z^813WK;~!+*wtkc<>jLOqr~Tp`)mp*Tk^M>*ZfuuHE~th!C*t2w#H5n@YrDAFi@ zRM71*QtcBiievTk*Mityr`Byob|IAAm=(5UOF^~Me+aR5TaDMF+7vIeUP6kmhuexB zchdK)4Rp*JFE1A~c{WevIZfA$A%}!_KjW6=q+FBuO!$m8n_FHe${lms;=Dee?B3ItTq5~| zaom{^VtmQU28&BYvX_-j*cwquGzF&h+@eO`^cFpx;E8~Vf=SZdzE&4UQZRr7(oIkL z)^WR$s&`=QrGx&6qZxQRn0@q=Kit;NUx0 zcQSm-A*Q>yTLDjc7k8^w0A`l}Ocw{ZTg-&HTLYm?J-1RXFuW25ekCf7U~Z)~lo{Yw z1_XvzaU2}0ym&<7R;AELE4SL}0^A)sV&{Hm7Z|3WwFQltaL8ue0qu($7v;ZV+)JN` ze@`3$2F#C*`|%rsKh9u@FKXW?mf(ASNh8Dbj~)FDQ_PXzNH4^n0y7On9r-$KP9(8T zk0oN_5b$8`7|V%I1nW4AC+O*}S)8XgyC#}+M*JQA+;e~UJv{e@=GcHe zRps}F@G1J;z1hwQ<|v6X`Nc)^2oy*G2#IJjnqHi)9F786W+c(6lsZj6i`((PjdQ7G z3x34-w8xF{w~a4)pU3z+#)bZqmI(V@q5}N2WfF$0uT;%r#@+oN+Z~nm0NFxI55@3K z`k#mXgcHW?hbJv~H*HJ5j#G3s{XA}?qZvKY1CeG!4pt{JTSz+T1siJ&;X^|MdS)it=9r+uXTD* z9|66f3NwFkP%e)F5( z_xm0*v$LN};q&LP<$>93KUe`j~qj!BCfU!N?W;N+soGYxI_dXsGRqP@DknB>V) zFV}1D19i=y?LM%-IYs0Jg3grS#t?RWz1B@@!_@W^`NW~- zy&oz1ZZqB5XL)4iGRt%ZkaU=aobcRfdxX|N9gp{0xSt~+WxgGS8=sK9Em=w&aIH8JS zl=Eem>|Q1=bYoV8ZhxlM;#i6lGmG+SQM_Ex$j2>NxeGHr`O%j3S$xqV9}Pe@dOXM4 zZ!JbqPbRmV?#Rk|DPE>~tdFvcW^vT|;AMX!_gMXs#X5?myPV#w_R>9w}OssVIA*z6@3*n$mlCrv8u0_rEHW^mwk)CsoT? zu0b5l%~Z%i{e=j{v+D<*jIn7kgQ$u3p+Ouf>mQ@vt}Rz*rSn+5X5_K@&=e6Id{P`E zqa$MpvYaI+EGwdY_C#(a%)DRWIvuz0QuTL-5#wC?cb-?2fDcoj z)4g;lgGn4q+J_BdSBqRnE{#YH}Y2eU<%){y52o-D2<@X5eQyLnO%0 zm|T$nKNAoD2TL?ZrJ*Ct&xBnaCjP3)%(#4qrV8~WxtJaf%MY{H&YGby8v z+SRO~&9yEZrGvH6sxIb88U{v3Mzo_HCoceDA+dp2Jkggv^l>uINHR=+tKDT-1rW@f zs?_b{@H+Kcy%pov)!FbNj1Q~38n$!Zb<95w|2IEzgT66idej?@wrEU~r`GpyxPl6i)3}Cy6gh;K(29<@w-%Jzu4vV@Y^#B5qF;0b@lHD1QI`7@ z5O0Ek&o@~>yCMZ^Niz_z8>E4mkd43}D18-90MhOQ+!(LDKZfLS-*Q5nJ z?AMCu0cRooZbLx$m`z?*A8uGFRG$Rrd(4CcatiSKU`~TM14cVXj%anx(%vmW;ZsKc zp&r@t8urH-Oj-v>tUs}5f2@zh_V0;Jgs`??Hhe}awpIyKOoY_v)=FOdoFSspqdnci z1qRLZUQdsaBNGg7X8H-*s?>>ZgXk1}MR~dn7EUZ+V2hH%;P7aFg1{vu=}iQ*xUsM- z0_`Pr&y9`_6R1os&__y<;Ua^Wz2m>qCEHf{?i<@V{5-y8wjB!`8$T92vMa@F%pFI5 sN@%ACx4D;V^OPRhT`4Jz4aiw^LY~}|N=K(mNR<9Gr+r=O&20+)7lLcS`v3p{ diff --git a/backend/app/services/__pycache__/focus_group_service.cpython-313.pyc b/backend/app/services/__pycache__/focus_group_service.cpython-313.pyc index 031c9b26c4feb847b195e1b68545d221e3259e64..f0f86c9f1c0e1a715d92c56445b07150d5bda5a7 100644 GIT binary patch delta 7994 zcmcIp3s79wdA|4VE-d@vC196b;4TX+uZ4x>A&@{`!2)aX5|_(ENLnv&7gk!`Mf=cW zC422O58HKX*~d<>Ye&d!YGs_%Xx!9t(~Q-rlc>`sb15VcqRD9N)Sb+9QWPnQo#{;b zpSybj)!^8j_Kx`PdHm=9zyERmbN1@Z;18cCb$7K|6#>tW+n=9(YT%l#pHk)GK0J3L z$VU~)3kfD2eT6EmOFNpPfMG^+RCP4vsJel|y@o7Cn@^mOpCB9Y8hAn)Mi zGIiCK76_d3oC;2Jf%TLS7m0@WDP@9Dq*|ad_`7Q_Acz;yb7~rWPu76Ua=lE+q@ewB zbGl*zD-s`8$)uuy+#FXvFqUQmjz%)U(?})Wym}%v(E`j5%1GIfUo-X;tFploRxMHu zrZ(^nuO0iI4S@1$(64H3B?zUr4}_|D9r~rbB|SY%)e>PUo9M|Rh~R&rjdT~?S|2^6UH2nn3I&4#qU823d=6*RZ2dGPp>8TT%=EJljX5_Xe{-ZA+J2C-D@C- zi5v+E%>FpFMVYq`2D~N$2V0g8gZ0W+$y_8TtAPHevH)m)nhj`ATC+Dt@}Y-hDp(oN zN;VB>6{`YT&8mUgSPjq`RtL0}%>Zg=GlABzSwQRAY@iNy4^RV}3$$TEy$LB7-A*ge z=5A?WbCF7A$;-_qM)Eh~S`ER^XPVi3)Tt^Z^U(>F1L)UPd4Te7R2HD?Dl>XQLnEWQ zT4rP#(BtYlStn~mkEt7>--Y{%Zq~^3h%;`Op*4-95shffYU5_gnox$a2wl-ULYfez z-MfcPZ6hULPD5VP1jC>Wwaq%b-2@4|j$l}aOzP1DnDU6$7RRO(Y?@LArWCLRLsrQJ zTW@Bsw04*IebPKLQbP?=eE>}jn8Flapd%cVGz%z4S(6y$;{-vmCS=#;Xh)@KzA!Oj z8)FMMEiYn=nDN#zNDSD@Y$0<5Z$7?=HL-=|+bWoXOMZM_ElKxZb8La%~6 zhAG{_8h13QfzgRN&=YDq4FTDasgWs`nCc66X6a(|5{o_kxMT`gYT=6!onE9&>4^hi zOCiqc_#>B7Gi%~Y*i#to$}P zWs==sP;k2(whU@;L7kPg?&#e)Y2Btj_kee;%xTn~VXm_dRP3@Y^oe!ZcpbWwVR2wx zEfV^zH?zwc#=?ZrLm5S+6f5F zBFh**yKSnLt%W=q2PQjf-%-#x2{>~eZ+KkS`tkv86_YMzO%+=`)UoA4sm0dpC@scZ zh)cM3QFxJgRN?@?KPD%bIIb?t<2Bn#R^LQ2!FN{k#5NP_*gDbpOfa&Ztsjc-R7*eU z6aN3pCs24Ed>C+wWHDsX7Xaf<5Fg-j$o|*fi^CbvHz54IvcC86~iw9s>@#fC5KaIk+F zBJ~xd(^l;*V5^}0iryL4t1JMLqE$w-)PrOjsp5B_Aa7k&wR!gJc`GW)z z#U-PWw~NK+kJ(1pdB6(7pJDCHpTG$WZHF8mtW|#sBNvk++qVmxG1w~DwZ-DG4M!5n z$SKTcp4|oaC9o|I8FR7&%yYY#|NH|*eCwdx57ptb9+YsuVJ)np6|Ul5I)RB|5VGg& zsb*e~yugtI-)5_J0xGUMpI8@XUKAto)twl@S?mLm*n->pIp8*JgKLKx4X#f-Lk0pB zt;Ee1OME!j z`DXNZZXv}sV}RYw(iBHxGvI=o?gRR1Ei*9zSER&~N_YnWxE@4W^YmD}B#(wuma!bl z;0-WWBr9PJ=yq=Hgx;y|R`uV2%OtdXq>pHm6%js3cmAgC0v`c-;Md5e9=JX7dd9QO zEWM;F>2}d9(eIg?e&@)9DzuoF*W4wE+j@fmtSI>MrwC5OGeetWac`}ZTFe4ms4UDC zIj$;khYY*5U{gO|T!e4V*le9;Zr zACivEZxF5Yz+A*1e6m_+ z^Le9z2wgtIo$~X3TYXKVZ7vk7Kpwi9Y(~$}-!3q+!;Ugxlj?sOew zyJ?s}d(DCPx@=}H62+lYsWvXZd{z3RJBHlD?ha=!-8C>ocMlHJeFL4YUWT^OLoR10 zJ>27F=q~pVGfYcM@LLrt86RM2=RszmmmPNXj?;ZCu(df84F?HY4-48vfooQ8&b z#2p`YyBK=ZJ={Y_&d+ge)~OH&Zac$yLfjcYch;(k?Q=OhdT8$yjQS(z=~K~ggbr~& zF2wOu96iwQqJus1xULRICzAu=n2c_x*V9f%xiDr3$JBJW)TxNo;$#xN22KO- zh)x@+!=7<6fYL`+BHrz2rwD;>of=lxfop+}uV{qFwmR=Piko+vh0jG~W2h4bOpY<9H1{>JJ3KvPkGWErygk!|@Q}5YExLfPcy#p|^{!i9PgbLP65$ zs6WI_W9ix`{;>M~%M1T;{aKnuGD~Y!6h~4T*%BmSng(4{kZl1jBI0vw$5#_G?6e}t z2hP*6k_R+rMe!%z_h0!E-5m_#5>(%bP8*GA!t&Q>PswZW8}#jx?^@PX;fOaB31hoM za26Bm84?grG9A&2rA?VB-nluBpI%Sn_~^*hB8{s@>yrFQY1N~Lm44uv;cdsY0 zd)IX$w@2EiXpi;C*m}N{L&+NEN!Bh%?NASfg!4Fr&$@M`RMtX=aaXmq7ehnhytMn) zNk4kUS|HyGqv-FgHY8Zp=-1YFl|M@-h{uV0```Lb`TG>rMZPs(^))KXzGzsj8xz{c z1pBz4KeD2kKxH*|;`dSrZT7Q=o;oDtH?3&)-qK{@&V2R4qpQ}vOV+*DO*f*;);^)E zU(gS%Xa*$)+g0sqdCO9H%XQn$%;oY!g0)xB_pNC9lMF(B?V@(o?p(4vg@dEQxM$h^ zh*0Yl^ph)^sb40v2>N+{V5gT4bHbo+gCJ(eK?+_~hp9URVK_`B z*=CpY{(0TcOB?20Yo^LYYO(R{mTN87kK8mYI~bvUSQs7=YT~0yrqP%C@5qR<#@kqU z$9o+&)0aEPgpP5Ld4yy|(IcYh5lQsal71SrRPMdrv{dPwPrs!vysUmnEtI+c*>W?u z{P1zX?GZe@P!e3x&w;Z|Wvj-fe=#<#87tT5s>h^79 z5w%Tkp8V!Xh+)=pP49yG7W%;Mhzr%uwd$_b>b|AwzO{DOyC>f{dDAK|N0-}=32n!* z#L2+wh*Zyv5ZC}T```_7rGfiMT%ljS?yqqw} z3HyA4pI_R?1DXM{2GH1Q0ZropKvTExZQV7U=K6)32bb*w3+|scw4vYIP5(E5x~Rh< zuA$G4>mJ~0zh|%!j`lkSqPpSULnKjPxqRrQLqg@aaAa!r$XQ|LtT28~IQOVf{@98s ze#=yhY;`s94~trE(Pgizuc(FUffai2mSexrHu_V?*p)*I&V_TgN-AGJbmh=u@#5jd z)7O|q*LCBKv77!S*O<^bF4&K(luSr0H8=D(E0&zY!b7ZJANgs?=p6;oFivi$2)gk) zxt!3WyP^~7_?2J?93LS&s5pdU4x$3xU?M6mY6SP}qtrcuFpp6fow%ywhI_TsD;)L; z9h1N?MGlL6tjIS)-A^G(Y`Ao|mg-zLxYfGerMh0>@R%^+TR!Z=Ap5WM!@8y^yr7h$ zep%@dn&M}cE6)if=RUe^Zu-0I>z?J7zGZXYrp|7m=a|ra9F}=VH(vKJ)rYnAQ^#;3 zJxm?PJvZgSFAwDt5zUB*W0BS5D~bHhgllP~S*-m1wp8tg@b{Jq*$-(TJm&8kD1F9hc(YhZ6n| zlp)ffdoRZjY0-VZ*br&g{lIL9%H%&x?aYlTiGM0|*1%`dA88zCN>x8P&{YVXl>*zD zO4UzPoh8s&mv`CE8>!ok2P@CkQXg0jD&Y06)dwkf{agLRG`xP3QwsFAO4XTS*>AI) ziZcbW`vr3OR49Ihf6L7H#OK2Up;GAeqmLQ}Q)ZwQVo`r% zKKTOjHyYz#g#qv+j3P|n+)5Dq-+JMffP9(wncQ|;kqOyuFs>EQYev&rdG(sbdMEQy zxuRk%zhFa#8@Khw4Fzt%8Dc8hNEMq(B0F~@O>C-&T;qmXY-)&H!-iIDx^;xXypa8p zb|YQvXApZ#^BvE%ZHU659;tLsPF-?5Ir~)My==^JS4N~{-KB6dv><`4$Pc}OTARL= z62K#2^zTiklzH4_kgnO3k8MmaV;k3%`{Ax04RGzDH&AEu(R8PRtoRLqsmS!-6tF^u delta 3984 zcma)9eQaCR6~FI2zu0;HO5!+<No~jZc+Q?3 zVAioMbRsioAS7tZq%B>t4{6f2bD#4( z7h1L_<=k`6Irn$ZIrp48I1yh&mDMjc4FXV(?M3Kr*rtWW=WcLv!aPS z!M1e>$E%L(dsrS6JvE}C3C(Hdn7CqykZcf*vN6N?&E#G7`|c_^Ralm#8SRdm4o3Ln z;BRZmN?zuU+O^YVt;kPPSmnc7;?>xQPSeO}$=$&9YYax+P5MVcIt$WItcvN6J%X!) zfP)2v>M0FEe3IeV*&uiz30Nx%gM$bqClM0$l9BvVGhjC5*)Ynp7PP+(q1>Mcqiyfc zvyv&!l$?sQrBO1A1_^?fYDJS&Cz>V8q2~awrVLmMfNT6M0lRJkSOj7k_>Xsnww*j#Nh;;{~PO^|%-gk?jI<)nYDU2j532TSB2HZe$+WVOXa#3sJ8m4UI zk9-qhbWV`Cb$+0C>b}cZ$y%dl*R;Nr0LZLWO^OMLE?i|oF^wwmfR;q7gRm%3-IuIa zpwaBe(`=6xRan#&tkr*aFm!tw4J!Jt2Ru zb{fn6BpBG;EBI_y3p!#ipJ*4Hx?SwUcJioTB}+mLL%EpUu6lQf5qIB&dQtE}1UCdP z(?p_1H|f@Q0hiFnxh64AlKLn=j+?}Nl;b8aq|87ycPX0Bg605l7OP*)m^g`>)B+;4 zdM`O|cz|&byRpB$a$D6MNUIp*)R~gfpBaNz8dP&RsCEdd88<5-)tCf^at;0JBJrLO zdzhWQJxIjZF$C@`%)Mky+sR@#v6=(SeK7Hpk4*Z2=##wD(Q-!2m>11- zy^3x@6Wo62NU6m|B1Vtze%u0iIDz?_%WJw@g_!CgtMyjB18c;D_`m=s`RMi?$%>5n z)PMl#!J9JbBd^yv`BvOI)kj0O�D=G386b6^L8Klf-QCYFiKaRZCmy6P6ZgNs<ONrM?n#eOO&TuBmybj8V?SJmUxz(*;a!S$ zu0k8Y0noZZ+l9NRHZZUHB`(ksISJlPHi0*taLh)q>zwqKig5>Ru>viKgMbECvJ}Fh z|Gii5|Gn4b?$VxuW=$Cqxi>T{K) zb*Kk--pXze-j!rq3CSxfUgU3O2VRIVp0NBi;sL~hQ zmS;Vv6^Rey4%+{c2jXzC*h7+TYuKYMle{j3TQE;uJP8l<1UCsaEgEnOoEe- znATw1mlT&y;V^8qTA8fredWH~Py4bjtfG4;-r>?Yh^J{ki;qr+Rcq{3?P#A%5i;s_ zGZE@vG@@!!3=M<6dugDz=g6qb%GdzGC5RsSE{R@jBdZ{6q{1q(6*o@#lsE3DW>d(G z;7+oQ+9s+FzE|SXOd1VyZj@Fxw3jz*CT6$QX%mlExNcJ&+{rCzyU;Ok`fBAZUkCi978 zKA$S&2R$-yR(U1}kp0ugj2S~2d3q?6e+$cD*Dz)s!_ylBwpmmkchW(wJylqZp3oEacL2_9fqOvD%-;cQ`+40rdE$GY2?C^_5h zBUid>R_XgK@1i6?3H*#eMU$LbOlGC5lt~n_iz%5tVMV@>TguMJA!o zS4Bb5Cl<2#f=n;xqB)(LS$5 z6w8pm#qJHsxqs*yd1ZI|&>_a?ey6748U54xORl}I^}Xi55WO&cVe(S* zeOGFxx2sTd`&*9Q%Z}a+hj+sh*l@Sr&}y3Np3-d_$iIhQfxdlp&*7Sm=$TV%r(T+S zt!2Gq{Mr3m#5)pqT<#pc!K3KVrhvk|FV4R(e?EAjZasA1dHvhurIDEJa@Xh$Z|~17=M(D#lk48eos}=SE`0`H8aV=XM`6`ALVMY9x@sSb*)2Ld zQi3{4hokHX7^+buK`p%xkmMad)-AHAF}f+U#5ERY6IBF{J*t$p;;|=P0Is+&0L@D=dbxjg=~z!9@GHx^%xJL>-`+% zhlIH}{}JCd7vVpO@W8)-{F>{uSu<(n`*1{VrNwk=-(fHOa76L}AVogCkV_V1`ah%$ zF9njTDfue-^FGJw*MNnz!u%_gm{np0CQp@*q2FtQ@A0)z7k0;n)3f1d-stSQVP4^Q z|3;H@lcUUgjgC#8GEfQ4?oF-2>X4;jvsz&V)Zp0EE35%E*f)&|YeM!u@AH;#8#fiS z%^D<_9-nzC_W0}*uI*ZCvc;jQx-FKnGW>EX`R8wvzdb}!~mE-$3^ V$loFF>_2Wk#WDWBAW9XZ{{VOGJ0}1D diff --git a/backend/app/services/__pycache__/image_description_service.cpython-313.pyc b/backend/app/services/__pycache__/image_description_service.cpython-313.pyc index 2c442fe20bbc00eb489a8664c360079c9c87cc20..b8e13a7f4f9c1ea7b9518610346df1a04568a94b 100644 GIT binary patch delta 2759 zcmaJ?T}&g_6~5!~*m!L0@jn>+Z?A12-m->;UD#}ZHGd}1Wp)x&1Fo^hV67SG7}Q;= z%KcHIrpm*%H))fHYNNiCK2%AIDv_sdTA?-FjdZuW>N;*zt<(?g6S{nE{g4GFhyr*HD55xDA9aC10 zX4@{v1$De07XY?B?rxwsb;Dl^SR1Eib!>+mV7W6wH7qW`sporPuhIrDwY*K7gMV-7 zAnb62wm_$9h;Y;;8h%X`Bi@J4C|&1RC#S(d)Lbj3t_US)o6@^EE!KJ>WK#kyY^R+n z9qZ)?Z1dreR?Z){KP^+&z+!7_L@6*$@y>9J7DQwXgbT!RyK0AH8d_dzk8VT)GCjVL+Rjgi8{3;@RW7%lSl>wVxz$Yd{P}W74n10rx=dHq2_d<@H>UkI zLD=A3-8aK!OLB8FTs7sx87WX=Rf;4^?Jd)ptdLHu+)QNCWpb6@f|JZyLJw~+7u&qp zUIVF{-8^uQxvG?kcez}!MZc)ZkpO%HR2-y)3xS@5C_>eK9w&~)oDe;l58BX)c4&AHv!qt3zNwOgu>B*c~9Ij)pC+$DGS zTbh!~TXF_JR#8sFE%hfF_&38a(GP>hl)MX=yfA6(g6|stRha4lzX^|+C&J)B?whoM zgV3maiUfDV^rV%%J7}9UkVON9<)W3u*rJV|0%Xx=og5;ILll+|fuuhq>8TKT*lL~f zk%vA?l0#K}4?T01JUnlm=^}rt9chiZW%oJ=th(o>X9Co{p6-De4|U%|;miF1iBb2v zC~Pk4H^l5}R!HU&U)kpKTiFdk9ED5f_QJnq0K5(yfF)R23 zbAXkxRCV?h&7;}mujFK>V>oi2swaV;QJMnLm^wkuws3Mhv#JQm(wq!S>Im5MN6 z>*uuEs#fuGA!I}gmM;XE73jl26K5f2&D_1u9bIccB z#`+fg#TyIt4mCDW8hbsDFW9a=#y6yeR~Az9EsfhTXU%v6DVjQI;S{)&*8lD{+a@So zU{0n6cYzh0mwN?56a2Ty*Wof`J`PAQX&;dxqSXm%2hb)MBse8EjZQhmD>cji=ej1h=wV zIX=CZ?~Vr+JxiB&^flfL(glTFb}$glD@T${e&*yRUsmM#q?lSO(^C_(bMw)$5jI*T^V=(BW!+iq!*H=5 zlaNN7mSj8#Kpd6G942L^7Ac*`WOF>;{d`$ltuaxrF<;j6!dg;D@x$q-Yp86j>!jKe z_y>{8^69d&?ow7aRW3d!rJ8_a9owcn7W2~Ah1b39qRRgVjrk*Z*byzX0GH?X%{OoE zIvzR)k*2dk1G5!b1IQBG)gXQUzW30+-A%U?!QNyMz20ytrpQnaDA zAhL#b?MOecAHCCk$6j1P7p@{^zGBrlwBMPnbOQG|q_LMg0iEZ-W44n4|)kn z9-yMb@H2a_S{grbQX+BK=Qy)|9g8o659BjXD1Ak?Ku`m_Yz0XCjXRpoJl^6!sTfW*<&Yjq)&sSDSIqpGRuc_bSr;Cl`e(F1?)*dzMjcbx$u1ApO+ Q>3A98{|At$Xu{?E2e(am%_M=ZYvk*h9L0qX=kUbVP!+`13o|#l3BN8 z#wA-qa*R=9vc(s96NARS4IPti#N_N^)*%mzF-!ER6JLDNa|(q<_uxss|NnRX=YKut z|NlPkzIxoSt=DS+ULDsK&$l?fGJL~QU}cScM(bi8A}4F83Vx}u^e9ETmJ%#NNh>3% zV${wV0D?8<%wtj2v@16N!6vGNBB7K87?%aP{0Y3Nw82kQ-%?EEln*j_mpl-)@Pfvn)(K9L!e=h*s^k^H z9jn~SOqW;2$NHdB(ib@NhOY#7uj3`n)tj2}P1Ftb-^gui1 zgKqOETLH{&c-njrer^6M8EFHzUI<%WYzMblPmdqm4up#%Ch$YMrpL>yE6RF!W}W8< z_A*#^-LHulnDqv0M9rkt9L8w_k*7_XNHdczw?-P6bOT3lb57o-=?yV=SZi+!bEhJ# zKUquP4NzEgw^q~J#NF*_ZSJk(HtIOM*=S<0)x@ipu%HAZB=eTIg&S$A^3xo8mxjKJoah%0>Yg6C6+^z(J1MiMC=#7(Nq^@TFX zNX#x)i8Ow6R$@gkRG164Na7Df8=Gjt0g$+YU}}-W!8HF(NaQ@YVFjj_mK1_67fu&s zc9DK3SR*YM@`>!C-8Aq?(Vk6m2ksd~O}J@|ITuVLUCT;J5ho=o4}eG`0P{G_=_}F8 zq}H<-_vru-xqsJ03W;8MZb>Flh5Z-r7nT&b{dvX1#m&+@@Bl5qm`w8ll8Ru)msfZ* zmVF15fgx zwZOWt?Sg789gza|v0(=Zp^?uDF`yWFK*$loQjF@zKO4 zEhpr9;uIw%v76b5oES^U37q7nX-}5VRz5+j zRl7#Bo7$<#v&4msWV5N267S?4%55arad@F}-ZY8fER8F~f2y)WYVQ_Q*t?SoV6;Cd zYIx$Uy74ZmI=mc5?iOU^Gd};49r;^QY$}%OL*A3f=z8L5dgKY+^MugR{s*2>WOV*Y zesb+7)SsS10|E*SqjnLAQB-p3q4Bkh)sKw+Z3QruWmUjd`mr6^{7V$F99)Vo8&K`B z)ZA)say5ji2a$OwV|CmxAV=-e46@WOM^h3C^`(c=(CcXM4HO(f<}?38!{SE1=H=Pc zkyH)xMv(bLR?SruFRHQz;604<{kg8?p1FFlH)D1EWNpq=haPoQci*e-UY&SQJ%Vh3 zEn6kxBkA(Ao>Xz_O*AouCa2J;X%wA7Gjqs3|Iqe!#!+|QR`*N|>RYj2e=GdmQLor3 z7CQN3jpV^Eg#(=};JfND!0h`vvbj}ONob3vtA<&l`7S@R=AsDpb6qv?1HN8MnnVs0 zG62{3s$>Gg_rYWKr6-&zOAk_9^OBGSgs-}Hc-p<4+ix>KQM{v)9iwx&ne(PPvj8(R zIK0D0$9DLHv`yqWqiq@^*-V03F$q{?GE#B?6FB8urs^T@@=-AuarG9xOjF)J0HHa9 Fe*mmp^kV=3 diff --git a/backend/app/services/__pycache__/key_theme_service.cpython-313.pyc b/backend/app/services/__pycache__/key_theme_service.cpython-313.pyc index 06acdb4236b8c00089ea78212128dea52f04c23a..569129316f916f4eec5c500fad8b8ec12c1d901f 100644 GIT binary patch delta 4450 zcmb6cTX0*&b@x8?mi4wROIB>hl9JetUj!$ygX6qoC9!WV30R3yXUO2bTFAMM#I%P+!AyE8hw zd-lBc?0H*{LQ|fIKIUl(A(6!M)Gah$@IyTmT66AH1fz~ z+m2lNbXL;~`L=12o6^#-$ZOdXnUtQ^+VW@g!bz<#nQqDF(vw=@OxuZ6`jn=Rwb37N z%8ZMtfN|$AM(7(Ti3nB@;S@}Gg(E^z45KhoJc^K%6fr3)Qqq)^L|{GCHl#@15D9E(xGeXWJW`1gq>7bO2U1Kb0_j2p6G3fAmlU%qYys}nZiG}pF|)X+ zXiD`i;XG(h7ecyBACwx~<%$g5q?#6~!AYt#>|?g99IA<4k-BA3l~iH4p5FF&j@cDQ zH{6&F6|0=$>=B#L8Z_cB;}DWjst)v-M`|h<#iGh^3#)2gd5e0a*mQHhIq^6|xv`>0 zNdZW_sHl@ECOCcpUZe^=KT&U8$$&Yw}NHi;ucFa&WpZnbT95$lzci zVmx%Dkc*toYmxCBq1XL~=@rvU8(eCBQlD6&*&O*-^_VuEI-My*ViQ_+QlD(;Xzgx+ zRFBgk^Q(5TXv%8&d}>0=lLl(H)N&+Dn=HSGS_oVikq`r607WU2o0!l@(K-$VBR@Jp za;K+BGv%ypBC9kJ+HFmko`u(c9DNp}Plsyg_pH9~yvgx3>jmqaKl-xyR_x$h_rba7 zp*io+N2cMD&_G|e{>e38+gP$9?*J|#$?E_>U$$+;)%0Uqd}aV7zge~2zOwi

4-u$@%cEym%r4OStQ8z&oZA7w60!1a`%>SV>h*f+wy zZrOf4q^eU1vX_Lpj?GG_mD8(~aG5IgdnimxiRM(o^xw|4^)8?eGioRyuYdvWWi;*) zFEhYmD69p+Zknpvj~T2xS-Ftz88JF5h(N<&#p;xSa*iOi+nbq=75fsBXoqGzd^SmB!A+atge!B4kAo(4v9|SdbqS z+fZe#I_|2wYDxEQoPfI+62xJ7$w>M~mw9i~vWIn4c))_ScMpW+MO}5|xd>`nkW9bp z_IWlMLD)XBSejJ}?RT&7bQt)~Rd_GG;P&w{_yu_F^0HGIN~f3h`s{YoDr`VB>vF$L z?Vivgr)?EYnbW=sTj6}x6LQI_tXo!`zw24cd&@6WvpgZ1S5Sq#fzGJvH6mAnsEn1@ zsbdHo{TZYsM9*e7w76|>7FVq;Phh=ZX8ueGkQZ^3KyIiC$P9|pD<(w5o}G``K12v}%*@<^b9 zQMy)13wT!X$GcOvWUs2Cze;gRb zjn2)Hfm9|_A&;GPtn7AY{c&1V^!p=A9=Y}4YuM) zJKxkc-`qLhxZ$>04ErzcDmmyAVb8!DM}Galt;E#agHv;Zr$9mm?_nbLa)V4>f>XFV zYIO6qwpBs^cbM-soW4{EOcUn9E-xUU|FumvGfcQQ4R)Ft2EQ2oo{pzkk8-L9v!upzv2mCd! zB@y7Sg}V}N{<>R)_4NS5U$3nn48`~xF>$D6_QQr50k5S>^ne5{50TyUhtVkNEr8P@}GR zBOavP@lJemb~64SjK^jt*WVPJ=M1*|w3a%h5t5_(Hg2tjdWHx)Ap04BW`;-~13CKQ z#((0y^xN$Tshk`1)Ar!r1Uoy-z!3&m29N^`81|dV7+ZHSpaCcbviXV8$+6MtRH2{| zee?triBno3PtMb!j*c3Z7J24~NM(>}#;eljI@+;!_O~7N9M)$4+I3E<%CUpB3@~%g z#_5K>8v6Au9x2Ok8T!hWBls&+++p+j5UMgy*Y+C7vxl@zs_@wt#bQ-Q|Hxy(NR7WI`6llVcY92OIJ-tE6wxIFNp=klIQ@?$sL%_aUEO%3=D8>gTo7%s`> zwF&uyC3AUgsVFZ?DcL@!-EI&rs4p`;MqeLz%lZJjy76dVr5AQQkK1T;XB59e5AN)D OCM4|p8)A^KF8E(sR*D+{ delta 3636 zcmb7GYiv`=6`t{Z*uM6?e%m;X?VE=a@*;#JWr2`jNFXc;$@=z|u99wK5+@`CJ4^x# zi?%6?wB6nQSkOpaspif>f2NYR_E9 zi4)Nuy^=qld*+)nXXZTaT)Bj=d;=>_Wm!V-Jb(1{V;6d_D<7C}1$}DLBnQ*N^R$Bw za>04ct#QMm#t)k{Vc0Tk9TtbhHj@AZ_G=S0u?$V|Q@EYYfrm)LLIlAq^9tLx#?~w^ z(1FGOXc24T zgdIE9O>k*W;+}BTdFV&{5sHOKR3xdnQzSiVDx8Rc7C;VuPje>vc>4})qStr&>9+(w z{j1Ov;&g8F3VBRHXh>dpK^jL}#9bV(^E4v{WWF62Mp9S@3xY2w47rM2eRWhpnn-Vm zo_07Yo!bS3Yw`}h8dabnf6+fPN|wVKmZ4x#qgiwje6{Kp z1+}hvuc9c@q_ib&>7Pd{(l{PRySXSD$1k*KoR^!K)s&%%qIumy&wIW86fRg>vr*?r zCTPm?Gy3ywPC8;;qGQreWIks(k(!-NPNZguN~5+i+G+bmrImosh=c)h;&f(WB1Lkx z@yzI{*^vp7IWlTVb3g?ERK=5TLK2XVvtN(IEYm-N)s5C@cG8C2vLEeK?N< zuL3~-ByYuj>Q(Aa?1iZdd*vP;-NakEL#CU}4ItkNNj+G&6?1iW2)DiNO!~jNlfZ}5Z!N|SWERcKKjcj7s_b;WIzUrtmb33@S z02#Kt(?=gSTj>uR4%t!?e`CaFEoxMx+0z!yoVLOo$idw*i=U>na%+sCP;qg6)shDt zz`Z|$43Kn5b2I@VZ7W!CICUFXa2a;otpYvgY?2|bbhG9G-|Piee<{m5#E#r}bbE1K zu;FVp7vEIWjMB1hH`av|PM4;JLR(x_1Abj$)iDNH+g}CA6DWCafLvEJKdTt{53ql2 z(-u?Op#=-9j!W@oP`akum+1aj?!gkAgq?g zTbE}|Dym*#B|OX%Yl9Kb#vvbVvG}Ou^;??^&6X8Sr#B*q;J3k+g&`j}V?4SDg$=avXTb!HRqj;xC8wt+(-Uf6U%xt@ zA?n<*)QOZjkxHjXa&9t{uH)!XsNDR9x|31p`=MQ89Kuib(roCA+ohgPPEU>{=Tc*Z znX?PY@=hGBVHB3Ognjr3s|*6^iAWhhE<)AD2z?ax;ug9be$Ua!l;+oyBn_UBt@OP} zxPf(^I^TwdX>@q9jTwUIAhMmo9{MoyAAbanH!UDuj^dh+AY$8xqO^o(G&C4>nQCWV-gKl)jg+USB zpO#0eD-M4mr8ofwn_7?v70W`HqtV z{T+|g=jZN(+xlGGU6%mzT|d*`4N8NY&~mqGuQbpp+-ov}?p|A*y?oXwz)+TBw5%u% zHgZ{KV6c|U)(V4-3m?Vid0a*7>JN*oqmpj=X8jb7(ZAGJ?qKC~xXw(rvH>HY{8VN# zP1py3usbY)D-$9u0PDj__cbK&H2r2nb^CF~IKd#zAOnyy&ydXc3mQ<=Hc$Xx2ooNovBVRz z6C;yjaAAXggZnL>oP%WYS=tJ+mMvft8e=)is`k~bG*3-X8Z1ruOyCf_#7zPuK%5JJBnaO3B~lV8@xElNR)$T^+6&CTNxl=tntpN;$eHL^}H=C39sZWf(oxJ<{1f(Rr$W zVzB%C@|)4im5buSrOI<>h6X2xuUx+NbR;@3(>p&g+}X0U*xxugbETm%cD7ciJAI;V zaDJ};g~`xTU299{=+&j}-mCSK%@b2|i=n=dIC!e@n$YyZ(CPZFxeJ$j2Il%NFDxuy z=xG^zzNN8g_RJ|^ex+Wxbm4q&^T`v@OG9Vo_|YpvqbDv7otX%6Jp;YmrG-nO6AgoB z&vczUT|0B7bNNcs`KOwjhC4qt%n0+dk=e?+sz!7-rA(Jo$_40Kcs9t028hP8YGyH3 z*-%wGnGQ{w(wV{sHcGn1RMCFvZRYc|MS4aS_2xmFh{O;7N7X=nk@{U59i&Nm zBr6;_2gCRpHBN~%M~Mtai!zQ8<>Ly@%E`x-<0=J+a*A^sY~)pbR*Q@BdR|o zl_S-(TUJ0+bx2eTqNs%7)Y!7CLN~5(Q|W)4jmsHVahh>Grv<|XVtCI5-2rD{)*P~6 z1PcauUopO78qXb9jpsEmsAAkao`=8b61WCaY@Y*`|Ca;%^f%}@(?M6HFDW!DZt7>~ zk9oht#918&bN)cE3$l)Kg(OaS(6RL3JSk!;&|?yC9cMnI$a+YT1r+V;4+;B|RPJfa zKcvyd6^Mm1vYvYPUjmo4@l@>VAUIuSQy+B^3b_yt)FKMlN^O;w44~?Fr(VsB-Zx5}PZWxcm)kny> zy>~+yq%9&Y>L5)VisCK+9!OiNBDzKTZ*CDvj= zKMfmB^x}jlgrf@)vPp=I(j8+<;Sp@6g(!>>^a`JJ&m0nKa!6)VDcyaq-Si!XsZdIH zl|_=n>|}Y_rv?{aCr?B@rk0LWxTKf8IaQIIF@3gyS2kugFEiCk_g#m1py4%~tP%tw zT3!({N?~(;r`7=Tm{$T-@;N|N^{VW9ENmQn4ySHAM^WJ~QB*Y*(ed)^EDKvGir0m5 zL5n#*hnI7jDrWD^Y)h?{rw+BKc^yx4x++;j&ojH)

$TlG6t$si>W0LIrpf(l$8t z@{NHSir1f{o9KvvH-zkHP(^mHkdsKc3H3_r?RHbdIC^&sw_@^y{L0`u zbPXNJ-DecmBG2%-oJmTU%`#J{7=i)H9t zK6;mn-f@;zCSn+^;!zKn)l*M?!*S@1eePD`dk#Z3j1eOYn4#_0ApBPFR1vC1{{s2^ z?x5Anv$8D38>0+M6;WDP{2<$bvN=U$Xp6_{r7QXQ(kI7s`eWH%a3!SHUtW`~QBmQ4 zhslx0=S5Uw_1RiJFKZ*zh%r`1%%Hv*)fX1*xx!iZzalMmS_K<##_2xghP|>d!`pzj zXLvX}IY)-q0q@N4Fu6Hbnh#IHy!b7cwScnPKt2rab8cQ!31b|wkdP#5Emgb)#*5{( z>FEtTnbP&UO8~aRmTZ4QZHT3$7i)9%d7XK^%rNZb*?1LuNxXdZvTUDO%0qEXBrW;H zJxRU)KzAS2I$R*b!crS92N%g3)ATgeA@fkvbg=Z^=dAxm({<8vVdcuQid~A%MrPQL zb9Q%L(FFdbl+kO^m@t2rNy){9IYGp8JSAU>3gTT^NM#D2gRP2FPu@?#M zk))W)oe#e-v9J_dT#8M^7A^~s=(3t4O550FwMN57g(9(yg{^iJ-@&cxE}hDq5h8*Z zj?FGaCMFjm)3Y8AaI6E4f%6InR_u@z&Qd3Wv0%Q~jWv70 zVX@dJ^*f6OMO?!v_3p``3dbPai{MR$nTRaSiyR6mFFzlKGfzB93Zf8Qnv01cRCNYP zm-Hp4Tl&i;yAls3F(Pd_S=BE98|7ru|2SE8+v?38G-g-QT$?c0u9t0?J6=)0Z*{JY zC8c7QZ-pO^KO@A)r{mKL@xsMT-IX2rD6O||nH{SyY?uSv9`E(OzqJ-^+1Ojgo5pq9 z{rN=c=}jBIWpTbfdSi6$%zb5|sCU!Sx1*$dRa-?BTYp7Y5)Q#M~n(&NV@7r<}CtZ~ZSLIqb;i^fxS`x07 zr0aOXbv)_nNw|78Tzxls9;+!=K>Dk}%9Rh5l&u&{76p_3)`Y)xJ6QeJx%>0?C*r4{ zjZX;iXQ$&wX5wuZ6YT7cjB&XiE2-*+uU)=-IaxLEZq-1dY9c=TEYO`Cs;F&;QWV*5 zs&`Dg>b9J|hgJ1Yl2;IUtE|Yrs(!4a+@(p^iG=IK{k{#?@bw49e0=CIYz-+CKmoq+noxanjOK;Dp=(jneg^f_v`Qu4XkXpD3$C68TO6oRUsY*%~7&xo z@(Asaez&}Yc{67Zs>pvjR59)zT9F*sc=dRacx7Wout6T4&ThW2k;@4xQPeA>pY!H> zcQ6E+0j|;Ww3+IA z7xWp%3bKBL0Db@nap0jmx_c;R5z7=LjbpB?ET`oSU~Lxx3G|pJ+r}F>T^4sU6ddZh zkQa5zjDSzp+kH2_obS?Sy9_vm!GGBo;4C*twN{I?P@|UKJZdT7c0J*Ym`ebl0RTfV z8k_=LE|m45a*RW99%tq(d@e*W|EvjPQA2YD2T+4-Vx{IUark*@b9lO!V`tVc72{(B1 zgaAldEP4E{3K%RaZw(zs@AU3A*cZaN&>?H+1lAbcyJKeM3n1h;q}EV3_*^74SDICQ~ z7#qp-f(o4?u?u0G9T;ajL8nE4PA&Vq;PE|&C95lv4_H&P4{MTT87O}8QsVOuV9jSR z9ytvJJ2j5=?_$lp<{y(*oOi50E5qBQonw}x0u2z%)@j>=U|#BgA_TfN-UdK-->cbRWENbG z!U_A+S?pY4$zCA1!2Wj#(kf;SuSUWq3G9xbh5-NVg)xD}k>}^BJV8Jb-ko zGDz2z-6yN7c^7oJ2B0q4^?*NES&9%D zyW(0hc6Fb^y=lp&JxP82fzAW&^?(e)y)Qy%4h22f68@I-t5(Oop1NDKq7J+ok&ZQ# z*i7u~JV4meXfT6>MZCrk2c#7((j;KdmFV=++}t&GZXrA+Or;$q_adX@DzuFiF=5KSiM)6U2`)hK zDI~o>QnFBQS61bZ)7VQcCIOh|_k^K)Q*3O3owI}8jMa}ButtFFY1GS0-)I;yokbRh zSUisehPcUWZ$S20Boj!ULlQ=ELF#C%r6;9@#_}|huNJ4UUO@5${4QRBhLmhhh=|iD zGJ{2BI$SAcA)1mehGQ2~O5p{-5z!2gKzyIdxzN-gL?+?t1(FvbJe5*T30M+ERH2A2 zuFTEG(g^{)9mBhli)djM$t5J0k<1~PM}o;u8u{k{my%=p0~x|XkX=H8@Gj_1L!Z~Nf9R@Jm)G$HXQ@XSmBro&fSh}B|MU{9I z5x|vF5{YO^HakBmT~xy1dag5N{of501shr{ZHmT!_Ri3!Cc2OyZ(% zDO(Y%%`Psa@4P^muPQfAjfUFWr1;?NZXyn((wf^wq{21|GCM zsEF5{-SC}@JI_H%;P%}vTbtT+)vqsamDeWAk0i>EyfyGgqu&|bXdm7vA4!(;iE=)E z=9!K1XIFm&C|AGANHiU-a^W>V&Uq)=4ZA5)4#$BvFF^xV?j z)WrkC4=z0zj~74vo^9+=fC|*@R8WxMC=;Gzarg1-y;~N?%IhOHMs9a(T56%^ka$%! z+_xr*`{P9ePe{O&KPd(K88Wa}dv-LGo4wxiqmmVf^A2Muyg)zn7vE`qqxsI!H;%5C zCH)-C<#)^1g^jZI+b6czk~{i0^lOt}yLk8FS1)a{tsmu3z7~j%%YSR==1{!+sd#AI z9DnMWc<|ZxoD+`%i>L1N)wjSwSrAc&91j-O8nnc>6RQ6~ z*#l>sKf8GjCh9XA=bnw9oru>xx8V!No#9V*WGMK_NJfOFh5|c zN0h1`8c#Gs;eo1CJyItBQ)4GRVpIK@$q9u&tLSn=)7whTNWS)MlNx!OW+b3}+lR7m zmuW`Ls<#{LqXyMG1_ki%m}MaIPJsp>`8#ZvkJBjL&B;ev>;k%>Q81iQ`m44|=AtH( zDp~HeANdL+W5P4iKXlZ4KAkqP;4pb0CGp+(b?0$@4>1}!8{`SvNbVTIL-O#Z>={q4 zd$$4J0AS||Nos@_c0q(OJY2m2WN`2#9mu{xE_#ieGm{#b;2d{x+QIyY1weQH7^)x- zzk4+d$r9}9OOS9x3L+W+_HL7p!u=W_0L_|EJ;F<^m2-2RR)BT9Mf$s{e1ONznDI!y zPK$|Sv-Saq<%hKBU%i*}aem&0sT3qDMf;PLVc5O#ZWB^MJy%Rpl0v}0N6?ToaV)0| ztQfcwzK{!KvXN5AMxF$!gBZ23cH%6M&`|=Ij}zKO(vz+%Y$mY#B)X<@k@Td8Nc9mq zi0O$T;vD@9uLp$g;$3NPth;dnFy`AeLy&s)-YB{O9wP4ddxncZWs^x_6Bs z!XQrwa6M#3rwO`8H$4R1R{*+q?6Y;2pnJz|gq<)KT>H@ddF;}O$|ui;F;&(YSH&Cm zr?n7b=KIkddiw;k^*iR!E)63f^6_`(gfb+31EYq+z}{+b06^ zwGnNnwpTV>3nmpIGEl{BWT1{5g85m=;XO%NJL!0*>_qr|0^p4&KBk?&1{MkWO#2zKjId!XdPshHs~_fd{hObOHg{3-}e0otM7XQ%<)_|I*WvlgT!g z-BP5dpfGdi%ZfiMq<*=#K{<(bYNRWU0x90huXLmBLm<)ub-{*1csr$76lWtb@i*}W zydD?tAR$4#iyVSo@wbtzBl$X#Zy;$wg1gqCD|ZCyD`}*j2BkRy++yQ(zK~*O7gDOO zYcV0(Kbn$9!vLMX3K~*sxWvC2o?8;c-$jLAL-Kz`<4;1`Ba5hkKy6GQL~@Y|M?@NV z9|GR#dsSZ=eSa5)4h8OcN!?$r{XJ~?4w5eEXuo&51X%*Y_kj6}Showu#d}ap(X)`S zEKN^C=J73TCV9j`d@cSyHiVFzL9&OTeY+SMaI_3>JHOdKppwB!7kypy@F0c+cOMur{t=+OT%M(zk7QyfU~|=z3+~eFuBnk(9nNSg~@J&UJ5D zJ-1snt>ynnuFiwytNMo})$7{#O4@Jstah$O-!Bf_dHTywe`S2NXUpli)pxV+_L=qW z)xLzYZ4Vyz{5W{L?F=TJH3?_UR%!iqQ7~S4;{MS6qw(?(z}%`8AK=_N_lK0i<$0v1 z0v$U}s1eAC8~95VucmTBf!f-dBeobu*N+YUeYI^wLm_ z>6J^5hmJ5;nR~UvZu-J04fFky&b-lP#SdE4Q1~HZ0Qx76o@1w)nRl8sr&Kv{S_V~d z6`>l&ga9(2Vjfun~K3xT9`aJL_uotzh97Z;{PCDxPm7eJ0=!{x}4b&E?hrI?1xjTj`C zun&=x8BbynzhH<6azr(f&ms8&>@1Y{8nSfGRr0XMTcU+3fwfY?je%2e`vb;5Uzy7U@-*Ml2?v#mMd74q2Pdh=l?fk-3 z|BdrI3Q__`3LHDCG{5IWx~$1MrA?R9P7prhM7sV3ImSdyxxHIOrSRV)?E<4PkbW;P zD+0;C)fbJR?Oy-U2e4Ojs+!S|xl!f^Wjo?T}@K%o;e{`-jp;*dL>SN{C#Y72!`{ zit!!5Jn+p7t}oyN^O7itdaNYJjvu)qB;=IKLykBsXW1{S8$pHF5Rl^DM91Z`faV-*Cs-njMO&KQH@$qVk@Wy=?evQ^D#>2~*X} tdWc)D7k<=~)w5-^K2pdmOq?=3)-ZI=_1VW1{CuPy($I$gppcR{{VzN|%liNT delta 6719 zcmbuDdvH@%dcg0!($)L@ep!};Y%IU90fR6Q#|DG(3!}@0U?~vAmW{y3-YXLlW;afD z+mxic3FhoB^pDP(?sP)>n0D4PUAASWWOvihl4<3I23N~;*qNQA-M&O&cBf6->Gz#0 z$%1v$>GULg{?79|=R4 zLA|6OG)RU)qht&*0xKwoOoL|0Om%L^B3V*wB7(i;M6^Qzi@*!2E>13x>?t*Q;BoAV zFe$sB-oZjojpXz&5k}DZ7(thEbt%eC-LzB>rG{#E&omb^k~#JvInB*k&YPw)XR^6$ z+vfJJwmE5*ysy~DdWc5(HftuAmHDs{hLTWt;9p(?;tl3+l<}fcBe`f5Y2m#Kn_+U_ zU{Z|43XH@FtfUY)NtxmWm!M3kQfeNW3VceFuz~Va+Nu;(KIWA26x&s1#QXzD_&5gjMT)MF@23$^;Uymc*=wcOc-GRK4nf>QtFg- zD~BVbY$+@Lm2)sP(-RZ0uRnnWF!p&9s4)OjF+VjG$NGc*FJszjrp+?sZB?j4@KB#v zVG**&W$*m*+|aiM!A43d?+Lk&9s1PFk~;JAdpn+5glKF&pBOo~w|_XsN`7#3o&^z-+=SIf*?Q8b-=M;CHNg_L z-LX8OZ&b4lcV+IvNHppGE7b*Y6L|a^4>~ z?BH^SgY9&%LngbM`JcN5p6<4`f`pquXTPDczMK&}VeI}o%-;<&u)e*nKEb^qoNV|WNB){RnmVt+N1f;2qFA@(!?l*iz!QsSEsp5g zpdki^ZGm}H6I1LIvs+QmOtG=>@>t-XS#~4o3AP=R&{ak2ne@viX3x&got-~1KYKcp z%NLbr^BL*9MtCJZpE=VVIOKCT4R} z*=Y%}Ma=bA*ciE1|43zqY|KfnhMXOEs*Ajo&P`{E{AA|Ev(u6nili`>TgoG4aGd!} zZe9wKo#8rb94nRC+|;aupQp5$WW!AX1XRo_!MDWFMM%3)!}ucYCcht!k_TazzsR4N zoy^Qg{aCyOL{TMW@@Hq}rR^jT39?r5lVc9G1jn3_j*{_6NPQaA{3VXO9to*_>JD5< zeoWqvL>9b9?i!Akl-)+(eNW_`r**~CdTsoUCw`GHsTgNuX=h2nHP{N4@Xs}jBe=SI zf1z>5ilh7ID#j6p7NLfF^<69VT@M;su6u5_-K;N+jTe&X!uX4Y?GuGc|&d<%};6!XEUyXTKH~H;Y zoV~sLx3Re5$hvz1eParFw~ykOc`Q(^zkgVd#-5DkGi`(1KQQEa+aA`n{2y(9#IY}t z<&Ku)^aNGMEb6lPY%V{a&P`;B%9(6_o=(50oPT956H|Y_L1_xDA|qsmAfk7x`Y!;%vJv6bfQL%*$N%R=FZ^=iEnqZ zer)CEpR^HTMt+wm$7T$kV}d5Rp<-0jRHg!`i$)m1uns007ym1;Ra~38Nid2WK+-HKsyIYQ_6Q~lNoErZ0oIaeK_r>0^8>V) z5^Y$Ftm{u!v^~MG z9?G#04aMPPJ>}TiPDY>vI7Xs7>UOfD{c>alqy;K&1Ekf1i}W?SucFjaC!t(UqMj`6 z@RD6)fqKNBUep8rYHBOXNNh*^@pf?c4tf%7Yby}!Fq7|%g(n=My-Gc2Sx4%*$~scd zUDlC$p0bYA^U6A<-k-td)>6+W8YuM~GJHD(zvzIy4v0qi6jb-UdQJd(7yxKW?2@79 zsH~;TCw;FT==2Fi8TE8S`NmLt2q_-1B{u>@fz{KN#`;T*hU|ppo>ss&rD0(u?bwn7-64AWN~C^!@Esao4(zA*U|P1E#qn}85pbk@^-_bp-|s_z59A= zp>F@jmVt*}#@|?qFk16F`Zx6j*Nz(-u220*%k{dOS+IInbEtd=x!Tvfu=)RZ`GB=X znwB&djjNWrdzR>mCAxIvuBG*XKXlLEx#I6!b%gIXw!C}#>gjupeLrgKTWLI6=syCo z#4~}-B}NgjUDP}_Fy+gIrh2JFIO-lTEV|Xz zP-xnH{nYi;E!#(X3S)!`94?Qk~p5sNuKnP(~RtxWljDM&2Qx9vp$c-zD3}Vn$2NSb8!v3_m9{ zYI!$=|D6smSx5LamUV>R#3KqKAaX?Ai*vs5`Z7)Sc~H6y-Vy zqcAe9Gj4ifqPC>QBa0a!U4z{<%j0_0K?YEK6qXN%37)@lOI1`nP-=;3HwZ<(ka4Ue^(u@zPe~Sf@^(f&j>RO&1e}UZy5j_~YGIC*L z)!@Bn2(1`GOa8ltwg*1{g`rh%-G#xQ`k~}w@^8sjRl7BKKhQ{ud)r8`f0I?m1e@;F z?OCbYb93NM-N?m#vtzum#3 z9@ib*%zwo7Z8+G*|7EKas(P`2?eRqPSNy9&*9zWBecS?Sa!*;;9B3>8!gVERK}aa$Zx(YvsI-@r0HXi(e|~<-CE> z86O*|{z$>7Y$Z-Ef0bMQEZxE`oMQQ7vL&iLaC)z7SUgtZX%4Kp{3W%luUV4wx{77J zoR=+8y=+M?e~y~fFv0L@vIT8Ti{I(f{~@I*A&-;YnrRitOPfgc&sm* zrs|qynq4zYv$9=Oso6&ysbxr%7}&ynuUNRKYVpo13oL zR(dGtR^tX26=Mg6Y4|8|+1a8xlY1#E&E|@V>CC*O#RgjWSFE#AMhZb*jwnXd=x#rG z0*ablaIro+lX*tc!9$yYFP6!lB7Zj-B-+fDur>Ue@v)L)wHLFG8Tj)H&8UVo{VRi# HuI;}8yuxNI diff --git a/backend/app/services/ai_moderator_service.py b/backend/app/services/ai_moderator_service.py index 32e984b3..752873ca 100644 --- a/backend/app/services/ai_moderator_service.py +++ b/backend/app/services/ai_moderator_service.py @@ -579,10 +579,15 @@ class AIModeratorService: # Load moderator prompt prompt = load_prompt('ai-moderator-system', context) + # Get LLM model for this focus group + focus_group = FocusGroup.find_by_id(focus_group_id) + llm_model = focus_group.get('llm_model') if focus_group else None + # Generate response response = LLMService.generate_content( prompt=prompt, - temperature=0.7 + temperature=0.7, + model_name=llm_model ) return response.strip() @@ -632,9 +637,14 @@ class AIModeratorService: # Try to load and use the moderator prompt prompt = load_prompt('ai-moderator-system', context) + # Get LLM model for this focus group + focus_group = FocusGroup.find_by_id(focus_group_id) + llm_model = focus_group.get('llm_model') if focus_group else None + response = LLMService.generate_content( prompt=prompt, - temperature=0.7 + temperature=0.7, + model_name=llm_model ) return { @@ -738,9 +748,14 @@ class AIModeratorService: # Try to generate with LLM using moderator prompt prompt = load_prompt('ai-moderator-system', context) + # Get LLM model for this focus group + focus_group = FocusGroup.find_by_id(focus_group_id) + llm_model = focus_group.get('llm_model') if focus_group else None + response = LLMService.generate_content( prompt=prompt, - temperature=0.5 # Lower temperature for more consistent, professional responses + temperature=0.5, # Lower temperature for more consistent, professional responses + model_name=llm_model ) return response.strip() diff --git a/backend/app/services/ai_persona_service.py b/backend/app/services/ai_persona_service.py index 5cdaf159..87fa677a 100644 --- a/backend/app/services/ai_persona_service.py +++ b/backend/app/services/ai_persona_service.py @@ -63,7 +63,8 @@ def generate_basic_personas( research_objective: Optional[str] = None, count: int = 5, temperature: float = 0.8, - customer_data_session_id: Optional[str] = None + customer_data_session_id: Optional[str] = None, + llm_model: Optional[str] = None ) -> List[Dict[str, Any]]: """ Generate basic profiles for multiple personas based on a research brief. @@ -74,6 +75,7 @@ def generate_basic_personas( count: Number of basic personas to generate temperature: Controls randomness in generation (0.0 = deterministic, 1.0 = creative) customer_data_session_id: Optional session ID for customer data context + llm_model: Optional LLM model to use for generation Returns: A list of dictionaries containing basic persona data @@ -112,10 +114,14 @@ def generate_basic_personas( except PromptLoaderError as e: raise PersonaGenerationError(f"Error loading system prompt: {str(e)}") + # Log the LLM API call + print(f"๐Ÿค– Backend: Making LLM API call to {llm_model or 'gemini-2.5-pro'} for basic persona generation") + raw_response = LLMService.generate_content( prompt=final_prompt, temperature=temperature, - system_prompt=system_prompt + system_prompt=system_prompt, + model_name=llm_model ) # Try to clean up the response for proper JSON parsing @@ -185,16 +191,18 @@ def generate_persona( prompt_customization: Optional[str] = None, basic_persona: Optional[Dict[str, Any]] = None, temperature: float = 0.7, - customer_data_session_id: Optional[str] = None + customer_data_session_id: Optional[str] = None, + llm_model: Optional[str] = None ) -> Dict[str, Any]: """ - Generate a synthetic persona using the Gemini model. + Generate a synthetic persona using the specified LLM model. Args: prompt_customization: Optional string to customize the generation basic_persona: Optional dictionary containing basic persona data to start with temperature: Controls randomness in generation (0.0 = deterministic, 1.0 = creative) customer_data_session_id: Optional session ID for customer data context + llm_model: Optional LLM model to use for generation Returns: A dictionary containing the generated persona data @@ -242,10 +250,15 @@ def generate_persona( except PromptLoaderError as e: raise PersonaGenerationError(f"Error loading system prompt: {str(e)}") + # Log the LLM API call + persona_name = basic_persona.get('name', 'Unknown') if basic_persona else 'New Persona' + print(f"๐Ÿค– Backend: Making LLM API call to {llm_model or 'gemini-2.5-pro'} for detailed persona generation of '{persona_name}'") + persona_data = LLMService.generate_structured_response( prompt=final_prompt, temperature=temperature, - system_prompt=system_prompt + system_prompt=system_prompt, + model_name=llm_model ) except LLMServiceError as e: @@ -272,7 +285,8 @@ def generate_persona( def generate_persona_summary( persona_data: Dict[str, Any], - temperature: float = 0.7 + temperature: float = 0.7, + llm_model: Optional[str] = None ) -> Dict[str, Any]: """ Generate a concise summary of a persona for display on persona cards. @@ -280,6 +294,7 @@ def generate_persona_summary( Args: persona_data: The complete persona data dictionary temperature: Controls randomness in generation (0.0 = deterministic, 1.0 = creative) + llm_model: Optional LLM model to use for generation Returns: A dictionary containing aiSynthesizedBio, qualitativeAttributes, and topPersonalityTraits @@ -306,10 +321,15 @@ def generate_persona_summary( except PromptLoaderError as e: raise PersonaGenerationError(f"Error loading system prompt: {str(e)}") + # Log the LLM API call + persona_name = persona_data.get('name', 'Unknown') + print(f"๐Ÿค– Backend: Making LLM API call to {llm_model or 'gemini-2.5-pro'} for summary generation of '{persona_name}'") + raw_response = LLMService.generate_content( prompt=final_prompt, temperature=temperature, - system_prompt=system_prompt + system_prompt=system_prompt, + model_name=llm_model ) # Clean up the response for proper JSON parsing @@ -370,7 +390,8 @@ def generate_persona_summary( def generate_persona_download_summary( persona_data: Dict[str, Any], - temperature: float = 0.7 + temperature: float = 0.7, + llm_model: Optional[str] = None ) -> str: """ Generate a comprehensive markdown summary of a persona for download/client review. @@ -378,6 +399,7 @@ def generate_persona_download_summary( Args: persona_data: The complete persona data dictionary temperature: Controls randomness in generation (0.0 = deterministic, 1.0 = creative) + llm_model: Optional LLM model to use for generation Returns: A string containing the markdown-formatted persona summary @@ -404,11 +426,16 @@ def generate_persona_download_summary( except PromptLoaderError as e: raise PersonaGenerationError(f"Error loading system prompt: {str(e)}") + # Log the LLM API call + persona_name = persona_data.get('name', 'Unknown') + print(f"๐Ÿค– Backend: Making LLM API call to {llm_model or 'gemini-2.5-pro'} for download summary of '{persona_name}'") + # Generate the markdown content directly markdown_response = LLMService.generate_content( prompt=final_prompt, temperature=temperature, - system_prompt=system_prompt + system_prompt=system_prompt, + model_name=llm_model ) # Clean up the response if needed diff --git a/backend/app/services/autonomous_conversation_controller.py b/backend/app/services/autonomous_conversation_controller.py index 77a3a334..c7c1fdf5 100644 --- a/backend/app/services/autonomous_conversation_controller.py +++ b/backend/app/services/autonomous_conversation_controller.py @@ -636,6 +636,10 @@ class AutonomousConversationController: # Get discussion guide discussion_guide = focus_group.get('discussionGuide', '') + # Get the LLM model for this focus group + llm_model = focus_group.get('llm_model') + self.logger.info(f"๐Ÿค– Autonomous conversation using model: {llm_model or 'default (gemini-2.5-pro)'} for focus group {self.focus_group_id}") + # Get recent messages messages = FocusGroup.get_messages(self.focus_group_id) recent_messages = messages[-20:] if len(messages) > 20 else messages @@ -647,7 +651,8 @@ class AutonomousConversationController: current_topic=topic, previous_messages=recent_messages, temperature=0.7, - focus_group_id=self.focus_group_id + focus_group_id=self.focus_group_id, + llm_model=llm_model ) except Exception as e: self.logger.error(f"Error in generate_persona_response: {str(e)}") diff --git a/backend/app/services/conversation_decision_service.py b/backend/app/services/conversation_decision_service.py index 0485a242..2bf60859 100644 --- a/backend/app/services/conversation_decision_service.py +++ b/backend/app/services/conversation_decision_service.py @@ -53,11 +53,17 @@ class ConversationDecisionService: print(f"โŒ Error loading {mode} mode prompt: {str(e)}") raise ConversationDecisionError(f"Error loading {mode} mode prompt: {str(e)}") + # Get LLM model for this focus group + from app.models.focus_group import FocusGroup + focus_group = FocusGroup.find_by_id(focus_group_id) + llm_model = focus_group.get('llm_model') if focus_group else None + # Get LLM decision try: response = LLMService.generate_content( prompt=prompt, - temperature=temperature + temperature=temperature, + model_name=llm_model ) # Parse the JSON response @@ -352,9 +358,15 @@ class ConversationDecisionService: }} """ + # Get LLM model for this focus group + from app.models.focus_group import FocusGroup + focus_group = FocusGroup.find_by_id(focus_group_id) + llm_model = focus_group.get('llm_model') if focus_group else None + response = LLMService.generate_content( prompt=insight_prompt, - temperature=temperature + temperature=temperature, + model_name=llm_model ) insights = LLMService.parse_json_response(response) diff --git a/backend/app/services/focus_group_response_service.py b/backend/app/services/focus_group_response_service.py index 9ff553a2..6619a5f7 100644 --- a/backend/app/services/focus_group_response_service.py +++ b/backend/app/services/focus_group_response_service.py @@ -20,7 +20,8 @@ def generate_persona_response( current_topic: str, previous_messages: List[Dict[str, Any]], temperature: float = 0.7, - focus_group_id: Optional[str] = None + focus_group_id: Optional[str] = None, + llm_model: Optional[str] = None ) -> str: """ Generate a response from a persona in a focus group discussion. @@ -32,6 +33,7 @@ def generate_persona_response( previous_messages: List of previous messages in the discussion temperature: Controls randomness in generation (0.0 = deterministic, 1.0 = creative) focus_group_id: Optional focus group ID for visual context integration + llm_model: Optional LLM model to use for generation Returns: A string containing the persona's response @@ -43,6 +45,7 @@ def generate_persona_response( print(f"๐ŸŽญ Generating persona response for {persona.get('name', 'Unknown')}") print(f" - focus_group_id: {focus_group_id}") print(f" - current_topic: {current_topic[:50]}...") + print(f" - llm_model: {llm_model or 'default (gemini-2.5-pro)'}") # Import LLMService at the top to avoid scoping issues from app.services.llm_service import LLMService @@ -114,7 +117,8 @@ Be genuine and specific in your feedback, drawing on your personal experiences a response = LLMService.generate_contextual_response( prompt=prompt, conversation_context=multimodal_context['conversation_context'], - temperature=temperature + temperature=temperature, + model_name=llm_model ) print(f"โœ… Generated contextual response with visual context") @@ -139,7 +143,8 @@ Be genuine and specific in your feedback, drawing on your personal experiences a # Generate the standard response response = LLMService.generate_content( prompt=prompt, - temperature=temperature + temperature=temperature, + model_name=llm_model ) print(f"โœ… Generated standard response") diff --git a/backend/app/services/focus_group_service.py b/backend/app/services/focus_group_service.py index c87055a2..a4556642 100644 --- a/backend/app/services/focus_group_service.py +++ b/backend/app/services/focus_group_service.py @@ -29,7 +29,8 @@ class FocusGroupService: duration: int = 60, temperature: float = 0.7, max_retries: int = 3, - focus_group_id: Optional[str] = None + focus_group_id: Optional[str] = None, + llm_model: Optional[str] = None ) -> Dict[str, Any]: """ Generate a focus group discussion guide using the LLM with retry logic. @@ -42,6 +43,7 @@ class FocusGroupService: temperature: Controls randomness in generation max_retries: Maximum number of retry attempts focus_group_id: Optional focus group ID to check for uploaded assets + llm_model: Optional LLM model to use for generation Returns: A structured JSON discussion guide (dict) @@ -157,6 +159,7 @@ class FocusGroupService: # DEBUG: Log the complete prompt to verify asset information is included logger.info("=== DEBUG: COMPLETE PROMPT BEING SENT TO LLM ===") logger.info(f"Prompt length: {len(prompt)} characters") + logger.info(f"LLM model being used: {llm_model or 'default (gemini-2.5-pro)'}") logger.info(f"Assets in template variables: {len(uploaded_assets)} assets") if uploaded_assets: logger.info(f"Asset details: {[{'filename': a.get('filename'), 'original': a.get('original_filename')} for a in uploaded_assets]}") @@ -173,6 +176,12 @@ class FocusGroupService: else: logger.warning("CREATIVE ASSETS REQUIREMENTS section not found in prompt!") + # ENHANCED DEBUG: Log specific template variables for asset handling + logger.info(f"=== ASSET TEMPLATE DEBUG ===") + logger.info(f"has_assets: {template_vars.get('has_assets', False)}") + logger.info(f"asset_count: {template_vars.get('asset_count', 0)}") + logger.info(f"uploaded_asset_list: {template_vars.get('uploaded_asset_list', 'None')}") + logger.info("=== END DEBUG PROMPT ===") except PromptLoaderError as e: error_msg = f"Error loading discussion guide prompt: {str(e)}" @@ -185,11 +194,27 @@ class FocusGroupService: try: logger.info(f"Discussion guide generation attempt {attempt}/{max_retries}") + # Special handling for GPT models to ensure creative review compliance + enhanced_prompt = prompt + if llm_model and llm_model.startswith('gpt'): + # Add extra emphasis for GPT models about creative review requirements + if uploaded_assets and len(uploaded_assets) > 0: + asset_emphasis = f"\n\n๐Ÿšจ๐Ÿšจ๐Ÿšจ CRITICAL FOR GPT MODELS - READ THIS FIRST ๐Ÿšจ๐Ÿšจ๐Ÿšจ\n" + asset_emphasis += f"YOU ABSOLUTELY MUST INCLUDE EXACTLY {len(uploaded_assets)} ACTIVITIES WITH type='creative_review'\n" + asset_emphasis += f"EACH activity must reference ONE of these exact filenames:\n" + for asset in uploaded_assets: + asset_emphasis += f"- {asset.get('filename', 'unknown')}\n" + asset_emphasis += f"FAILURE TO INCLUDE ALL {len(uploaded_assets)} CREATIVE_REVIEW ACTIVITIES WILL RESULT IN INVALID OUTPUT\n" + asset_emphasis += f"๐Ÿšจ๐Ÿšจ๐Ÿšจ END CRITICAL INSTRUCTIONS ๐Ÿšจ๐Ÿšจ๐Ÿšจ\n\n" + enhanced_prompt = asset_emphasis + prompt + logger.info(f"Enhanced prompt for GPT model with {len(uploaded_assets)} asset emphasis") + # Generate content using LLM response = LLMService.generate_content( - prompt=prompt, + prompt=enhanced_prompt, temperature=temperature, - max_tokens=16000 # Use a much higher token limit to avoid truncation + max_tokens=16000, # Use a much higher token limit to avoid truncation + model_name=llm_model ) logger.info(f"Received LLM response (length: {len(response)} chars)") @@ -219,6 +244,7 @@ class FocusGroupService: # Validate creative review activities if assets were uploaded if uploaded_assets and len(uploaded_assets) > 0: creative_review_count = 0 + creative_review_activities = [] sections = guide_json.get('sections', []) # Count creative_review activities across all sections @@ -227,22 +253,63 @@ class FocusGroupService: for activity in activities: if activity.get('type') == 'creative_review': creative_review_count += 1 + creative_review_activities.append({ + 'section': section.get('title', 'Unknown'), + 'content': activity.get('content', 'No content')[:100] + '...' + }) - # Also check in subsections + # Also check in subsections subsections = section.get('subsections', []) for subsection in subsections: activities = subsection.get('activities', []) for activity in activities: if activity.get('type') == 'creative_review': creative_review_count += 1 + creative_review_activities.append({ + 'section': f"{section.get('title', 'Unknown')} > {subsection.get('title', 'Unknown')}", + 'content': activity.get('content', 'No content')[:100] + '...' + }) + + # Also check questions in subsections for creative_review type + questions = subsection.get('questions', []) + for question in questions: + if question.get('type') == 'creative_review': + creative_review_count += 1 + creative_review_activities.append({ + 'section': f"{section.get('title', 'Unknown')} > {subsection.get('title', 'Unknown')} (question)", + 'content': question.get('content', 'No content')[:100] + '...' + }) + logger.info(f"=== CREATIVE REVIEW VALIDATION RESULTS (Model: {llm_model or 'gemini-2.5-pro'}) ===") logger.info(f"Found {creative_review_count} creative_review activities for {len(uploaded_assets)} uploaded assets") - # If no creative review activities were generated, log a warning but continue + if creative_review_activities: + logger.info("Creative review activities found:") + for i, activity in enumerate(creative_review_activities): + logger.info(f" {i+1}. Section: {activity['section']}") + logger.info(f" Content: {activity['content']}") + + # If no creative review activities were generated, retry with enhanced prompt if creative_review_count == 0: - logger.warning(f"WARNING: No creative_review activities generated despite {len(uploaded_assets)} uploaded assets!") + logger.warning(f"โŒ WARNING: No creative_review activities generated despite {len(uploaded_assets)} uploaded assets!") + logger.warning(f"โŒ This suggests {llm_model or 'gemini-2.5-pro'} is not following the creative asset instructions") + + # For GPT models, if this was already the enhanced prompt, we have a serious issue + if llm_model and llm_model.startswith('gpt') and attempt < max_retries: + logger.warning(f"โŒ GPT model failed to generate creative_review activities. Will retry with even more explicit instructions.") + # This will trigger a retry with the next attempt + raise Exception(f"GPT model failed to generate required creative_review activities") + elif creative_review_count < len(uploaded_assets): - logger.warning(f"WARNING: Only {creative_review_count} creative_review activities generated for {len(uploaded_assets)} assets") + logger.warning(f"โš ๏ธ WARNING: Only {creative_review_count} creative_review activities generated for {len(uploaded_assets)} assets") + + # For GPT models with incomplete creative reviews, also consider this a failure worth retrying + if llm_model and llm_model.startswith('gpt') and attempt < max_retries: + logger.warning(f"โš ๏ธ GPT model generated incomplete creative_review activities. Will retry.") + raise Exception(f"GPT model generated only {creative_review_count}/{len(uploaded_assets)} required creative_review activities") + + else: + logger.info(f"โœ… Good: {creative_review_count} creative_review activities generated for {len(uploaded_assets)} assets") logger.info(f"Discussion guide generation successful on attempt {attempt}/{max_retries}") logger.info(f"Generated guide has {len(guide_json.get('sections', []))} sections") diff --git a/backend/app/services/image_description_service.py b/backend/app/services/image_description_service.py index f3f92407..23cab046 100644 --- a/backend/app/services/image_description_service.py +++ b/backend/app/services/image_description_service.py @@ -73,10 +73,17 @@ class ImageDescriptionService: # Generate description using multimodal LLM try: print(f"๐Ÿš€ DESCRIPTION: Calling LLM service with image: {asset_path}") + + # Get LLM model for this focus group + from app.models.focus_group import FocusGroup + focus_group = FocusGroup.find_by_id(focus_group_id) + llm_model = focus_group.get('llm_model') if focus_group else None + description = LLMService.generate_multimodal_content( prompt=prompt, image_paths=[asset_path], - temperature=0.7 + temperature=0.7, + model_name=llm_model ) print(f"โœ… DESCRIPTION: LLM returned description ({len(description)} chars): {description[:100]}...") return description.strip() @@ -119,43 +126,58 @@ class ImageDescriptionService: Enhanced question text with detailed visual description """ try: + import re + print(f"๐Ÿ”ง ENHANCEMENT: Enhancing question for {asset_filename}") print(f"๐Ÿ”ง Original: {original_question[:100]}...") print(f"๐Ÿ”ง Description: {description[:100]}...") - # Look for the asset filename reference in the question - if asset_filename in original_question: - # Find the filename reference and enhance it - filename_pattern = f"'{asset_filename}'" - enhanced_reference = f"'{asset_filename}' - {description}" + # Use regex patterns to handle punctuation and variations + # Escape the filename for regex use + escaped_filename = re.escape(asset_filename) + + # Define comprehensive patterns that handle punctuation after filenames + regex_patterns = [ + # Quoted filenames with optional punctuation + (rf"('{escaped_filename}')([.,;!?]*)", rf"\1 - {description}\2"), + (rf'("{escaped_filename}")([.,;!?]*)', rf'\1 - {description}\2'), - enhanced_question = original_question.replace(filename_pattern, enhanced_reference) + # Titled/labeled patterns + (rf"(titled\s+['\"]?{escaped_filename}['\"]?)([.,;!?]*)", rf"\1 - {description}\2"), + (rf"(asset\s+['\"]?{escaped_filename}['\"]?)([.,;!?]*)", rf"\1 - {description}\2"), + (rf"(image\s+['\"]?{escaped_filename}['\"]?)([.,;!?]*)", rf"\1 - {description}\2"), - print(f"โœ… ENHANCEMENT: Enhanced question: {enhanced_question[:150]}...") - return enhanced_question - else: - # If filename not found in expected format, try other patterns - import re - - # Try to find quoted filename patterns - patterns = [ - (f'"{asset_filename}"', f'"{asset_filename}" - {description}'), - (f"titled '{asset_filename}'", f"titled '{asset_filename}' - {description}"), - (f'titled "{asset_filename}"', f'titled "{asset_filename}" - {description}'), - (asset_filename, f"{asset_filename} - {description}") - ] - - enhanced_question = original_question - for old_pattern, new_pattern in patterns: - if old_pattern in enhanced_question: - enhanced_question = enhanced_question.replace(old_pattern, new_pattern) - print(f"โœ… ENHANCEMENT: Enhanced with pattern '{old_pattern}': {enhanced_question[:150]}...") - return enhanced_question - - # If no patterns match, append description at the end + # Unquoted filename with word boundaries + (rf"\b({escaped_filename})\b([.,;!?]*)", rf"\1 - {description}\2") + ] + + enhanced_question = original_question + enhancement_applied = False + + # Try each regex pattern + for pattern, replacement in regex_patterns: + if re.search(pattern, enhanced_question, re.IGNORECASE): + enhanced_question = re.sub(pattern, replacement, enhanced_question, flags=re.IGNORECASE) + print(f"โœ… ENHANCEMENT: Enhanced with regex pattern: {enhanced_question[:150]}...") + enhancement_applied = True + break + + # If no regex patterns worked, try simple string replacement as fallback + if not enhancement_applied and asset_filename in original_question: + # Simple replacement that adds description after any occurrence of filename + enhanced_question = original_question.replace( + asset_filename, + f"{asset_filename} - {description}" + ) + print(f"โœ… ENHANCEMENT: Enhanced with simple replacement: {enhanced_question[:150]}...") + enhancement_applied = True + + # Final fallback: append description if no enhancements worked + if not enhancement_applied: enhanced_question = f"{original_question} The image shows {description}." print(f"โš ๏ธ ENHANCEMENT: Appended description to end: {enhanced_question[:150]}...") - return enhanced_question + + return enhanced_question except Exception as e: error_msg = f"Failed to enhance question for {asset_filename}: {str(e)}" diff --git a/backend/app/services/key_theme_service.py b/backend/app/services/key_theme_service.py index aebd1a1f..a54a9812 100644 --- a/backend/app/services/key_theme_service.py +++ b/backend/app/services/key_theme_service.py @@ -22,7 +22,8 @@ class KeyThemeService: @staticmethod def generate_key_themes( focus_group_id: str, - temperature: float = 0.7 + temperature: float = 0.7, + llm_model: Optional[str] = None ) -> List[Dict[str, str]]: """ Generate key themes from a focus group discussion. @@ -30,6 +31,7 @@ class KeyThemeService: Args: focus_group_id: The ID of the focus group temperature: Controls randomness in generation (default: 0.7) + llm_model: Optional LLM model to use for generation Returns: A list of key theme objects with title and description fields @@ -39,6 +41,7 @@ class KeyThemeService: """ logger = logging.getLogger(__name__) logger.info(f"Starting key theme generation for focus group {focus_group_id} with temperature {temperature}") + logger.info(f"Using LLM model: {llm_model or 'default (gemini-2.5-pro)'}") try: # Get the focus group @@ -69,7 +72,8 @@ class KeyThemeService: messages=messages, participants=participants_data, discussion_guide=focus_group.get('discussionGuide', ''), - temperature=temperature + temperature=temperature, + llm_model=llm_model ) except Exception as e: @@ -80,7 +84,8 @@ class KeyThemeService: messages: List[Dict[str, Any]], participants: List[Dict[str, Any]], discussion_guide: str, - temperature: float = 0.7 + temperature: float = 0.7, + llm_model: Optional[str] = None ) -> List[Dict[str, str]]: """ Extract key themes from a discussion using LLM. @@ -90,6 +95,7 @@ class KeyThemeService: participants: List of participant personas discussion_guide: The discussion guide for the focus group temperature: Controls randomness in generation + llm_model: Optional LLM model to use for generation Returns: A list of key theme objects with title and description @@ -99,6 +105,7 @@ class KeyThemeService: """ logger = logging.getLogger(__name__) logger.info(f"Beginning theme extraction from {len(messages)} messages") + logger.info(f"Theme extraction using LLM model: {llm_model or 'default (gemini-2.5-pro)'}") try: # Load and prepare the prompt for the LLM @@ -128,16 +135,17 @@ class KeyThemeService: for attempt in range(max_retries): attempt_num = attempt + 1 - logger.info(f"Attempt {attempt_num}/{max_retries}: Calling LLM for theme generation") + logger.info(f"Attempt {attempt_num}/{max_retries}: Calling LLM ({llm_model or 'gemini-2.5-pro'}) for theme generation") try: themes = LLMService.generate_structured_array( prompt=prompt, temperature=temperature, - system_prompt=system_prompt + system_prompt=system_prompt, + model_name=llm_model ) - logger.info(f"Attempt {attempt_num}/{max_retries}: LLM call successful, received {len(themes)} themes") + logger.info(f"Attempt {attempt_num}/{max_retries}: LLM ({llm_model or 'gemini-2.5-pro'}) call successful, received {len(themes)} themes") # Validate the response structure validated_themes = [] @@ -167,7 +175,7 @@ class KeyThemeService: validated_themes.append(validated_theme) - logger.info(f"Theme generation completed successfully with {len(validated_themes)} validated themes") + logger.info(f"Theme generation completed successfully with {len(validated_themes)} validated themes using {llm_model or 'gemini-2.5-pro'}") return validated_themes except LLMServiceError as e: diff --git a/backend/app/services/llm_service.py b/backend/app/services/llm_service.py index c59e4592..b1aee982 100644 --- a/backend/app/services/llm_service.py +++ b/backend/app/services/llm_service.py @@ -10,6 +10,7 @@ import json import time import logging import google.generativeai as genai +from openai import OpenAI from typing import Dict, Any, Optional, Union, List from PIL import Image import io @@ -18,9 +19,19 @@ import io GEMINI_API_KEY = os.environ.get('GEMINI_API_KEY', 'AIzaSyAc50jzC3k9K1PmKT1vGFi0sCdhhnqsvl0') genai.configure(api_key=GEMINI_API_KEY) +# Set up OpenAI API key +OPENAI_API_KEY = os.environ.get('OPENAI_API_KEY', 'REDACTED_OPENAI_KEY') +openai_client = OpenAI(api_key=OPENAI_API_KEY) + # The default model we're using DEFAULT_MODEL = "gemini-2.5-pro" +# Supported models +SUPPORTED_MODELS = { + 'gemini-2.5-pro': 'gemini', + 'gpt-4.1': 'openai' +} + class LLMServiceError(Exception): """Exception raised for errors in LLM operations.""" pass @@ -28,6 +39,20 @@ class LLMServiceError(Exception): class LLMService: """Centralized service for LLM operations.""" + @staticmethod + def _get_model_provider(model_name: Optional[str] = None) -> str: + """ + Get the provider for a given model name. + + Args: + model_name: Optional model name to use. Defaults to the default model. + + Returns: + The provider name ('gemini' or 'openai') + """ + actual_model = model_name or DEFAULT_MODEL + return SUPPORTED_MODELS.get(actual_model, 'gemini') + @staticmethod def get_model(model_name: Optional[str] = None) -> genai.GenerativeModel: """ @@ -132,39 +157,63 @@ class LLMService: max_retries = 3 last_error = None + actual_model = model_name or DEFAULT_MODEL + provider = LLMService._get_model_provider(model_name) + for attempt in range(max_retries): attempt_num = attempt + 1 - logger.debug(f"LLM content generation attempt {attempt_num}/{max_retries}") + logger.debug(f"LLM content generation attempt {attempt_num}/{max_retries} using {provider} provider") try: - model = LLMService.get_model(model_name) - - generation_config = { - "temperature": temperature, - } - - if max_tokens: - generation_config["max_output_tokens"] = max_tokens - - # If system prompt is provided, use it to create a structured chat - if system_prompt: - # For Gemini models, system prompts need to be passed as part of the user prompt - # as Gemini API doesn't support 'system' role directly - response = model.generate_content( - [ - {"role": "user", "parts": [f"System: {system_prompt}\n\nUser: {prompt}"]} - ], - generation_config=genai.types.GenerationConfig(**generation_config) - ) + if provider == 'openai': + # OpenAI API call + messages = [] + if system_prompt: + messages.append({"role": "system", "content": system_prompt}) + messages.append({"role": "user", "content": prompt}) + + kwargs = { + "model": actual_model, + "messages": messages, + "temperature": temperature, + } + + if max_tokens: + kwargs["max_tokens"] = max_tokens + + response = openai_client.chat.completions.create(**kwargs) + result = response.choices[0].message.content.strip() + else: - # Otherwise use the standard prompt-only approach - response = model.generate_content( - prompt, - generation_config=genai.types.GenerationConfig(**generation_config) - ) - - # If successful, extract and return the response - result = LLMService._extract_text_from_response(response) + # Gemini API call (existing logic) + model = LLMService.get_model(model_name) + + generation_config = { + "temperature": temperature, + } + + if max_tokens: + generation_config["max_output_tokens"] = max_tokens + + # If system prompt is provided, use it to create a structured chat + if system_prompt: + # For Gemini models, system prompts need to be passed as part of the user prompt + # as Gemini API doesn't support 'system' role directly + response = model.generate_content( + [ + {"role": "user", "parts": [f"System: {system_prompt}\n\nUser: {prompt}"]} + ], + generation_config=genai.types.GenerationConfig(**generation_config) + ) + else: + # Otherwise use the standard prompt-only approach + response = model.generate_content( + prompt, + generation_config=genai.types.GenerationConfig(**generation_config) + ) + + # If successful, extract and return the response + result = LLMService._extract_text_from_response(response) if attempt > 0: logger.info(f"LLM content generation succeeded on attempt {attempt_num}/{max_retries}") @@ -176,7 +225,7 @@ class LLMService: logger.warning(f"LLM attempt {attempt_num}/{max_retries} failed: {str(e)}") - # Check if this is a retryable error (Google API internal errors, rate limiting, etc.) + # Check if this is a retryable error (API internal errors, rate limiting, etc.) if ("500" in error_message or "internal error" in error_message or "internal server error" in error_message or @@ -334,52 +383,100 @@ class LLMService: max_retries = 3 last_error = None - # Load and validate images - images = [] - for image_path in image_paths: - try: - if not os.path.exists(image_path): - raise LLMServiceError(f"Image file not found: {image_path}") - - # Load image using PIL - with Image.open(image_path) as img: - # Convert to RGB if necessary - if img.mode != 'RGB': - img = img.convert('RGB') - images.append(img.copy()) - - logger.debug(f"Successfully loaded image: {image_path}") - - except Exception as e: - raise LLMServiceError(f"Failed to load image {image_path}: {str(e)}") + actual_model = model_name or DEFAULT_MODEL + provider = LLMService._get_model_provider(model_name) - logger.info(f"Generating multimodal content with {len(images)} image(s)") + logger.info(f"Generating multimodal content with {len(image_paths)} image(s) using {provider} provider") for attempt in range(max_retries): attempt_num = attempt + 1 logger.debug(f"Multimodal content generation attempt {attempt_num}/{max_retries}") try: - model = LLMService.get_model(model_name) + if provider == 'openai': + # OpenAI multimodal API call + import base64 + + # Prepare image content for OpenAI API + image_content = [] + for image_path in image_paths: + if not os.path.exists(image_path): + raise LLMServiceError(f"Image file not found: {image_path}") + + # Encode image to base64 + with open(image_path, "rb") as image_file: + base64_image = base64.b64encode(image_file.read()).decode('utf-8') + + # Get image format + image_format = image_path.lower().split('.')[-1] + if image_format == 'jpg': + image_format = 'jpeg' + + image_content.append({ + "type": "image_url", + "image_url": { + "url": f"data:image/{image_format};base64,{base64_image}" + } + }) + logger.debug(f"Successfully loaded image for OpenAI: {image_path}") + + # Create message content with text and images + content = [{"type": "text", "text": prompt}] + content.extend(image_content) + + kwargs = { + "model": actual_model, + "messages": [{"role": "user", "content": content}], + "temperature": temperature, + } + + if max_tokens: + kwargs["max_tokens"] = max_tokens + + response = openai_client.chat.completions.create(**kwargs) + result = response.choices[0].message.content.strip() + + else: + # Gemini multimodal API call (existing logic) + # Load and validate images + images = [] + for image_path in image_paths: + try: + if not os.path.exists(image_path): + raise LLMServiceError(f"Image file not found: {image_path}") + + # Load image using PIL + with Image.open(image_path) as img: + # Convert to RGB if necessary + if img.mode != 'RGB': + img = img.convert('RGB') + images.append(img.copy()) + + logger.debug(f"Successfully loaded image for Gemini: {image_path}") + + except Exception as e: + raise LLMServiceError(f"Failed to load image {image_path}: {str(e)}") + + model = LLMService.get_model(model_name) + + generation_config = { + "temperature": temperature, + } + + if max_tokens: + generation_config["max_output_tokens"] = max_tokens + + # Create multimodal input - combine text prompt with images + content_parts = [prompt] + content_parts.extend(images) - generation_config = { - "temperature": temperature, - } - - if max_tokens: - generation_config["max_output_tokens"] = max_tokens - - # Create multimodal input - combine text prompt with images - content_parts = [prompt] - content_parts.extend(images) - - response = model.generate_content( - content_parts, - generation_config=genai.types.GenerationConfig(**generation_config) - ) - - # Extract and return the response - result = LLMService._extract_text_from_response(response) + response = model.generate_content( + content_parts, + generation_config=genai.types.GenerationConfig(**generation_config) + ) + + # Extract and return the response + result = LLMService._extract_text_from_response(response) if attempt > 0: logger.info(f"Multimodal content generation succeeded on attempt {attempt_num}/{max_retries}") @@ -480,9 +577,8 @@ class LLMService: if image_parts: print(f"๐ŸŽจ Using multimodal generation with {len(image_parts)} images") - # Create content parts with text and images - content_parts = [full_prompt] - content_parts.extend(image_parts) + actual_model = model_name or DEFAULT_MODEL + provider = LLMService._get_model_provider(model_name) max_retries = 3 last_error = None @@ -492,26 +588,67 @@ class LLMService: logger.debug(f"Contextual multimodal generation attempt {attempt_num}/{max_retries}") try: - model = LLMService.get_model(model_name) - - generation_config = { - "temperature": temperature, - } - - if max_tokens: - generation_config["max_output_tokens"] = max_tokens - - response = model.generate_content( - content_parts, - generation_config=genai.types.GenerationConfig(**generation_config) - ) - - result = LLMService._extract_text_from_response(response) + if provider == 'openai': + # OpenAI contextual multimodal API call + import base64 + + # Convert PIL images to base64 for OpenAI API + image_content = [] + for i, img in enumerate(image_parts): + # Convert PIL image to base64 + buffer = io.BytesIO() + img.save(buffer, format='PNG') + base64_image = base64.b64encode(buffer.getvalue()).decode('utf-8') + + image_content.append({ + "type": "image_url", + "image_url": { + "url": f"data:image/png;base64,{base64_image}" + } + }) + + # Create message content with text and images + content = [{"type": "text", "text": full_prompt}] + content.extend(image_content) + + kwargs = { + "model": actual_model, + "messages": [{"role": "user", "content": content}], + "temperature": temperature, + } + + if max_tokens: + kwargs["max_tokens"] = max_tokens + + response = openai_client.chat.completions.create(**kwargs) + result = response.choices[0].message.content.strip() + + else: + # Gemini contextual multimodal API call (existing logic) + # Create content parts with text and images + content_parts = [full_prompt] + content_parts.extend(image_parts) + + model = LLMService.get_model(model_name) + + generation_config = { + "temperature": temperature, + } + + if max_tokens: + generation_config["max_output_tokens"] = max_tokens + + response = model.generate_content( + content_parts, + generation_config=genai.types.GenerationConfig(**generation_config) + ) + + result = LLMService._extract_text_from_response(response) if attempt > 0: logger.info(f"Contextual multimodal generation succeeded on attempt {attempt_num}/{max_retries}") - print(f"โœ… Generated contextual response with visual context") + print(f"โœ… Generated contextual response with visual context using {provider}") return result except Exception as e: diff --git a/backend/prompts/image-description.md b/backend/prompts/image-description.md index 571e442a..a74d7bfc 100644 --- a/backend/prompts/image-description.md +++ b/backend/prompts/image-description.md @@ -20,6 +20,7 @@ Analyze the provided image and create a comprehensive visual description that fo - **Focus**: Marketing/advertising context with brand and product emphasis - **Specificity**: Include specific details that help distinguish from other advertisements - **Clarity**: Clear, precise language that non-experts can understand +- **Integration**: Description will be inserted directly into moderator questions, so ensure it flows naturally and helps participants visualize the asset ## OUTPUT FORMAT Provide only the description text - no additional formatting, explanations, or commentary. The description should flow naturally and be suitable for incorporation into a moderator question. diff --git a/backend/requirements.txt b/backend/requirements.txt index 9740afee..e4bad9e5 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -8,5 +8,6 @@ bcrypt==4.0.1 pydantic==1.10.7 hypercorn google-generativeai==0.3.2 +openai>=1.0.0 requests==2.31.0 llama-cloud-services \ No newline at end of file diff --git a/dist/assets/index-Bk-FPBaP.js b/dist/assets/index-Bk-FPBaP.js deleted file mode 100644 index 7f143001..00000000 --- a/dist/assets/index-Bk-FPBaP.js +++ /dev/null @@ -1,732 +0,0 @@ -var qP=e=>{throw TypeError(e)};var c0=(e,t,n)=>t.has(e)||qP("Cannot "+n);var we=(e,t,n)=>(c0(e,t,"read from private field"),n?n.call(e):t.get(e)),Dt=(e,t,n)=>t.has(e)?qP("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),jt=(e,t,n,r)=>(c0(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),nr=(e,t,n)=>(c0(e,t,"access private method"),n);var Fp=(e,t,n,r)=>({set _(i){jt(e,t,i,n)},get _(){return we(e,t,r)}});function o8(e,t){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var Bp=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Rt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var r$={exports:{}},hy={},i$={exports:{}},Ot={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var ap=Symbol.for("react.element"),l8=Symbol.for("react.portal"),c8=Symbol.for("react.fragment"),u8=Symbol.for("react.strict_mode"),d8=Symbol.for("react.profiler"),f8=Symbol.for("react.provider"),h8=Symbol.for("react.context"),p8=Symbol.for("react.forward_ref"),m8=Symbol.for("react.suspense"),g8=Symbol.for("react.memo"),v8=Symbol.for("react.lazy"),KP=Symbol.iterator;function y8(e){return e===null||typeof e!="object"?null:(e=KP&&e[KP]||e["@@iterator"],typeof e=="function"?e:null)}var s$={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},a$=Object.assign,o$={};function Fu(e,t,n){this.props=e,this.context=t,this.refs=o$,this.updater=n||s$}Fu.prototype.isReactComponent={};Fu.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Fu.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function l$(){}l$.prototype=Fu.prototype;function sS(e,t,n){this.props=e,this.context=t,this.refs=o$,this.updater=n||s$}var aS=sS.prototype=new l$;aS.constructor=sS;a$(aS,Fu.prototype);aS.isPureReactComponent=!0;var XP=Array.isArray,c$=Object.prototype.hasOwnProperty,oS={current:null},u$={key:!0,ref:!0,__self:!0,__source:!0};function d$(e,t,n){var r,i={},s=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)c$.call(t,r)&&!u$.hasOwnProperty(r)&&(i[r]=t[r]);var l=arguments.length-2;if(l===1)i.children=n;else if(1>>1,re=I[ee];if(0>>1;eei(ae,Z))dei(fe,ae)?(I[ee]=fe,I[de]=Z,ee=de):(I[ee]=ae,I[z]=Z,ee=z);else if(dei(fe,Z))I[ee]=fe,I[de]=Z,ee=de;else break e}}return L}function i(I,L){var Z=I.sortIndex-L.sortIndex;return Z!==0?Z:I.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],u=[],d=1,f=null,h=3,p=!1,g=!1,m=!1,x=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(I){for(var L=n(u);L!==null;){if(L.callback===null)r(u);else if(L.startTime<=I)r(u),L.sortIndex=L.expirationTime,t(c,L);else break;L=n(u)}}function j(I){if(m=!1,w(I),!g)if(n(c)!==null)g=!0,F(S);else{var L=n(u);L!==null&&V(j,L.startTime-I)}}function S(I,L){g=!1,m&&(m=!1,b(_),_=-1),p=!0;var Z=h;try{for(w(L),f=n(c);f!==null&&(!(f.expirationTime>L)||I&&!$());){var ee=f.callback;if(typeof ee=="function"){f.callback=null,h=f.priorityLevel;var re=ee(f.expirationTime<=L);L=e.unstable_now(),typeof re=="function"?f.callback=re:f===n(c)&&r(c),w(L)}else r(c);f=n(c)}if(f!==null)var me=!0;else{var z=n(u);z!==null&&V(j,z.startTime-L),me=!1}return me}finally{f=null,h=Z,p=!1}}var N=!1,P=null,_=-1,A=5,O=-1;function $(){return!(e.unstable_now()-OI||125ee?(I.sortIndex=Z,t(u,I),n(c)===null&&I===n(u)&&(m?(b(_),_=-1):m=!0,V(j,Z-ee))):(I.sortIndex=re,t(c,I),g||p||(g=!0,F(S))),I},e.unstable_shouldYield=$,e.unstable_wrapCallback=function(I){var L=h;return function(){var Z=h;h=L;try{return I.apply(this,arguments)}finally{h=Z}}}})(v$);g$.exports=v$;var E8=g$.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var O8=v,ri=E8;function Ce(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Rb=Object.prototype.hasOwnProperty,k8=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,ZP={},QP={};function T8(e){return Rb.call(QP,e)?!0:Rb.call(ZP,e)?!1:k8.test(e)?QP[e]=!0:(ZP[e]=!0,!1)}function $8(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function I8(e,t,n,r){if(t===null||typeof t>"u"||$8(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Ar(e,t,n,r,i,s,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var Qn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Qn[e]=new Ar(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Qn[t]=new Ar(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Qn[e]=new Ar(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Qn[e]=new Ar(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Qn[e]=new Ar(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Qn[e]=new Ar(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Qn[e]=new Ar(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Qn[e]=new Ar(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Qn[e]=new Ar(e,5,!1,e.toLowerCase(),null,!1,!1)});var cS=/[\-:]([a-z])/g;function uS(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(cS,uS);Qn[t]=new Ar(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(cS,uS);Qn[t]=new Ar(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(cS,uS);Qn[t]=new Ar(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Qn[e]=new Ar(e,1,!1,e.toLowerCase(),null,!1,!1)});Qn.xlinkHref=new Ar("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Qn[e]=new Ar(e,1,!1,e.toLowerCase(),null,!0,!0)});function dS(e,t,n,r){var i=Qn.hasOwnProperty(t)?Qn[t]:null;(i!==null?i.type!==0:r||!(2l||i[o]!==s[l]){var c=` -`+i[o].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{f0=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Gd(e):""}function M8(e){switch(e.tag){case 5:return Gd(e.type);case 16:return Gd("Lazy");case 13:return Gd("Suspense");case 19:return Gd("SuspenseList");case 0:case 2:case 15:return e=h0(e.type,!1),e;case 11:return e=h0(e.type.render,!1),e;case 1:return e=h0(e.type,!0),e;default:return""}}function Bb(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case lc:return"Fragment";case oc:return"Portal";case Db:return"Profiler";case fS:return"StrictMode";case Lb:return"Suspense";case Fb:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case b$:return(e.displayName||"Context")+".Consumer";case x$:return(e._context.displayName||"Context")+".Provider";case hS:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case pS:return t=e.displayName||null,t!==null?t:Bb(e.type)||"Memo";case Ra:t=e._payload,e=e._init;try{return Bb(e(t))}catch{}}return null}function R8(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Bb(t);case 8:return t===fS?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function po(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function j$(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function D8(e){var t=j$(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Vp(e){e._valueTracker||(e._valueTracker=D8(e))}function S$(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=j$(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Ym(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function zb(e,t){var n=t.checked;return ln({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function eC(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=po(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function N$(e,t){t=t.checked,t!=null&&dS(e,"checked",t,!1)}function Ub(e,t){N$(e,t);var n=po(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Vb(e,t.type,n):t.hasOwnProperty("defaultValue")&&Vb(e,t.type,po(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function tC(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Vb(e,t,n){(t!=="number"||Ym(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var qd=Array.isArray;function Nc(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=Wp.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Pf(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var nf={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},L8=["Webkit","ms","Moz","O"];Object.keys(nf).forEach(function(e){L8.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),nf[t]=nf[e]})});function A$(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||nf.hasOwnProperty(e)&&nf[e]?(""+t).trim():t+"px"}function E$(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=A$(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var F8=ln({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Gb(e,t){if(t){if(F8[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Ce(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Ce(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Ce(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Ce(62))}}function qb(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Kb=null;function mS(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Xb=null,_c=null,Pc=null;function iC(e){if(e=cp(e)){if(typeof Xb!="function")throw Error(Ce(280));var t=e.stateNode;t&&(t=yy(t),Xb(e.stateNode,e.type,t))}}function O$(e){_c?Pc?Pc.push(e):Pc=[e]:_c=e}function k$(){if(_c){var e=_c,t=Pc;if(Pc=_c=null,iC(e),t)for(e=0;e>>=0,e===0?32:31-(Y8(e)/Z8|0)|0}var Hp=64,Gp=4194304;function Kd(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function eg(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,s=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~i;l!==0?r=Kd(l):(s&=o,s!==0&&(r=Kd(s)))}else o=n&~i,o!==0?r=Kd(o):s!==0&&(r=Kd(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,s=t&-t,i>=s||i===16&&(s&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function op(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Hi(t),e[t]=n}function tU(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=sf),hC=" ",pC=!1;function Z$(e,t){switch(e){case"keyup":return EU.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Q$(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var cc=!1;function kU(e,t){switch(e){case"compositionend":return Q$(t);case"keypress":return t.which!==32?null:(pC=!0,hC);case"textInput":return e=t.data,e===hC&&pC?null:e;default:return null}}function TU(e,t){if(cc)return e==="compositionend"||!SS&&Z$(e,t)?(e=X$(),Tm=bS=Ya=null,cc=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=yC(n)}}function nI(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?nI(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function rI(){for(var e=window,t=Ym();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ym(e.document)}return t}function NS(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function zU(e){var t=rI(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&nI(n.ownerDocument.documentElement,n)){if(r!==null&&NS(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!e.extend&&s>r&&(i=r,r=s,s=i),i=xC(n,s);var o=xC(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,uc=null,tw=null,of=null,nw=!1;function bC(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;nw||uc==null||uc!==Ym(r)||(r=uc,"selectionStart"in r&&NS(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),of&&Tf(of,r)||(of=r,r=rg(tw,"onSelect"),0hc||(e.current=lw[hc],lw[hc]=null,hc--)}function Yt(e,t){hc++,lw[hc]=e.current,e.current=t}var mo={},hr=Ao(mo),Dr=Ao(!1),yl=mo;function Qc(e,t){var n=e.type.contextTypes;if(!n)return mo;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Lr(e){return e=e.childContextTypes,e!=null}function sg(){tn(Dr),tn(hr)}function CC(e,t,n){if(hr.current!==mo)throw Error(Ce(168));Yt(hr,t),Yt(Dr,n)}function fI(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(Ce(108,R8(e)||"Unknown",i));return ln({},n,r)}function ag(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||mo,yl=hr.current,Yt(hr,e),Yt(Dr,Dr.current),!0}function AC(e,t,n){var r=e.stateNode;if(!r)throw Error(Ce(169));n?(e=fI(e,t,yl),r.__reactInternalMemoizedMergedChildContext=e,tn(Dr),tn(hr),Yt(hr,e)):tn(Dr),Yt(Dr,n)}var Ws=null,xy=!1,C0=!1;function hI(e){Ws===null?Ws=[e]:Ws.push(e)}function JU(e){xy=!0,hI(e)}function Eo(){if(!C0&&Ws!==null){C0=!0;var e=0,t=Ut;try{var n=Ws;for(Ut=1;e>=o,i-=o,qs=1<<32-Hi(t)+i|n<_?(A=P,P=null):A=P.sibling;var O=h(b,P,w[_],j);if(O===null){P===null&&(P=A);break}e&&P&&O.alternate===null&&t(b,P),y=s(O,y,_),N===null?S=O:N.sibling=O,N=O,P=A}if(_===w.length)return n(b,P),nn&&Wo(b,_),S;if(P===null){for(;__?(A=P,P=null):A=P.sibling;var $=h(b,P,O.value,j);if($===null){P===null&&(P=A);break}e&&P&&$.alternate===null&&t(b,P),y=s($,y,_),N===null?S=$:N.sibling=$,N=$,P=A}if(O.done)return n(b,P),nn&&Wo(b,_),S;if(P===null){for(;!O.done;_++,O=w.next())O=f(b,O.value,j),O!==null&&(y=s(O,y,_),N===null?S=O:N.sibling=O,N=O);return nn&&Wo(b,_),S}for(P=r(b,P);!O.done;_++,O=w.next())O=p(P,b,_,O.value,j),O!==null&&(e&&O.alternate!==null&&P.delete(O.key===null?_:O.key),y=s(O,y,_),N===null?S=O:N.sibling=O,N=O);return e&&P.forEach(function(T){return t(b,T)}),nn&&Wo(b,_),S}function x(b,y,w,j){if(typeof w=="object"&&w!==null&&w.type===lc&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Up:e:{for(var S=w.key,N=y;N!==null;){if(N.key===S){if(S=w.type,S===lc){if(N.tag===7){n(b,N.sibling),y=i(N,w.props.children),y.return=b,b=y;break e}}else if(N.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Ra&&kC(S)===N.type){n(b,N.sibling),y=i(N,w.props),y.ref=_d(b,N,w),y.return=b,b=y;break e}n(b,N);break}else t(b,N);N=N.sibling}w.type===lc?(y=hl(w.props.children,b.mode,j,w.key),y.return=b,b=y):(j=Bm(w.type,w.key,w.props,null,b.mode,j),j.ref=_d(b,y,w),j.return=b,b=j)}return o(b);case oc:e:{for(N=w.key;y!==null;){if(y.key===N)if(y.tag===4&&y.stateNode.containerInfo===w.containerInfo&&y.stateNode.implementation===w.implementation){n(b,y.sibling),y=i(y,w.children||[]),y.return=b,b=y;break e}else{n(b,y);break}else t(b,y);y=y.sibling}y=M0(w,b.mode,j),y.return=b,b=y}return o(b);case Ra:return N=w._init,x(b,y,N(w._payload),j)}if(qd(w))return g(b,y,w,j);if(bd(w))return m(b,y,w,j);Jp(b,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,y!==null&&y.tag===6?(n(b,y.sibling),y=i(y,w),y.return=b,b=y):(n(b,y),y=I0(w,b.mode,j),y.return=b,b=y),o(b)):n(b,y)}return x}var eu=vI(!0),yI=vI(!1),cg=Ao(null),ug=null,gc=null,AS=null;function ES(){AS=gc=ug=null}function OS(e){var t=cg.current;tn(cg),e._currentValue=t}function dw(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Ac(e,t){ug=e,AS=gc=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Mr=!0),e.firstContext=null)}function Ni(e){var t=e._currentValue;if(AS!==e)if(e={context:e,memoizedValue:t,next:null},gc===null){if(ug===null)throw Error(Ce(308));gc=e,ug.dependencies={lanes:0,firstContext:e}}else gc=gc.next=e;return t}var Qo=null;function kS(e){Qo===null?Qo=[e]:Qo.push(e)}function xI(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,kS(t)):(n.next=i.next,i.next=n),t.interleaved=n,oa(e,r)}function oa(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Da=!1;function TS(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function bI(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Js(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function so(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,$t&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,oa(e,n)}return i=r.interleaved,i===null?(t.next=t,kS(r)):(t.next=i.next,i.next=t),r.interleaved=t,oa(e,n)}function Im(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,vS(e,n)}}function TC(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=t:s=s.next=t}else i=s=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function dg(e,t,n,r){var i=e.updateQueue;Da=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?s=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(s!==null){var f=i.baseState;o=0,d=u=c=null,l=s;do{var h=l.lane,p=l.eventTime;if((r&h)===h){d!==null&&(d=d.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var g=e,m=l;switch(h=t,p=n,m.tag){case 1:if(g=m.payload,typeof g=="function"){f=g.call(p,f,h);break e}f=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=m.payload,h=typeof g=="function"?g.call(p,f,h):g,h==null)break e;f=ln({},f,h);break e;case 2:Da=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,h=i.effects,h===null?i.effects=[l]:h.push(l))}else p={eventTime:p,lane:h,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=p,c=f):d=d.next=p,o|=h;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;h=l,l=h.next,h.next=null,i.lastBaseUpdate=h,i.shared.pending=null}}while(!0);if(d===null&&(c=f),i.baseState=c,i.firstBaseUpdate=u,i.lastBaseUpdate=d,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else s===null&&(i.shared.lanes=0);wl|=o,e.lanes=o,e.memoizedState=f}}function $C(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=E0.transition;E0.transition={};try{e(!1),t()}finally{Ut=n,E0.transition=r}}function DI(){return _i().memoizedState}function rV(e,t,n){var r=oo(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},LI(e))FI(t,n);else if(n=xI(e,t,n,r),n!==null){var i=_r();Gi(n,e,r,i),BI(n,t,r)}}function iV(e,t,n){var r=oo(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(LI(e))FI(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,l=s(o,n);if(i.hasEagerState=!0,i.eagerState=l,Zi(l,o)){var c=t.interleaved;c===null?(i.next=i,kS(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}finally{}n=xI(e,t,i,r),n!==null&&(i=_r(),Gi(n,e,r,i),BI(n,t,r))}}function LI(e){var t=e.alternate;return e===on||t!==null&&t===on}function FI(e,t){lf=hg=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function BI(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,vS(e,n)}}var pg={readContext:Ni,useCallback:rr,useContext:rr,useEffect:rr,useImperativeHandle:rr,useInsertionEffect:rr,useLayoutEffect:rr,useMemo:rr,useReducer:rr,useRef:rr,useState:rr,useDebugValue:rr,useDeferredValue:rr,useTransition:rr,useMutableSource:rr,useSyncExternalStore:rr,useId:rr,unstable_isNewReconciler:!1},sV={readContext:Ni,useCallback:function(e,t){return us().memoizedState=[e,t===void 0?null:t],e},useContext:Ni,useEffect:MC,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Rm(4194308,4,TI.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Rm(4194308,4,e,t)},useInsertionEffect:function(e,t){return Rm(4,2,e,t)},useMemo:function(e,t){var n=us();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=us();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=rV.bind(null,on,e),[r.memoizedState,e]},useRef:function(e){var t=us();return e={current:e},t.memoizedState=e},useState:IC,useDebugValue:BS,useDeferredValue:function(e){return us().memoizedState=e},useTransition:function(){var e=IC(!1),t=e[0];return e=nV.bind(null,e[1]),us().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=on,i=us();if(nn){if(n===void 0)throw Error(Ce(407));n=n()}else{if(n=t(),Wn===null)throw Error(Ce(349));bl&30||NI(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,MC(PI.bind(null,r,s,e),[e]),r.flags|=2048,Bf(9,_I.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=us(),t=Wn.identifierPrefix;if(nn){var n=Ks,r=qs;n=(r&~(1<<32-Hi(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Lf++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[ms]=t,e[Mf]=r,YI(e,t,!1,!1),t.stateNode=e;e:{switch(o=qb(n,r),n){case"dialog":Qt("cancel",e),Qt("close",e),i=r;break;case"iframe":case"object":case"embed":Qt("load",e),i=r;break;case"video":case"audio":for(i=0;iru&&(t.flags|=128,r=!0,Pd(s,!1),t.lanes=4194304)}else{if(!r)if(e=fg(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Pd(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!nn)return ir(t),null}else 2*vn()-s.renderingStartTime>ru&&n!==1073741824&&(t.flags|=128,r=!0,Pd(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(n=s.last,n!==null?n.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=vn(),t.sibling=null,n=an.current,Yt(an,r?n&1|2:n&1),t):(ir(t),null);case 22:case 23:return GS(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?qr&1073741824&&(ir(t),t.subtreeFlags&6&&(t.flags|=8192)):ir(t),null;case 24:return null;case 25:return null}throw Error(Ce(156,t.tag))}function hV(e,t){switch(PS(t),t.tag){case 1:return Lr(t.type)&&sg(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return tu(),tn(Dr),tn(hr),MS(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return IS(t),null;case 13:if(tn(an),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Ce(340));Jc()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return tn(an),null;case 4:return tu(),null;case 10:return OS(t.type._context),null;case 22:case 23:return GS(),null;case 24:return null;default:return null}}var tm=!1,ur=!1,pV=typeof WeakSet=="function"?WeakSet:Set,Ve=null;function vc(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){dn(e,t,r)}else n.current=null}function bw(e,t,n){try{n()}catch(r){dn(e,t,r)}}var GC=!1;function mV(e,t){if(rw=tg,e=rI(),NS(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var p;f!==n||i!==0&&f.nodeType!==3||(l=o+i),f!==s||r!==0&&f.nodeType!==3||(c=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===e)break t;if(h===n&&++u===i&&(l=o),h===s&&++d===r&&(c=o),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(iw={focusedElem:e,selectionRange:n},tg=!1,Ve=t;Ve!==null;)if(t=Ve,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ve=e;else for(;Ve!==null;){t=Ve;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var m=g.memoizedProps,x=g.memoizedState,b=t.stateNode,y=b.getSnapshotBeforeUpdate(t.elementType===t.type?m:Ii(t.type,m),x);b.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Ce(163))}}catch(j){dn(t,t.return,j)}if(e=t.sibling,e!==null){e.return=t.return,Ve=e;break}Ve=t.return}return g=GC,GC=!1,g}function cf(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,s!==void 0&&bw(t,n,s)}i=i.next}while(i!==r)}}function jy(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function ww(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function JI(e){var t=e.alternate;t!==null&&(e.alternate=null,JI(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ms],delete t[Mf],delete t[ow],delete t[ZU],delete t[QU])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function eM(e){return e.tag===5||e.tag===3||e.tag===4}function qC(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||eM(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function jw(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=ig));else if(r!==4&&(e=e.child,e!==null))for(jw(e,t,n),e=e.sibling;e!==null;)jw(e,t,n),e=e.sibling}function Sw(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Sw(e,t,n),e=e.sibling;e!==null;)Sw(e,t,n),e=e.sibling}var Kn=null,Di=!1;function Oa(e,t,n){for(n=n.child;n!==null;)tM(e,t,n),n=n.sibling}function tM(e,t,n){if(bs&&typeof bs.onCommitFiberUnmount=="function")try{bs.onCommitFiberUnmount(py,n)}catch{}switch(n.tag){case 5:ur||vc(n,t);case 6:var r=Kn,i=Di;Kn=null,Oa(e,t,n),Kn=r,Di=i,Kn!==null&&(Di?(e=Kn,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Kn.removeChild(n.stateNode));break;case 18:Kn!==null&&(Di?(e=Kn,n=n.stateNode,e.nodeType===8?P0(e.parentNode,n):e.nodeType===1&&P0(e,n),Of(e)):P0(Kn,n.stateNode));break;case 4:r=Kn,i=Di,Kn=n.stateNode.containerInfo,Di=!0,Oa(e,t,n),Kn=r,Di=i;break;case 0:case 11:case 14:case 15:if(!ur&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&bw(n,t,o),i=i.next}while(i!==r)}Oa(e,t,n);break;case 1:if(!ur&&(vc(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){dn(n,t,l)}Oa(e,t,n);break;case 21:Oa(e,t,n);break;case 22:n.mode&1?(ur=(r=ur)||n.memoizedState!==null,Oa(e,t,n),ur=r):Oa(e,t,n);break;default:Oa(e,t,n)}}function KC(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new pV),t.forEach(function(r){var i=NV.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Oi(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=vn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*vV(r/1960))-r,10e?16:e,Za===null)var r=!1;else{if(e=Za,Za=null,vg=0,$t&6)throw Error(Ce(331));var i=$t;for($t|=4,Ve=e.current;Ve!==null;){var s=Ve,o=s.child;if(Ve.flags&16){var l=s.deletions;if(l!==null){for(var c=0;cvn()-WS?fl(e,0):VS|=n),Fr(e,t)}function cM(e,t){t===0&&(e.mode&1?(t=Gp,Gp<<=1,!(Gp&130023424)&&(Gp=4194304)):t=1);var n=_r();e=oa(e,t),e!==null&&(op(e,t,n),Fr(e,n))}function SV(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),cM(e,n)}function NV(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(Ce(314))}r!==null&&r.delete(t),cM(e,n)}var uM;uM=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Dr.current)Mr=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Mr=!1,dV(e,t,n);Mr=!!(e.flags&131072)}else Mr=!1,nn&&t.flags&1048576&&pI(t,lg,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Dm(e,t),e=t.pendingProps;var i=Qc(t,hr.current);Ac(t,n),i=DS(null,t,r,e,i,n);var s=LS();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Lr(r)?(s=!0,ag(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,TS(t),i.updater=wy,t.stateNode=i,i._reactInternals=t,hw(t,r,e,n),t=gw(null,t,r,!0,s,n)):(t.tag=0,nn&&s&&_S(t),xr(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Dm(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=PV(r),e=Ii(r,e),i){case 0:t=mw(null,t,r,e,n);break e;case 1:t=VC(null,t,r,e,n);break e;case 11:t=zC(null,t,r,e,n);break e;case 14:t=UC(null,t,r,Ii(r.type,e),n);break e}throw Error(Ce(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Ii(r,i),mw(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Ii(r,i),VC(e,t,r,i,n);case 3:e:{if(qI(t),e===null)throw Error(Ce(387));r=t.pendingProps,s=t.memoizedState,i=s.element,bI(e,t),dg(t,r,null,n);var o=t.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=nu(Error(Ce(423)),t),t=WC(e,t,r,n,i);break e}else if(r!==i){i=nu(Error(Ce(424)),t),t=WC(e,t,r,n,i);break e}else for(Qr=io(t.stateNode.containerInfo.firstChild),Jr=t,nn=!0,Bi=null,n=yI(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Jc(),r===i){t=la(e,t,n);break e}xr(e,t,r,n)}t=t.child}return t;case 5:return wI(t),e===null&&uw(t),r=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,sw(r,i)?o=null:s!==null&&sw(r,s)&&(t.flags|=32),GI(e,t),xr(e,t,o,n),t.child;case 6:return e===null&&uw(t),null;case 13:return KI(e,t,n);case 4:return $S(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=eu(t,null,r,n):xr(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Ii(r,i),zC(e,t,r,i,n);case 7:return xr(e,t,t.pendingProps,n),t.child;case 8:return xr(e,t,t.pendingProps.children,n),t.child;case 12:return xr(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,s=t.memoizedProps,o=i.value,Yt(cg,r._currentValue),r._currentValue=o,s!==null)if(Zi(s.value,o)){if(s.children===i.children&&!Dr.current){t=la(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var l=s.dependencies;if(l!==null){o=s.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(s.tag===1){c=Js(-1,n&-n),c.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),dw(s.return,n,t),l.lanes|=n;break}c=c.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(Ce(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),dw(o,n,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}xr(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,Ac(t,n),i=Ni(i),r=r(i),t.flags|=1,xr(e,t,r,n),t.child;case 14:return r=t.type,i=Ii(r,t.pendingProps),i=Ii(r.type,i),UC(e,t,r,i,n);case 15:return WI(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Ii(r,i),Dm(e,t),t.tag=1,Lr(r)?(e=!0,ag(t)):e=!1,Ac(t,n),zI(t,r,i),hw(t,r,i,n),gw(null,t,r,!0,e,n);case 19:return XI(e,t,n);case 22:return HI(e,t,n)}throw Error(Ce(156,t.tag))};function dM(e,t){return L$(e,t)}function _V(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function yi(e,t,n,r){return new _V(e,t,n,r)}function KS(e){return e=e.prototype,!(!e||!e.isReactComponent)}function PV(e){if(typeof e=="function")return KS(e)?1:0;if(e!=null){if(e=e.$$typeof,e===hS)return 11;if(e===pS)return 14}return 2}function lo(e,t){var n=e.alternate;return n===null?(n=yi(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Bm(e,t,n,r,i,s){var o=2;if(r=e,typeof e=="function")KS(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case lc:return hl(n.children,i,s,t);case fS:o=8,i|=8;break;case Db:return e=yi(12,n,t,i|2),e.elementType=Db,e.lanes=s,e;case Lb:return e=yi(13,n,t,i),e.elementType=Lb,e.lanes=s,e;case Fb:return e=yi(19,n,t,i),e.elementType=Fb,e.lanes=s,e;case w$:return Ny(n,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case x$:o=10;break e;case b$:o=9;break e;case hS:o=11;break e;case pS:o=14;break e;case Ra:o=16,r=null;break e}throw Error(Ce(130,e==null?e:typeof e,""))}return t=yi(o,n,t,i),t.elementType=e,t.type=r,t.lanes=s,t}function hl(e,t,n,r){return e=yi(7,e,r,t),e.lanes=n,e}function Ny(e,t,n,r){return e=yi(22,e,r,t),e.elementType=w$,e.lanes=n,e.stateNode={isHidden:!1},e}function I0(e,t,n){return e=yi(6,e,null,t),e.lanes=n,e}function M0(e,t,n){return t=yi(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function CV(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=m0(0),this.expirationTimes=m0(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=m0(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function XS(e,t,n,r,i,s,o,l,c){return e=new CV(e,t,n,l,c),t===1?(t=1,s===!0&&(t|=8)):t=0,s=yi(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},TS(s),e}function AV(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(mM)}catch(e){console.error(e)}}mM(),m$.exports=si;var Vi=m$.exports;const gM=Rt(Vi);var vM,nA=Vi;vM=nA.createRoot,nA.hydrateRoot;var rA=["light","dark"],$V="(prefers-color-scheme: dark)",IV=v.createContext(void 0),MV={setTheme:e=>{},themes:[]},RV=()=>{var e;return(e=v.useContext(IV))!=null?e:MV};v.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:s,value:o,attrs:l,nonce:c})=>{let u=s==="system",d=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${l.map(g=>`'${g}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,f=i?rA.includes(s)&&s?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${s}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",h=(g,m=!1,x=!0)=>{let b=o?o[g]:g,y=m?g+"|| ''":`'${b}'`,w="";return i&&x&&!m&&rA.includes(g)&&(w+=`d.style.colorScheme = '${g}';`),n==="class"?m||b?w+=`c.add(${y})`:w+="null":b&&(w+=`d[s](n,${y})`),w},p=e?`!function(){${d}${h(e)}}()`:r?`!function(){try{${d}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${u})){var t='${$V}',m=window.matchMedia(t);if(m.media!==t||m.matches){${h("dark")}}else{${h("light")}}}else if(e){${o?`var x=${JSON.stringify(o)};`:""}${h(o?"x[e]":"e",!0)}}${u?"":"else{"+h(s,!1,!1)+"}"}${f}}catch(e){}}()`:`!function(){try{${d}var e=localStorage.getItem('${t}');if(e){${o?`var x=${JSON.stringify(o)};`:""}${h(o?"x[e]":"e",!0)}}else{${h(s,!1,!1)};}${f}}catch(t){}}();`;return v.createElement("script",{nonce:c,dangerouslySetInnerHTML:{__html:p}})});var DV=e=>{switch(e){case"success":return BV;case"info":return UV;case"warning":return zV;case"error":return VV;default:return null}},LV=Array(12).fill(0),FV=({visible:e})=>C.createElement("div",{className:"sonner-loading-wrapper","data-visible":e},C.createElement("div",{className:"sonner-spinner"},LV.map((t,n)=>C.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),BV=C.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},C.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),zV=C.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},C.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),UV=C.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},C.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),VV=C.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},C.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),WV=()=>{let[e,t]=C.useState(document.hidden);return C.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},Aw=1,HV=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:n,...r}=e,i=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:Aw++,s=this.toasts.find(l=>l.id===i),o=e.dismissible===void 0?!0:e.dismissible;return s?this.toasts=this.toasts.map(l=>l.id===i?(this.publish({...l,...e,id:i,title:n}),{...l,...e,id:i,dismissible:o,title:n}):l):this.addToast({title:n,...r,dismissible:o,id:i}),i},this.dismiss=e=>(e||this.toasts.forEach(t=>{this.subscribers.forEach(n=>n({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let r=e instanceof Promise?e:e(),i=n!==void 0;return r.then(async s=>{if(qV(s)&&!s.ok){i=!1;let o=typeof t.error=="function"?await t.error(`HTTP error! status: ${s.status}`):t.error,l=typeof t.description=="function"?await t.description(`HTTP error! status: ${s.status}`):t.description;this.create({id:n,type:"error",message:o,description:l})}else if(t.success!==void 0){i=!1;let o=typeof t.success=="function"?await t.success(s):t.success,l=typeof t.description=="function"?await t.description(s):t.description;this.create({id:n,type:"success",message:o,description:l})}}).catch(async s=>{if(t.error!==void 0){i=!1;let o=typeof t.error=="function"?await t.error(s):t.error,l=typeof t.description=="function"?await t.description(s):t.description;this.create({id:n,type:"error",message:o,description:l})}}).finally(()=>{var s;i&&(this.dismiss(n),n=void 0),(s=t.finally)==null||s.call(t)}),n},this.custom=(e,t)=>{let n=(t==null?void 0:t.id)||Aw++;return this.create({jsx:e(n),id:n,...t}),n},this.subscribers=[],this.toasts=[]}},Gr=new HV,GV=(e,t)=>{let n=(t==null?void 0:t.id)||Aw++;return Gr.addToast({title:e,...t,id:n}),n},qV=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",KV=GV,XV=()=>Gr.toasts,pe=Object.assign(KV,{success:Gr.success,info:Gr.info,warning:Gr.warning,error:Gr.error,custom:Gr.custom,message:Gr.message,promise:Gr.promise,dismiss:Gr.dismiss,loading:Gr.loading},{getHistory:XV});function YV(e,{insertAt:t}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}YV(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999}:where([data-sonner-toaster][data-x-position="right"]){right:max(var(--offset),env(safe-area-inset-right))}:where([data-sonner-toaster][data-x-position="left"]){left:max(var(--offset),env(safe-area-inset-left))}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:max(var(--offset),env(safe-area-inset-top))}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:max(var(--offset),env(safe-area-inset-bottom))}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;background:var(--gray1);color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:0;right:0;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount, 0px));transition:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation:swipe-out .2s ease-out forwards}@keyframes swipe-out{0%{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount)));opacity:1}to{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;--mobile-offset: 16px;right:var(--mobile-offset);left:var(--mobile-offset);width:100%}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset)}[data-sonner-toaster][data-y-position=bottom]{bottom:20px}[data-sonner-toaster][data-y-position=top]{top:20px}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset);right:var(--mobile-offset);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} -`);function im(e){return e.label!==void 0}var ZV=3,QV="32px",JV=4e3,e7=356,t7=14,n7=20,r7=200;function i7(...e){return e.filter(Boolean).join(" ")}var s7=e=>{var t,n,r,i,s,o,l,c,u,d;let{invert:f,toast:h,unstyled:p,interacting:g,setHeights:m,visibleToasts:x,heights:b,index:y,toasts:w,expanded:j,removeToast:S,defaultRichColors:N,closeButton:P,style:_,cancelButtonStyle:A,actionButtonStyle:O,className:$="",descriptionClassName:T="",duration:M,position:R,gap:H,loadingIcon:F,expandByDefault:V,classNames:I,icons:L,closeButtonAriaLabel:Z="Close toast",pauseWhenPageIsHidden:ee,cn:re}=e,[me,z]=C.useState(!1),[ae,de]=C.useState(!1),[fe,Ne]=C.useState(!1),[he,ue]=C.useState(!1),[Ee,ie]=C.useState(0),[Xe,K]=C.useState(0),ve=C.useRef(null),Se=C.useRef(null),$e=y===0,E=y+1<=x,D=h.type,U=h.dismissible!==!1,Q=h.className||"",te=h.descriptionClassName||"",Y=C.useMemo(()=>b.findIndex(Je=>Je.toastId===h.id)||0,[b,h.id]),xe=C.useMemo(()=>{var Je;return(Je=h.closeButton)!=null?Je:P},[h.closeButton,P]),je=C.useMemo(()=>h.duration||M||JV,[h.duration,M]),Fe=C.useRef(0),ce=C.useRef(0),ke=C.useRef(0),Be=C.useRef(null),[mt,_t]=R.split("-"),Pt=C.useMemo(()=>b.reduce((Je,X,G)=>G>=Y?Je:Je+X.height,0),[b,Y]),qt=WV(),mn=h.invert||f,Wt=D==="loading";ce.current=C.useMemo(()=>Y*H+Pt,[Y,Pt]),C.useEffect(()=>{z(!0)},[]),C.useLayoutEffect(()=>{if(!me)return;let Je=Se.current,X=Je.style.height;Je.style.height="auto";let G=Je.getBoundingClientRect().height;Je.style.height=X,K(G),m(q=>q.find(k=>k.toastId===h.id)?q.map(k=>k.toastId===h.id?{...k,height:G}:k):[{toastId:h.id,height:G,position:h.position},...q])},[me,h.title,h.description,m,h.id]);let zt=C.useCallback(()=>{de(!0),ie(ce.current),m(Je=>Je.filter(X=>X.toastId!==h.id)),setTimeout(()=>{S(h)},r7)},[h,S,m,ce]);C.useEffect(()=>{if(h.promise&&D==="loading"||h.duration===1/0||h.type==="loading")return;let Je,X=je;return j||g||ee&&qt?(()=>{if(ke.current{var G;(G=h.onAutoClose)==null||G.call(h,h),zt()},X)),()=>clearTimeout(Je)},[j,g,V,h,je,zt,h.promise,D,ee,qt]),C.useEffect(()=>{let Je=Se.current;if(Je){let X=Je.getBoundingClientRect().height;return K(X),m(G=>[{toastId:h.id,height:X,position:h.position},...G]),()=>m(G=>G.filter(q=>q.toastId!==h.id))}},[m,h.id]),C.useEffect(()=>{h.delete&&zt()},[zt,h.delete]);function mr(){return L!=null&&L.loading?C.createElement("div",{className:"sonner-loader","data-visible":D==="loading"},L.loading):F?C.createElement("div",{className:"sonner-loader","data-visible":D==="loading"},F):C.createElement(FV,{visible:D==="loading"})}return C.createElement("li",{"aria-live":h.important?"assertive":"polite","aria-atomic":"true",role:"status",tabIndex:0,ref:Se,className:re($,Q,I==null?void 0:I.toast,(t=h==null?void 0:h.classNames)==null?void 0:t.toast,I==null?void 0:I.default,I==null?void 0:I[D],(n=h==null?void 0:h.classNames)==null?void 0:n[D]),"data-sonner-toast":"","data-rich-colors":(r=h.richColors)!=null?r:N,"data-styled":!(h.jsx||h.unstyled||p),"data-mounted":me,"data-promise":!!h.promise,"data-removed":ae,"data-visible":E,"data-y-position":mt,"data-x-position":_t,"data-index":y,"data-front":$e,"data-swiping":fe,"data-dismissible":U,"data-type":D,"data-invert":mn,"data-swipe-out":he,"data-expanded":!!(j||V&&me),style:{"--index":y,"--toasts-before":y,"--z-index":w.length-y,"--offset":`${ae?Ee:ce.current}px`,"--initial-height":V?"auto":`${Xe}px`,..._,...h.style},onPointerDown:Je=>{Wt||!U||(ve.current=new Date,ie(ce.current),Je.target.setPointerCapture(Je.pointerId),Je.target.tagName!=="BUTTON"&&(Ne(!0),Be.current={x:Je.clientX,y:Je.clientY}))},onPointerUp:()=>{var Je,X,G,q;if(he||!U)return;Be.current=null;let k=Number(((Je=Se.current)==null?void 0:Je.style.getPropertyValue("--swipe-amount").replace("px",""))||0),B=new Date().getTime()-((X=ve.current)==null?void 0:X.getTime()),W=Math.abs(k)/B;if(Math.abs(k)>=n7||W>.11){ie(ce.current),(G=h.onDismiss)==null||G.call(h,h),zt(),ue(!0);return}(q=Se.current)==null||q.style.setProperty("--swipe-amount","0px"),Ne(!1)},onPointerMove:Je=>{var X;if(!Be.current||!U)return;let G=Je.clientY-Be.current.y,q=Je.clientX-Be.current.x,k=(mt==="top"?Math.min:Math.max)(0,G),B=Je.pointerType==="touch"?10:2;Math.abs(k)>B?(X=Se.current)==null||X.style.setProperty("--swipe-amount",`${G}px`):Math.abs(q)>B&&(Be.current=null)}},xe&&!h.jsx?C.createElement("button",{"aria-label":Z,"data-disabled":Wt,"data-close-button":!0,onClick:Wt||!U?()=>{}:()=>{var Je;zt(),(Je=h.onDismiss)==null||Je.call(h,h)},className:re(I==null?void 0:I.closeButton,(i=h==null?void 0:h.classNames)==null?void 0:i.closeButton)},C.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},C.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),C.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))):null,h.jsx||C.isValidElement(h.title)?h.jsx||h.title:C.createElement(C.Fragment,null,D||h.icon||h.promise?C.createElement("div",{"data-icon":"",className:re(I==null?void 0:I.icon,(s=h==null?void 0:h.classNames)==null?void 0:s.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||mr():null,h.type!=="loading"?h.icon||(L==null?void 0:L[D])||DV(D):null):null,C.createElement("div",{"data-content":"",className:re(I==null?void 0:I.content,(o=h==null?void 0:h.classNames)==null?void 0:o.content)},C.createElement("div",{"data-title":"",className:re(I==null?void 0:I.title,(l=h==null?void 0:h.classNames)==null?void 0:l.title)},h.title),h.description?C.createElement("div",{"data-description":"",className:re(T,te,I==null?void 0:I.description,(c=h==null?void 0:h.classNames)==null?void 0:c.description)},h.description):null),C.isValidElement(h.cancel)?h.cancel:h.cancel&&im(h.cancel)?C.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||A,onClick:Je=>{var X,G;im(h.cancel)&&U&&((G=(X=h.cancel).onClick)==null||G.call(X,Je),zt())},className:re(I==null?void 0:I.cancelButton,(u=h==null?void 0:h.classNames)==null?void 0:u.cancelButton)},h.cancel.label):null,C.isValidElement(h.action)?h.action:h.action&&im(h.action)?C.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||O,onClick:Je=>{var X,G;im(h.action)&&(Je.defaultPrevented||((G=(X=h.action).onClick)==null||G.call(X,Je),zt()))},className:re(I==null?void 0:I.actionButton,(d=h==null?void 0:h.classNames)==null?void 0:d.actionButton)},h.action.label):null))};function iA(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}var a7=e=>{let{invert:t,position:n="bottom-right",hotkey:r=["altKey","KeyT"],expand:i,closeButton:s,className:o,offset:l,theme:c="light",richColors:u,duration:d,style:f,visibleToasts:h=ZV,toastOptions:p,dir:g=iA(),gap:m=t7,loadingIcon:x,icons:b,containerAriaLabel:y="Notifications",pauseWhenPageIsHidden:w,cn:j=i7}=e,[S,N]=C.useState([]),P=C.useMemo(()=>Array.from(new Set([n].concat(S.filter(ee=>ee.position).map(ee=>ee.position)))),[S,n]),[_,A]=C.useState([]),[O,$]=C.useState(!1),[T,M]=C.useState(!1),[R,H]=C.useState(c!=="system"?c:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),F=C.useRef(null),V=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),I=C.useRef(null),L=C.useRef(!1),Z=C.useCallback(ee=>{var re;(re=S.find(me=>me.id===ee.id))!=null&&re.delete||Gr.dismiss(ee.id),N(me=>me.filter(({id:z})=>z!==ee.id))},[S]);return C.useEffect(()=>Gr.subscribe(ee=>{if(ee.dismiss){N(re=>re.map(me=>me.id===ee.id?{...me,delete:!0}:me));return}setTimeout(()=>{gM.flushSync(()=>{N(re=>{let me=re.findIndex(z=>z.id===ee.id);return me!==-1?[...re.slice(0,me),{...re[me],...ee},...re.slice(me+1)]:[ee,...re]})})})}),[]),C.useEffect(()=>{if(c!=="system"){H(c);return}c==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?H("dark"):H("light")),typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",({matches:ee})=>{H(ee?"dark":"light")})},[c]),C.useEffect(()=>{S.length<=1&&$(!1)},[S]),C.useEffect(()=>{let ee=re=>{var me,z;r.every(ae=>re[ae]||re.code===ae)&&($(!0),(me=F.current)==null||me.focus()),re.code==="Escape"&&(document.activeElement===F.current||(z=F.current)!=null&&z.contains(document.activeElement))&&$(!1)};return document.addEventListener("keydown",ee),()=>document.removeEventListener("keydown",ee)},[r]),C.useEffect(()=>{if(F.current)return()=>{I.current&&(I.current.focus({preventScroll:!0}),I.current=null,L.current=!1)}},[F.current]),S.length?C.createElement("section",{"aria-label":`${y} ${V}`,tabIndex:-1},P.map((ee,re)=>{var me;let[z,ae]=ee.split("-");return C.createElement("ol",{key:ee,dir:g==="auto"?iA():g,tabIndex:-1,ref:F,className:o,"data-sonner-toaster":!0,"data-theme":R,"data-y-position":z,"data-x-position":ae,style:{"--front-toast-height":`${((me=_[0])==null?void 0:me.height)||0}px`,"--offset":typeof l=="number"?`${l}px`:l||QV,"--width":`${e7}px`,"--gap":`${m}px`,...f},onBlur:de=>{L.current&&!de.currentTarget.contains(de.relatedTarget)&&(L.current=!1,I.current&&(I.current.focus({preventScroll:!0}),I.current=null))},onFocus:de=>{de.target instanceof HTMLElement&&de.target.dataset.dismissible==="false"||L.current||(L.current=!0,I.current=de.relatedTarget)},onMouseEnter:()=>$(!0),onMouseMove:()=>$(!0),onMouseLeave:()=>{T||$(!1)},onPointerDown:de=>{de.target instanceof HTMLElement&&de.target.dataset.dismissible==="false"||M(!0)},onPointerUp:()=>M(!1)},S.filter(de=>!de.position&&re===0||de.position===ee).map((de,fe)=>{var Ne,he;return C.createElement(s7,{key:de.id,icons:b,index:fe,toast:de,defaultRichColors:u,duration:(Ne=p==null?void 0:p.duration)!=null?Ne:d,className:p==null?void 0:p.className,descriptionClassName:p==null?void 0:p.descriptionClassName,invert:t,visibleToasts:h,closeButton:(he=p==null?void 0:p.closeButton)!=null?he:s,interacting:T,position:ee,style:p==null?void 0:p.style,unstyled:p==null?void 0:p.unstyled,classNames:p==null?void 0:p.classNames,cancelButtonStyle:p==null?void 0:p.cancelButtonStyle,actionButtonStyle:p==null?void 0:p.actionButtonStyle,removeToast:Z,toasts:S.filter(ue=>ue.position==de.position),heights:_.filter(ue=>ue.position==de.position),setHeights:A,expandByDefault:i,gap:m,loadingIcon:x,expanded:O,pauseWhenPageIsHidden:w,cn:j})}))})):null};const o7=({...e})=>{const{theme:t="system"}=RV();return a.jsx(a7,{theme:t,className:"toaster group",position:"bottom-right",visibleToasts:2,closeButton:!0,toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg group-[.toaster]:pr-8",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",closeButton:"group-[.toast]:absolute group-[.toast]:left-3 group-[.toast]:top-3 group-[.toast]:h-5 group-[.toast]:w-5 group-[.toast]:rounded-md group-[.toast]:p-1 group-[.toast]:text-foreground/70 group-[.toast]:opacity-100 group-[.toast]:transition-opacity hover:group-[.toast]:text-foreground hover:group-[.toast]:bg-muted/50 focus:group-[.toast]:opacity-100 focus:group-[.toast]:outline-none focus:group-[.toast]:ring-1 focus:group-[.toast]:ring-ring"}},...e})};function Te(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function l7(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Ey(...e){return t=>e.forEach(n=>l7(n,t))}function dt(...e){return v.useCallback(Ey(...e),e)}function c7(e,t){const n=v.createContext(t),r=s=>{const{children:o,...l}=s,c=v.useMemo(()=>l,Object.values(l));return a.jsx(n.Provider,{value:c,children:o})};r.displayName=e+"Provider";function i(s){const o=v.useContext(n);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,i]}function Er(e,t=[]){let n=[];function r(s,o){const l=v.createContext(o),c=n.length;n=[...n,o];const u=f=>{var b;const{scope:h,children:p,...g}=f,m=((b=h==null?void 0:h[e])==null?void 0:b[c])||l,x=v.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:x,children:p})};u.displayName=s+"Provider";function d(f,h){var m;const p=((m=h==null?void 0:h[e])==null?void 0:m[c])||l,g=v.useContext(p);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[u,d]}const i=()=>{const s=n.map(o=>v.createContext(o));return function(l){const c=(l==null?void 0:l[e])||s;return v.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return i.scopeName=e,[r,u7(i,...t)]}function u7(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...l,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var ca=v.forwardRef((e,t)=>{const{children:n,...r}=e,i=v.Children.toArray(n),s=i.find(d7);if(s){const o=s.props.children,l=i.map(c=>c===s?v.Children.count(o)>1?v.Children.only(null):v.isValidElement(o)?o.props.children:null:c);return a.jsx(Ew,{...r,ref:t,children:v.isValidElement(o)?v.cloneElement(o,void 0,l):null})}return a.jsx(Ew,{...r,ref:t,children:n})});ca.displayName="Slot";var Ew=v.forwardRef((e,t)=>{const{children:n,...r}=e;if(v.isValidElement(n)){const i=h7(n);return v.cloneElement(n,{...f7(r,n.props),ref:t?Ey(t,i):i})}return v.Children.count(n)>1?v.Children.only(null):null});Ew.displayName="SlotClone";var JS=({children:e})=>a.jsx(a.Fragment,{children:e});function d7(e){return v.isValidElement(e)&&e.type===JS}function f7(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...l)=>{s(...l),i(...l)}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function h7(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var p7=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],qe=p7.reduce((e,t)=>{const n=v.forwardRef((r,i)=>{const{asChild:s,...o}=r,l=s?ca:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(l,{...o,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function yM(e,t){e&&Vi.flushSync(()=>e.dispatchEvent(t))}function $n(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function m7(e,t=globalThis==null?void 0:globalThis.document){const n=$n(e);v.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var g7="DismissableLayer",Ow="dismissableLayer.update",v7="dismissableLayer.pointerDownOutside",y7="dismissableLayer.focusOutside",sA,xM=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),dp=v.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:l,...c}=e,u=v.useContext(xM),[d,f]=v.useState(null),h=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=v.useState({}),g=dt(t,P=>f(P)),m=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),b=m.indexOf(x),y=d?m.indexOf(d):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,j=y>=b,S=w7(P=>{const _=P.target,A=[...u.branches].some(O=>O.contains(_));!j||A||(i==null||i(P),o==null||o(P),P.defaultPrevented||l==null||l())},h),N=j7(P=>{const _=P.target;[...u.branches].some(O=>O.contains(_))||(s==null||s(P),o==null||o(P),P.defaultPrevented||l==null||l())},h);return m7(P=>{y===u.layers.size-1&&(r==null||r(P),!P.defaultPrevented&&l&&(P.preventDefault(),l()))},h),v.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(sA=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),aA(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=sA)}},[d,h,n,u]),v.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),aA())},[d,u]),v.useEffect(()=>{const P=()=>p({});return document.addEventListener(Ow,P),()=>document.removeEventListener(Ow,P)},[]),a.jsx(qe.div,{...c,ref:g,style:{pointerEvents:w?j?"auto":"none":void 0,...e.style},onFocusCapture:Te(e.onFocusCapture,N.onFocusCapture),onBlurCapture:Te(e.onBlurCapture,N.onBlurCapture),onPointerDownCapture:Te(e.onPointerDownCapture,S.onPointerDownCapture)})});dp.displayName=g7;var x7="DismissableLayerBranch",b7=v.forwardRef((e,t)=>{const n=v.useContext(xM),r=v.useRef(null),i=dt(t,r);return v.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),a.jsx(qe.div,{...e,ref:i})});b7.displayName=x7;function w7(e,t=globalThis==null?void 0:globalThis.document){const n=$n(e),r=v.useRef(!1),i=v.useRef(()=>{});return v.useEffect(()=>{const s=l=>{if(l.target&&!r.current){let c=function(){bM(v7,n,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",i.current),i.current=c,t.addEventListener("click",i.current,{once:!0})):c()}else t.removeEventListener("click",i.current);r.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",s),t.removeEventListener("click",i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function j7(e,t=globalThis==null?void 0:globalThis.document){const n=$n(e),r=v.useRef(!1);return v.useEffect(()=>{const i=s=>{s.target&&!r.current&&bM(y7,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",i),()=>t.removeEventListener("focusin",i)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function aA(){const e=new CustomEvent(Ow);document.dispatchEvent(e)}function bM(e,t,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?yM(i,s):i.dispatchEvent(s)}var Jn=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{},S7=h$.useId||(()=>{}),N7=0;function wi(e){const[t,n]=v.useState(S7());return Jn(()=>{n(r=>r??String(N7++))},[e]),t?`radix-${t}`:""}const _7=["top","right","bottom","left"],go=Math.min,Yr=Math.max,bg=Math.round,sm=Math.floor,vo=e=>({x:e,y:e}),P7={left:"right",right:"left",bottom:"top",top:"bottom"},C7={start:"end",end:"start"};function kw(e,t,n){return Yr(e,go(t,n))}function ua(e,t){return typeof e=="function"?e(t):e}function da(e){return e.split("-")[0]}function Uu(e){return e.split("-")[1]}function eN(e){return e==="x"?"y":"x"}function tN(e){return e==="y"?"height":"width"}function yo(e){return["top","bottom"].includes(da(e))?"y":"x"}function nN(e){return eN(yo(e))}function A7(e,t,n){n===void 0&&(n=!1);const r=Uu(e),i=nN(e),s=tN(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=wg(o)),[o,wg(o)]}function E7(e){const t=wg(e);return[Tw(e),t,Tw(t)]}function Tw(e){return e.replace(/start|end/g,t=>C7[t])}function O7(e,t,n){const r=["left","right"],i=["right","left"],s=["top","bottom"],o=["bottom","top"];switch(e){case"top":case"bottom":return n?t?i:r:t?r:i;case"left":case"right":return t?s:o;default:return[]}}function k7(e,t,n,r){const i=Uu(e);let s=O7(da(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(Tw)))),s}function wg(e){return e.replace(/left|right|bottom|top/g,t=>P7[t])}function T7(e){return{top:0,right:0,bottom:0,left:0,...e}}function wM(e){return typeof e!="number"?T7(e):{top:e,right:e,bottom:e,left:e}}function jg(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function oA(e,t,n){let{reference:r,floating:i}=e;const s=yo(t),o=nN(t),l=tN(o),c=da(t),u=s==="y",d=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,h=r[l]/2-i[l]/2;let p;switch(c){case"top":p={x:d,y:r.y-i.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-i.width,y:f};break;default:p={x:r.x,y:r.y}}switch(Uu(t)){case"start":p[o]-=h*(n&&u?-1:1);break;case"end":p[o]+=h*(n&&u?-1:1);break}return p}const $7=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,l=s.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t));let u=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:d,y:f}=oA(u,r,c),h=r,p={},g=0;for(let m=0;m({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:o,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=ua(e,t)||{};if(u==null)return{};const f=wM(d),h={x:n,y:r},p=nN(i),g=tN(p),m=await o.getDimensions(u),x=p==="y",b=x?"top":"left",y=x?"bottom":"right",w=x?"clientHeight":"clientWidth",j=s.reference[g]+s.reference[p]-h[p]-s.floating[g],S=h[p]-s.reference[p],N=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let P=N?N[w]:0;(!P||!await(o.isElement==null?void 0:o.isElement(N)))&&(P=l.floating[w]||s.floating[g]);const _=j/2-S/2,A=P/2-m[g]/2-1,O=go(f[b],A),$=go(f[y],A),T=O,M=P-m[g]-$,R=P/2-m[g]/2+_,H=kw(T,R,M),F=!c.arrow&&Uu(i)!=null&&R!==H&&s.reference[g]/2-(RR<=0)){var $,T;const R=((($=s.flip)==null?void 0:$.index)||0)+1,H=P[R];if(H)return{data:{index:R,overflows:O},reset:{placement:H}};let F=(T=O.filter(V=>V.overflows[0]<=0).sort((V,I)=>V.overflows[1]-I.overflows[1])[0])==null?void 0:T.placement;if(!F)switch(p){case"bestFit":{var M;const V=(M=O.filter(I=>{if(N){const L=yo(I.placement);return L===y||L==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(L=>L>0).reduce((L,Z)=>L+Z,0)]).sort((I,L)=>I[1]-L[1])[0])==null?void 0:M[0];V&&(F=V);break}case"initialPlacement":F=l;break}if(i!==F)return{reset:{placement:F}}}return{}}}};function lA(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function cA(e){return _7.some(t=>e[t]>=0)}const R7=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...i}=ua(e,t);switch(r){case"referenceHidden":{const s=await Uf(t,{...i,elementContext:"reference"}),o=lA(s,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:cA(o)}}}case"escaped":{const s=await Uf(t,{...i,altBoundary:!0}),o=lA(s,n.floating);return{data:{escapedOffsets:o,escaped:cA(o)}}}default:return{}}}}};async function D7(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=da(n),l=Uu(n),c=yo(n)==="y",u=["left","top"].includes(o)?-1:1,d=s&&c?-1:1,f=ua(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof g=="number"&&(p=l==="end"?g*-1:g),c?{x:p*d,y:h*u}:{x:h*u,y:p*d}}const L7=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:o,middlewareData:l}=t,c=await D7(t,e);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:s+c.y,data:{...c,placement:o}}}}},F7=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:s=!0,crossAxis:o=!1,limiter:l={fn:x=>{let{x:b,y}=x;return{x:b,y}}},...c}=ua(e,t),u={x:n,y:r},d=await Uf(t,c),f=yo(da(i)),h=eN(f);let p=u[h],g=u[f];if(s){const x=h==="y"?"top":"left",b=h==="y"?"bottom":"right",y=p+d[x],w=p-d[b];p=kw(y,p,w)}if(o){const x=f==="y"?"top":"left",b=f==="y"?"bottom":"right",y=g+d[x],w=g-d[b];g=kw(y,g,w)}const m=l.fn({...t,[h]:p,[f]:g});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[h]:s,[f]:o}}}}}},B7=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:s,middlewareData:o}=t,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=ua(e,t),d={x:n,y:r},f=yo(i),h=eN(f);let p=d[h],g=d[f];const m=ua(l,t),x=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(c){const w=h==="y"?"height":"width",j=s.reference[h]-s.floating[w]+x.mainAxis,S=s.reference[h]+s.reference[w]-x.mainAxis;pS&&(p=S)}if(u){var b,y;const w=h==="y"?"width":"height",j=["top","left"].includes(da(i)),S=s.reference[f]-s.floating[w]+(j&&((b=o.offset)==null?void 0:b[f])||0)+(j?0:x.crossAxis),N=s.reference[f]+s.reference[w]+(j?0:((y=o.offset)==null?void 0:y[f])||0)-(j?x.crossAxis:0);gN&&(g=N)}return{[h]:p,[f]:g}}}},z7=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:s,platform:o,elements:l}=t,{apply:c=()=>{},...u}=ua(e,t),d=await Uf(t,u),f=da(i),h=Uu(i),p=yo(i)==="y",{width:g,height:m}=s.floating;let x,b;f==="top"||f==="bottom"?(x=f,b=h===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(b=f,x=h==="end"?"top":"bottom");const y=m-d.top-d.bottom,w=g-d.left-d.right,j=go(m-d[x],y),S=go(g-d[b],w),N=!t.middlewareData.shift;let P=j,_=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(_=w),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(P=y),N&&!h){const O=Yr(d.left,0),$=Yr(d.right,0),T=Yr(d.top,0),M=Yr(d.bottom,0);p?_=g-2*(O!==0||$!==0?O+$:Yr(d.left,d.right)):P=m-2*(T!==0||M!==0?T+M:Yr(d.top,d.bottom))}await c({...t,availableWidth:_,availableHeight:P});const A=await o.getDimensions(l.floating);return g!==A.width||m!==A.height?{reset:{rects:!0}}:{}}}};function Oy(){return typeof window<"u"}function Vu(e){return jM(e)?(e.nodeName||"").toLowerCase():"#document"}function ei(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ts(e){var t;return(t=(jM(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function jM(e){return Oy()?e instanceof Node||e instanceof ei(e).Node:!1}function Qi(e){return Oy()?e instanceof Element||e instanceof ei(e).Element:!1}function Cs(e){return Oy()?e instanceof HTMLElement||e instanceof ei(e).HTMLElement:!1}function uA(e){return!Oy()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ei(e).ShadowRoot}function fp(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Ji(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(i)}function U7(e){return["table","td","th"].includes(Vu(e))}function ky(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function rN(e){const t=iN(),n=Qi(e)?Ji(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function V7(e){let t=xo(e);for(;Cs(t)&&!iu(t);){if(rN(t))return t;if(ky(t))return null;t=xo(t)}return null}function iN(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function iu(e){return["html","body","#document"].includes(Vu(e))}function Ji(e){return ei(e).getComputedStyle(e)}function Ty(e){return Qi(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function xo(e){if(Vu(e)==="html")return e;const t=e.assignedSlot||e.parentNode||uA(e)&&e.host||Ts(e);return uA(t)?t.host:t}function SM(e){const t=xo(e);return iu(t)?e.ownerDocument?e.ownerDocument.body:e.body:Cs(t)&&fp(t)?t:SM(t)}function Vf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=SM(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=ei(i);if(s){const l=$w(o);return t.concat(o,o.visualViewport||[],fp(i)?i:[],l&&n?Vf(l):[])}return t.concat(i,Vf(i,[],n))}function $w(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function NM(e){const t=Ji(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Cs(e),s=i?e.offsetWidth:n,o=i?e.offsetHeight:r,l=bg(n)!==s||bg(r)!==o;return l&&(n=s,r=o),{width:n,height:r,$:l}}function sN(e){return Qi(e)?e:e.contextElement}function Oc(e){const t=sN(e);if(!Cs(t))return vo(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=NM(t);let o=(s?bg(n.width):n.width)/r,l=(s?bg(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const W7=vo(0);function _M(e){const t=ei(e);return!iN()||!t.visualViewport?W7:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function H7(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ei(e)?!1:t}function Sl(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=sN(e);let o=vo(1);t&&(r?Qi(r)&&(o=Oc(r)):o=Oc(e));const l=H7(s,n,r)?_M(s):vo(0);let c=(i.left+l.x)/o.x,u=(i.top+l.y)/o.y,d=i.width/o.x,f=i.height/o.y;if(s){const h=ei(s),p=r&&Qi(r)?ei(r):r;let g=h,m=$w(g);for(;m&&r&&p!==g;){const x=Oc(m),b=m.getBoundingClientRect(),y=Ji(m),w=b.left+(m.clientLeft+parseFloat(y.paddingLeft))*x.x,j=b.top+(m.clientTop+parseFloat(y.paddingTop))*x.y;c*=x.x,u*=x.y,d*=x.x,f*=x.y,c+=w,u+=j,g=ei(m),m=$w(g)}}return jg({width:d,height:f,x:c,y:u})}function G7(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=Ts(r),l=t?ky(t.floating):!1;if(r===o||l&&s)return n;let c={scrollLeft:0,scrollTop:0},u=vo(1);const d=vo(0),f=Cs(r);if((f||!f&&!s)&&((Vu(r)!=="body"||fp(o))&&(c=Ty(r)),Cs(r))){const h=Sl(r);u=Oc(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x,y:n.y*u.y-c.scrollTop*u.y+d.y}}function q7(e){return Array.from(e.getClientRects())}function Iw(e,t){const n=Ty(e).scrollLeft;return t?t.left+n:Sl(Ts(e)).left+n}function K7(e){const t=Ts(e),n=Ty(e),r=e.ownerDocument.body,i=Yr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Yr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Iw(e);const l=-n.scrollTop;return Ji(r).direction==="rtl"&&(o+=Yr(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:l}}function X7(e,t){const n=ei(e),r=Ts(e),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,l=0,c=0;if(i){s=i.width,o=i.height;const u=iN();(!u||u&&t==="fixed")&&(l=i.offsetLeft,c=i.offsetTop)}return{width:s,height:o,x:l,y:c}}function Y7(e,t){const n=Sl(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=Cs(e)?Oc(e):vo(1),o=e.clientWidth*s.x,l=e.clientHeight*s.y,c=i*s.x,u=r*s.y;return{width:o,height:l,x:c,y:u}}function dA(e,t,n){let r;if(t==="viewport")r=X7(e,n);else if(t==="document")r=K7(Ts(e));else if(Qi(t))r=Y7(t,n);else{const i=_M(e);r={...t,x:t.x-i.x,y:t.y-i.y}}return jg(r)}function PM(e,t){const n=xo(e);return n===t||!Qi(n)||iu(n)?!1:Ji(n).position==="fixed"||PM(n,t)}function Z7(e,t){const n=t.get(e);if(n)return n;let r=Vf(e,[],!1).filter(l=>Qi(l)&&Vu(l)!=="body"),i=null;const s=Ji(e).position==="fixed";let o=s?xo(e):e;for(;Qi(o)&&!iu(o);){const l=Ji(o),c=rN(o);!c&&l.position==="fixed"&&(i=null),(s?!c&&!i:!c&&l.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||fp(o)&&!c&&PM(e,o))?r=r.filter(d=>d!==o):i=l,o=xo(o)}return t.set(e,r),r}function Q7(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?ky(t)?[]:Z7(t,this._c):[].concat(n),r],l=o[0],c=o.reduce((u,d)=>{const f=dA(t,d,i);return u.top=Yr(f.top,u.top),u.right=go(f.right,u.right),u.bottom=go(f.bottom,u.bottom),u.left=Yr(f.left,u.left),u},dA(t,l,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function J7(e){const{width:t,height:n}=NM(e);return{width:t,height:n}}function e9(e,t,n){const r=Cs(t),i=Ts(t),s=n==="fixed",o=Sl(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=vo(0);if(r||!r&&!s)if((Vu(t)!=="body"||fp(i))&&(l=Ty(t)),r){const p=Sl(t,!0,s,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else i&&(c.x=Iw(i));let u=0,d=0;if(i&&!r&&!s){const p=i.getBoundingClientRect();d=p.top+l.scrollTop,u=p.left+l.scrollLeft-Iw(i,p)}const f=o.left+l.scrollLeft-c.x-u,h=o.top+l.scrollTop-c.y-d;return{x:f,y:h,width:o.width,height:o.height}}function R0(e){return Ji(e).position==="static"}function fA(e,t){if(!Cs(e)||Ji(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ts(e)===n&&(n=n.ownerDocument.body),n}function CM(e,t){const n=ei(e);if(ky(e))return n;if(!Cs(e)){let i=xo(e);for(;i&&!iu(i);){if(Qi(i)&&!R0(i))return i;i=xo(i)}return n}let r=fA(e,t);for(;r&&U7(r)&&R0(r);)r=fA(r,t);return r&&iu(r)&&R0(r)&&!rN(r)?n:r||V7(e)||n}const t9=async function(e){const t=this.getOffsetParent||CM,n=this.getDimensions,r=await n(e.floating);return{reference:e9(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function n9(e){return Ji(e).direction==="rtl"}const r9={convertOffsetParentRelativeRectToViewportRelativeRect:G7,getDocumentElement:Ts,getClippingRect:Q7,getOffsetParent:CM,getElementRects:t9,getClientRects:q7,getDimensions:J7,getScale:Oc,isElement:Qi,isRTL:n9};function i9(e,t){let n=null,r;const i=Ts(e);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function o(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),s();const{left:u,top:d,width:f,height:h}=e.getBoundingClientRect();if(l||t(),!f||!h)return;const p=sm(d),g=sm(i.clientWidth-(u+f)),m=sm(i.clientHeight-(d+h)),x=sm(u),y={rootMargin:-p+"px "+-g+"px "+-m+"px "+-x+"px",threshold:Yr(0,go(1,c))||1};let w=!0;function j(S){const N=S[0].intersectionRatio;if(N!==c){if(!w)return o();N?o(!1,N):r=setTimeout(()=>{o(!1,1e-7)},1e3)}w=!1}try{n=new IntersectionObserver(j,{...y,root:i.ownerDocument})}catch{n=new IntersectionObserver(j,y)}n.observe(e)}return o(!0),s}function s9(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=sN(e),d=i||s?[...u?Vf(u):[],...Vf(t)]:[];d.forEach(b=>{i&&b.addEventListener("scroll",n,{passive:!0}),s&&b.addEventListener("resize",n)});const f=u&&l?i9(u,n):null;let h=-1,p=null;o&&(p=new ResizeObserver(b=>{let[y]=b;y&&y.target===u&&p&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(t)})),n()}),u&&!c&&p.observe(u),p.observe(t));let g,m=c?Sl(e):null;c&&x();function x(){const b=Sl(e);m&&(b.x!==m.x||b.y!==m.y||b.width!==m.width||b.height!==m.height)&&n(),m=b,g=requestAnimationFrame(x)}return n(),()=>{var b;d.forEach(y=>{i&&y.removeEventListener("scroll",n),s&&y.removeEventListener("resize",n)}),f==null||f(),(b=p)==null||b.disconnect(),p=null,c&&cancelAnimationFrame(g)}}const a9=L7,o9=F7,l9=M7,c9=z7,u9=R7,hA=I7,d9=B7,f9=(e,t,n)=>{const r=new Map,i={platform:r9,...n},s={...i.platform,_c:r};return $7(e,t,{...i,platform:s})};var zm=typeof document<"u"?v.useLayoutEffect:v.useEffect;function Sg(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Sg(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&e.$$typeof)&&!Sg(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function AM(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function pA(e,t){const n=AM(e);return Math.round(t*n)/n}function D0(e){const t=v.useRef(e);return zm(()=>{t.current=e}),t}function h9(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,f]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=v.useState(r);Sg(h,r)||p(r);const[g,m]=v.useState(null),[x,b]=v.useState(null),y=v.useCallback(I=>{I!==N.current&&(N.current=I,m(I))},[]),w=v.useCallback(I=>{I!==P.current&&(P.current=I,b(I))},[]),j=s||g,S=o||x,N=v.useRef(null),P=v.useRef(null),_=v.useRef(d),A=c!=null,O=D0(c),$=D0(i),T=D0(u),M=v.useCallback(()=>{if(!N.current||!P.current)return;const I={placement:t,strategy:n,middleware:h};$.current&&(I.platform=$.current),f9(N.current,P.current,I).then(L=>{const Z={...L,isPositioned:T.current!==!1};R.current&&!Sg(_.current,Z)&&(_.current=Z,Vi.flushSync(()=>{f(Z)}))})},[h,t,n,$,T]);zm(()=>{u===!1&&_.current.isPositioned&&(_.current.isPositioned=!1,f(I=>({...I,isPositioned:!1})))},[u]);const R=v.useRef(!1);zm(()=>(R.current=!0,()=>{R.current=!1}),[]),zm(()=>{if(j&&(N.current=j),S&&(P.current=S),j&&S){if(O.current)return O.current(j,S,M);M()}},[j,S,M,O,A]);const H=v.useMemo(()=>({reference:N,floating:P,setReference:y,setFloating:w}),[y,w]),F=v.useMemo(()=>({reference:j,floating:S}),[j,S]),V=v.useMemo(()=>{const I={position:n,left:0,top:0};if(!F.floating)return I;const L=pA(F.floating,d.x),Z=pA(F.floating,d.y);return l?{...I,transform:"translate("+L+"px, "+Z+"px)",...AM(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:L,top:Z}},[n,l,F.floating,d.x,d.y]);return v.useMemo(()=>({...d,update:M,refs:H,elements:F,floatingStyles:V}),[d,M,H,F,V])}const p9=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?hA({element:r.current,padding:i}).fn(n):{}:r?hA({element:r,padding:i}).fn(n):{}}}},m9=(e,t)=>({...a9(e),options:[e,t]}),g9=(e,t)=>({...o9(e),options:[e,t]}),v9=(e,t)=>({...d9(e),options:[e,t]}),y9=(e,t)=>({...l9(e),options:[e,t]}),x9=(e,t)=>({...c9(e),options:[e,t]}),b9=(e,t)=>({...u9(e),options:[e,t]}),w9=(e,t)=>({...p9(e),options:[e,t]});var j9="Arrow",EM=v.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...s}=e;return a.jsx(qe.svg,{...s,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});EM.displayName=j9;var S9=EM;function N9(e,t=[]){let n=[];function r(s,o){const l=v.createContext(o),c=n.length;n=[...n,o];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[e][c])||l,x=v.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:x,children:p})}function d(f,h){const p=(h==null?void 0:h[e][c])||l,g=v.useContext(p);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return u.displayName=s+"Provider",[u,d]}const i=()=>{const s=n.map(o=>v.createContext(o));return function(l){const c=(l==null?void 0:l[e])||s;return v.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return i.scopeName=e,[r,_9(i,...t)]}function _9(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...l,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}function hp(e){const[t,n]=v.useState(void 0);return Jn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,l;if("borderBoxSize"in s){const c=s.borderBoxSize,u=Array.isArray(c)?c[0]:c;o=u.inlineSize,l=u.blockSize}else o=e.offsetWidth,l=e.offsetHeight;n({width:o,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var aN="Popper",[OM,Wu]=N9(aN),[P9,kM]=OM(aN),TM=e=>{const{__scopePopper:t,children:n}=e,[r,i]=v.useState(null);return a.jsx(P9,{scope:t,anchor:r,onAnchorChange:i,children:n})};TM.displayName=aN;var $M="PopperAnchor",IM=v.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,s=kM($M,n),o=v.useRef(null),l=dt(t,o);return v.useEffect(()=>{s.onAnchorChange((r==null?void 0:r.current)||o.current)}),r?null:a.jsx(qe.div,{...i,ref:l})});IM.displayName=$M;var oN="PopperContent",[C9,A9]=OM(oN),MM=v.forwardRef((e,t)=>{var fe,Ne,he,ue,Ee,ie;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:g,...m}=e,x=kM(oN,n),[b,y]=v.useState(null),w=dt(t,Xe=>y(Xe)),[j,S]=v.useState(null),N=hp(j),P=(N==null?void 0:N.width)??0,_=(N==null?void 0:N.height)??0,A=r+(s!=="center"?"-"+s:""),O=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},$=Array.isArray(u)?u:[u],T=$.length>0,M={padding:O,boundary:$.filter(O9),altBoundary:T},{refs:R,floatingStyles:H,placement:F,isPositioned:V,middlewareData:I}=h9({strategy:"fixed",placement:A,whileElementsMounted:(...Xe)=>s9(...Xe,{animationFrame:p==="always"}),elements:{reference:x.anchor},middleware:[m9({mainAxis:i+_,alignmentAxis:o}),c&&g9({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?v9():void 0,...M}),c&&y9({...M}),x9({...M,apply:({elements:Xe,rects:K,availableWidth:ve,availableHeight:Se})=>{const{width:$e,height:E}=K.reference,D=Xe.floating.style;D.setProperty("--radix-popper-available-width",`${ve}px`),D.setProperty("--radix-popper-available-height",`${Se}px`),D.setProperty("--radix-popper-anchor-width",`${$e}px`),D.setProperty("--radix-popper-anchor-height",`${E}px`)}}),j&&w9({element:j,padding:l}),k9({arrowWidth:P,arrowHeight:_}),h&&b9({strategy:"referenceHidden",...M})]}),[L,Z]=LM(F),ee=$n(g);Jn(()=>{V&&(ee==null||ee())},[V,ee]);const re=(fe=I.arrow)==null?void 0:fe.x,me=(Ne=I.arrow)==null?void 0:Ne.y,z=((he=I.arrow)==null?void 0:he.centerOffset)!==0,[ae,de]=v.useState();return Jn(()=>{b&&de(window.getComputedStyle(b).zIndex)},[b]),a.jsx("div",{ref:R.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:V?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ae,"--radix-popper-transform-origin":[(ue=I.transformOrigin)==null?void 0:ue.x,(Ee=I.transformOrigin)==null?void 0:Ee.y].join(" "),...((ie=I.hide)==null?void 0:ie.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:a.jsx(C9,{scope:n,placedSide:L,onArrowChange:S,arrowX:re,arrowY:me,shouldHideArrow:z,children:a.jsx(qe.div,{"data-side":L,"data-align":Z,...m,ref:w,style:{...m.style,animation:V?void 0:"none"}})})})});MM.displayName=oN;var RM="PopperArrow",E9={top:"bottom",right:"left",bottom:"top",left:"right"},DM=v.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,s=A9(RM,r),o=E9[s.placedSide];return a.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:a.jsx(S9,{...i,ref:n,style:{...i.style,display:"block"}})})});DM.displayName=RM;function O9(e){return e!==null}var k9=e=>({name:"transformOrigin",options:e,fn(t){var x,b,y;const{placement:n,rects:r,middlewareData:i}=t,o=((x=i.arrow)==null?void 0:x.centerOffset)!==0,l=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[u,d]=LM(n),f={start:"0%",center:"50%",end:"100%"}[d],h=(((b=i.arrow)==null?void 0:b.x)??0)+l/2,p=(((y=i.arrow)==null?void 0:y.y)??0)+c/2;let g="",m="";return u==="bottom"?(g=o?f:`${h}px`,m=`${-c}px`):u==="top"?(g=o?f:`${h}px`,m=`${r.floating.height+c}px`):u==="right"?(g=`${-c}px`,m=o?f:`${p}px`):u==="left"&&(g=`${r.floating.width+c}px`,m=o?f:`${p}px`),{data:{x:g,y:m}}}});function LM(e){const[t,n="center"]=e.split("-");return[t,n]}var FM=TM,lN=IM,cN=MM,uN=DM,T9="Portal",$y=v.forwardRef((e,t)=>{var l;const{container:n,...r}=e,[i,s]=v.useState(!1);Jn(()=>s(!0),[]);const o=n||i&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?gM.createPortal(a.jsx(qe.div,{...r,ref:t}),o):null});$y.displayName=T9;function $9(e,t){return v.useReducer((n,r)=>t[n][r]??n,e)}var er=e=>{const{present:t,children:n}=e,r=I9(t),i=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),s=dt(r.ref,M9(i));return typeof n=="function"||r.isPresent?v.cloneElement(i,{ref:s}):null};er.displayName="Presence";function I9(e){const[t,n]=v.useState(),r=v.useRef({}),i=v.useRef(e),s=v.useRef("none"),o=e?"mounted":"unmounted",[l,c]=$9(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const u=am(r.current);s.current=l==="mounted"?u:"none"},[l]),Jn(()=>{const u=r.current,d=i.current;if(d!==e){const h=s.current,p=am(u);e?c("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&h!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,c]),Jn(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=p=>{const m=am(r.current).includes(p.animationName);if(p.target===t&&m&&(c("ANIMATION_END"),!i.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},h=p=>{p.target===t&&(s.current=am(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:v.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function am(e){return(e==null?void 0:e.animationName)||"none"}function M9(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function ii({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,i]=R9({defaultProp:t,onChange:n}),s=e!==void 0,o=s?e:r,l=$n(n),c=v.useCallback(u=>{if(s){const f=typeof u=="function"?u(e):u;f!==e&&l(f)}else i(u)},[s,e,i,l]);return[o,c]}function R9({defaultProp:e,onChange:t}){const n=v.useState(e),[r]=n,i=v.useRef(r),s=$n(t);return v.useEffect(()=>{i.current!==r&&(s(r),i.current=r)},[r,i,s]),n}var D9="VisuallyHidden",dN=v.forwardRef((e,t)=>a.jsx(qe.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));dN.displayName=D9;var L9=dN,[Iy,mOe]=Er("Tooltip",[Wu]),fN=Wu(),BM="TooltipProvider",F9=700,mA="tooltip.open",[B9,zM]=Iy(BM),UM=e=>{const{__scopeTooltip:t,delayDuration:n=F9,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:s}=e,[o,l]=v.useState(!0),c=v.useRef(!1),u=v.useRef(0);return v.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),a.jsx(B9,{scope:t,isOpenDelayed:o,delayDuration:n,onOpen:v.useCallback(()=>{window.clearTimeout(u.current),l(!1)},[]),onClose:v.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>l(!0),r)},[r]),isPointerInTransitRef:c,onPointerInTransitChange:v.useCallback(d=>{c.current=d},[]),disableHoverableContent:i,children:s})};UM.displayName=BM;var VM="Tooltip",[gOe,My]=Iy(VM),Mw="TooltipTrigger",z9=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=My(Mw,n),s=zM(Mw,n),o=fN(n),l=v.useRef(null),c=dt(t,l,i.onTriggerChange),u=v.useRef(!1),d=v.useRef(!1),f=v.useCallback(()=>u.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),a.jsx(lN,{asChild:!0,...o,children:a.jsx(qe.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:c,onPointerMove:Te(e.onPointerMove,h=>{h.pointerType!=="touch"&&!d.current&&!s.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:Te(e.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:Te(e.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Te(e.onFocus,()=>{u.current||i.onOpen()}),onBlur:Te(e.onBlur,i.onClose),onClick:Te(e.onClick,i.onClose)})})});z9.displayName=Mw;var U9="TooltipPortal",[vOe,V9]=Iy(U9,{forceMount:void 0}),su="TooltipContent",WM=v.forwardRef((e,t)=>{const n=V9(su,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...s}=e,o=My(su,e.__scopeTooltip);return a.jsx(er,{present:r||o.open,children:o.disableHoverableContent?a.jsx(HM,{side:i,...s,ref:t}):a.jsx(W9,{side:i,...s,ref:t})})}),W9=v.forwardRef((e,t)=>{const n=My(su,e.__scopeTooltip),r=zM(su,e.__scopeTooltip),i=v.useRef(null),s=dt(t,i),[o,l]=v.useState(null),{trigger:c,onClose:u}=n,d=i.current,{onPointerInTransitChange:f}=r,h=v.useCallback(()=>{l(null),f(!1)},[f]),p=v.useCallback((g,m)=>{const x=g.currentTarget,b={x:g.clientX,y:g.clientY},y=K9(b,x.getBoundingClientRect()),w=X9(b,y),j=Y9(m.getBoundingClientRect()),S=Q9([...w,...j]);l(S),f(!0)},[f]);return v.useEffect(()=>()=>h(),[h]),v.useEffect(()=>{if(c&&d){const g=x=>p(x,d),m=x=>p(x,c);return c.addEventListener("pointerleave",g),d.addEventListener("pointerleave",m),()=>{c.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",m)}}},[c,d,p,h]),v.useEffect(()=>{if(o){const g=m=>{const x=m.target,b={x:m.clientX,y:m.clientY},y=(c==null?void 0:c.contains(x))||(d==null?void 0:d.contains(x)),w=!Z9(b,o);y?h():w&&(h(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,d,o,u,h]),a.jsx(HM,{...e,ref:s})}),[H9,G9]=Iy(VM,{isInside:!1}),HM=v.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:s,onPointerDownOutside:o,...l}=e,c=My(su,n),u=fN(n),{onClose:d}=c;return v.useEffect(()=>(document.addEventListener(mA,d),()=>document.removeEventListener(mA,d)),[d]),v.useEffect(()=>{if(c.trigger){const f=h=>{const p=h.target;p!=null&&p.contains(c.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,d]),a.jsx(dp,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:a.jsxs(cN,{"data-state":c.stateAttribute,...u,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[a.jsx(JS,{children:r}),a.jsx(H9,{scope:n,isInside:!0,children:a.jsx(L9,{id:c.contentId,role:"tooltip",children:i||r})})]})})});WM.displayName=su;var GM="TooltipArrow",q9=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,i=fN(n);return G9(GM,n).isInside?null:a.jsx(uN,{...i,...r,ref:t})});q9.displayName=GM;function K9(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function X9(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Y9(e){const{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function Z9(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,o=t.length-1;sr!=d>r&&n<(u-l)*(r-c)/(d-c)+l&&(i=!i)}return i}function Q9(e){const t=e.slice();return t.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),J9(t)}function J9(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r=2;){const s=t[t.length-1],o=t[t.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))t.pop();else break}t.push(i)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const i=e[r];for(;n.length>=2;){const s=n[n.length-1],o=n[n.length-2];if((s.x-o.x)*(i.y-o.y)>=(s.y-o.y)*(i.x-o.x))n.pop();else break}n.push(i)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var eW=UM,qM=WM;function KM(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t{const t=rW(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{const l=o.split(hN);return l[0]===""&&l.length!==1&&l.shift(),XM(l,t)||nW(o)},getConflictingClassGroupIds:(o,l)=>{const c=n[o]||[];return l&&r[o]?[...c,...r[o]]:c}}},XM=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),i=r?XM(e.slice(1),r):void 0;if(i)return i;if(t.validators.length===0)return;const s=e.join(hN);return(o=t.validators.find(({validator:l})=>l(s)))==null?void 0:o.classGroupId},gA=/^\[(.+)\]$/,nW=e=>{if(gA.test(e)){const t=gA.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},rW=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return sW(Object.entries(e.classGroups),n).forEach(([s,o])=>{Rw(o,r,s,t)}),r},Rw=(e,t,n,r)=>{e.forEach(i=>{if(typeof i=="string"){const s=i===""?t:vA(t,i);s.classGroupId=n;return}if(typeof i=="function"){if(iW(i)){Rw(i(r),t,n,r);return}t.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([s,o])=>{Rw(o,vA(t,s),n,r)})})},vA=(e,t)=>{let n=e;return t.split(hN).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},iW=e=>e.isThemeGetter,sW=(e,t)=>t?e.map(([n,r])=>{const i=r.map(s=>typeof s=="string"?t+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,l])=>[t+o,l])):s);return[n,i]}):e,aW=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const i=(s,o)=>{n.set(s,o),t++,t>e&&(t=0,r=n,n=new Map)};return{get(s){let o=n.get(s);if(o!==void 0)return o;if((o=r.get(s))!==void 0)return i(s,o),o},set(s,o){n.has(s)?n.set(s,o):i(s,o)}}},YM="!",oW=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,i=t[0],s=t.length,o=l=>{const c=[];let u=0,d=0,f;for(let x=0;xd?f-d:void 0;return{modifiers:c,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:m}};return n?l=>n({className:l,parseClassName:o}):o},lW=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},cW=e=>({cache:aW(e.cacheSize),parseClassName:oW(e),...tW(e)}),uW=/\s+/,dW=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=t,s=[],o=e.trim().split(uW);let l="";for(let c=o.length-1;c>=0;c-=1){const u=o[c],{modifiers:d,hasImportantModifier:f,baseClassName:h,maybePostfixModifierPosition:p}=n(u);let g=!!p,m=r(g?h.substring(0,p):h);if(!m){if(!g){l=u+(l.length>0?" "+l:l);continue}if(m=r(h),!m){l=u+(l.length>0?" "+l:l);continue}g=!1}const x=lW(d).join(":"),b=f?x+YM:x,y=b+m;if(s.includes(y))continue;s.push(y);const w=i(m,g);for(let j=0;j0?" "+l:l)}return l};function fW(){let e=0,t,n,r="";for(;e{if(typeof e=="string")return e;let t,n="";for(let r=0;rf(d),e());return n=cW(u),r=n.cache.get,i=n.cache.set,s=l,l(c)}function l(c){const u=r(c);if(u)return u;const d=dW(c,n);return i(c,d),d}return function(){return s(fW.apply(null,arguments))}}const Zt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},QM=/^\[(?:([a-z-]+):)?(.+)\]$/i,pW=/^\d+\/\d+$/,mW=new Set(["px","full","screen"]),gW=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,vW=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,yW=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,xW=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,bW=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Rs=e=>kc(e)||mW.has(e)||pW.test(e),ka=e=>Hu(e,"length",AW),kc=e=>!!e&&!Number.isNaN(Number(e)),L0=e=>Hu(e,"number",kc),Ad=e=>!!e&&Number.isInteger(Number(e)),wW=e=>e.endsWith("%")&&kc(e.slice(0,-1)),xt=e=>QM.test(e),Ta=e=>gW.test(e),jW=new Set(["length","size","percentage"]),SW=e=>Hu(e,jW,JM),NW=e=>Hu(e,"position",JM),_W=new Set(["image","url"]),PW=e=>Hu(e,_W,OW),CW=e=>Hu(e,"",EW),Ed=()=>!0,Hu=(e,t,n)=>{const r=QM.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},AW=e=>vW.test(e)&&!yW.test(e),JM=()=>!1,EW=e=>xW.test(e),OW=e=>bW.test(e),kW=()=>{const e=Zt("colors"),t=Zt("spacing"),n=Zt("blur"),r=Zt("brightness"),i=Zt("borderColor"),s=Zt("borderRadius"),o=Zt("borderSpacing"),l=Zt("borderWidth"),c=Zt("contrast"),u=Zt("grayscale"),d=Zt("hueRotate"),f=Zt("invert"),h=Zt("gap"),p=Zt("gradientColorStops"),g=Zt("gradientColorStopPositions"),m=Zt("inset"),x=Zt("margin"),b=Zt("opacity"),y=Zt("padding"),w=Zt("saturate"),j=Zt("scale"),S=Zt("sepia"),N=Zt("skew"),P=Zt("space"),_=Zt("translate"),A=()=>["auto","contain","none"],O=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto",xt,t],T=()=>[xt,t],M=()=>["",Rs,ka],R=()=>["auto",kc,xt],H=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],F=()=>["solid","dashed","dotted","double","none"],V=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],I=()=>["start","end","center","between","around","evenly","stretch"],L=()=>["","0",xt],Z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ee=()=>[kc,xt];return{cacheSize:500,separator:":",theme:{colors:[Ed],spacing:[Rs,ka],blur:["none","",Ta,xt],brightness:ee(),borderColor:[e],borderRadius:["none","","full",Ta,xt],borderSpacing:T(),borderWidth:M(),contrast:ee(),grayscale:L(),hueRotate:ee(),invert:L(),gap:T(),gradientColorStops:[e],gradientColorStopPositions:[wW,ka],inset:$(),margin:$(),opacity:ee(),padding:T(),saturate:ee(),scale:ee(),sepia:L(),skew:ee(),space:T(),translate:T()},classGroups:{aspect:[{aspect:["auto","square","video",xt]}],container:["container"],columns:[{columns:[Ta]}],"break-after":[{"break-after":Z()}],"break-before":[{"break-before":Z()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...H(),xt]}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ad,xt]}],basis:[{basis:$()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",xt]}],grow:[{grow:L()}],shrink:[{shrink:L()}],order:[{order:["first","last","none",Ad,xt]}],"grid-cols":[{"grid-cols":[Ed]}],"col-start-end":[{col:["auto",{span:["full",Ad,xt]},xt]}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":[Ed]}],"row-start-end":[{row:["auto",{span:[Ad,xt]},xt]}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",xt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",xt]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...I()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...I(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...I(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[y]}],px:[{px:[y]}],py:[{py:[y]}],ps:[{ps:[y]}],pe:[{pe:[y]}],pt:[{pt:[y]}],pr:[{pr:[y]}],pb:[{pb:[y]}],pl:[{pl:[y]}],m:[{m:[x]}],mx:[{mx:[x]}],my:[{my:[x]}],ms:[{ms:[x]}],me:[{me:[x]}],mt:[{mt:[x]}],mr:[{mr:[x]}],mb:[{mb:[x]}],ml:[{ml:[x]}],"space-x":[{"space-x":[P]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[P]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",xt,t]}],"min-w":[{"min-w":[xt,t,"min","max","fit"]}],"max-w":[{"max-w":[xt,t,"none","full","min","max","fit","prose",{screen:[Ta]},Ta]}],h:[{h:[xt,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[xt,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[xt,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[xt,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Ta,ka]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",L0]}],"font-family":[{font:[Ed]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",xt]}],"line-clamp":[{"line-clamp":["none",kc,L0]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Rs,xt]}],"list-image":[{"list-image":["none",xt]}],"list-style-type":[{list:["none","disc","decimal",xt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...F(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Rs,ka]}],"underline-offset":[{"underline-offset":["auto",Rs,xt]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",xt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",xt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...H(),NW]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",SW]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},PW]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...F(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:F()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...F()]}],"outline-offset":[{"outline-offset":[Rs,xt]}],"outline-w":[{outline:[Rs,ka]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:M()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[Rs,ka]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Ta,CW]}],"shadow-color":[{shadow:[Ed]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...V(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":V()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",Ta,xt]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[w]}],sepia:[{sepia:[S]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[S]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",xt]}],duration:[{duration:ee()}],ease:[{ease:["linear","in","out","in-out",xt]}],delay:[{delay:ee()}],animate:[{animate:["none","spin","ping","pulse","bounce",xt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[j]}],"scale-x":[{"scale-x":[j]}],"scale-y":[{"scale-y":[j]}],rotate:[{rotate:[Ad,xt]}],"translate-x":[{"translate-x":[_]}],"translate-y":[{"translate-y":[_]}],"skew-x":[{"skew-x":[N]}],"skew-y":[{"skew-y":[N]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",xt]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",xt]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",xt]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Rs,ka,L0]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},TW=hW(kW);function Me(...e){return TW(ht(e))}const $W=eW,IW=v.forwardRef(({className:e,sideOffset:t=4,...n},r)=>a.jsx(qM,{ref:r,sideOffset:t,className:Me("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n}));IW.displayName=qM.displayName;var Ry=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Dy=typeof window>"u"||"Deno"in globalThis;function Mi(){}function MW(e,t){return typeof e=="function"?e(t):e}function RW(e){return typeof e=="number"&&e>=0&&e!==1/0}function DW(e,t){return Math.max(e+(t||0)-Date.now(),0)}function yA(e,t){return typeof e=="function"?e(t):e}function LW(e,t){return typeof e=="function"?e(t):e}function xA(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:l}=e;if(o){if(r){if(t.queryHash!==pN(o,t.options))return!1}else if(!Hf(t.queryKey,o))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||i&&i!==t.state.fetchStatus||s&&!s(t))}function bA(e,t){const{exact:n,status:r,predicate:i,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(n){if(Wf(t.options.mutationKey)!==Wf(s))return!1}else if(!Hf(t.options.mutationKey,s))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function pN(e,t){return((t==null?void 0:t.queryKeyHashFn)||Wf)(e)}function Wf(e){return JSON.stringify(e,(t,n)=>Dw(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function Hf(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!Hf(e[n],t[n])):!1}function eR(e,t){if(e===t)return e;const n=wA(e)&&wA(t);if(n||Dw(e)&&Dw(t)){const r=n?e:Object.keys(e),i=r.length,s=n?t:Object.keys(t),o=s.length,l=n?[]:{};let c=0;for(let u=0;u{setTimeout(t,e)})}function BW(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?eR(e,t):t}function zW(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function UW(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var mN=Symbol();function tR(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===mN?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var ll,Ha,Uc,XT,VW=(XT=class extends Ry{constructor(){super();Dt(this,ll);Dt(this,Ha);Dt(this,Uc);jt(this,Uc,t=>{if(!Dy&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){we(this,Ha)||this.setEventListener(we(this,Uc))}onUnsubscribe(){var t;this.hasListeners()||((t=we(this,Ha))==null||t.call(this),jt(this,Ha,void 0))}setEventListener(t){var n;jt(this,Uc,t),(n=we(this,Ha))==null||n.call(this),jt(this,Ha,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){we(this,ll)!==t&&(jt(this,ll,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof we(this,ll)=="boolean"?we(this,ll):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},ll=new WeakMap,Ha=new WeakMap,Uc=new WeakMap,XT),nR=new VW,Vc,Ga,Wc,YT,WW=(YT=class extends Ry{constructor(){super();Dt(this,Vc,!0);Dt(this,Ga);Dt(this,Wc);jt(this,Wc,t=>{if(!Dy&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){we(this,Ga)||this.setEventListener(we(this,Wc))}onUnsubscribe(){var t;this.hasListeners()||((t=we(this,Ga))==null||t.call(this),jt(this,Ga,void 0))}setEventListener(t){var n;jt(this,Wc,t),(n=we(this,Ga))==null||n.call(this),jt(this,Ga,t(this.setOnline.bind(this)))}setOnline(t){we(this,Vc)!==t&&(jt(this,Vc,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return we(this,Vc)}},Vc=new WeakMap,Ga=new WeakMap,Wc=new WeakMap,YT),Ng=new WW;function HW(){let e,t;const n=new Promise((i,s)=>{e=i,t=s});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),e(i)},n.reject=i=>{r({status:"rejected",reason:i}),t(i)},n}function GW(e){return Math.min(1e3*2**e,3e4)}function rR(e){return(e??"online")==="online"?Ng.isOnline():!0}var iR=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function F0(e){return e instanceof iR}function sR(e){let t=!1,n=0,r=!1,i;const s=HW(),o=m=>{var x;r||(h(new iR(m)),(x=e.abort)==null||x.call(e))},l=()=>{t=!0},c=()=>{t=!1},u=()=>nR.isFocused()&&(e.networkMode==="always"||Ng.isOnline())&&e.canRun(),d=()=>rR(e.networkMode)&&e.canRun(),f=m=>{var x;r||(r=!0,(x=e.onSuccess)==null||x.call(e,m),i==null||i(),s.resolve(m))},h=m=>{var x;r||(r=!0,(x=e.onError)==null||x.call(e,m),i==null||i(),s.reject(m))},p=()=>new Promise(m=>{var x;i=b=>{(r||u())&&m(b)},(x=e.onPause)==null||x.call(e)}).then(()=>{var m;i=void 0,r||(m=e.onContinue)==null||m.call(e)}),g=()=>{if(r)return;let m;const x=n===0?e.initialPromise:void 0;try{m=x??e.fn()}catch(b){m=Promise.reject(b)}Promise.resolve(m).then(f).catch(b=>{var N;if(r)return;const y=e.retry??(Dy?0:3),w=e.retryDelay??GW,j=typeof w=="function"?w(n,b):w,S=y===!0||typeof y=="number"&&nu()?void 0:p()).then(()=>{t?h(b):g()})})};return{promise:s,cancel:o,continue:()=>(i==null||i(),s),cancelRetry:l,continueRetry:c,canStart:d,start:()=>(d()?g():p().then(g),s)}}function qW(){let e=[],t=0,n=l=>{l()},r=l=>{l()},i=l=>setTimeout(l,0);const s=l=>{t?e.push(l):i(()=>{n(l)})},o=()=>{const l=e;e=[],l.length&&i(()=>{r(()=>{l.forEach(c=>{n(c)})})})};return{batch:l=>{let c;t++;try{c=l()}finally{t--,t||o()}return c},batchCalls:l=>(...c)=>{s(()=>{l(...c)})},schedule:s,setNotifyFunction:l=>{n=l},setBatchNotifyFunction:l=>{r=l},setScheduler:l=>{i=l}}}var wr=qW(),cl,ZT,aR=(ZT=class{constructor(){Dt(this,cl)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),RW(this.gcTime)&&jt(this,cl,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Dy?1/0:5*60*1e3))}clearGcTimeout(){we(this,cl)&&(clearTimeout(we(this,cl)),jt(this,cl,void 0))}},cl=new WeakMap,ZT),Hc,Gc,ui,sr,ip,ul,Ri,Fs,QT,KW=(QT=class extends aR{constructor(t){super();Dt(this,Ri);Dt(this,Hc);Dt(this,Gc);Dt(this,ui);Dt(this,sr);Dt(this,ip);Dt(this,ul);jt(this,ul,!1),jt(this,ip,t.defaultOptions),this.setOptions(t.options),this.observers=[],jt(this,ui,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,jt(this,Hc,YW(this.options)),this.state=t.state??we(this,Hc),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=we(this,sr))==null?void 0:t.promise}setOptions(t){this.options={...we(this,ip),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&we(this,ui).remove(this)}setData(t,n){const r=BW(this.state.data,t,this.options);return nr(this,Ri,Fs).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){nr(this,Ri,Fs).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,i;const n=(r=we(this,sr))==null?void 0:r.promise;return(i=we(this,sr))==null||i.cancel(t),n?n.then(Mi).catch(Mi):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(we(this,Hc))}isActive(){return this.observers.some(t=>LW(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===mN||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!DW(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=we(this,sr))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=we(this,sr))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),we(this,ui).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(we(this,sr)&&(we(this,ul)?we(this,sr).cancel({revert:!0}):we(this,sr).cancelRetry()),this.scheduleGc()),we(this,ui).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||nr(this,Ri,Fs).call(this,{type:"invalidate"})}fetch(t,n){var c,u,d;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(we(this,sr))return we(this,sr).continueRetry(),we(this,sr).promise}if(t&&this.setOptions(t),!this.options.queryFn){const f=this.observers.find(h=>h.options.queryFn);f&&this.setOptions(f.options)}const r=new AbortController,i=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(jt(this,ul,!0),r.signal)})},s=()=>{const f=tR(this.options,n),h={queryKey:this.queryKey,meta:this.meta};return i(h),jt(this,ul,!1),this.options.persister?this.options.persister(f,h,this):f(h)},o={fetchOptions:n,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:s};i(o),(c=this.options.behavior)==null||c.onFetch(o,this),jt(this,Gc,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=o.fetchOptions)==null?void 0:u.meta))&&nr(this,Ri,Fs).call(this,{type:"fetch",meta:(d=o.fetchOptions)==null?void 0:d.meta});const l=f=>{var h,p,g,m;F0(f)&&f.silent||nr(this,Ri,Fs).call(this,{type:"error",error:f}),F0(f)||((p=(h=we(this,ui).config).onError)==null||p.call(h,f,this),(m=(g=we(this,ui).config).onSettled)==null||m.call(g,this.state.data,f,this)),this.scheduleGc()};return jt(this,sr,sR({initialPromise:n==null?void 0:n.initialPromise,fn:o.fetchFn,abort:r.abort.bind(r),onSuccess:f=>{var h,p,g,m;if(f===void 0){l(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(f)}catch(x){l(x);return}(p=(h=we(this,ui).config).onSuccess)==null||p.call(h,f,this),(m=(g=we(this,ui).config).onSettled)==null||m.call(g,f,this.state.error,this),this.scheduleGc()},onError:l,onFail:(f,h)=>{nr(this,Ri,Fs).call(this,{type:"failed",failureCount:f,error:h})},onPause:()=>{nr(this,Ri,Fs).call(this,{type:"pause"})},onContinue:()=>{nr(this,Ri,Fs).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0})),we(this,sr).start()}},Hc=new WeakMap,Gc=new WeakMap,ui=new WeakMap,sr=new WeakMap,ip=new WeakMap,ul=new WeakMap,Ri=new WeakSet,Fs=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...XW(r.data,this.options),fetchMeta:t.meta??null};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=t.error;return F0(i)&&i.revert&&we(this,Gc)?{...we(this,Gc),fetchStatus:"idle"}:{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),wr.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),we(this,ui).notify({query:this,type:"updated",action:t})})},QT);function XW(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:rR(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function YW(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var fs,JT,ZW=(JT=class extends Ry{constructor(t={}){super();Dt(this,fs);this.config=t,jt(this,fs,new Map)}build(t,n,r){const i=n.queryKey,s=n.queryHash??pN(i,n);let o=this.get(s);return o||(o=new KW({cache:this,queryKey:i,queryHash:s,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(i)}),this.add(o)),o}add(t){we(this,fs).has(t.queryHash)||(we(this,fs).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=we(this,fs).get(t.queryHash);n&&(t.destroy(),n===t&&we(this,fs).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){wr.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return we(this,fs).get(t)}getAll(){return[...we(this,fs).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>xA(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>xA(t,r)):n}notify(t){wr.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){wr.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){wr.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},fs=new WeakMap,JT),hs,vr,dl,ps,$a,e$,QW=(e$=class extends aR{constructor(t){super();Dt(this,ps);Dt(this,hs);Dt(this,vr);Dt(this,dl);this.mutationId=t.mutationId,jt(this,vr,t.mutationCache),jt(this,hs,[]),this.state=t.state||JW(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){we(this,hs).includes(t)||(we(this,hs).push(t),this.clearGcTimeout(),we(this,vr).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){jt(this,hs,we(this,hs).filter(n=>n!==t)),this.scheduleGc(),we(this,vr).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){we(this,hs).length||(this.state.status==="pending"?this.scheduleGc():we(this,vr).remove(this))}continue(){var t;return((t=we(this,dl))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var i,s,o,l,c,u,d,f,h,p,g,m,x,b,y,w,j,S,N,P;jt(this,dl,sR({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(_,A)=>{nr(this,ps,$a).call(this,{type:"failed",failureCount:_,error:A})},onPause:()=>{nr(this,ps,$a).call(this,{type:"pause"})},onContinue:()=>{nr(this,ps,$a).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>we(this,vr).canRun(this)}));const n=this.state.status==="pending",r=!we(this,dl).canStart();try{if(!n){nr(this,ps,$a).call(this,{type:"pending",variables:t,isPaused:r}),await((s=(i=we(this,vr).config).onMutate)==null?void 0:s.call(i,t,this));const A=await((l=(o=this.options).onMutate)==null?void 0:l.call(o,t));A!==this.state.context&&nr(this,ps,$a).call(this,{type:"pending",context:A,variables:t,isPaused:r})}const _=await we(this,dl).start();return await((u=(c=we(this,vr).config).onSuccess)==null?void 0:u.call(c,_,t,this.state.context,this)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,_,t,this.state.context)),await((p=(h=we(this,vr).config).onSettled)==null?void 0:p.call(h,_,null,this.state.variables,this.state.context,this)),await((m=(g=this.options).onSettled)==null?void 0:m.call(g,_,null,t,this.state.context)),nr(this,ps,$a).call(this,{type:"success",data:_}),_}catch(_){try{throw await((b=(x=we(this,vr).config).onError)==null?void 0:b.call(x,_,t,this.state.context,this)),await((w=(y=this.options).onError)==null?void 0:w.call(y,_,t,this.state.context)),await((S=(j=we(this,vr).config).onSettled)==null?void 0:S.call(j,void 0,_,this.state.variables,this.state.context,this)),await((P=(N=this.options).onSettled)==null?void 0:P.call(N,void 0,_,t,this.state.context)),_}finally{nr(this,ps,$a).call(this,{type:"error",error:_})}}finally{we(this,vr).runNext(this)}}},hs=new WeakMap,vr=new WeakMap,dl=new WeakMap,ps=new WeakSet,$a=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),wr.batch(()=>{we(this,hs).forEach(r=>{r.onMutationUpdate(t)}),we(this,vr).notify({mutation:this,type:"updated",action:t})})},e$);function JW(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Hr,sp,t$,eH=(t$=class extends Ry{constructor(t={}){super();Dt(this,Hr);Dt(this,sp);this.config=t,jt(this,Hr,new Map),jt(this,sp,Date.now())}build(t,n,r){const i=new QW({mutationCache:this,mutationId:++Fp(this,sp)._,options:t.defaultMutationOptions(n),state:r});return this.add(i),i}add(t){const n=om(t),r=we(this,Hr).get(n)??[];r.push(t),we(this,Hr).set(n,r),this.notify({type:"added",mutation:t})}remove(t){var r;const n=om(t);if(we(this,Hr).has(n)){const i=(r=we(this,Hr).get(n))==null?void 0:r.filter(s=>s!==t);i&&(i.length===0?we(this,Hr).delete(n):we(this,Hr).set(n,i))}this.notify({type:"removed",mutation:t})}canRun(t){var r;const n=(r=we(this,Hr).get(om(t)))==null?void 0:r.find(i=>i.state.status==="pending");return!n||n===t}runNext(t){var r;const n=(r=we(this,Hr).get(om(t)))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}clear(){wr.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}getAll(){return[...we(this,Hr).values()].flat()}find(t){const n={exact:!0,...t};return this.getAll().find(r=>bA(n,r))}findAll(t={}){return this.getAll().filter(n=>bA(t,n))}notify(t){wr.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return wr.batch(()=>Promise.all(t.map(n=>n.continue().catch(Mi))))}},Hr=new WeakMap,sp=new WeakMap,t$);function om(e){var t;return((t=e.options.scope)==null?void 0:t.id)??String(e.mutationId)}function SA(e){return{onFetch:(t,n)=>{var d,f,h,p,g;const r=t.options,i=(h=(f=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:h.direction,s=((p=t.state.data)==null?void 0:p.pages)||[],o=((g=t.state.data)==null?void 0:g.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const u=async()=>{let m=!1;const x=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(t.signal.aborted?m=!0:t.signal.addEventListener("abort",()=>{m=!0}),t.signal)})},b=tR(t.options,t.fetchOptions),y=async(w,j,S)=>{if(m)return Promise.reject();if(j==null&&w.pages.length)return Promise.resolve(w);const N={queryKey:t.queryKey,pageParam:j,direction:S?"backward":"forward",meta:t.options.meta};x(N);const P=await b(N),{maxPages:_}=t.options,A=S?UW:zW;return{pages:A(w.pages,P,_),pageParams:A(w.pageParams,j,_)}};if(i&&s.length){const w=i==="backward",j=w?tH:NA,S={pages:s,pageParams:o},N=j(r,S);l=await y(S,N,w)}else{const w=e??s.length;do{const j=c===0?o[0]??r.initialPageParam:NA(r,l);if(c>0&&j==null)break;l=await y(l,j),c++}while(c{var m,x;return(x=(m=t.options).persister)==null?void 0:x.call(m,u,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function NA(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function tH(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var cn,qa,Ka,qc,Kc,Xa,Xc,Yc,n$,nH=(n$=class{constructor(e={}){Dt(this,cn);Dt(this,qa);Dt(this,Ka);Dt(this,qc);Dt(this,Kc);Dt(this,Xa);Dt(this,Xc);Dt(this,Yc);jt(this,cn,e.queryCache||new ZW),jt(this,qa,e.mutationCache||new eH),jt(this,Ka,e.defaultOptions||{}),jt(this,qc,new Map),jt(this,Kc,new Map),jt(this,Xa,0)}mount(){Fp(this,Xa)._++,we(this,Xa)===1&&(jt(this,Xc,nR.subscribe(async e=>{e&&(await this.resumePausedMutations(),we(this,cn).onFocus())})),jt(this,Yc,Ng.subscribe(async e=>{e&&(await this.resumePausedMutations(),we(this,cn).onOnline())})))}unmount(){var e,t;Fp(this,Xa)._--,we(this,Xa)===0&&((e=we(this,Xc))==null||e.call(this),jt(this,Xc,void 0),(t=we(this,Yc))==null||t.call(this),jt(this,Yc,void 0))}isFetching(e){return we(this,cn).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return we(this,qa).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=we(this,cn).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.getQueryData(e.queryKey);if(t===void 0)return this.fetchQuery(e);{const n=this.defaultQueryOptions(e),r=we(this,cn).build(this,n);return e.revalidateIfStale&&r.isStaleByTime(yA(n.staleTime,r))&&this.prefetchQuery(n),Promise.resolve(t)}}getQueriesData(e){return we(this,cn).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),i=we(this,cn).get(r.queryHash),s=i==null?void 0:i.state.data,o=MW(t,s);if(o!==void 0)return we(this,cn).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return wr.batch(()=>we(this,cn).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=we(this,cn).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=we(this,cn);wr.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=we(this,cn),r={type:"active",...e};return wr.batch(()=>(n.findAll(e).forEach(i=>{i.reset()}),this.refetchQueries(r,t)))}cancelQueries(e={},t={}){const n={revert:!0,...t},r=wr.batch(()=>we(this,cn).findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(Mi).catch(Mi)}invalidateQueries(e={},t={}){return wr.batch(()=>{if(we(this,cn).findAll(e).forEach(r=>{r.invalidate()}),e.refetchType==="none")return Promise.resolve();const n={...e,type:e.refetchType??e.type??"active"};return this.refetchQueries(n,t)})}refetchQueries(e={},t){const n={...t,cancelRefetch:(t==null?void 0:t.cancelRefetch)??!0},r=wr.batch(()=>we(this,cn).findAll(e).filter(i=>!i.isDisabled()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(Mi)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Mi)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=we(this,cn).build(this,t);return n.isStaleByTime(yA(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Mi).catch(Mi)}fetchInfiniteQuery(e){return e.behavior=SA(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Mi).catch(Mi)}ensureInfiniteQueryData(e){return e.behavior=SA(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Ng.isOnline()?we(this,qa).resumePausedMutations():Promise.resolve()}getQueryCache(){return we(this,cn)}getMutationCache(){return we(this,qa)}getDefaultOptions(){return we(this,Ka)}setDefaultOptions(e){jt(this,Ka,e)}setQueryDefaults(e,t){we(this,qc).set(Wf(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...we(this,qc).values()];let n={};return t.forEach(r=>{Hf(e,r.queryKey)&&(n={...n,...r.defaultOptions})}),n}setMutationDefaults(e,t){we(this,Kc).set(Wf(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...we(this,Kc).values()];let n={};return t.forEach(r=>{Hf(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...we(this,Ka).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=pN(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.enabled!==!0&&t.queryFn===mN&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...we(this,Ka).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){we(this,cn).clear(),we(this,qa).clear()}},cn=new WeakMap,qa=new WeakMap,Ka=new WeakMap,qc=new WeakMap,Kc=new WeakMap,Xa=new WeakMap,Xc=new WeakMap,Yc=new WeakMap,n$),rH=v.createContext(void 0),iH=({client:e,children:t})=>(v.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),a.jsx(rH.Provider,{value:e,children:t}));/** - * @remix-run/router v1.20.0 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function Gf(){return Gf=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function oR(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function aH(){return Math.random().toString(36).substr(2,8)}function PA(e,t){return{usr:e.state,key:e.key,idx:t}}function Lw(e,t,n,r){return n===void 0&&(n=null),Gf({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Gu(t):t,{state:n,key:t&&t.key||r||aH()})}function _g(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function Gu(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function oH(e,t,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:s=!1}=r,o=i.history,l=Qa.Pop,c=null,u=d();u==null&&(u=0,o.replaceState(Gf({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function f(){l=Qa.Pop;let x=d(),b=x==null?null:x-u;u=x,c&&c({action:l,location:m.location,delta:b})}function h(x,b){l=Qa.Push;let y=Lw(m.location,x,b);u=d()+1;let w=PA(y,u),j=m.createHref(y);try{o.pushState(w,"",j)}catch(S){if(S instanceof DOMException&&S.name==="DataCloneError")throw S;i.location.assign(j)}s&&c&&c({action:l,location:m.location,delta:1})}function p(x,b){l=Qa.Replace;let y=Lw(m.location,x,b);u=d();let w=PA(y,u),j=m.createHref(y);o.replaceState(w,"",j),s&&c&&c({action:l,location:m.location,delta:0})}function g(x){let b=i.location.origin!=="null"?i.location.origin:i.location.href,y=typeof x=="string"?x:_g(x);return y=y.replace(/ $/,"%20"),xn(b,"No window.location.(origin|href) available to create URL for href: "+y),new URL(y,b)}let m={get action(){return l},get location(){return e(i,o)},listen(x){if(c)throw new Error("A history only accepts one active listener");return i.addEventListener(_A,f),c=x,()=>{i.removeEventListener(_A,f),c=null}},createHref(x){return t(i,x)},createURL:g,encodeLocation(x){let b=g(x);return{pathname:b.pathname,search:b.search,hash:b.hash}},push:h,replace:p,go(x){return o.go(x)}};return m}var CA;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(CA||(CA={}));function lH(e,t,n){return n===void 0&&(n="/"),cH(e,t,n,!1)}function cH(e,t,n,r){let i=typeof t=="string"?Gu(t):t,s=gN(i.pathname||"/",n);if(s==null)return null;let o=lR(e);uH(o);let l=null;for(let c=0;l==null&&c{let c={relativePath:l===void 0?s.path||"":l,caseSensitive:s.caseSensitive===!0,childrenIndex:o,route:s};c.relativePath.startsWith("/")&&(xn(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let u=co([r,c.relativePath]),d=n.concat(c);s.children&&s.children.length>0&&(xn(s.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),lR(s.children,t,d,u)),!(s.path==null&&!s.index)&&t.push({path:u,score:vH(u,s.index),routesMeta:d})};return e.forEach((s,o)=>{var l;if(s.path===""||!((l=s.path)!=null&&l.includes("?")))i(s,o);else for(let c of cR(s.path))i(s,o,c)}),t}function cR(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let o=cR(r.join("/")),l=[];return l.push(...o.map(c=>c===""?s:[s,c].join("/"))),i&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function uH(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:yH(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const dH=/^:[\w-]+$/,fH=3,hH=2,pH=1,mH=10,gH=-2,AA=e=>e==="*";function vH(e,t){let n=e.split("/"),r=n.length;return n.some(AA)&&(r+=gH),t&&(r+=hH),n.filter(i=>!AA(i)).reduce((i,s)=>i+(dH.test(s)?fH:s===""?pH:mH),r)}function yH(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function xH(e,t,n){let{routesMeta:r}=e,i={},s="/",o=[];for(let l=0;l{let{paramName:h,isOptional:p}=d;if(h==="*"){let m=l[f]||"";o=s.slice(0,s.length-m.length).replace(/(.)\/+$/,"$1")}const g=l[f];return p&&!g?u[h]=void 0:u[h]=(g||"").replace(/%2F/g,"/"),u},{}),pathname:s,pathnameBase:o,pattern:e}}function bH(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),oR(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function wH(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return oR(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function gN(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function jH(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?Gu(e):e;return{pathname:n?n.startsWith("/")?n:SH(n,t):t,search:PH(r),hash:CH(i)}}function SH(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function B0(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function NH(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function vN(e,t){let n=NH(e);return t?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function yN(e,t,n,r){r===void 0&&(r=!1);let i;typeof e=="string"?i=Gu(e):(i=Gf({},e),xn(!i.pathname||!i.pathname.includes("?"),B0("?","pathname","search",i)),xn(!i.pathname||!i.pathname.includes("#"),B0("#","pathname","hash",i)),xn(!i.search||!i.search.includes("#"),B0("#","search","hash",i)));let s=e===""||i.pathname==="",o=s?"/":i.pathname,l;if(o==null)l=n;else{let f=t.length-1;if(!r&&o.startsWith("..")){let h=o.split("/");for(;h[0]==="..";)h.shift(),f-=1;i.pathname=h.join("/")}l=f>=0?t[f]:"/"}let c=jH(i,l),u=o&&o!=="/"&&o.endsWith("/"),d=(s||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const co=e=>e.join("/").replace(/\/\/+/g,"/"),_H=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),PH=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,CH=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function AH(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const uR=["post","put","patch","delete"];new Set(uR);const EH=["get",...uR];new Set(EH);/** - * React Router v6.27.0 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function qf(){return qf=Object.assign?Object.assign.bind():function(e){for(var t=1;t{l.current=!0}),v.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let f=yN(u,JSON.parse(o),s,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:co([t,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[t,r,o,s,e])}function hR(){let{matches:e}=v.useContext(wa),t=e[e.length-1];return t?t.params:{}}function pR(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=v.useContext(Oo),{matches:i}=v.useContext(wa),{pathname:s}=rs(),o=JSON.stringify(vN(i,r.v7_relativeSplatPath));return v.useMemo(()=>yN(e,JSON.parse(o),s,n==="path"),[e,o,s,n])}function $H(e,t){return IH(e,t)}function IH(e,t,n,r){qu()||xn(!1);let{navigator:i}=v.useContext(Oo),{matches:s}=v.useContext(wa),o=s[s.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let u=rs(),d;if(t){var f;let x=typeof t=="string"?Gu(t):t;c==="/"||(f=x.pathname)!=null&&f.startsWith(c)||xn(!1),d=x}else d=u;let h=d.pathname||"/",p=h;if(c!=="/"){let x=c.replace(/^\//,"").split("/");p="/"+h.replace(/^\//,"").split("/").slice(x.length).join("/")}let g=lH(e,{pathname:p}),m=FH(g&&g.map(x=>Object.assign({},x,{params:Object.assign({},l,x.params),pathname:co([c,i.encodeLocation?i.encodeLocation(x.pathname).pathname:x.pathname]),pathnameBase:x.pathnameBase==="/"?c:co([c,i.encodeLocation?i.encodeLocation(x.pathnameBase).pathname:x.pathnameBase])})),s,n,r);return t&&m?v.createElement(Ly.Provider,{value:{location:qf({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:Qa.Pop}},m):m}function MH(){let e=VH(),t=AH(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},t),n?v.createElement("pre",{style:i},n):null,null)}const RH=v.createElement(MH,null);class DH extends v.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?v.createElement(wa.Provider,{value:this.props.routeContext},v.createElement(dR.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function LH(e){let{routeContext:t,match:n,children:r}=e,i=v.useContext(xN);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),v.createElement(wa.Provider,{value:t},r)}function FH(e,t,n,r){var i;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var s;if(!n)return null;if(n.errors)e=n.matches;else if((s=r)!=null&&s.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,l=(i=n)==null?void 0:i.errors;if(l!=null){let d=o.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);d>=0||xn(!1),o=o.slice(0,Math.min(o.length,d+1))}let c=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((d,f,h)=>{let p,g=!1,m=null,x=null;n&&(p=l&&f.route.id?l[f.route.id]:void 0,m=f.route.errorElement||RH,c&&(u<0&&h===0?(g=!0,x=null):u===h&&(g=!0,x=f.route.hydrateFallbackElement||null)));let b=t.concat(o.slice(0,h+1)),y=()=>{let w;return p?w=m:g?w=x:f.route.Component?w=v.createElement(f.route.Component,null):f.route.element?w=f.route.element:w=d,v.createElement(LH,{match:f,routeContext:{outlet:d,matches:b,isDataRoute:n!=null},children:w})};return n&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?v.createElement(DH,{location:n.location,revalidation:n.revalidation,component:m,error:p,children:y(),routeContext:{outlet:null,matches:b,isDataRoute:!0}}):y()},null)}var mR=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(mR||{}),Pg=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(Pg||{});function BH(e){let t=v.useContext(xN);return t||xn(!1),t}function zH(e){let t=v.useContext(OH);return t||xn(!1),t}function UH(e){let t=v.useContext(wa);return t||xn(!1),t}function gR(e){let t=UH(),n=t.matches[t.matches.length-1];return n.route.id||xn(!1),n.route.id}function VH(){var e;let t=v.useContext(dR),n=zH(Pg.UseRouteError),r=gR(Pg.UseRouteError);return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function WH(){let{router:e}=BH(mR.UseNavigateStable),t=gR(Pg.UseNavigateStable),n=v.useRef(!1);return fR(()=>{n.current=!0}),v.useCallback(function(i,s){s===void 0&&(s={}),n.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,qf({fromRouteId:t},s)))},[e,t])}function vR(e){let{to:t,replace:n,state:r,relative:i}=e;qu()||xn(!1);let{future:s,static:o}=v.useContext(Oo),{matches:l}=v.useContext(wa),{pathname:c}=rs(),u=Cn(),d=yN(t,vN(l,s.v7_relativeSplatPath),c,i==="path"),f=JSON.stringify(d);return v.useEffect(()=>u(JSON.parse(f),{replace:n,state:r,relative:i}),[u,f,i,n,r]),null}function Ti(e){xn(!1)}function HH(e){let{basename:t="/",children:n=null,location:r,navigationType:i=Qa.Pop,navigator:s,static:o=!1,future:l}=e;qu()&&xn(!1);let c=t.replace(/^\/*/,"/"),u=v.useMemo(()=>({basename:c,navigator:s,static:o,future:qf({v7_relativeSplatPath:!1},l)}),[c,l,s,o]);typeof r=="string"&&(r=Gu(r));let{pathname:d="/",search:f="",hash:h="",state:p=null,key:g="default"}=r,m=v.useMemo(()=>{let x=gN(d,c);return x==null?null:{location:{pathname:x,search:f,hash:h,state:p,key:g},navigationType:i}},[c,d,f,h,p,g,i]);return m==null?null:v.createElement(Oo.Provider,{value:u},v.createElement(Ly.Provider,{children:n,value:m}))}function GH(e){let{children:t,location:n}=e;return $H(Fw(t),n)}new Promise(()=>{});function Fw(e,t){t===void 0&&(t=[]);let n=[];return v.Children.forEach(e,(r,i)=>{if(!v.isValidElement(r))return;let s=[...t,i];if(r.type===v.Fragment){n.push.apply(n,Fw(r.props.children,s));return}r.type!==Ti&&xn(!1),!r.props.index||!r.props.children||xn(!1);let o={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=Fw(r.props.children,s)),n.push(o)}),n}/** - * React Router DOM v6.27.0 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function Bw(){return Bw=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[i]=e[i]);return n}function KH(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function XH(e,t){return e.button===0&&(!t||t==="_self")&&!KH(e)}const YH=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],ZH="6";try{window.__reactRouterVersion=ZH}catch{}const QH="startTransition",OA=h$[QH];function JH(e){let{basename:t,children:n,future:r,window:i}=e,s=v.useRef();s.current==null&&(s.current=sH({window:i,v5Compat:!0}));let o=s.current,[l,c]=v.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},d=v.useCallback(f=>{u&&OA?OA(()=>c(f)):c(f)},[c,u]);return v.useLayoutEffect(()=>o.listen(d),[o,d]),v.createElement(HH,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:o,future:r})}const eG=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",tG=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,gi=v.forwardRef(function(t,n){let{onClick:r,relative:i,reloadDocument:s,replace:o,state:l,target:c,to:u,preventScrollReset:d,viewTransition:f}=t,h=qH(t,YH),{basename:p}=v.useContext(Oo),g,m=!1;if(typeof u=="string"&&tG.test(u)&&(g=u,eG))try{let w=new URL(window.location.href),j=u.startsWith("//")?new URL(w.protocol+u):new URL(u),S=gN(j.pathname,p);j.origin===w.origin&&S!=null?u=S+j.search+j.hash:m=!0}catch{}let x=kH(u,{relative:i}),b=nG(u,{replace:o,state:l,target:c,preventScrollReset:d,relative:i,viewTransition:f});function y(w){r&&r(w),w.defaultPrevented||b(w)}return v.createElement("a",Bw({},h,{href:g||x,onClick:m||s?r:y,ref:n,target:c}))});var kA;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(kA||(kA={}));var TA;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(TA||(TA={}));function nG(e,t){let{target:n,replace:r,state:i,preventScrollReset:s,relative:o,viewTransition:l}=t===void 0?{}:t,c=Cn(),u=rs(),d=pR(e,{relative:o});return v.useCallback(f=>{if(XH(f,n)){f.preventDefault();let h=r!==void 0?r:_g(u)===_g(d);c(e,{replace:h,state:i,preventScrollReset:s,relative:o,viewTransition:l})}},[u,c,d,r,i,n,e,s,o,l])}/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const rG=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),yR=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var iG={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const sG=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:o,...l},c)=>v.createElement("svg",{ref:c,...iG,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:yR("lucide",i),...l},[...o.map(([u,d])=>v.createElement(u,d)),...Array.isArray(s)?s:[s]]));/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const De=(e,t)=>{const n=v.forwardRef(({className:r,...i},s)=>v.createElement(sG,{ref:s,iconNode:t,className:yR(`lucide-${rG(e)}`,r),...i}));return n.displayName=`${e}`,n};/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Hs=De("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $A=De("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Kf=De("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const z0=De("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Tc=De("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const fa=De("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const IA=De("Briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const aG=De("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const oG=De("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zw=De("ChartNoAxesColumnIncreasing",[["line",{x1:"12",x2:"12",y1:"20",y2:"10",key:"1vz5eb"}],["line",{x1:"18",x2:"18",y1:"20",y2:"4",key:"cun8e5"}],["line",{x1:"6",x2:"6",y1:"20",y2:"16",key:"hq0ia6"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const lG=De("ChartPie",[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ha=De("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ja=De("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ds=De("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const pp=De("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const cG=De("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Cg=De("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Yd=De("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Uw=De("CirclePlay",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const uG=De("CircleUser",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const dG=De("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ff=De("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const fG=De("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Xf=De("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const xR=De("CloudUpload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const MA=De("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ku=De("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Vw=De("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const hG=De("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ww=De("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const bN=De("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const bR=De("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Li=De("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const pG=De("Grid2x2",[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 12h18",key:"1i2n21"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const RA=De("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ag=De("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Hw=De("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wR=De("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const mG=De("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gG=De("Laptop",[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Gw=De("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const vG=De("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Nl=De("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const lm=De("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _l=De("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const yG=De("Loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const DA=De("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const LA=De("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const jR=De("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const xG=De("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const di=De("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const pa=De("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const bG=De("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const FA=De("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const BA=De("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wG=De("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const jG=De("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const or=De("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const SG=De("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $c=De("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wN=De("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const jN=De("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const SR=De("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const NG=De("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _G=De("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const PG=De("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const CG=De("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const AG=De("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Eg=De("StickyNote",[["path",{d:"M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z",key:"qazsjp"}],["path",{d:"M15 3v4a2 2 0 0 0 2 2h4",key:"40519r"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const EG=De("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const SN=De("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gn=De("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const OG=De("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const kG=De("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const NR=De("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Og=De("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Hn=De("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const TG=De("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const js=De("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const NN=De("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function _R(e,t){return function(){return e.apply(t,arguments)}}const{toString:$G}=Object.prototype,{getPrototypeOf:_N}=Object,{iterator:Fy,toStringTag:PR}=Symbol,By=(e=>t=>{const n=$G.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),is=e=>(e=e.toLowerCase(),t=>By(t)===e),zy=e=>t=>typeof t===e,{isArray:Xu}=Array,Yf=zy("undefined");function IG(e){return e!==null&&!Yf(e)&&e.constructor!==null&&!Yf(e.constructor)&&Br(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const CR=is("ArrayBuffer");function MG(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&CR(e.buffer),t}const RG=zy("string"),Br=zy("function"),AR=zy("number"),Uy=e=>e!==null&&typeof e=="object",DG=e=>e===!0||e===!1,Um=e=>{if(By(e)!=="object")return!1;const t=_N(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(PR in e)&&!(Fy in e)},LG=is("Date"),FG=is("File"),BG=is("Blob"),zG=is("FileList"),UG=e=>Uy(e)&&Br(e.pipe),VG=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Br(e.append)&&((t=By(e))==="formdata"||t==="object"&&Br(e.toString)&&e.toString()==="[object FormData]"))},WG=is("URLSearchParams"),[HG,GG,qG,KG]=["ReadableStream","Request","Response","Headers"].map(is),XG=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function mp(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,i;if(typeof e!="object"&&(e=[e]),Xu(e))for(r=0,i=e.length;r0;)if(i=n[r],t===i.toLowerCase())return i;return null}const el=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,OR=e=>!Yf(e)&&e!==el;function qw(){const{caseless:e}=OR(this)&&this||{},t={},n=(r,i)=>{const s=e&&ER(t,i)||i;Um(t[s])&&Um(r)?t[s]=qw(t[s],r):Um(r)?t[s]=qw({},r):Xu(r)?t[s]=r.slice():t[s]=r};for(let r=0,i=arguments.length;r(mp(t,(i,s)=>{n&&Br(i)?e[s]=_R(i,n):e[s]=i},{allOwnKeys:r}),e),ZG=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),QG=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},JG=(e,t,n,r)=>{let i,s,o;const l={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),s=i.length;s-- >0;)o=i[s],(!r||r(o,e,t))&&!l[o]&&(t[o]=e[o],l[o]=!0);e=n!==!1&&_N(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},eq=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},tq=e=>{if(!e)return null;if(Xu(e))return e;let t=e.length;if(!AR(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},nq=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&_N(Uint8Array)),rq=(e,t)=>{const r=(e&&e[Fy]).call(e);let i;for(;(i=r.next())&&!i.done;){const s=i.value;t.call(e,s[0],s[1])}},iq=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},sq=is("HTMLFormElement"),aq=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,i){return r.toUpperCase()+i}),zA=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),oq=is("RegExp"),kR=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};mp(n,(i,s)=>{let o;(o=t(i,s,e))!==!1&&(r[s]=o||i)}),Object.defineProperties(e,r)},lq=e=>{kR(e,(t,n)=>{if(Br(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(Br(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},cq=(e,t)=>{const n={},r=i=>{i.forEach(s=>{n[s]=!0})};return Xu(e)?r(e):r(String(e).split(t)),n},uq=()=>{},dq=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function fq(e){return!!(e&&Br(e.append)&&e[PR]==="FormData"&&e[Fy])}const hq=e=>{const t=new Array(10),n=(r,i)=>{if(Uy(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[i]=r;const s=Xu(r)?[]:{};return mp(r,(o,l)=>{const c=n(o,i+1);!Yf(c)&&(s[l]=c)}),t[i]=void 0,s}}return r};return n(e,0)},pq=is("AsyncFunction"),mq=e=>e&&(Uy(e)||Br(e))&&Br(e.then)&&Br(e.catch),TR=((e,t)=>e?setImmediate:t?((n,r)=>(el.addEventListener("message",({source:i,data:s})=>{i===el&&s===n&&r.length&&r.shift()()},!1),i=>{r.push(i),el.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Br(el.postMessage)),gq=typeof queueMicrotask<"u"?queueMicrotask.bind(el):typeof process<"u"&&process.nextTick||TR,vq=e=>e!=null&&Br(e[Fy]),le={isArray:Xu,isArrayBuffer:CR,isBuffer:IG,isFormData:VG,isArrayBufferView:MG,isString:RG,isNumber:AR,isBoolean:DG,isObject:Uy,isPlainObject:Um,isReadableStream:HG,isRequest:GG,isResponse:qG,isHeaders:KG,isUndefined:Yf,isDate:LG,isFile:FG,isBlob:BG,isRegExp:oq,isFunction:Br,isStream:UG,isURLSearchParams:WG,isTypedArray:nq,isFileList:zG,forEach:mp,merge:qw,extend:YG,trim:XG,stripBOM:ZG,inherits:QG,toFlatObject:JG,kindOf:By,kindOfTest:is,endsWith:eq,toArray:tq,forEachEntry:rq,matchAll:iq,isHTMLForm:sq,hasOwnProperty:zA,hasOwnProp:zA,reduceDescriptors:kR,freezeMethods:lq,toObjectSet:cq,toCamelCase:aq,noop:uq,toFiniteNumber:dq,findKey:ER,global:el,isContextDefined:OR,isSpecCompliantForm:fq,toJSONObject:hq,isAsyncFn:pq,isThenable:mq,setImmediate:TR,asap:gq,isIterable:vq};function vt(e,t,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}le.inherits(vt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:le.toJSONObject(this.config),code:this.code,status:this.status}}});const $R=vt.prototype,IR={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{IR[e]={value:e}});Object.defineProperties(vt,IR);Object.defineProperty($R,"isAxiosError",{value:!0});vt.from=(e,t,n,r,i,s)=>{const o=Object.create($R);return le.toFlatObject(e,o,function(c){return c!==Error.prototype},l=>l!=="isAxiosError"),vt.call(o,e.message,t,n,r,i),o.cause=e,o.name=e.name,s&&Object.assign(o,s),o};const yq=null;function Kw(e){return le.isPlainObject(e)||le.isArray(e)}function MR(e){return le.endsWith(e,"[]")?e.slice(0,-2):e}function UA(e,t,n){return e?e.concat(t).map(function(i,s){return i=MR(i),!n&&s?"["+i+"]":i}).join(n?".":""):t}function xq(e){return le.isArray(e)&&!e.some(Kw)}const bq=le.toFlatObject(le,{},null,function(t){return/^is[A-Z]/.test(t)});function Vy(e,t,n){if(!le.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=le.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,x){return!le.isUndefined(x[m])});const r=n.metaTokens,i=n.visitor||d,s=n.dots,o=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&le.isSpecCompliantForm(t);if(!le.isFunction(i))throw new TypeError("visitor must be a function");function u(g){if(g===null)return"";if(le.isDate(g))return g.toISOString();if(!c&&le.isBlob(g))throw new vt("Blob is not supported. Use a Buffer instead.");return le.isArrayBuffer(g)||le.isTypedArray(g)?c&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function d(g,m,x){let b=g;if(g&&!x&&typeof g=="object"){if(le.endsWith(m,"{}"))m=r?m:m.slice(0,-2),g=JSON.stringify(g);else if(le.isArray(g)&&xq(g)||(le.isFileList(g)||le.endsWith(m,"[]"))&&(b=le.toArray(g)))return m=MR(m),b.forEach(function(w,j){!(le.isUndefined(w)||w===null)&&t.append(o===!0?UA([m],j,s):o===null?m:m+"[]",u(w))}),!1}return Kw(g)?!0:(t.append(UA(x,m,s),u(g)),!1)}const f=[],h=Object.assign(bq,{defaultVisitor:d,convertValue:u,isVisitable:Kw});function p(g,m){if(!le.isUndefined(g)){if(f.indexOf(g)!==-1)throw Error("Circular reference detected in "+m.join("."));f.push(g),le.forEach(g,function(b,y){(!(le.isUndefined(b)||b===null)&&i.call(t,b,le.isString(y)?y.trim():y,m,h))===!0&&p(b,m?m.concat(y):[y])}),f.pop()}}if(!le.isObject(e))throw new TypeError("data must be an object");return p(e),t}function VA(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function PN(e,t){this._pairs=[],e&&Vy(e,this,t)}const RR=PN.prototype;RR.append=function(t,n){this._pairs.push([t,n])};RR.toString=function(t){const n=t?function(r){return t.call(this,r,VA)}:VA;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function wq(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function DR(e,t,n){if(!t)return e;const r=n&&n.encode||wq;le.isFunction(n)&&(n={serialize:n});const i=n&&n.serialize;let s;if(i?s=i(t,n):s=le.isURLSearchParams(t)?t.toString():new PN(t,n).toString(r),s){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}class WA{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){le.forEach(this.handlers,function(r){r!==null&&t(r)})}}const LR={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},jq=typeof URLSearchParams<"u"?URLSearchParams:PN,Sq=typeof FormData<"u"?FormData:null,Nq=typeof Blob<"u"?Blob:null,_q={isBrowser:!0,classes:{URLSearchParams:jq,FormData:Sq,Blob:Nq},protocols:["http","https","file","blob","url","data"]},CN=typeof window<"u"&&typeof document<"u",Xw=typeof navigator=="object"&&navigator||void 0,Pq=CN&&(!Xw||["ReactNative","NativeScript","NS"].indexOf(Xw.product)<0),Cq=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Aq=CN&&window.location.href||"http://localhost",Eq=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:CN,hasStandardBrowserEnv:Pq,hasStandardBrowserWebWorkerEnv:Cq,navigator:Xw,origin:Aq},Symbol.toStringTag,{value:"Module"})),fr={...Eq,..._q};function Oq(e,t){return Vy(e,new fr.classes.URLSearchParams,Object.assign({visitor:function(n,r,i,s){return fr.isNode&&le.isBuffer(n)?(this.append(r,n.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},t))}function kq(e){return le.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Tq(e){const t={},n=Object.keys(e);let r;const i=n.length;let s;for(r=0;r=n.length;return o=!o&&le.isArray(i)?i.length:o,c?(le.hasOwnProp(i,o)?i[o]=[i[o],r]:i[o]=r,!l):((!i[o]||!le.isObject(i[o]))&&(i[o]=[]),t(n,r,i[o],s)&&le.isArray(i[o])&&(i[o]=Tq(i[o])),!l)}if(le.isFormData(e)&&le.isFunction(e.entries)){const n={};return le.forEachEntry(e,(r,i)=>{t(kq(r),i,n,0)}),n}return null}function $q(e,t,n){if(le.isString(e))try{return(t||JSON.parse)(e),le.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(0,JSON.stringify)(e)}const gp={transitional:LR,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",i=r.indexOf("application/json")>-1,s=le.isObject(t);if(s&&le.isHTMLForm(t)&&(t=new FormData(t)),le.isFormData(t))return i?JSON.stringify(FR(t)):t;if(le.isArrayBuffer(t)||le.isBuffer(t)||le.isStream(t)||le.isFile(t)||le.isBlob(t)||le.isReadableStream(t))return t;if(le.isArrayBufferView(t))return t.buffer;if(le.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Oq(t,this.formSerializer).toString();if((l=le.isFileList(t))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Vy(l?{"files[]":t}:t,c&&new c,this.formSerializer)}}return s||i?(n.setContentType("application/json",!1),$q(t)):t}],transformResponse:[function(t){const n=this.transitional||gp.transitional,r=n&&n.forcedJSONParsing,i=this.responseType==="json";if(le.isResponse(t)||le.isReadableStream(t))return t;if(t&&le.isString(t)&&(r&&!this.responseType||i)){const o=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(t)}catch(l){if(o)throw l.name==="SyntaxError"?vt.from(l,vt.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:fr.classes.FormData,Blob:fr.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};le.forEach(["delete","get","head","post","put","patch"],e=>{gp.headers[e]={}});const Iq=le.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Mq=e=>{const t={};let n,r,i;return e&&e.split(` -`).forEach(function(o){i=o.indexOf(":"),n=o.substring(0,i).trim().toLowerCase(),r=o.substring(i+1).trim(),!(!n||t[n]&&Iq[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},HA=Symbol("internals");function Od(e){return e&&String(e).trim().toLowerCase()}function Vm(e){return e===!1||e==null?e:le.isArray(e)?e.map(Vm):String(e)}function Rq(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const Dq=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function U0(e,t,n,r,i){if(le.isFunction(r))return r.call(this,t,n);if(i&&(t=n),!!le.isString(t)){if(le.isString(r))return t.indexOf(r)!==-1;if(le.isRegExp(r))return r.test(t)}}function Lq(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function Fq(e,t){const n=le.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(i,s,o){return this[r].call(this,t,i,s,o)},configurable:!0})})}class zr{constructor(t){t&&this.set(t)}set(t,n,r){const i=this;function s(l,c,u){const d=Od(c);if(!d)throw new Error("header name must be a non-empty string");const f=le.findKey(i,d);(!f||i[f]===void 0||u===!0||u===void 0&&i[f]!==!1)&&(i[f||c]=Vm(l))}const o=(l,c)=>le.forEach(l,(u,d)=>s(u,d,c));if(le.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(le.isString(t)&&(t=t.trim())&&!Dq(t))o(Mq(t),n);else if(le.isObject(t)&&le.isIterable(t)){let l={},c,u;for(const d of t){if(!le.isArray(d))throw TypeError("Object iterator must return a key-value pair");l[u=d[0]]=(c=l[u])?le.isArray(c)?[...c,d[1]]:[c,d[1]]:d[1]}o(l,n)}else t!=null&&s(n,t,r);return this}get(t,n){if(t=Od(t),t){const r=le.findKey(this,t);if(r){const i=this[r];if(!n)return i;if(n===!0)return Rq(i);if(le.isFunction(n))return n.call(this,i,r);if(le.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Od(t),t){const r=le.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||U0(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let i=!1;function s(o){if(o=Od(o),o){const l=le.findKey(r,o);l&&(!n||U0(r,r[l],l,n))&&(delete r[l],i=!0)}}return le.isArray(t)?t.forEach(s):s(t),i}clear(t){const n=Object.keys(this);let r=n.length,i=!1;for(;r--;){const s=n[r];(!t||U0(this,this[s],s,t,!0))&&(delete this[s],i=!0)}return i}normalize(t){const n=this,r={};return le.forEach(this,(i,s)=>{const o=le.findKey(r,s);if(o){n[o]=Vm(i),delete n[s];return}const l=t?Lq(s):String(s).trim();l!==s&&delete n[s],n[l]=Vm(i),r[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return le.forEach(this,(r,i)=>{r!=null&&r!==!1&&(n[i]=t&&le.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` -`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(i=>r.set(i)),r}static accessor(t){const r=(this[HA]=this[HA]={accessors:{}}).accessors,i=this.prototype;function s(o){const l=Od(o);r[l]||(Fq(i,o),r[l]=!0)}return le.isArray(t)?t.forEach(s):s(t),this}}zr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);le.reduceDescriptors(zr.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});le.freezeMethods(zr);function V0(e,t){const n=this||gp,r=t||n,i=zr.from(r.headers);let s=r.data;return le.forEach(e,function(l){s=l.call(n,s,i.normalize(),t?t.status:void 0)}),i.normalize(),s}function BR(e){return!!(e&&e.__CANCEL__)}function Yu(e,t,n){vt.call(this,e??"canceled",vt.ERR_CANCELED,t,n),this.name="CanceledError"}le.inherits(Yu,vt,{__CANCEL__:!0});function zR(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new vt("Request failed with status code "+n.status,[vt.ERR_BAD_REQUEST,vt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Bq(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function zq(e,t){e=e||10;const n=new Array(e),r=new Array(e);let i=0,s=0,o;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),d=r[s];o||(o=u),n[i]=c,r[i]=u;let f=s,h=0;for(;f!==i;)h+=n[f++],f=f%e;if(i=(i+1)%e,i===s&&(s=(s+1)%e),u-o{n=d,i=null,s&&(clearTimeout(s),s=null),e.apply(null,u)};return[(...u)=>{const d=Date.now(),f=d-n;f>=r?o(u,d):(i=u,s||(s=setTimeout(()=>{s=null,o(i)},r-f)))},()=>i&&o(i)]}const kg=(e,t,n=3)=>{let r=0;const i=zq(50,250);return Uq(s=>{const o=s.loaded,l=s.lengthComputable?s.total:void 0,c=o-r,u=i(c),d=o<=l;r=o;const f={loaded:o,total:l,progress:l?o/l:void 0,bytes:c,rate:u||void 0,estimated:u&&l&&d?(l-o)/u:void 0,event:s,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(f)},n)},GA=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},qA=e=>(...t)=>le.asap(()=>e(...t)),Vq=fr.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,fr.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(fr.origin),fr.navigator&&/(msie|trident)/i.test(fr.navigator.userAgent)):()=>!0,Wq=fr.hasStandardBrowserEnv?{write(e,t,n,r,i,s){const o=[e+"="+encodeURIComponent(t)];le.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),le.isString(r)&&o.push("path="+r),le.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Hq(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Gq(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function UR(e,t,n){let r=!Hq(t);return e&&(r||n==!1)?Gq(e,t):t}const KA=e=>e instanceof zr?{...e}:e;function Pl(e,t){t=t||{};const n={};function r(u,d,f,h){return le.isPlainObject(u)&&le.isPlainObject(d)?le.merge.call({caseless:h},u,d):le.isPlainObject(d)?le.merge({},d):le.isArray(d)?d.slice():d}function i(u,d,f,h){if(le.isUndefined(d)){if(!le.isUndefined(u))return r(void 0,u,f,h)}else return r(u,d,f,h)}function s(u,d){if(!le.isUndefined(d))return r(void 0,d)}function o(u,d){if(le.isUndefined(d)){if(!le.isUndefined(u))return r(void 0,u)}else return r(void 0,d)}function l(u,d,f){if(f in t)return r(u,d);if(f in e)return r(void 0,u)}const c={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l,headers:(u,d,f)=>i(KA(u),KA(d),f,!0)};return le.forEach(Object.keys(Object.assign({},e,t)),function(d){const f=c[d]||i,h=f(e[d],t[d],d);le.isUndefined(h)&&f!==l||(n[d]=h)}),n}const VR=e=>{const t=Pl({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:l}=t;t.headers=o=zr.from(o),t.url=DR(UR(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let c;if(le.isFormData(n)){if(fr.hasStandardBrowserEnv||fr.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((c=o.getContentType())!==!1){const[u,...d]=c?c.split(";").map(f=>f.trim()).filter(Boolean):[];o.setContentType([u||"multipart/form-data",...d].join("; "))}}if(fr.hasStandardBrowserEnv&&(r&&le.isFunction(r)&&(r=r(t)),r||r!==!1&&Vq(t.url))){const u=i&&s&&Wq.read(s);u&&o.set(i,u)}return t},qq=typeof XMLHttpRequest<"u",Kq=qq&&function(e){return new Promise(function(n,r){const i=VR(e);let s=i.data;const o=zr.from(i.headers).normalize();let{responseType:l,onUploadProgress:c,onDownloadProgress:u}=i,d,f,h,p,g;function m(){p&&p(),g&&g(),i.cancelToken&&i.cancelToken.unsubscribe(d),i.signal&&i.signal.removeEventListener("abort",d)}let x=new XMLHttpRequest;x.open(i.method.toUpperCase(),i.url,!0),x.timeout=i.timeout;function b(){if(!x)return;const w=zr.from("getAllResponseHeaders"in x&&x.getAllResponseHeaders()),S={data:!l||l==="text"||l==="json"?x.responseText:x.response,status:x.status,statusText:x.statusText,headers:w,config:e,request:x};zR(function(P){n(P),m()},function(P){r(P),m()},S),x=null}"onloadend"in x?x.onloadend=b:x.onreadystatechange=function(){!x||x.readyState!==4||x.status===0&&!(x.responseURL&&x.responseURL.indexOf("file:")===0)||setTimeout(b)},x.onabort=function(){x&&(r(new vt("Request aborted",vt.ECONNABORTED,e,x)),x=null)},x.onerror=function(){r(new vt("Network Error",vt.ERR_NETWORK,e,x)),x=null},x.ontimeout=function(){let j=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const S=i.transitional||LR;i.timeoutErrorMessage&&(j=i.timeoutErrorMessage),r(new vt(j,S.clarifyTimeoutError?vt.ETIMEDOUT:vt.ECONNABORTED,e,x)),x=null},s===void 0&&o.setContentType(null),"setRequestHeader"in x&&le.forEach(o.toJSON(),function(j,S){x.setRequestHeader(S,j)}),le.isUndefined(i.withCredentials)||(x.withCredentials=!!i.withCredentials),l&&l!=="json"&&(x.responseType=i.responseType),u&&([h,g]=kg(u,!0),x.addEventListener("progress",h)),c&&x.upload&&([f,p]=kg(c),x.upload.addEventListener("progress",f),x.upload.addEventListener("loadend",p)),(i.cancelToken||i.signal)&&(d=w=>{x&&(r(!w||w.type?new Yu(null,e,x):w),x.abort(),x=null)},i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));const y=Bq(i.url);if(y&&fr.protocols.indexOf(y)===-1){r(new vt("Unsupported protocol "+y+":",vt.ERR_BAD_REQUEST,e));return}x.send(s||null)})},Xq=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,i;const s=function(u){if(!i){i=!0,l();const d=u instanceof Error?u:this.reason;r.abort(d instanceof vt?d:new Yu(d instanceof Error?d.message:d))}};let o=t&&setTimeout(()=>{o=null,s(new vt(`timeout ${t} of ms exceeded`,vt.ETIMEDOUT))},t);const l=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(s):u.removeEventListener("abort",s)}),e=null)};e.forEach(u=>u.addEventListener("abort",s));const{signal:c}=r;return c.unsubscribe=()=>le.asap(l),c}},Yq=function*(e,t){let n=e.byteLength;if(n{const i=Zq(e,t);let s=0,o,l=c=>{o||(o=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:u,value:d}=await i.next();if(u){l(),c.close();return}let f=d.byteLength;if(n){let h=s+=f;n(h)}c.enqueue(new Uint8Array(d))}catch(u){throw l(u),u}},cancel(c){return l(c),i.return()}},{highWaterMark:2})},Wy=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",WR=Wy&&typeof ReadableStream=="function",Jq=Wy&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),HR=(e,...t)=>{try{return!!e(...t)}catch{return!1}},eK=WR&&HR(()=>{let e=!1;const t=new Request(fr.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),YA=64*1024,Yw=WR&&HR(()=>le.isReadableStream(new Response("").body)),Tg={stream:Yw&&(e=>e.body)};Wy&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Tg[t]&&(Tg[t]=le.isFunction(e[t])?n=>n[t]():(n,r)=>{throw new vt(`Response type '${t}' is not supported`,vt.ERR_NOT_SUPPORT,r)})})})(new Response);const tK=async e=>{if(e==null)return 0;if(le.isBlob(e))return e.size;if(le.isSpecCompliantForm(e))return(await new Request(fr.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(le.isArrayBufferView(e)||le.isArrayBuffer(e))return e.byteLength;if(le.isURLSearchParams(e)&&(e=e+""),le.isString(e))return(await Jq(e)).byteLength},nK=async(e,t)=>{const n=le.toFiniteNumber(e.getContentLength());return n??tK(t)},rK=Wy&&(async e=>{let{url:t,method:n,data:r,signal:i,cancelToken:s,timeout:o,onDownloadProgress:l,onUploadProgress:c,responseType:u,headers:d,withCredentials:f="same-origin",fetchOptions:h}=VR(e);u=u?(u+"").toLowerCase():"text";let p=Xq([i,s&&s.toAbortSignal()],o),g;const m=p&&p.unsubscribe&&(()=>{p.unsubscribe()});let x;try{if(c&&eK&&n!=="get"&&n!=="head"&&(x=await nK(d,r))!==0){let S=new Request(t,{method:"POST",body:r,duplex:"half"}),N;if(le.isFormData(r)&&(N=S.headers.get("content-type"))&&d.setContentType(N),S.body){const[P,_]=GA(x,kg(qA(c)));r=XA(S.body,YA,P,_)}}le.isString(f)||(f=f?"include":"omit");const b="credentials"in Request.prototype;g=new Request(t,{...h,signal:p,method:n.toUpperCase(),headers:d.normalize().toJSON(),body:r,duplex:"half",credentials:b?f:void 0});let y=await fetch(g);const w=Yw&&(u==="stream"||u==="response");if(Yw&&(l||w&&m)){const S={};["status","statusText","headers"].forEach(A=>{S[A]=y[A]});const N=le.toFiniteNumber(y.headers.get("content-length")),[P,_]=l&&GA(N,kg(qA(l),!0))||[];y=new Response(XA(y.body,YA,P,()=>{_&&_(),m&&m()}),S)}u=u||"text";let j=await Tg[le.findKey(Tg,u)||"text"](y,e);return!w&&m&&m(),await new Promise((S,N)=>{zR(S,N,{data:j,headers:zr.from(y.headers),status:y.status,statusText:y.statusText,config:e,request:g})})}catch(b){throw m&&m(),b&&b.name==="TypeError"&&/Load failed|fetch/i.test(b.message)?Object.assign(new vt("Network Error",vt.ERR_NETWORK,e,g),{cause:b.cause||b}):vt.from(b,b&&b.code,e,g)}}),Zw={http:yq,xhr:Kq,fetch:rK};le.forEach(Zw,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const ZA=e=>`- ${e}`,iK=e=>le.isFunction(e)||e===null||e===!1,GR={getAdapter:e=>{e=le.isArray(e)?e:[e];const{length:t}=e;let n,r;const i={};for(let s=0;s`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let o=t?s.length>1?`since : -`+s.map(ZA).join(` -`):" "+ZA(s[0]):"as no adapter specified";throw new vt("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r},adapters:Zw};function W0(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Yu(null,e)}function QA(e){return W0(e),e.headers=zr.from(e.headers),e.data=V0.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),GR.getAdapter(e.adapter||gp.adapter)(e).then(function(r){return W0(e),r.data=V0.call(e,e.transformResponse,r),r.headers=zr.from(r.headers),r},function(r){return BR(r)||(W0(e),r&&r.response&&(r.response.data=V0.call(e,e.transformResponse,r.response),r.response.headers=zr.from(r.response.headers))),Promise.reject(r)})}const qR="1.9.0",Hy={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Hy[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const JA={};Hy.transitional=function(t,n,r){function i(s,o){return"[Axios v"+qR+"] Transitional option '"+s+"'"+o+(r?". "+r:"")}return(s,o,l)=>{if(t===!1)throw new vt(i(o," has been removed"+(n?" in "+n:"")),vt.ERR_DEPRECATED);return n&&!JA[o]&&(JA[o]=!0,console.warn(i(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(s,o,l):!0}};Hy.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function sK(e,t,n){if(typeof e!="object")throw new vt("options must be an object",vt.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let i=r.length;for(;i-- >0;){const s=r[i],o=t[s];if(o){const l=e[s],c=l===void 0||o(l,s,e);if(c!==!0)throw new vt("option "+s+" must be "+c,vt.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new vt("Unknown option "+s,vt.ERR_BAD_OPTION)}}const Wm={assertOptions:sK,validators:Hy},cs=Wm.validators;class pl{constructor(t){this.defaults=t||{},this.interceptors={request:new WA,response:new WA}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=` -`+s):r.stack=s}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Pl(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:s}=n;r!==void 0&&Wm.assertOptions(r,{silentJSONParsing:cs.transitional(cs.boolean),forcedJSONParsing:cs.transitional(cs.boolean),clarifyTimeoutError:cs.transitional(cs.boolean)},!1),i!=null&&(le.isFunction(i)?n.paramsSerializer={serialize:i}:Wm.assertOptions(i,{encode:cs.function,serialize:cs.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Wm.assertOptions(n,{baseUrl:cs.spelling("baseURL"),withXsrfToken:cs.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=s&&le.merge(s.common,s[n.method]);s&&le.forEach(["delete","get","head","post","put","patch","common"],g=>{delete s[g]}),n.headers=zr.concat(o,s);const l=[];let c=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(c=c&&m.synchronous,l.unshift(m.fulfilled,m.rejected))});const u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});let d,f=0,h;if(!c){const g=[QA.bind(this),void 0];for(g.unshift.apply(g,l),g.push.apply(g,u),h=g.length,d=Promise.resolve(n);f{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](i);r._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(l=>{r.subscribe(l),s=l}).then(i);return o.cancel=function(){r.unsubscribe(s)},o},t(function(s,o,l){r.reason||(r.reason=new Yu(s,o,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new AN(function(i){t=i}),cancel:t}}}function aK(e){return function(n){return e.apply(null,n)}}function oK(e){return le.isObject(e)&&e.isAxiosError===!0}const Qw={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Qw).forEach(([e,t])=>{Qw[t]=e});function KR(e){const t=new pl(e),n=_R(pl.prototype.request,t);return le.extend(n,pl.prototype,t,{allOwnKeys:!0}),le.extend(n,t,null,{allOwnKeys:!0}),n.create=function(i){return KR(Pl(e,i))},n}const Pn=KR(gp);Pn.Axios=pl;Pn.CanceledError=Yu;Pn.CancelToken=AN;Pn.isCancel=BR;Pn.VERSION=qR;Pn.toFormData=Vy;Pn.AxiosError=vt;Pn.Cancel=Pn.CanceledError;Pn.all=function(t){return Promise.all(t)};Pn.spread=aK;Pn.isAxiosError=oK;Pn.mergeConfig=Pl;Pn.AxiosHeaders=zr;Pn.formToJSON=e=>FR(le.isHTMLForm(e)?new FormData(e):e);Pn.getAdapter=GR.getAdapter;Pn.HttpStatusCode=Qw;Pn.default=Pn;const XR="https://ai-sandbox.oliver.solutions/semblance_back/api",He=Pn.create({baseURL:XR,headers:{"Content-Type":"application/json"},timeout:6e5});He.interceptors.request.use(e=>{const t=localStorage.getItem("auth_token");return t&&(e.headers.Authorization=`Bearer ${t}`),e},e=>Promise.reject(e));const Jw="auth_error",lK=e=>{e!=null&&e.isPersonaCreation||(localStorage.removeItem("auth_token"),localStorage.removeItem("user"));const t=new CustomEvent(Jw,{detail:e||{}});window.dispatchEvent(t)};He.interceptors.response.use(e=>e,e=>{var t,n,r,i,s,o;if(e.response&&e.response.status===401){const l=e.config&&(((t=e.config.url)==null?void 0:t.includes("/personas"))||((n=e.config.url)==null?void 0:n.includes("/personas/batch"))||e.config.method&&((r=e.config.url)==null?void 0:r.startsWith("/personas")));console.log("API Error:",{url:(i=e.config)==null?void 0:i.url,method:(s=e.config)==null?void 0:s.method,isPersonaRequest:l}),l?console.warn("Authentication error in persona request, letting component handle it"):lK({source:(o=e.config)==null?void 0:o.url,isPersonaCreation:!1})}return Promise.reject(e)});const e1={login:(e,t)=>He.post("/auth/login",{username:e,password:t}),register:(e,t,n)=>He.post("/auth/register",{username:e,email:t,password:n}),getProfile:()=>He.get("/auth/me")},Nn={getAll:()=>He.get("/personas/all"),getById:e=>He.get(`/personas/${e}`),create:e=>He.post("/personas",e),update:(e,t)=>e&&e.startsWith("local-")?(console.log("Cannot update with local ID, creating new instead:",e),He.post("/personas",t)):He.put(`/personas/${e}`,t),delete:e=>{const t=typeof e=="object"&&e!==null&&e._id||e;return console.log(`Deleting persona with ID: ${t}`),He.delete(`/personas/${t}`)},createBatch:e=>He.post("/personas/batch",e)},Us={generate:e=>He.post("/ai-personas/generate",e||{},{timeout:6e5}),generateAndSave:e=>He.post("/ai-personas/generate-and-save",e||{},{timeout:6e5}),batchGenerate:e=>He.post("/ai-personas/batch-generate",e,{timeout:6e5}),batchGenerateAndSave:e=>He.post("/ai-personas/batch-generate-and-save",e,{timeout:6e5}),generateBasicProfiles:(e,t=5,n=.8)=>He.post("/ai-personas/generate-basic-profiles",{audience_brief:e,count:t,temperature:n},{timeout:6e5}),completePersona:(e,t=.7)=>He.post("/ai-personas/complete-persona",{basic_profile:e,temperature:t},{timeout:6e5}),completeAndSavePersona:(e,t=.7)=>He.post("/ai-personas/complete-and-save-persona",{basic_profile:e,temperature:t},{timeout:6e5}),generatePersonaSummary:(e,t=.7)=>He.post("/ai-personas/generate-persona-summary",{persona_data:e,temperature:t},{timeout:6e5}),batchGenerateWithStages:async(e,t,n=5,r=.7,i)=>{var s;try{const l=(await He.post("/ai-personas/generate-basic-profiles",{audience_brief:e,research_objective:t,count:n,temperature:.7,customer_data_session_id:i},{timeout:6e5})).data.profiles,c=[],u=[],d=[],f=l.map(p=>He.post("/ai-personas/complete-and-save-persona",{basic_profile:p,temperature:r,customer_data_session_id:i},{timeout:6e5}));if((await Promise.allSettled(f)).forEach((p,g)=>{if(p.status==="fulfilled")c.push(p.value.data.persona),u.push(p.value.data.persona_id);else{const m=l[g],x={index:g,name:m.name||`Persona ${g+1}`,error:p.reason};d.push(x),console.error(`Failed to complete persona ${g+1} (${m.name||"unnamed"}):`,p.reason)}}),c.length===0&&d.length>0)throw new Error(`Failed to generate any personas. ${d.length} profile(s) failed.`);return{data:{message:`Generated and saved ${c.length} personas${d.length>0?` (${d.length} failed)`:""}`,personas:c,persona_ids:u,errors:d.length>0?d:void 0,partial_success:d.length>0&&c.length>0}}}catch(o){throw((s=o.response)==null?void 0:s.status)===504||o.code==="ECONNABORTED"?new Error("Timeout error: The server took too long to generate personas. Please try with fewer personas or try again later."):o}},enhanceAudienceBrief:(e,t,n=.7)=>He.post("/ai-personas/enhance-audience-brief",{audience_brief:e,research_objective:t,temperature:n},{timeout:6e5}),batchGenerateSummaries:(e,t=.7)=>He.post("/ai-personas/batch-generate-summaries",{persona_ids:e,temperature:t},{timeout:9e5}),uploadCustomerData:e=>{const t=new FormData;for(let n=0;nHe.delete(`/ai-personas/cleanup-customer-data/${e}`)},At={getAll:()=>He.get("/focus-groups"),getById:e=>He.get(`/focus-groups/${e}`),create:e=>He.post("/focus-groups",e),update:(e,t)=>He.put(`/focus-groups/${e}`,t),delete:e=>He.delete(`/focus-groups/${e}`),addParticipant:(e,t)=>He.post(`/focus-groups/${e}/participants`,{persona_id:t}),removeParticipant:(e,t)=>He.delete(`/focus-groups/${e}/participants/${t}`),sendMessage:(e,t)=>He.post(`/focus-groups/${e}/messages`,t),getMessages:e=>He.get(`/focus-groups/${e}/messages`),updateMessageHighlight:(e,t,n)=>He.patch(`/focus-groups/${e}/messages/${t}`,{highlighted:n}),describeAsset:(e,t)=>He.post(`/focus-groups/${e}/describe-asset`,{asset_filename:t},{timeout:12e4}),generateDiscussionGuide:e=>He.post("/focus-groups/generate-discussion-guide",e,{timeout:6e5}),generateDiscussionGuideForGroup:(e,t)=>He.post(`/focus-groups/${e}/generate-discussion-guide`,t,{timeout:6e5}),downloadDiscussionGuide:async e=>{try{const t=await He.get(`/focus-groups/${e}/discussion-guide/download`,{responseType:"blob",timeout:3e4}),n=t.headers["content-disposition"];let r="discussion-guide.md";if(n){const l=n.match(/filename="([^"]+)"/);l&&(r=l[1])}const i=new Blob([t.data],{type:"text/markdown"}),s=URL.createObjectURL(i),o=document.createElement("a");return o.href=s,o.download=r,o.style.display="none",document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(s),{success:!0,filename:r}}catch(t){throw console.error("Error downloading discussion guide:",t),new Error("Failed to download discussion guide")}},createNote:(e,t)=>He.post(`/focus-groups/${e}/notes`,t),getNotes:e=>He.get(`/focus-groups/${e}/notes`),deleteNote:(e,t)=>He.delete(`/focus-groups/${e}/notes/${t}`),uploadAssets:(e,t)=>He.post(`/focus-groups/${e}/assets`,t,{headers:{"Content-Type":"multipart/form-data"},timeout:12e4}),getAssets:e=>He.get(`/focus-groups/${e}/assets`),getAssetUrl:(e,t)=>`${XR}/focus-groups/${e}/assets/${t}`,deleteAsset:(e,t)=>He.delete(`/focus-groups/${e}/assets/${t}`)},fn={generateResponse:(e,t,n,r=.7)=>He.post("/focus-group-ai/generate-response",{focus_group_id:e,persona_id:t,current_topic:n,temperature:r},{timeout:6e5}),generateKeyThemes:(e,t=.7)=>He.post("/focus-group-ai/generate-key-themes",{focus_group_id:e,temperature:t},{timeout:6e5}),getKeyThemes:e=>He.get(`/focus-group-ai/key-themes/${e}`),deleteKeyTheme:(e,t)=>He.delete(`/focus-group-ai/key-themes/${e}/${t}`),getModeratorStatus:e=>He.get(`/focus-group-ai/moderator/status/${e}`),advanceModeratorDiscussion:e=>He.post(`/focus-group-ai/moderator/advance/${e}`,{},{timeout:6e5}),setModeratorPosition:(e,t,n)=>He.put(`/focus-group-ai/moderator/position/${e}`,{section_id:t,item_id:n}),startAutonomousConversation:(e,t)=>He.post(`/focus-group-ai/autonomous/start/${e}`,{initial_prompt:t},{timeout:6e5}),stopAutonomousConversation:(e,t)=>He.post(`/focus-group-ai/autonomous/stop/${e}`,{reason:t}),getAutonomousConversationStatus:e=>He.get(`/focus-group-ai/autonomous/status/${e}`),getConversationState:e=>He.get(`/focus-group-ai/conversation/state/${e}`),getConversationAnalytics:e=>He.get(`/focus-group-ai/conversation/analytics/${e}`),makeConversationDecision:(e,t=.7,n="ai")=>He.post(`/focus-group-ai/conversation/decision/${e}`,{temperature:t,mode:n},{timeout:6e5}),getConversationInsights:e=>He.get(`/focus-group-ai/conversation/insights/${e}`,{timeout:6e5}),manualIntervention:(e,t,n,r)=>He.post(`/focus-group-ai/conversation/intervene/${e}`,{action:t,message:n,participant_id:r}),getReasoningHistory:e=>He.get(`/focus-group-ai/conversation/reasoning-history/${e}`),endSession:(e,t)=>He.post(`/focus-group-ai/moderator/end-session/${e}`,{reason:t||"session_ended"})},YR=v.createContext(void 0);function cK({children:e}){const[t,n]=v.useState(null),[r,i]=v.useState(null),[s,o]=v.useState(!0),l=Cn();v.useEffect(()=>{const p=g=>{const x=g.detail||{};if(x.isPersonaCreation){console.log("Ignoring auth error from persona creation",x);return}i(null),n(null),pe.error("Session expired",{description:"Please log in again"}),l("/login")};return window.addEventListener(Jw,p),()=>{window.removeEventListener(Jw,p)}},[l]),v.useEffect(()=>{const p=localStorage.getItem("auth_token"),g=localStorage.getItem("user");if(console.log("AuthContext initializing - stored data check:",{hasToken:!!p,hasUser:!!g}),p&&g)try{i(p),n(JSON.parse(g)),console.log("User session restored from localStorage")}catch(m){console.error("Failed to parse stored user data:",m),localStorage.removeItem("auth_token"),localStorage.removeItem("user")}else console.log("No stored authentication data found");o(!1)},[]),v.useEffect(()=>{if(r){console.log("Verifying token...");const p=`token_validated_${r.substring(0,10)}`;if(sessionStorage.getItem(p)==="true"&&t){console.log("Token already validated this session, skipping validation");return}e1.getProfile().then(m=>{m&&"data"in m&&(console.log("Profile verified successfully"),n(m.data),sessionStorage.setItem(p,"true"))}).catch(m=>{m.response&&m.response.status===401?(console.error("Token invalid (401):",m),localStorage.removeItem("auth_token"),localStorage.removeItem("user"),i(null),n(null)):(console.warn("Profile validation error (not clearing token):",m),sessionStorage.setItem(p,"true"))})}else console.log("No token available, not validating profile")},[r,t]);const c=async(p,g)=>{var m,x;o(!0),console.log("Attempting login for user:",p);try{const b=await e1.login(p,g);if(console.log("Login API response received"),!b.data.access_token)throw new Error("No access token received from server");return localStorage.setItem("auth_token",b.data.access_token),localStorage.setItem("user",JSON.stringify(b.data.user)),i(b.data.access_token),n(b.data.user),console.log("Authentication state updated"),pe.success("Login successful!"),b.data.access_token}catch(b){throw console.error("Login failed:",b),pe.error("Login failed",{description:((x=(m=b.response)==null?void 0:m.data)==null?void 0:x.message)||"Invalid username or password"}),b}finally{o(!1)}},u=()=>{localStorage.removeItem("auth_token"),localStorage.removeItem("user"),i(null),n(null),pe.info("You have been logged out")},d=!!localStorage.getItem("auth_token"),h={user:t,token:r,isLoading:s,login:c,logout:u,isAuthenticated:!!r||d};return a.jsx(YR.Provider,{value:h,children:e})}function Ul(){const e=v.useContext(YR);if(e===void 0)throw new Error("useAuth must be used within an AuthProvider");return e}function ea(){const[e,t]=v.useState(!1),n=rs(),r=Cn(),{isAuthenticated:i,logout:s}=Ul(),o=[{name:"Home",href:"/",icon:Hw},{name:"Synthetic Personas",href:"/synthetic-users",icon:Hn},{name:"Focus Groups",href:"/focus-groups",icon:pa},{name:"Dashboard",href:"/dashboard",icon:Gw}],l=()=>{t(!e)},c=d=>n.pathname===d,u=d=>{if(d==="/synthetic-users"){const f=new CustomEvent("syntheticUsersNavigation");window.dispatchEvent(f)}r(d)};return a.jsxs("header",{className:"fixed top-0 left-0 right-0 z-50 bg-white/80 backdrop-blur-md border-b border-slate-200/80",children:[a.jsx("div",{className:"px-4 sm:px-6 lg:px-8",children:a.jsxs("div",{className:"flex h-16 items-center justify-between",children:[a.jsx("div",{className:"flex items-center",children:a.jsx(gi,{to:"/",className:"flex items-center",children:a.jsx("span",{className:"font-sf text-2xl font-semibold text-gradient",children:"Semblance"})})}),a.jsx("nav",{className:"hidden md:block",children:a.jsxs("ul",{className:"flex items-center space-x-8",children:[o.map(d=>a.jsx("li",{children:d.href==="/"?a.jsxs(gi,{to:d.href,className:Me("flex items-center px-1 py-2 text-sm font-medium hover-transition border-b-2",c(d.href)?"border-primary text-primary":"border-transparent text-slate-600 hover:text-slate-900 hover:border-slate-300"),children:[a.jsx(d.icon,{className:"mr-1 h-4 w-4"}),d.name]}):a.jsxs("button",{onClick:()=>u(d.href),className:Me("flex items-center px-1 py-2 text-sm font-medium hover-transition border-b-2",c(d.href)?"border-primary text-primary":"border-transparent text-slate-600 hover:text-slate-900 hover:border-slate-300"),children:[a.jsx(d.icon,{className:"mr-1 h-4 w-4"}),d.name]})},d.name)),a.jsx("li",{children:i?a.jsxs("button",{onClick:()=>{s(),r("/login")},className:"flex items-center px-3 py-2 text-sm font-medium text-slate-600 hover:text-slate-900 button-transition rounded-md hover:bg-slate-50",children:[a.jsx(LA,{className:"mr-1 h-4 w-4"}),"Logout"]}):a.jsxs(gi,{to:"/login",className:"flex items-center px-3 py-2 text-sm font-medium text-slate-600 hover:text-slate-900 button-transition rounded-md hover:bg-slate-50",children:[a.jsx(DA,{className:"mr-1 h-4 w-4"}),"Login"]})})]})}),a.jsx("div",{className:"flex md:hidden",children:a.jsxs("button",{type:"button",className:"inline-flex items-center justify-center rounded-md p-2 text-slate-700 hover:bg-slate-100 hover:text-slate-900 button-transition",onClick:l,children:[a.jsx("span",{className:"sr-only",children:"Open main menu"}),e?a.jsx(js,{className:"block h-6 w-6","aria-hidden":"true"}):a.jsx(xG,{className:"block h-6 w-6","aria-hidden":"true"})]})})]})}),e&&a.jsx("div",{className:"md:hidden glass-panel animate-fade-in",children:a.jsxs("div",{className:"space-y-1 px-4 pb-3 pt-2",children:[o.map(d=>a.jsx("div",{children:d.href==="/"?a.jsxs(gi,{to:d.href,className:Me("flex items-center rounded-md px-3 py-2 text-base font-medium button-transition",c(d.href)?"bg-primary text-white":"text-slate-600 hover:bg-slate-50 hover:text-slate-900"),onClick:()=>t(!1),children:[a.jsx(d.icon,{className:"mr-3 h-5 w-5"}),d.name]}):a.jsxs("button",{className:Me("flex items-center rounded-md px-3 py-2 text-base font-medium button-transition w-full text-left",c(d.href)?"bg-primary text-white":"text-slate-600 hover:bg-slate-50 hover:text-slate-900"),onClick:()=>{t(!1),u(d.href)},children:[a.jsx(d.icon,{className:"mr-3 h-5 w-5"}),d.name]})},d.name)),i?a.jsxs("button",{onClick:()=>{s(),t(!1),r("/login")},className:"flex items-center rounded-md px-3 py-2 text-base font-medium button-transition text-slate-600 hover:bg-slate-50 hover:text-slate-900 w-full",children:[a.jsx(LA,{className:"mr-3 h-5 w-5"}),"Logout"]}):a.jsxs(gi,{to:"/login",className:"flex items-center rounded-md px-3 py-2 text-base font-medium button-transition text-slate-600 hover:bg-slate-50 hover:text-slate-900",onClick:()=>t(!1),children:[a.jsx(DA,{className:"mr-3 h-5 w-5"}),"Login"]})]})})]})}const eE=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,tE=ht,EN=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return tE(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:s}=t,o=Object.keys(i).map(u=>{const d=n==null?void 0:n[u],f=s==null?void 0:s[u];if(d===null)return null;const h=eE(d)||eE(f);return i[u][h]}),l=n&&Object.entries(n).reduce((u,d)=>{let[f,h]=d;return h===void 0||(u[f]=h),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:f,className:h,...p}=d;return Object.entries(p).every(g=>{let[m,x]=g;return Array.isArray(x)?x.includes({...s,...l}[m]):{...s,...l}[m]===x})?[...u,f,h]:u},[]);return tE(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)},ON=EN("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),oe=v.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},s)=>{const o=r?ca:"button";return a.jsx(o,{className:Me(ON({variant:t,size:n,className:e})),ref:s,...i})});oe.displayName="Button";function uK(){return a.jsxs("div",{className:"relative isolate overflow-hidden",children:[a.jsx("div",{className:"absolute inset-x-0 top-[-10rem] -z-10 transform-gpu overflow-hidden blur-3xl sm:top-[-20rem]","aria-hidden":"true",children:a.jsx("div",{className:"relative left-[calc(50%-11rem)] aspect-[1155/678] w-[36.125rem] -translate-x-1/2 rotate-[30deg] bg-gradient-to-tr from-primary to-blue-400 opacity-20 sm:left-[calc(50%-30rem)] sm:w-[72.1875rem]",style:{clipPath:"polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)"}})}),a.jsxs("div",{className:"mx-auto max-w-7xl px-6 py-24 sm:py-32 lg:flex lg:items-center lg:gap-x-10 lg:px-8 lg:py-40",children:[a.jsxs("div",{className:"mx-auto max-w-2xl lg:mx-0 lg:flex-auto",children:[a.jsx("div",{className:"flex",children:a.jsxs("div",{className:"relative flex items-center gap-x-4 rounded-full px-4 py-1 text-sm leading-6 text-gray-600 ring-1 ring-gray-900/10 hover:ring-gray-900/20",children:[a.jsx("span",{className:"font-semibold text-primary",children:"New"}),a.jsx("span",{className:"h-4 w-px bg-gray-900/10","aria-hidden":"true"}),a.jsx("span",{children:"Introducing AI-driven focus groups"})]})}),a.jsxs("h1",{className:"mt-10 max-w-lg text-4xl font-sf font-bold tracking-tight text-gray-900 sm:text-6xl",children:["Research with ",a.jsx("span",{className:"text-gradient",children:"synthetic personas"})]}),a.jsx("p",{className:"mt-6 text-lg leading-8 text-gray-600",children:"Conduct research using AI-powered synthetic personas and autonomous focus groups. Gain valuable insights without the limitations of traditional research methods."}),a.jsxs("div",{className:"mt-10 flex items-center gap-x-6",children:[a.jsx(gi,{to:"/synthetic-users",children:a.jsxs(oe,{className:"px-6 py-6 text-base hover:shadow-lg hover:translate-y-[-2px] button-transition",children:["Create synthetic personas",a.jsx(ds,{className:"ml-2 h-4 w-4"})]})}),a.jsxs(gi,{to:"/focus-groups",className:"text-sm font-semibold leading-6 text-gray-900 hover:text-primary button-transition",children:["Set up focus groups ",a.jsx("span",{"aria-hidden":"true",children:"โ†’"})]})]})]}),a.jsx("div",{className:"mt-16 sm:mt-24 lg:mt-0 lg:flex-shrink-0 lg:flex-grow",children:a.jsxs("div",{className:"relative glass-card mx-auto w-[350px] h-[450px] rounded-2xl shadow-xl overflow-hidden animate-float",children:[a.jsxs("div",{className:"absolute top-4 left-4 right-4 h-12 bg-white/70 backdrop-blur-sm rounded-lg flex items-center px-4",children:[a.jsx("div",{className:"h-3 w-3 rounded-full bg-red-400 mr-2"}),a.jsx("div",{className:"h-3 w-3 rounded-full bg-yellow-400 mr-2"}),a.jsx("div",{className:"h-3 w-3 rounded-full bg-green-400 mr-2"}),a.jsx("div",{className:"text-xs text-gray-500 ml-2",children:"Shampoo Brand Perception"})]}),a.jsx("div",{className:"absolute top-20 left-4 right-4 bottom-4 bg-gray-50 rounded-lg overflow-hidden",children:[1,2,3,4].map(e=>a.jsx("div",{className:`flex ${e%2===0?"justify-end":"justify-start"} px-3 py-2`,children:a.jsxs("div",{className:`max-w-[70%] rounded-lg px-3 py-2 text-xs ${e%2===0?"bg-primary text-white":"bg-gray-200 text-gray-800"}`,children:[e===1&&"What qualities do you look for in a premium shampoo brand?",e===2&&"I value natural ingredients and a brand that feels luxurious but still eco-friendly.",e===3&&"How important is fragrance in your shampoo selection?",e===4&&"Very important - it affects my mood and how I feel about the product throughout the day."]})},e))})]})})]}),a.jsx("div",{className:"absolute inset-x-0 bottom-[-10rem] -z-10 transform-gpu overflow-hidden blur-3xl sm:bottom-[-20rem]","aria-hidden":"true",children:a.jsx("div",{className:"relative left-[calc(50%+11rem)] aspect-[1155/678] w-[36.125rem] -translate-x-1/2 rotate-[30deg] bg-gradient-to-tr from-blue-400 to-primary opacity-20 sm:left-[calc(50%+30rem)] sm:w-[72.1875rem]",style:{clipPath:"polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)"}})})]})}function Zl({title:e,description:t,icon:n,className:r}){return a.jsxs("div",{className:Me("relative group glass-card rounded-xl overflow-hidden p-6 hover:shadow-lg hover:translate-y-[-4px] button-transition",r),children:[a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-primary/5 to-blue-400/5 opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"rounded-full bg-primary/10 w-12 h-12 flex items-center justify-center mb-4",children:a.jsx(n,{className:"h-6 w-6 text-primary"})}),a.jsx("h3",{className:"font-sf text-lg font-semibold mb-2",children:e}),a.jsx("p",{className:"text-gray-600 text-sm",children:t})]})]})}const dK=()=>(Ul(),Cn(),a.jsxs("div",{className:"min-h-screen overflow-hidden bg-background",children:[a.jsx(ea,{}),a.jsx("main",{children:a.jsxs("div",{className:"pt-16",children:[a.jsx(uK,{}),a.jsx("section",{className:"py-20 px-6 bg-white",children:a.jsxs("div",{className:"max-w-7xl mx-auto",children:[a.jsxs("div",{className:"text-center mb-16",children:[a.jsx("h2",{className:"text-3xl font-sf font-bold sm:text-4xl",children:"Why Synthetic Personas?"}),a.jsx("p",{className:"mt-4 text-lg text-gray-600 max-w-3xl mx-auto",children:"Our platform combines advanced AI with intuitive design to help researchers gain deeper insights faster than traditional methods."})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:[a.jsx(Zl,{title:"Scalable Research",description:"Create and test with thousands of synthetic personas, each with unique demographic profiles and behaviors.",icon:Hn}),a.jsx(Zl,{title:"AI-Driven Focus Groups",description:"Run autonomous focus groups moderated by AI that adapts to participant responses in real-time.",icon:pa}),a.jsx(Zl,{title:"Instant Analysis",description:"Generate comprehensive reports and visualizations that highlight key insights and patterns.",icon:Gw}),a.jsx(Zl,{title:"Diverse Perspectives",description:"Access synthetic personas from various backgrounds, ensuring representation across age, gender, and location.",icon:Hn}),a.jsx(Zl,{title:"Dynamic Discussions",description:"AI moderators guide conversations naturally, following up on interesting points without bias.",icon:PG}),a.jsx(Zl,{title:"Comprehensive Reporting",description:"Export detailed reports with sentiment analysis, key themes, and actionable recommendations.",icon:Gw})]})]})}),a.jsx("section",{className:"py-20 px-6 bg-gradient-to-b from-white to-slate-50",children:a.jsxs("div",{className:"max-w-7xl mx-auto",children:[a.jsxs("div",{className:"text-center mb-16",children:[a.jsx("h2",{className:"text-3xl font-sf font-bold sm:text-4xl",children:"How It Works"}),a.jsx("p",{className:"mt-4 text-lg text-gray-600 max-w-3xl mx-auto",children:"Just three simple steps to gather valuable insights from synthetic personas."})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8",children:[a.jsxs("div",{className:"text-center p-6",children:[a.jsx("div",{className:"rounded-full bg-primary/10 w-16 h-16 flex items-center justify-center mx-auto mb-4",children:a.jsx("span",{className:"text-2xl font-bold text-primary",children:"1"})}),a.jsx("h3",{className:"text-xl font-sf font-semibold mb-3",children:"Create Synthetic Personas"}),a.jsx("p",{className:"text-gray-600",children:"Define your target audience with customizable demographic profiles and personality traits."})]}),a.jsxs("div",{className:"text-center p-6",children:[a.jsx("div",{className:"rounded-full bg-primary/10 w-16 h-16 flex items-center justify-center mx-auto mb-4",children:a.jsx("span",{className:"text-2xl font-bold text-primary",children:"2"})}),a.jsx("h3",{className:"text-xl font-sf font-semibold mb-3",children:"Set Up Focus Groups"}),a.jsx("p",{className:"text-gray-600",children:"Configure your research objectives, topics, and parameters for the AI moderator."})]}),a.jsxs("div",{className:"text-center p-6",children:[a.jsx("div",{className:"rounded-full bg-primary/10 w-16 h-16 flex items-center justify-center mx-auto mb-4",children:a.jsx("span",{className:"text-2xl font-bold text-primary",children:"3"})}),a.jsx("h3",{className:"text-xl font-sf font-semibold mb-3",children:"Analyze Results"}),a.jsx("p",{className:"text-gray-600",children:"Review comprehensive visual reports and actionable insights from your synthetic research."})]})]}),a.jsx("div",{className:"text-center mt-12",children:a.jsx(gi,{to:"synthetic-users",className:"inline-flex items-center justify-center px-6 py-3 border border-transparent text-base font-medium rounded-md text-white bg-primary hover:bg-primary/90 button-transition",children:"Get Started"})})]})}),a.jsxs("footer",{className:"bg-white py-12 px-6",children:[a.jsxs("div",{className:"max-w-7xl mx-auto flex flex-col md:flex-row justify-between items-center",children:[a.jsxs("div",{className:"mb-6 md:mb-0",children:[a.jsx("span",{className:"text-xl font-sf font-semibold text-gradient",children:"Semblance"}),a.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"AI-powered synthetic persona research"})]}),a.jsxs("div",{className:"flex flex-col md:flex-row gap-8",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-900 mb-3",children:"Platform"}),a.jsxs("ul",{className:"space-y-2",children:[a.jsx("li",{children:a.jsx(gi,{to:"/",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Home"})}),a.jsx("li",{children:a.jsx(gi,{to:"/synthetic-users",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Synthetic Personas"})}),a.jsx("li",{children:a.jsx(gi,{to:"/focus-groups",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Focus Groups"})}),a.jsx("li",{children:a.jsx(gi,{to:"/dashboard",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Dashboard"})})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-900 mb-3",children:"Company"}),a.jsxs("ul",{className:"space-y-2",children:[a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"About"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Blog"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Careers"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Contact"})})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-900 mb-3",children:"Legal"}),a.jsxs("ul",{className:"space-y-2",children:[a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Privacy"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Terms"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Security"})})]})]})]})]}),a.jsx("div",{className:"max-w-7xl mx-auto mt-8 pt-8 border-t border-gray-200",children:a.jsxs("p",{className:"text-sm text-gray-500 text-center",children:["ยฉ ",new Date().getFullYear()," Semblance. All rights reserved."]})})]})]})})]})),fK=()=>{const e=rs(),t=Cn();v.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",e.pathname)},[e.pathname]);const n=e.pathname.startsWith("/synthetic-users/"),i=new URLSearchParams(e.search).get("fromReview")==="true";return a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-100",children:a.jsxs("div",{className:"text-center p-8 max-w-md bg-white rounded-lg shadow-md",children:[a.jsx("h1",{className:"text-4xl font-bold mb-4",children:"404"}),n?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-xl text-gray-600 mb-4",children:"Persona Not Found"}),a.jsx("p",{className:"text-gray-500 mb-6",children:"The persona you're looking for may have been removed or doesn't exist."}),i?a.jsx(oe,{onClick:()=>t("/synthetic-users?mode=create&tab=ai&step=review"),className:"mb-2 w-full",children:"Return to Review Page"}):a.jsx(oe,{onClick:()=>t("/synthetic-users"),className:"mb-2 w-full",children:"View All Personas"})]}):a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-xl text-gray-600 mb-4",children:"Oops! Page not found"}),a.jsx("p",{className:"text-gray-500 mb-6",children:"The page you're looking for doesn't exist or has been moved."})]}),a.jsx(oe,{variant:"outline",onClick:()=>t("/"),className:"w-full",children:"Return to Home"})]})})};function hK(e,t=[]){let n=[];function r(s,o){const l=v.createContext(o),c=n.length;n=[...n,o];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[e][c])||l,x=v.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:x,children:p})}function d(f,h){const p=(h==null?void 0:h[e][c])||l,g=v.useContext(p);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return u.displayName=s+"Provider",[u,d]}const i=()=>{const s=n.map(o=>v.createContext(o));return function(l){const c=(l==null?void 0:l[e])||s;return v.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return i.scopeName=e,[r,pK(i,...t)]}function pK(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...l,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var kN="Progress",TN=100,[mK,yOe]=hK(kN),[gK,vK]=mK(kN),ZR=v.forwardRef((e,t)=>{const{__scopeProgress:n,value:r=null,max:i,getValueLabel:s=yK,...o}=e;(i||i===0)&&!nE(i)&&console.error(xK(`${i}`,"Progress"));const l=nE(i)?i:TN;r!==null&&!rE(r,l)&&console.error(bK(`${r}`,"Progress"));const c=rE(r,l)?r:null,u=$g(c)?s(c,l):void 0;return a.jsx(gK,{scope:n,value:c,max:l,children:a.jsx(qe.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":$g(c)?c:void 0,"aria-valuetext":u,role:"progressbar","data-state":eD(c,l),"data-value":c??void 0,"data-max":l,...o,ref:t})})});ZR.displayName=kN;var QR="ProgressIndicator",JR=v.forwardRef((e,t)=>{const{__scopeProgress:n,...r}=e,i=vK(QR,n);return a.jsx(qe.div,{"data-state":eD(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...r,ref:t})});JR.displayName=QR;function yK(e,t){return`${Math.round(e/t*100)}%`}function eD(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function $g(e){return typeof e=="number"}function nE(e){return $g(e)&&!isNaN(e)&&e>0}function rE(e,t){return $g(e)&&!isNaN(e)&&e<=t&&e>=0}function xK(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${TN}\`.`}function bK(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be: - - a positive number - - less than the value passed to \`max\` (or ${TN} if no \`max\` prop is set) - - \`null\` or \`undefined\` if the progress is indeterminate. - -Defaulting to \`null\`.`}var tD=ZR,wK=JR;const tl=v.forwardRef(({className:e,value:t,...n},r)=>a.jsx(tD,{ref:r,className:Me("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...n,children:a.jsx(wK,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));tl.displayName=tD.displayName;var vp=e=>e.type==="checkbox",nl=e=>e instanceof Date,br=e=>e==null;const nD=e=>typeof e=="object";var bn=e=>!br(e)&&!Array.isArray(e)&&nD(e)&&!nl(e),rD=e=>bn(e)&&e.target?vp(e.target)?e.target.checked:e.target.value:e,jK=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,iD=(e,t)=>e.has(jK(t)),SK=e=>{const t=e.constructor&&e.constructor.prototype;return bn(t)&&t.hasOwnProperty("isPrototypeOf")},$N=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function kr(e){let t;const n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!($N&&(e instanceof Blob||e instanceof FileList))&&(n||bn(e)))if(t=n?[]:{},!n&&!SK(e))t=e;else for(const r in e)e.hasOwnProperty(r)&&(t[r]=kr(e[r]));else return e;return t}var Gy=e=>Array.isArray(e)?e.filter(Boolean):[],hn=e=>e===void 0,Re=(e,t,n)=>{if(!t||!bn(e))return n;const r=Gy(t.split(/[,[\].]+?/)).reduce((i,s)=>br(i)?i:i[s],e);return hn(r)||r===e?hn(e[t])?n:e[t]:r},fi=e=>typeof e=="boolean",IN=e=>/^\w*$/.test(e),sD=e=>Gy(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Lt=(e,t,n)=>{let r=-1;const i=IN(t)?[t]:sD(t),s=i.length,o=s-1;for(;++rC.useContext(aD),NK=e=>{const{children:t,...n}=e;return C.createElement(aD.Provider,{value:n},t)};var oD=(e,t,n,r=!0)=>{const i={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(i,s,{get:()=>{const o=s;return t._proxyFormState[o]!==zi.all&&(t._proxyFormState[o]=!r||zi.all),n&&(n[o]=!0),e[o]}});return i},Tr=e=>bn(e)&&!Object.keys(e).length,lD=(e,t,n,r)=>{n(e);const{name:i,...s}=e;return Tr(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(o=>t[o]===(!r||zi.all))},hf=e=>Array.isArray(e)?e:[e],cD=(e,t,n)=>!e||!t||e===t||hf(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r)));function MN(e){const t=C.useRef(e);t.current=e,C.useEffect(()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}function _K(e){const t=qy(),{control:n=t.control,disabled:r,name:i,exact:s}=e||{},[o,l]=C.useState(n._formState),c=C.useRef(!0),u=C.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=C.useRef(i);return d.current=i,MN({disabled:r,next:f=>c.current&&cD(d.current,f.name,s)&&lD(f,u.current,n._updateFormState)&&l({...n._formState,...f}),subject:n._subjects.state}),C.useEffect(()=>(c.current=!0,u.current.isValid&&n._updateValid(!0),()=>{c.current=!1}),[n]),oD(o,n,u.current,!1)}var vs=e=>typeof e=="string",uD=(e,t,n,r,i)=>vs(e)?(r&&t.watch.add(e),Re(n,e,i)):Array.isArray(e)?e.map(s=>(r&&t.watch.add(s),Re(n,s))):(r&&(t.watchAll=!0),n);function PK(e){const t=qy(),{control:n=t.control,name:r,defaultValue:i,disabled:s,exact:o}=e||{},l=C.useRef(r);l.current=r,MN({disabled:s,subject:n._subjects.values,next:d=>{cD(l.current,d.name,o)&&u(kr(uD(l.current,n._names,d.values||n._formValues,!1,i)))}});const[c,u]=C.useState(n._getWatch(r,i));return C.useEffect(()=>n._removeUnmounted()),c}function CK(e){const t=qy(),{name:n,disabled:r,control:i=t.control,shouldUnregister:s}=e,o=iD(i._names.array,n),l=PK({control:i,name:n,defaultValue:Re(i._formValues,n,Re(i._defaultValues,n,e.defaultValue)),exact:!0}),c=_K({control:i,name:n,exact:!0}),u=C.useRef(i.register(n,{...e.rules,value:l,...fi(e.disabled)?{disabled:e.disabled}:{}}));return C.useEffect(()=>{const d=i._options.shouldUnregister||s,f=(h,p)=>{const g=Re(i._fields,h);g&&g._f&&(g._f.mount=p)};if(f(n,!0),d){const h=kr(Re(i._options.defaultValues,n));Lt(i._defaultValues,n,h),hn(Re(i._formValues,n))&&Lt(i._formValues,n,h)}return()=>{(o?d&&!i._state.action:d)?i.unregister(n):f(n,!1)}},[n,i,o,s]),C.useEffect(()=>{Re(i._fields,n)&&i._updateDisabledField({disabled:r,fields:i._fields,name:n,value:Re(i._fields,n)._f.value})},[r,n,i]),{field:{name:n,value:l,...fi(r)||c.disabled?{disabled:c.disabled||r}:{},onChange:C.useCallback(d=>u.current.onChange({target:{value:rD(d),name:n},type:Ig.CHANGE}),[n]),onBlur:C.useCallback(()=>u.current.onBlur({target:{value:Re(i._formValues,n),name:n},type:Ig.BLUR}),[n,i]),ref:C.useCallback(d=>{const f=Re(i._fields,n);f&&d&&(f._f.ref={focus:()=>d.focus(),select:()=>d.select(),setCustomValidity:h=>d.setCustomValidity(h),reportValidity:()=>d.reportValidity()})},[i._fields,n])},formState:c,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Re(c.errors,n)},isDirty:{enumerable:!0,get:()=>!!Re(c.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Re(c.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Re(c.validatingFields,n)},error:{enumerable:!0,get:()=>Re(c.errors,n)}})}}const AK=e=>e.render(CK(e));var dD=(e,t,n,r,i)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:i||!0}}:{},iE=e=>({isOnSubmit:!e||e===zi.onSubmit,isOnBlur:e===zi.onBlur,isOnChange:e===zi.onChange,isOnAll:e===zi.all,isOnTouch:e===zi.onTouched}),sE=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const pf=(e,t,n,r)=>{for(const i of n||Object.keys(e)){const s=Re(e,i);if(s){const{_f:o,...l}=s;if(o){if(o.refs&&o.refs[0]&&t(o.refs[0],i)&&!r)return!0;if(o.ref&&t(o.ref,o.name)&&!r)return!0;if(pf(l,t))break}else if(bn(l)&&pf(l,t))break}}};var EK=(e,t,n)=>{const r=hf(Re(e,n));return Lt(r,"root",t[n]),Lt(e,n,r),e},RN=e=>e.type==="file",Xs=e=>typeof e=="function",Mg=e=>{if(!$N)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Hm=e=>vs(e),DN=e=>e.type==="radio",Rg=e=>e instanceof RegExp;const aE={value:!1,isValid:!1},oE={value:!0,isValid:!0};var fD=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!hn(e[0].attributes.value)?hn(e[0].value)||e[0].value===""?oE:{value:e[0].value,isValid:!0}:oE:aE}return aE};const lE={isValid:!1,value:null};var hD=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,lE):lE;function cE(e,t,n="validate"){if(Hm(e)||Array.isArray(e)&&e.every(Hm)||fi(e)&&!e)return{type:n,message:Hm(e)?e:"",ref:t}}var Ql=e=>bn(e)&&!Rg(e)?e:{value:e,message:""},uE=async(e,t,n,r,i)=>{const{ref:s,refs:o,required:l,maxLength:c,minLength:u,min:d,max:f,pattern:h,validate:p,name:g,valueAsNumber:m,mount:x,disabled:b}=e._f,y=Re(t,g);if(!x||b)return{};const w=o?o[0]:s,j=T=>{r&&w.reportValidity&&(w.setCustomValidity(fi(T)?"":T||""),w.reportValidity())},S={},N=DN(s),P=vp(s),_=N||P,A=(m||RN(s))&&hn(s.value)&&hn(y)||Mg(s)&&s.value===""||y===""||Array.isArray(y)&&!y.length,O=dD.bind(null,g,n,S),$=(T,M,R,H=Ds.maxLength,F=Ds.minLength)=>{const V=T?M:R;S[g]={type:T?H:F,message:V,ref:s,...O(T?H:F,V)}};if(i?!Array.isArray(y)||!y.length:l&&(!_&&(A||br(y))||fi(y)&&!y||P&&!fD(o).isValid||N&&!hD(o).isValid)){const{value:T,message:M}=Hm(l)?{value:!!l,message:l}:Ql(l);if(T&&(S[g]={type:Ds.required,message:M,ref:w,...O(Ds.required,M)},!n))return j(M),S}if(!A&&(!br(d)||!br(f))){let T,M;const R=Ql(f),H=Ql(d);if(!br(y)&&!isNaN(y)){const F=s.valueAsNumber||y&&+y;br(R.value)||(T=F>R.value),br(H.value)||(M=Fnew Date(new Date().toDateString()+" "+Z),I=s.type=="time",L=s.type=="week";vs(R.value)&&y&&(T=I?V(y)>V(R.value):L?y>R.value:F>new Date(R.value)),vs(H.value)&&y&&(M=I?V(y)+T.value,H=!br(M.value)&&y.length<+M.value;if((R||H)&&($(R,T.message,M.message),!n))return j(S[g].message),S}if(h&&!A&&vs(y)){const{value:T,message:M}=Ql(h);if(Rg(T)&&!y.match(T)&&(S[g]={type:Ds.pattern,message:M,ref:s,...O(Ds.pattern,M)},!n))return j(M),S}if(p){if(Xs(p)){const T=await p(y,t),M=cE(T,w);if(M&&(S[g]={...M,...O(Ds.validate,M.message)},!n))return j(M.message),S}else if(bn(p)){let T={};for(const M in p){if(!Tr(T)&&!n)break;const R=cE(await p[M](y,t),w,M);R&&(T={...R,...O(M,R.message)},j(R.message),n&&(S[g]=T))}if(!Tr(T)&&(S[g]={ref:w,...T},!n))return S}}return j(!0),S};function OK(e,t){const n=t.slice(0,-1).length;let r=0;for(;r{let e=[];return{get observers(){return e},next:i=>{for(const s of e)s.next&&s.next(i)},subscribe:i=>(e.push(i),{unsubscribe:()=>{e=e.filter(s=>s!==i)}}),unsubscribe:()=>{e=[]}}},t1=e=>br(e)||!nD(e);function Ua(e,t){if(t1(e)||t1(t))return e===t;if(nl(e)&&nl(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const i of n){const s=e[i];if(!r.includes(i))return!1;if(i!=="ref"){const o=t[i];if(nl(s)&&nl(o)||bn(s)&&bn(o)||Array.isArray(s)&&Array.isArray(o)?!Ua(s,o):s!==o)return!1}}return!0}var pD=e=>e.type==="select-multiple",TK=e=>DN(e)||vp(e),G0=e=>Mg(e)&&e.isConnected,mD=e=>{for(const t in e)if(Xs(e[t]))return!0;return!1};function Dg(e,t={}){const n=Array.isArray(e);if(bn(e)||n)for(const r in e)Array.isArray(e[r])||bn(e[r])&&!mD(e[r])?(t[r]=Array.isArray(e[r])?[]:{},Dg(e[r],t[r])):br(e[r])||(t[r]=!0);return t}function gD(e,t,n){const r=Array.isArray(e);if(bn(e)||r)for(const i in e)Array.isArray(e[i])||bn(e[i])&&!mD(e[i])?hn(t)||t1(n[i])?n[i]=Array.isArray(e[i])?Dg(e[i],[]):{...Dg(e[i])}:gD(e[i],br(t)?{}:t[i],n[i]):n[i]=!Ua(e[i],t[i]);return n}var kd=(e,t)=>gD(e,t,Dg(t)),vD=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>hn(e)?e:t?e===""?NaN:e&&+e:n&&vs(e)?new Date(e):r?r(e):e;function q0(e){const t=e.ref;if(!(e.refs?e.refs.every(n=>n.disabled):t.disabled))return RN(t)?t.files:DN(t)?hD(e.refs).value:pD(t)?[...t.selectedOptions].map(({value:n})=>n):vp(t)?fD(e.refs).value:vD(hn(t.value)?e.ref.value:t.value,e)}var $K=(e,t,n,r)=>{const i={};for(const s of e){const o=Re(t,s);o&&Lt(i,s,o._f)}return{criteriaMode:n,names:[...e],fields:i,shouldUseNativeValidation:r}},Td=e=>hn(e)?e:Rg(e)?e.source:bn(e)?Rg(e.value)?e.value.source:e.value:e;const dE="AsyncFunction";var IK=e=>(!e||!e.validate)&&!!(Xs(e.validate)&&e.validate.constructor.name===dE||bn(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===dE)),MK=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function fE(e,t,n){const r=Re(e,n);if(r||IN(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const s=i.join("."),o=Re(t,s),l=Re(e,s);if(o&&!Array.isArray(o)&&n!==s)return{name:n};if(l&&l.type)return{name:s,error:l};i.pop()}return{name:n}}var RK=(e,t,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(t||e):(n?r.isOnBlur:i.isOnBlur)?!e:(n?r.isOnChange:i.isOnChange)?e:!0,DK=(e,t)=>!Gy(Re(e,t)).length&&En(e,t);const LK={mode:zi.onSubmit,reValidateMode:zi.onChange,shouldFocusError:!0};function FK(e={}){let t={...LK,...e},n={submitCount:0,isDirty:!1,isLoading:Xs(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},i=bn(t.defaultValues)||bn(t.values)?kr(t.defaultValues||t.values)||{}:{},s=t.shouldUnregister?{}:kr(i),o={action:!1,mount:!1,watch:!1},l={mount:new Set,unMount:new Set,array:new Set,watch:new Set},c,u=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={values:H0(),array:H0(),state:H0()},h=iE(t.mode),p=iE(t.reValidateMode),g=t.criteriaMode===zi.all,m=E=>D=>{clearTimeout(u),u=setTimeout(E,D)},x=async E=>{if(!e.disabled&&(d.isValid||E)){const D=t.resolver?Tr((await _()).errors):await O(r,!0);D!==n.isValid&&f.state.next({isValid:D})}},b=(E,D)=>{!e.disabled&&(d.isValidating||d.validatingFields)&&((E||Array.from(l.mount)).forEach(U=>{U&&(D?Lt(n.validatingFields,U,D):En(n.validatingFields,U))}),f.state.next({validatingFields:n.validatingFields,isValidating:!Tr(n.validatingFields)}))},y=(E,D=[],U,Q,te=!0,Y=!0)=>{if(Q&&U&&!e.disabled){if(o.action=!0,Y&&Array.isArray(Re(r,E))){const xe=U(Re(r,E),Q.argA,Q.argB);te&&Lt(r,E,xe)}if(Y&&Array.isArray(Re(n.errors,E))){const xe=U(Re(n.errors,E),Q.argA,Q.argB);te&&Lt(n.errors,E,xe),DK(n.errors,E)}if(d.touchedFields&&Y&&Array.isArray(Re(n.touchedFields,E))){const xe=U(Re(n.touchedFields,E),Q.argA,Q.argB);te&&Lt(n.touchedFields,E,xe)}d.dirtyFields&&(n.dirtyFields=kd(i,s)),f.state.next({name:E,isDirty:T(E,D),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Lt(s,E,D)},w=(E,D)=>{Lt(n.errors,E,D),f.state.next({errors:n.errors})},j=E=>{n.errors=E,f.state.next({errors:n.errors,isValid:!1})},S=(E,D,U,Q)=>{const te=Re(r,E);if(te){const Y=Re(s,E,hn(U)?Re(i,E):U);hn(Y)||Q&&Q.defaultChecked||D?Lt(s,E,D?Y:q0(te._f)):H(E,Y),o.mount&&x()}},N=(E,D,U,Q,te)=>{let Y=!1,xe=!1;const je={name:E};if(!e.disabled){const Fe=!!(Re(r,E)&&Re(r,E)._f&&Re(r,E)._f.disabled);if(!U||Q){d.isDirty&&(xe=n.isDirty,n.isDirty=je.isDirty=T(),Y=xe!==je.isDirty);const ce=Fe||Ua(Re(i,E),D);xe=!!(!Fe&&Re(n.dirtyFields,E)),ce||Fe?En(n.dirtyFields,E):Lt(n.dirtyFields,E,!0),je.dirtyFields=n.dirtyFields,Y=Y||d.dirtyFields&&xe!==!ce}if(U){const ce=Re(n.touchedFields,E);ce||(Lt(n.touchedFields,E,U),je.touchedFields=n.touchedFields,Y=Y||d.touchedFields&&ce!==U)}Y&&te&&f.state.next(je)}return Y?je:{}},P=(E,D,U,Q)=>{const te=Re(n.errors,E),Y=d.isValid&&fi(D)&&n.isValid!==D;if(e.delayError&&U?(c=m(()=>w(E,U)),c(e.delayError)):(clearTimeout(u),c=null,U?Lt(n.errors,E,U):En(n.errors,E)),(U?!Ua(te,U):te)||!Tr(Q)||Y){const xe={...Q,...Y&&fi(D)?{isValid:D}:{},errors:n.errors,name:E};n={...n,...xe},f.state.next(xe)}},_=async E=>{b(E,!0);const D=await t.resolver(s,t.context,$K(E||l.mount,r,t.criteriaMode,t.shouldUseNativeValidation));return b(E),D},A=async E=>{const{errors:D}=await _(E);if(E)for(const U of E){const Q=Re(D,U);Q?Lt(n.errors,U,Q):En(n.errors,U)}else n.errors=D;return D},O=async(E,D,U={valid:!0})=>{for(const Q in E){const te=E[Q];if(te){const{_f:Y,...xe}=te;if(Y){const je=l.array.has(Y.name),Fe=te._f&&IK(te._f);Fe&&d.validatingFields&&b([Q],!0);const ce=await uE(te,s,g,t.shouldUseNativeValidation&&!D,je);if(Fe&&d.validatingFields&&b([Q]),ce[Y.name]&&(U.valid=!1,D))break;!D&&(Re(ce,Y.name)?je?EK(n.errors,ce,Y.name):Lt(n.errors,Y.name,ce[Y.name]):En(n.errors,Y.name))}!Tr(xe)&&await O(xe,D,U)}}return U.valid},$=()=>{for(const E of l.unMount){const D=Re(r,E);D&&(D._f.refs?D._f.refs.every(U=>!G0(U)):!G0(D._f.ref))&&de(E)}l.unMount=new Set},T=(E,D)=>!e.disabled&&(E&&D&&Lt(s,E,D),!Ua(ee(),i)),M=(E,D,U)=>uD(E,l,{...o.mount?s:hn(D)?i:vs(E)?{[E]:D}:D},U,D),R=E=>Gy(Re(o.mount?s:i,E,e.shouldUnregister?Re(i,E,[]):[])),H=(E,D,U={})=>{const Q=Re(r,E);let te=D;if(Q){const Y=Q._f;Y&&(!Y.disabled&&Lt(s,E,vD(D,Y)),te=Mg(Y.ref)&&br(D)?"":D,pD(Y.ref)?[...Y.ref.options].forEach(xe=>xe.selected=te.includes(xe.value)):Y.refs?vp(Y.ref)?Y.refs.length>1?Y.refs.forEach(xe=>(!xe.defaultChecked||!xe.disabled)&&(xe.checked=Array.isArray(te)?!!te.find(je=>je===xe.value):te===xe.value)):Y.refs[0]&&(Y.refs[0].checked=!!te):Y.refs.forEach(xe=>xe.checked=xe.value===te):RN(Y.ref)?Y.ref.value="":(Y.ref.value=te,Y.ref.type||f.values.next({name:E,values:{...s}})))}(U.shouldDirty||U.shouldTouch)&&N(E,te,U.shouldTouch,U.shouldDirty,!0),U.shouldValidate&&Z(E)},F=(E,D,U)=>{for(const Q in D){const te=D[Q],Y=`${E}.${Q}`,xe=Re(r,Y);(l.array.has(E)||bn(te)||xe&&!xe._f)&&!nl(te)?F(Y,te,U):H(Y,te,U)}},V=(E,D,U={})=>{const Q=Re(r,E),te=l.array.has(E),Y=kr(D);Lt(s,E,Y),te?(f.array.next({name:E,values:{...s}}),(d.isDirty||d.dirtyFields)&&U.shouldDirty&&f.state.next({name:E,dirtyFields:kd(i,s),isDirty:T(E,Y)})):Q&&!Q._f&&!br(Y)?F(E,Y,U):H(E,Y,U),sE(E,l)&&f.state.next({...n}),f.values.next({name:o.mount?E:void 0,values:{...s}})},I=async E=>{o.mount=!0;const D=E.target;let U=D.name,Q=!0;const te=Re(r,U),Y=()=>D.type?q0(te._f):rD(E),xe=je=>{Q=Number.isNaN(je)||nl(je)&&isNaN(je.getTime())||Ua(je,Re(s,U,je))};if(te){let je,Fe;const ce=Y(),ke=E.type===Ig.BLUR||E.type===Ig.FOCUS_OUT,Be=!MK(te._f)&&!t.resolver&&!Re(n.errors,U)&&!te._f.deps||RK(ke,Re(n.touchedFields,U),n.isSubmitted,p,h),mt=sE(U,l,ke);Lt(s,U,ce),ke?(te._f.onBlur&&te._f.onBlur(E),c&&c(0)):te._f.onChange&&te._f.onChange(E);const _t=N(U,ce,ke,!1),Pt=!Tr(_t)||mt;if(!ke&&f.values.next({name:U,type:E.type,values:{...s}}),Be)return d.isValid&&(e.mode==="onBlur"?ke&&x():x()),Pt&&f.state.next({name:U,...mt?{}:_t});if(!ke&&mt&&f.state.next({...n}),t.resolver){const{errors:qt}=await _([U]);if(xe(ce),Q){const mn=fE(n.errors,r,U),Wt=fE(qt,r,mn.name||U);je=Wt.error,U=Wt.name,Fe=Tr(qt)}}else b([U],!0),je=(await uE(te,s,g,t.shouldUseNativeValidation))[U],b([U]),xe(ce),Q&&(je?Fe=!1:d.isValid&&(Fe=await O(r,!0)));Q&&(te._f.deps&&Z(te._f.deps),P(U,Fe,je,_t))}},L=(E,D)=>{if(Re(n.errors,D)&&E.focus)return E.focus(),1},Z=async(E,D={})=>{let U,Q;const te=hf(E);if(t.resolver){const Y=await A(hn(E)?E:te);U=Tr(Y),Q=E?!te.some(xe=>Re(Y,xe)):U}else E?(Q=(await Promise.all(te.map(async Y=>{const xe=Re(r,Y);return await O(xe&&xe._f?{[Y]:xe}:xe)}))).every(Boolean),!(!Q&&!n.isValid)&&x()):Q=U=await O(r);return f.state.next({...!vs(E)||d.isValid&&U!==n.isValid?{}:{name:E},...t.resolver||!E?{isValid:U}:{},errors:n.errors}),D.shouldFocus&&!Q&&pf(r,L,E?te:l.mount),Q},ee=E=>{const D={...o.mount?s:i};return hn(E)?D:vs(E)?Re(D,E):E.map(U=>Re(D,U))},re=(E,D)=>({invalid:!!Re((D||n).errors,E),isDirty:!!Re((D||n).dirtyFields,E),error:Re((D||n).errors,E),isValidating:!!Re(n.validatingFields,E),isTouched:!!Re((D||n).touchedFields,E)}),me=E=>{E&&hf(E).forEach(D=>En(n.errors,D)),f.state.next({errors:E?n.errors:{}})},z=(E,D,U)=>{const Q=(Re(r,E,{_f:{}})._f||{}).ref,te=Re(n.errors,E)||{},{ref:Y,message:xe,type:je,...Fe}=te;Lt(n.errors,E,{...Fe,...D,ref:Q}),f.state.next({name:E,errors:n.errors,isValid:!1}),U&&U.shouldFocus&&Q&&Q.focus&&Q.focus()},ae=(E,D)=>Xs(E)?f.values.subscribe({next:U=>E(M(void 0,D),U)}):M(E,D,!0),de=(E,D={})=>{for(const U of E?hf(E):l.mount)l.mount.delete(U),l.array.delete(U),D.keepValue||(En(r,U),En(s,U)),!D.keepError&&En(n.errors,U),!D.keepDirty&&En(n.dirtyFields,U),!D.keepTouched&&En(n.touchedFields,U),!D.keepIsValidating&&En(n.validatingFields,U),!t.shouldUnregister&&!D.keepDefaultValue&&En(i,U);f.values.next({values:{...s}}),f.state.next({...n,...D.keepDirty?{isDirty:T()}:{}}),!D.keepIsValid&&x()},fe=({disabled:E,name:D,field:U,fields:Q,value:te})=>{if(fi(E)&&o.mount||E){const Y=E?void 0:hn(te)?q0(U?U._f:Re(Q,D)._f):te;Lt(s,D,Y),N(D,Y,!1,!1,!0)}},Ne=(E,D={})=>{let U=Re(r,E);const Q=fi(D.disabled)||fi(e.disabled);return Lt(r,E,{...U||{},_f:{...U&&U._f?U._f:{ref:{name:E}},name:E,mount:!0,...D}}),l.mount.add(E),U?fe({field:U,disabled:fi(D.disabled)?D.disabled:e.disabled,name:E,value:D.value}):S(E,!0,D.value),{...Q?{disabled:D.disabled||e.disabled}:{},...t.progressive?{required:!!D.required,min:Td(D.min),max:Td(D.max),minLength:Td(D.minLength),maxLength:Td(D.maxLength),pattern:Td(D.pattern)}:{},name:E,onChange:I,onBlur:I,ref:te=>{if(te){Ne(E,D),U=Re(r,E);const Y=hn(te.value)&&te.querySelectorAll&&te.querySelectorAll("input,select,textarea")[0]||te,xe=TK(Y),je=U._f.refs||[];if(xe?je.find(Fe=>Fe===Y):Y===U._f.ref)return;Lt(r,E,{_f:{...U._f,...xe?{refs:[...je.filter(G0),Y,...Array.isArray(Re(i,E))?[{}]:[]],ref:{type:Y.type,name:E}}:{ref:Y}}}),S(E,!1,void 0,Y)}else U=Re(r,E,{}),U._f&&(U._f.mount=!1),(t.shouldUnregister||D.shouldUnregister)&&!(iD(l.array,E)&&o.action)&&l.unMount.add(E)}}},he=()=>t.shouldFocusError&&pf(r,L,l.mount),ue=E=>{fi(E)&&(f.state.next({disabled:E}),pf(r,(D,U)=>{const Q=Re(r,U);Q&&(D.disabled=Q._f.disabled||E,Array.isArray(Q._f.refs)&&Q._f.refs.forEach(te=>{te.disabled=Q._f.disabled||E}))},0,!1))},Ee=(E,D)=>async U=>{let Q;U&&(U.preventDefault&&U.preventDefault(),U.persist&&U.persist());let te=kr(s);if(f.state.next({isSubmitting:!0}),t.resolver){const{errors:Y,values:xe}=await _();n.errors=Y,te=xe}else await O(r);if(En(n.errors,"root"),Tr(n.errors)){f.state.next({errors:{}});try{await E(te,U)}catch(Y){Q=Y}}else D&&await D({...n.errors},U),he(),setTimeout(he);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Tr(n.errors)&&!Q,submitCount:n.submitCount+1,errors:n.errors}),Q)throw Q},ie=(E,D={})=>{Re(r,E)&&(hn(D.defaultValue)?V(E,kr(Re(i,E))):(V(E,D.defaultValue),Lt(i,E,kr(D.defaultValue))),D.keepTouched||En(n.touchedFields,E),D.keepDirty||(En(n.dirtyFields,E),n.isDirty=D.defaultValue?T(E,kr(Re(i,E))):T()),D.keepError||(En(n.errors,E),d.isValid&&x()),f.state.next({...n}))},Xe=(E,D={})=>{const U=E?kr(E):i,Q=kr(U),te=Tr(E),Y=te?i:Q;if(D.keepDefaultValues||(i=U),!D.keepValues){if(D.keepDirtyValues){const xe=new Set([...l.mount,...Object.keys(kd(i,s))]);for(const je of Array.from(xe))Re(n.dirtyFields,je)?Lt(Y,je,Re(s,je)):V(je,Re(Y,je))}else{if($N&&hn(E))for(const xe of l.mount){const je=Re(r,xe);if(je&&je._f){const Fe=Array.isArray(je._f.refs)?je._f.refs[0]:je._f.ref;if(Mg(Fe)){const ce=Fe.closest("form");if(ce){ce.reset();break}}}}r={}}s=e.shouldUnregister?D.keepDefaultValues?kr(i):{}:kr(Y),f.array.next({values:{...Y}}),f.values.next({values:{...Y}})}l={mount:D.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!d.isValid||!!D.keepIsValid||!!D.keepDirtyValues,o.watch=!!e.shouldUnregister,f.state.next({submitCount:D.keepSubmitCount?n.submitCount:0,isDirty:te?!1:D.keepDirty?n.isDirty:!!(D.keepDefaultValues&&!Ua(E,i)),isSubmitted:D.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:te?{}:D.keepDirtyValues?D.keepDefaultValues&&s?kd(i,s):n.dirtyFields:D.keepDefaultValues&&E?kd(i,E):D.keepDirty?n.dirtyFields:{},touchedFields:D.keepTouched?n.touchedFields:{},errors:D.keepErrors?n.errors:{},isSubmitSuccessful:D.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},K=(E,D)=>Xe(Xs(E)?E(s):E,D);return{control:{register:Ne,unregister:de,getFieldState:re,handleSubmit:Ee,setError:z,_executeSchema:_,_getWatch:M,_getDirty:T,_updateValid:x,_removeUnmounted:$,_updateFieldArray:y,_updateDisabledField:fe,_getFieldArray:R,_reset:Xe,_resetDefaultValues:()=>Xs(t.defaultValues)&&t.defaultValues().then(E=>{K(E,t.resetOptions),f.state.next({isLoading:!1})}),_updateFormState:E=>{n={...n,...E}},_disableForm:ue,_subjects:f,_proxyFormState:d,_setErrors:j,get _fields(){return r},get _formValues(){return s},get _state(){return o},set _state(E){o=E},get _defaultValues(){return i},get _names(){return l},set _names(E){l=E},get _formState(){return n},set _formState(E){n=E},get _options(){return t},set _options(E){t={...t,...E}}},trigger:Z,register:Ne,handleSubmit:Ee,watch:ae,setValue:V,getValues:ee,reset:K,resetField:ie,clearErrors:me,unregister:de,setError:z,setFocus:(E,D={})=>{const U=Re(r,E),Q=U&&U._f;if(Q){const te=Q.refs?Q.refs[0]:Q.ref;te.focus&&(te.focus(),D.shouldSelect&&te.select())}},getFieldState:re}}function Ky(e={}){const t=C.useRef(),n=C.useRef(),[r,i]=C.useState({isDirty:!1,isValidating:!1,isLoading:Xs(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:Xs(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...FK(e),formState:r});const s=t.current.control;return s._options=e,MN({subject:s._subjects.state,next:o=>{lD(o,s._proxyFormState,s._updateFormState,!0)&&i({...s._formState})}}),C.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),C.useEffect(()=>{if(s._proxyFormState.isDirty){const o=s._getDirty();o!==r.isDirty&&s._subjects.state.next({isDirty:o})}},[s,r.isDirty]),C.useEffect(()=>{e.values&&!Ua(e.values,n.current)?(s._reset(e.values,s._options.resetOptions),n.current=e.values,i(o=>({...o}))):s._resetDefaultValues()},[e.values,s]),C.useEffect(()=>{e.errors&&s._setErrors(e.errors)},[e.errors,s]),C.useEffect(()=>{s._state.mount||(s._updateValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),C.useEffect(()=>{e.shouldUnregister&&s._subjects.values.next({values:s._getWatch()})},[e.shouldUnregister,s]),C.useEffect(()=>{t.current&&(t.current.watch=t.current.watch.bind({}))},[r]),t.current.formState=oD(r,s),t.current}const hE=(e,t,n)=>{if(e&&"reportValidity"in e){const r=Re(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},yD=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?hE(r.ref,n,e):r.refs&&r.refs.forEach(i=>hE(i,n,e))}},BK=(e,t)=>{t.shouldUseNativeValidation&&yD(e,t);const n={};for(const r in e){const i=Re(t.fields,r),s=Object.assign(e[r]||{},{ref:i&&i.ref});if(zK(t.names||Object.keys(e),r)){const o=Object.assign({},Re(n,r));Lt(o,"root",s),Lt(n,r,o)}else Lt(n,r,s)}return n},zK=(e,t)=>e.some(n=>n.startsWith(t+"."));var UK=function(e,t){for(var n={};e.length;){var r=e[0],i=r.code,s=r.message,o=r.path.join(".");if(!n[o])if("unionErrors"in r){var l=r.unionErrors[0].errors[0];n[o]={message:l.message,type:l.code}}else n[o]={message:s,type:i};if("unionErrors"in r&&r.unionErrors.forEach(function(d){return d.errors.forEach(function(f){return e.push(f)})}),t){var c=n[o].types,u=c&&c[r.code];n[o]=dD(o,t,n,i,u?[].concat(u,r.message):r.message)}e.shift()}return n},Xy=function(e,t,n){return n===void 0&&(n={}),function(r,i,s){try{return Promise.resolve(function(o,l){try{var c=Promise.resolve(e[n.mode==="sync"?"parse":"parseAsync"](r,t)).then(function(u){return s.shouldUseNativeValidation&&yD({},s),{errors:{},values:n.raw?r:u}})}catch(u){return l(u)}return c&&c.then?c.then(void 0,l):c}(0,function(o){if(function(l){return Array.isArray(l==null?void 0:l.errors)}(o))return{values:{},errors:BK(UK(o.errors,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw o}))}catch(o){return Promise.reject(o)}}},Tt;(function(e){e.assertEqual=i=>i;function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const s={};for(const o of i)s[o]=o;return s},e.getValidEnumValues=i=>{const s=e.objectKeys(i).filter(l=>typeof i[i[l]]!="number"),o={};for(const l of s)o[l]=i[l];return e.objectValues(o)},e.objectValues=i=>e.objectKeys(i).map(function(s){return i[s]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&s.push(o);return s},e.find=(i,s)=>{for(const o of i)if(s(o))return o},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}e.joinValues=r,e.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})(Tt||(Tt={}));var n1;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(n1||(n1={}));const Ue=Tt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Va=e=>{switch(typeof e){case"undefined":return Ue.undefined;case"string":return Ue.string;case"number":return isNaN(e)?Ue.nan:Ue.number;case"boolean":return Ue.boolean;case"function":return Ue.function;case"bigint":return Ue.bigint;case"symbol":return Ue.symbol;case"object":return Array.isArray(e)?Ue.array:e===null?Ue.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Ue.promise:typeof Map<"u"&&e instanceof Map?Ue.map:typeof Set<"u"&&e instanceof Set?Ue.set:typeof Date<"u"&&e instanceof Date?Ue.date:Ue.object;default:return Ue.unknown}},Ae=Tt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),VK=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class ti extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const n=t||function(s){return s.message},r={_errors:[]},i=s=>{for(const o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let l=r,c=0;for(;cn.message){const n={},r=[];for(const i of this.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}ti.create=e=>new ti(e);const au=(e,t)=>{let n;switch(e.code){case Ae.invalid_type:e.received===Ue.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case Ae.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Tt.jsonStringifyReplacer)}`;break;case Ae.unrecognized_keys:n=`Unrecognized key(s) in object: ${Tt.joinValues(e.keys,", ")}`;break;case Ae.invalid_union:n="Invalid input";break;case Ae.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Tt.joinValues(e.options)}`;break;case Ae.invalid_enum_value:n=`Invalid enum value. Expected ${Tt.joinValues(e.options)}, received '${e.received}'`;break;case Ae.invalid_arguments:n="Invalid function arguments";break;case Ae.invalid_return_type:n="Invalid function return type";break;case Ae.invalid_date:n="Invalid date";break;case Ae.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Tt.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case Ae.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case Ae.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case Ae.custom:n="Invalid input";break;case Ae.invalid_intersection_types:n="Intersection results could not be merged";break;case Ae.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Ae.not_finite:n="Number must be finite";break;default:n=t.defaultError,Tt.assertNever(e)}return{message:n}};let xD=au;function WK(e){xD=e}function Lg(){return xD}const Fg=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,s=[...n,...i.path||[]],o={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let l="";const c=r.filter(u=>!!u).slice().reverse();for(const u of c)l=u(o,{data:t,defaultError:l}).message;return{...i,path:s,message:l}},HK=[];function ze(e,t){const n=Lg(),r=Fg({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===au?void 0:au].filter(i=>!!i)});e.common.issues.push(r)}class pr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const i of n){if(i.status==="aborted")return ut;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const i of n){const s=await i.key,o=await i.value;r.push({key:s,value:o})}return pr.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:s,value:o}=i;if(s.status==="aborted"||o.status==="aborted")return ut;s.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[s.value]=o.value)}return{status:t.value,value:r}}}const ut=Object.freeze({status:"aborted"}),xc=e=>({status:"dirty",value:e}),Pr=e=>({status:"valid",value:e}),r1=e=>e.status==="aborted",i1=e=>e.status==="dirty",Zf=e=>e.status==="valid",Qf=e=>typeof Promise<"u"&&e instanceof Promise;function Bg(e,t,n,r){if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function bD(e,t,n,r,i){if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var Ye;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Ye||(Ye={}));var Zd,Qd;class As{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const pE=(e,t)=>{if(Zf(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new ti(e.common.issues);return this._error=n,this._error}}};function yt(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(o,l)=>{var c,u;const{message:d}=e;return o.code==="invalid_enum_value"?{message:d??l.defaultError}:typeof l.data>"u"?{message:(c=d??r)!==null&&c!==void 0?c:l.defaultError}:o.code!=="invalid_type"?{message:l.defaultError}:{message:(u=d??n)!==null&&u!==void 0?u:l.defaultError}},description:i}}class Nt{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return Va(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Va(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new pr,ctx:{common:t.parent.common,data:t.data,parsedType:Va(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Qf(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const i={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Va(t)},s=this._parseSync({data:t,path:i.path,parent:i});return pE(i,s)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Va(t)},i=this._parse({data:t,path:r.path,parent:r}),s=await(Qf(i)?i:Promise.resolve(i));return pE(r,s)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,s)=>{const o=t(i),l=()=>s.addIssue({code:Ae.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(l(),!1)):o?!0:(l(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new es({schema:this,typeName:lt.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return Ss.create(this,this._def)}nullable(){return So.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return qi.create(this,this._def)}promise(){return lu.create(this,this._def)}or(t){return nh.create([this,t],this._def)}and(t){return rh.create(this,t,this._def)}transform(t){return new es({...yt(this._def),schema:this,typeName:lt.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new lh({...yt(this._def),innerType:this,defaultValue:n,typeName:lt.ZodDefault})}brand(){return new LN({typeName:lt.ZodBranded,type:this,...yt(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new ch({...yt(this._def),innerType:this,catchValue:n,typeName:lt.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return yp.create(this,t)}readonly(){return uh.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const GK=/^c[^\s-]{8,}$/i,qK=/^[0-9a-z]+$/,KK=/^[0-9A-HJKMNP-TV-Z]{26}$/,XK=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,YK=/^[a-z0-9_-]{21}$/i,ZK=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,QK=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,JK="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let K0;const eX=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,tX=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,nX=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,wD="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",rX=new RegExp(`^${wD}$`);function jD(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function iX(e){return new RegExp(`^${jD(e)}$`)}function SD(e){let t=`${wD}T${jD(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function sX(e,t){return!!((t==="v4"||!t)&&eX.test(e)||(t==="v6"||!t)&&tX.test(e))}class Wi extends Nt{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Ue.string){const s=this._getOrReturnCtx(t);return ze(s,{code:Ae.invalid_type,expected:Ue.string,received:s.parsedType}),ut}const r=new pr;let i;for(const s of this._def.checks)if(s.kind==="min")t.data.lengths.value&&(i=this._getOrReturnCtx(t,i),ze(i,{code:Ae.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const o=t.data.length>s.value,l=t.data.lengtht.test(i),{validation:n,code:Ae.invalid_string,...Ye.errToObj(r)})}_addCheck(t){return new Wi({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Ye.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Ye.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Ye.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Ye.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Ye.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Ye.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Ye.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Ye.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Ye.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Ye.errToObj(t)})}datetime(t){var n,r;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,local:(r=t==null?void 0:t.local)!==null&&r!==void 0?r:!1,...Ye.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...Ye.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...Ye.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...Ye.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...Ye.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...Ye.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...Ye.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...Ye.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...Ye.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...Ye.errToObj(n)})}nonempty(t){return this.min(1,Ye.errToObj(t))}trim(){return new Wi({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Wi({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Wi({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new Wi({checks:[],typeName:lt.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...yt(e)})};function aX(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,s=parseInt(e.toFixed(i).replace(".","")),o=parseInt(t.toFixed(i).replace(".",""));return s%o/Math.pow(10,i)}class bo extends Nt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Ue.number){const s=this._getOrReturnCtx(t);return ze(s,{code:Ae.invalid_type,expected:Ue.number,received:s.parsedType}),ut}let r;const i=new pr;for(const s of this._def.checks)s.kind==="int"?Tt.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),ze(r,{code:Ae.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?t.datas.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),ze(r,{code:Ae.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?aX(t.data,s.value)!==0&&(r=this._getOrReturnCtx(t,r),ze(r,{code:Ae.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),ze(r,{code:Ae.not_finite,message:s.message}),i.dirty()):Tt.assertNever(s);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Ye.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Ye.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Ye.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Ye.toString(n))}setLimit(t,n,r,i){return new bo({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Ye.toString(i)}]})}_addCheck(t){return new bo({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Ye.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ye.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ye.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ye.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ye.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Ye.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:Ye.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ye.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ye.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuet.kind==="int"||t.kind==="multipleOf"&&Tt.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.valuenew bo({checks:[],typeName:lt.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...yt(e)});class wo extends Nt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==Ue.bigint){const s=this._getOrReturnCtx(t);return ze(s,{code:Ae.invalid_type,expected:Ue.bigint,received:s.parsedType}),ut}let r;const i=new pr;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?t.datas.value:t.data>=s.value)&&(r=this._getOrReturnCtx(t,r),ze(r,{code:Ae.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?t.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),ze(r,{code:Ae.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):Tt.assertNever(s);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Ye.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Ye.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Ye.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Ye.toString(n))}setLimit(t,n,r,i){return new wo({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Ye.toString(i)}]})}_addCheck(t){return new wo({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ye.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ye.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ye.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ye.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Ye.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new wo({checks:[],typeName:lt.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...yt(e)})};class Jf extends Nt{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Ue.boolean){const r=this._getOrReturnCtx(t);return ze(r,{code:Ae.invalid_type,expected:Ue.boolean,received:r.parsedType}),ut}return Pr(t.data)}}Jf.create=e=>new Jf({typeName:lt.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...yt(e)});class Cl extends Nt{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Ue.date){const s=this._getOrReturnCtx(t);return ze(s,{code:Ae.invalid_type,expected:Ue.date,received:s.parsedType}),ut}if(isNaN(t.data.getTime())){const s=this._getOrReturnCtx(t);return ze(s,{code:Ae.invalid_date}),ut}const r=new pr;let i;for(const s of this._def.checks)s.kind==="min"?t.data.getTime()s.value&&(i=this._getOrReturnCtx(t,i),ze(i,{code:Ae.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):Tt.assertNever(s);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Cl({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:Ye.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:Ye.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew Cl({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:lt.ZodDate,...yt(e)});class zg extends Nt{_parse(t){if(this._getType(t)!==Ue.symbol){const r=this._getOrReturnCtx(t);return ze(r,{code:Ae.invalid_type,expected:Ue.symbol,received:r.parsedType}),ut}return Pr(t.data)}}zg.create=e=>new zg({typeName:lt.ZodSymbol,...yt(e)});class eh extends Nt{_parse(t){if(this._getType(t)!==Ue.undefined){const r=this._getOrReturnCtx(t);return ze(r,{code:Ae.invalid_type,expected:Ue.undefined,received:r.parsedType}),ut}return Pr(t.data)}}eh.create=e=>new eh({typeName:lt.ZodUndefined,...yt(e)});class th extends Nt{_parse(t){if(this._getType(t)!==Ue.null){const r=this._getOrReturnCtx(t);return ze(r,{code:Ae.invalid_type,expected:Ue.null,received:r.parsedType}),ut}return Pr(t.data)}}th.create=e=>new th({typeName:lt.ZodNull,...yt(e)});class ou extends Nt{constructor(){super(...arguments),this._any=!0}_parse(t){return Pr(t.data)}}ou.create=e=>new ou({typeName:lt.ZodAny,...yt(e)});class ml extends Nt{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Pr(t.data)}}ml.create=e=>new ml({typeName:lt.ZodUnknown,...yt(e)});class ma extends Nt{_parse(t){const n=this._getOrReturnCtx(t);return ze(n,{code:Ae.invalid_type,expected:Ue.never,received:n.parsedType}),ut}}ma.create=e=>new ma({typeName:lt.ZodNever,...yt(e)});class Ug extends Nt{_parse(t){if(this._getType(t)!==Ue.undefined){const r=this._getOrReturnCtx(t);return ze(r,{code:Ae.invalid_type,expected:Ue.void,received:r.parsedType}),ut}return Pr(t.data)}}Ug.create=e=>new Ug({typeName:lt.ZodVoid,...yt(e)});class qi extends Nt{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==Ue.array)return ze(n,{code:Ae.invalid_type,expected:Ue.array,received:n.parsedType}),ut;if(i.exactLength!==null){const o=n.data.length>i.exactLength.value,l=n.data.lengthi.maxLength.value&&(ze(n,{code:Ae.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,l)=>i.type._parseAsync(new As(n,o,n.path,l)))).then(o=>pr.mergeArray(r,o));const s=[...n.data].map((o,l)=>i.type._parseSync(new As(n,o,n.path,l)));return pr.mergeArray(r,s)}get element(){return this._def.type}min(t,n){return new qi({...this._def,minLength:{value:t,message:Ye.toString(n)}})}max(t,n){return new qi({...this._def,maxLength:{value:t,message:Ye.toString(n)}})}length(t,n){return new qi({...this._def,exactLength:{value:t,message:Ye.toString(n)}})}nonempty(t){return this.min(1,t)}}qi.create=(e,t)=>new qi({type:e,minLength:null,maxLength:null,exactLength:null,typeName:lt.ZodArray,...yt(t)});function ac(e){if(e instanceof sn){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Ss.create(ac(r))}return new sn({...e._def,shape:()=>t})}else return e instanceof qi?new qi({...e._def,type:ac(e.element)}):e instanceof Ss?Ss.create(ac(e.unwrap())):e instanceof So?So.create(ac(e.unwrap())):e instanceof Es?Es.create(e.items.map(t=>ac(t))):e}class sn extends Nt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Tt.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==Ue.object){const u=this._getOrReturnCtx(t);return ze(u,{code:Ae.invalid_type,expected:Ue.object,received:u.parsedType}),ut}const{status:r,ctx:i}=this._processInputParams(t),{shape:s,keys:o}=this._getCached(),l=[];if(!(this._def.catchall instanceof ma&&this._def.unknownKeys==="strip"))for(const u in i.data)o.includes(u)||l.push(u);const c=[];for(const u of o){const d=s[u],f=i.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new As(i,f,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof ma){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of l)c.push({key:{status:"valid",value:d},value:{status:"valid",value:i.data[d]}});else if(u==="strict")l.length>0&&(ze(i,{code:Ae.unrecognized_keys,keys:l}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of l){const f=i.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new As(i,f,i.path,d)),alwaysSet:d in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of c){const f=await d.key,h=await d.value;u.push({key:f,value:h,alwaysSet:d.alwaysSet})}return u}).then(u=>pr.mergeObjectSync(r,u)):pr.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(t){return Ye.errToObj,new sn({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var i,s,o,l;const c=(o=(s=(i=this._def).errorMap)===null||s===void 0?void 0:s.call(i,n,r).message)!==null&&o!==void 0?o:r.defaultError;return n.code==="unrecognized_keys"?{message:(l=Ye.errToObj(t).message)!==null&&l!==void 0?l:c}:{message:c}}}:{}})}strip(){return new sn({...this._def,unknownKeys:"strip"})}passthrough(){return new sn({...this._def,unknownKeys:"passthrough"})}extend(t){return new sn({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new sn({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:lt.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new sn({...this._def,catchall:t})}pick(t){const n={};return Tt.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new sn({...this._def,shape:()=>n})}omit(t){const n={};return Tt.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new sn({...this._def,shape:()=>n})}deepPartial(){return ac(this)}partial(t){const n={};return Tt.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}),new sn({...this._def,shape:()=>n})}required(t){const n={};return Tt.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof Ss;)s=s._def.innerType;n[r]=s}}),new sn({...this._def,shape:()=>n})}keyof(){return ND(Tt.objectKeys(this.shape))}}sn.create=(e,t)=>new sn({shape:()=>e,unknownKeys:"strip",catchall:ma.create(),typeName:lt.ZodObject,...yt(t)});sn.strictCreate=(e,t)=>new sn({shape:()=>e,unknownKeys:"strict",catchall:ma.create(),typeName:lt.ZodObject,...yt(t)});sn.lazycreate=(e,t)=>new sn({shape:e,unknownKeys:"strip",catchall:ma.create(),typeName:lt.ZodObject,...yt(t)});class nh extends Nt{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(s){for(const l of s)if(l.result.status==="valid")return l.result;for(const l of s)if(l.result.status==="dirty")return n.common.issues.push(...l.ctx.common.issues),l.result;const o=s.map(l=>new ti(l.ctx.common.issues));return ze(n,{code:Ae.invalid_union,unionErrors:o}),ut}if(n.common.async)return Promise.all(r.map(async s=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(i);{let s;const o=[];for(const c of r){const u={...n,common:{...n.common,issues:[]},parent:null},d=c._parseSync({data:n.data,path:n.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!s&&(s={result:d,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const l=o.map(c=>new ti(c));return ze(n,{code:Ae.invalid_union,unionErrors:l}),ut}}get options(){return this._def.options}}nh.create=(e,t)=>new nh({options:e,typeName:lt.ZodUnion,...yt(t)});const Bs=e=>e instanceof sh?Bs(e.schema):e instanceof es?Bs(e.innerType()):e instanceof ah?[e.value]:e instanceof jo?e.options:e instanceof oh?Tt.objectValues(e.enum):e instanceof lh?Bs(e._def.innerType):e instanceof eh?[void 0]:e instanceof th?[null]:e instanceof Ss?[void 0,...Bs(e.unwrap())]:e instanceof So?[null,...Bs(e.unwrap())]:e instanceof LN||e instanceof uh?Bs(e.unwrap()):e instanceof ch?Bs(e._def.innerType):[];class Yy extends Nt{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Ue.object)return ze(n,{code:Ae.invalid_type,expected:Ue.object,received:n.parsedType}),ut;const r=this.discriminator,i=n.data[r],s=this.optionsMap.get(i);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(ze(n,{code:Ae.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),ut)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const i=new Map;for(const s of n){const o=Bs(s.shape[t]);if(!o.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const l of o){if(i.has(l))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(l)}`);i.set(l,s)}}return new Yy({typeName:lt.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...yt(r)})}}function s1(e,t){const n=Va(e),r=Va(t);if(e===t)return{valid:!0,data:e};if(n===Ue.object&&r===Ue.object){const i=Tt.objectKeys(t),s=Tt.objectKeys(e).filter(l=>i.indexOf(l)!==-1),o={...e,...t};for(const l of s){const c=s1(e[l],t[l]);if(!c.valid)return{valid:!1};o[l]=c.data}return{valid:!0,data:o}}else if(n===Ue.array&&r===Ue.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let s=0;s{if(r1(s)||r1(o))return ut;const l=s1(s.value,o.value);return l.valid?((i1(s)||i1(o))&&n.dirty(),{status:n.value,value:l.data}):(ze(r,{code:Ae.invalid_intersection_types}),ut)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,o])=>i(s,o)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}rh.create=(e,t,n)=>new rh({left:e,right:t,typeName:lt.ZodIntersection,...yt(n)});class Es extends Nt{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ue.array)return ze(r,{code:Ae.invalid_type,expected:Ue.array,received:r.parsedType}),ut;if(r.data.lengththis._def.items.length&&(ze(r,{code:Ae.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((o,l)=>{const c=this._def.items[l]||this._def.rest;return c?c._parse(new As(r,o,r.path,l)):null}).filter(o=>!!o);return r.common.async?Promise.all(s).then(o=>pr.mergeArray(n,o)):pr.mergeArray(n,s)}get items(){return this._def.items}rest(t){return new Es({...this._def,rest:t})}}Es.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Es({items:e,typeName:lt.ZodTuple,rest:null,...yt(t)})};class ih extends Nt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ue.object)return ze(r,{code:Ae.invalid_type,expected:Ue.object,received:r.parsedType}),ut;const i=[],s=this._def.keyType,o=this._def.valueType;for(const l in r.data)i.push({key:s._parse(new As(r,l,r.path,l)),value:o._parse(new As(r,r.data[l],r.path,l)),alwaysSet:l in r.data});return r.common.async?pr.mergeObjectAsync(n,i):pr.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Nt?new ih({keyType:t,valueType:n,typeName:lt.ZodRecord,...yt(r)}):new ih({keyType:Wi.create(),valueType:t,typeName:lt.ZodRecord,...yt(n)})}}class Vg extends Nt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ue.map)return ze(r,{code:Ae.invalid_type,expected:Ue.map,received:r.parsedType}),ut;const i=this._def.keyType,s=this._def.valueType,o=[...r.data.entries()].map(([l,c],u)=>({key:i._parse(new As(r,l,r.path,[u,"key"])),value:s._parse(new As(r,c,r.path,[u,"value"]))}));if(r.common.async){const l=new Map;return Promise.resolve().then(async()=>{for(const c of o){const u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return ut;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),l.set(u.value,d.value)}return{status:n.value,value:l}})}else{const l=new Map;for(const c of o){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return ut;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),l.set(u.value,d.value)}return{status:n.value,value:l}}}}Vg.create=(e,t,n)=>new Vg({valueType:t,keyType:e,typeName:lt.ZodMap,...yt(n)});class Al extends Nt{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Ue.set)return ze(r,{code:Ae.invalid_type,expected:Ue.set,received:r.parsedType}),ut;const i=this._def;i.minSize!==null&&r.data.sizei.maxSize.value&&(ze(r,{code:Ae.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const s=this._def.valueType;function o(c){const u=new Set;for(const d of c){if(d.status==="aborted")return ut;d.status==="dirty"&&n.dirty(),u.add(d.value)}return{status:n.value,value:u}}const l=[...r.data.values()].map((c,u)=>s._parse(new As(r,c,r.path,u)));return r.common.async?Promise.all(l).then(c=>o(c)):o(l)}min(t,n){return new Al({...this._def,minSize:{value:t,message:Ye.toString(n)}})}max(t,n){return new Al({...this._def,maxSize:{value:t,message:Ye.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Al.create=(e,t)=>new Al({valueType:e,minSize:null,maxSize:null,typeName:lt.ZodSet,...yt(t)});class Ic extends Nt{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Ue.function)return ze(n,{code:Ae.invalid_type,expected:Ue.function,received:n.parsedType}),ut;function r(l,c){return Fg({data:l,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Lg(),au].filter(u=>!!u),issueData:{code:Ae.invalid_arguments,argumentsError:c}})}function i(l,c){return Fg({data:l,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Lg(),au].filter(u=>!!u),issueData:{code:Ae.invalid_return_type,returnTypeError:c}})}const s={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof lu){const l=this;return Pr(async function(...c){const u=new ti([]),d=await l._def.args.parseAsync(c,s).catch(p=>{throw u.addIssue(r(c,p)),u}),f=await Reflect.apply(o,this,d);return await l._def.returns._def.type.parseAsync(f,s).catch(p=>{throw u.addIssue(i(f,p)),u})})}else{const l=this;return Pr(function(...c){const u=l._def.args.safeParse(c,s);if(!u.success)throw new ti([r(c,u.error)]);const d=Reflect.apply(o,this,u.data),f=l._def.returns.safeParse(d,s);if(!f.success)throw new ti([i(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new Ic({...this._def,args:Es.create(t).rest(ml.create())})}returns(t){return new Ic({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new Ic({args:t||Es.create([]).rest(ml.create()),returns:n||ml.create(),typeName:lt.ZodFunction,...yt(r)})}}class sh extends Nt{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}sh.create=(e,t)=>new sh({getter:e,typeName:lt.ZodLazy,...yt(t)});class ah extends Nt{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return ze(n,{received:n.data,code:Ae.invalid_literal,expected:this._def.value}),ut}return{status:"valid",value:t.data}}get value(){return this._def.value}}ah.create=(e,t)=>new ah({value:e,typeName:lt.ZodLiteral,...yt(t)});function ND(e,t){return new jo({values:e,typeName:lt.ZodEnum,...yt(t)})}class jo extends Nt{constructor(){super(...arguments),Zd.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return ze(n,{expected:Tt.joinValues(r),received:n.parsedType,code:Ae.invalid_type}),ut}if(Bg(this,Zd)||bD(this,Zd,new Set(this._def.values)),!Bg(this,Zd).has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return ze(n,{received:n.data,code:Ae.invalid_enum_value,options:r}),ut}return Pr(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return jo.create(t,{...this._def,...n})}exclude(t,n=this._def){return jo.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}Zd=new WeakMap;jo.create=ND;class oh extends Nt{constructor(){super(...arguments),Qd.set(this,void 0)}_parse(t){const n=Tt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==Ue.string&&r.parsedType!==Ue.number){const i=Tt.objectValues(n);return ze(r,{expected:Tt.joinValues(i),received:r.parsedType,code:Ae.invalid_type}),ut}if(Bg(this,Qd)||bD(this,Qd,new Set(Tt.getValidEnumValues(this._def.values))),!Bg(this,Qd).has(t.data)){const i=Tt.objectValues(n);return ze(r,{received:r.data,code:Ae.invalid_enum_value,options:i}),ut}return Pr(t.data)}get enum(){return this._def.values}}Qd=new WeakMap;oh.create=(e,t)=>new oh({values:e,typeName:lt.ZodNativeEnum,...yt(t)});class lu extends Nt{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Ue.promise&&n.common.async===!1)return ze(n,{code:Ae.invalid_type,expected:Ue.promise,received:n.parsedType}),ut;const r=n.parsedType===Ue.promise?n.data:Promise.resolve(n.data);return Pr(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}lu.create=(e,t)=>new lu({type:e,typeName:lt.ZodPromise,...yt(t)});class es extends Nt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===lt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,s={addIssue:o=>{ze(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const o=i.transform(r.data,s);if(r.common.async)return Promise.resolve(o).then(async l=>{if(n.value==="aborted")return ut;const c=await this._def.schema._parseAsync({data:l,path:r.path,parent:r});return c.status==="aborted"?ut:c.status==="dirty"||n.value==="dirty"?xc(c.value):c});{if(n.value==="aborted")return ut;const l=this._def.schema._parseSync({data:o,path:r.path,parent:r});return l.status==="aborted"?ut:l.status==="dirty"||n.value==="dirty"?xc(l.value):l}}if(i.type==="refinement"){const o=l=>{const c=i.refinement(l,s);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(r.common.async===!1){const l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return l.status==="aborted"?ut:(l.status==="dirty"&&n.dirty(),o(l.value),{status:n.value,value:l.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>l.status==="aborted"?ut:(l.status==="dirty"&&n.dirty(),o(l.value).then(()=>({status:n.value,value:l.value}))))}if(i.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Zf(o))return o;const l=i.transform(o.value,s);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:l}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>Zf(o)?Promise.resolve(i.transform(o.value,s)).then(l=>({status:n.value,value:l})):o);Tt.assertNever(i)}}es.create=(e,t,n)=>new es({schema:e,typeName:lt.ZodEffects,effect:t,...yt(n)});es.createWithPreprocess=(e,t,n)=>new es({schema:t,effect:{type:"preprocess",transform:e},typeName:lt.ZodEffects,...yt(n)});class Ss extends Nt{_parse(t){return this._getType(t)===Ue.undefined?Pr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Ss.create=(e,t)=>new Ss({innerType:e,typeName:lt.ZodOptional,...yt(t)});class So extends Nt{_parse(t){return this._getType(t)===Ue.null?Pr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}So.create=(e,t)=>new So({innerType:e,typeName:lt.ZodNullable,...yt(t)});class lh extends Nt{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===Ue.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}lh.create=(e,t)=>new lh({innerType:e,typeName:lt.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...yt(t)});class ch extends Nt{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Qf(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new ti(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ti(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}ch.create=(e,t)=>new ch({innerType:e,typeName:lt.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...yt(t)});class Wg extends Nt{_parse(t){if(this._getType(t)!==Ue.nan){const r=this._getOrReturnCtx(t);return ze(r,{code:Ae.invalid_type,expected:Ue.nan,received:r.parsedType}),ut}return{status:"valid",value:t.data}}}Wg.create=e=>new Wg({typeName:lt.ZodNaN,...yt(e)});const oX=Symbol("zod_brand");class LN extends Nt{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class yp extends Nt{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?ut:s.status==="dirty"?(n.dirty(),xc(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?ut:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new yp({in:t,out:n,typeName:lt.ZodPipeline})}}class uh extends Nt{_parse(t){const n=this._def.innerType._parse(t),r=i=>(Zf(i)&&(i.value=Object.freeze(i.value)),i);return Qf(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}uh.create=(e,t)=>new uh({innerType:e,typeName:lt.ZodReadonly,...yt(t)});function _D(e,t={},n){return e?ou.create().superRefine((r,i)=>{var s,o;if(!e(r)){const l=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,c=(o=(s=l.fatal)!==null&&s!==void 0?s:n)!==null&&o!==void 0?o:!0,u=typeof l=="string"?{message:l}:l;i.addIssue({code:"custom",...u,fatal:c})}}):ou.create()}const lX={object:sn.lazycreate};var lt;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(lt||(lt={}));const cX=(e,t={message:`Input not instance of ${e.name}`})=>_D(n=>n instanceof e,t),PD=Wi.create,CD=bo.create,uX=Wg.create,dX=wo.create,AD=Jf.create,fX=Cl.create,hX=zg.create,pX=eh.create,mX=th.create,gX=ou.create,vX=ml.create,yX=ma.create,xX=Ug.create,bX=qi.create,wX=sn.create,jX=sn.strictCreate,SX=nh.create,NX=Yy.create,_X=rh.create,PX=Es.create,CX=ih.create,AX=Vg.create,EX=Al.create,OX=Ic.create,kX=sh.create,TX=ah.create,$X=jo.create,IX=oh.create,MX=lu.create,mE=es.create,RX=Ss.create,DX=So.create,LX=es.createWithPreprocess,FX=yp.create,BX=()=>PD().optional(),zX=()=>CD().optional(),UX=()=>AD().optional(),VX={string:e=>Wi.create({...e,coerce:!0}),number:e=>bo.create({...e,coerce:!0}),boolean:e=>Jf.create({...e,coerce:!0}),bigint:e=>wo.create({...e,coerce:!0}),date:e=>Cl.create({...e,coerce:!0})},WX=ut;var Le=Object.freeze({__proto__:null,defaultErrorMap:au,setErrorMap:WK,getErrorMap:Lg,makeIssue:Fg,EMPTY_PATH:HK,addIssueToContext:ze,ParseStatus:pr,INVALID:ut,DIRTY:xc,OK:Pr,isAborted:r1,isDirty:i1,isValid:Zf,isAsync:Qf,get util(){return Tt},get objectUtil(){return n1},ZodParsedType:Ue,getParsedType:Va,ZodType:Nt,datetimeRegex:SD,ZodString:Wi,ZodNumber:bo,ZodBigInt:wo,ZodBoolean:Jf,ZodDate:Cl,ZodSymbol:zg,ZodUndefined:eh,ZodNull:th,ZodAny:ou,ZodUnknown:ml,ZodNever:ma,ZodVoid:Ug,ZodArray:qi,ZodObject:sn,ZodUnion:nh,ZodDiscriminatedUnion:Yy,ZodIntersection:rh,ZodTuple:Es,ZodRecord:ih,ZodMap:Vg,ZodSet:Al,ZodFunction:Ic,ZodLazy:sh,ZodLiteral:ah,ZodEnum:jo,ZodNativeEnum:oh,ZodPromise:lu,ZodEffects:es,ZodTransformer:es,ZodOptional:Ss,ZodNullable:So,ZodDefault:lh,ZodCatch:ch,ZodNaN:Wg,BRAND:oX,ZodBranded:LN,ZodPipeline:yp,ZodReadonly:uh,custom:_D,Schema:Nt,ZodSchema:Nt,late:lX,get ZodFirstPartyTypeKind(){return lt},coerce:VX,any:gX,array:bX,bigint:dX,boolean:AD,date:fX,discriminatedUnion:NX,effect:mE,enum:$X,function:OX,instanceof:cX,intersection:_X,lazy:kX,literal:TX,map:AX,nan:uX,nativeEnum:IX,never:yX,null:mX,nullable:DX,number:CD,object:wX,oboolean:UX,onumber:zX,optional:RX,ostring:BX,pipeline:FX,preprocess:LX,promise:MX,record:CX,set:EX,strictObject:jX,string:PD,symbol:hX,transformer:mE,tuple:PX,undefined:pX,union:SX,unknown:vX,void:xX,NEVER:WX,ZodIssueCode:Ae,quotelessJson:VK,ZodError:ti}),HX="Label",ED=v.forwardRef((e,t)=>a.jsx(qe.label,{...e,ref:t,onMouseDown:n=>{var i;n.target.closest("button, input, select, textarea")||((i=e.onMouseDown)==null||i.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));ED.displayName=HX;var OD=ED;const GX=EN("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),uo=v.forwardRef(({className:e,...t},n)=>a.jsx(OD,{ref:n,className:Me(GX(),e),...t}));uo.displayName=OD.displayName;const Zy=NK,kD=v.createContext({}),at=({...e})=>a.jsx(kD.Provider,{value:{name:e.name},children:a.jsx(AK,{...e})}),Qy=()=>{const e=v.useContext(kD),t=v.useContext(TD),{getFieldState:n,formState:r}=qy(),i=n(e.name,r);if(!e)throw new Error("useFormField should be used within ");const{id:s}=t;return{id:s,name:e.name,formItemId:`${s}-form-item`,formDescriptionId:`${s}-form-item-description`,formMessageId:`${s}-form-item-message`,...i}},TD=v.createContext({}),nt=v.forwardRef(({className:e,...t},n)=>{const r=v.useId();return a.jsx(TD.Provider,{value:{id:r},children:a.jsx("div",{ref:n,className:Me("space-y-2",e),...t})})});nt.displayName="FormItem";const rt=v.forwardRef(({className:e,...t},n)=>{const{error:r,formItemId:i}=Qy();return a.jsx(uo,{ref:n,className:Me(r&&"text-destructive",e),htmlFor:i,...t})});rt.displayName="FormLabel";const it=v.forwardRef(({...e},t)=>{const{error:n,formItemId:r,formDescriptionId:i,formMessageId:s}=Qy();return a.jsx(ca,{ref:t,id:r,"aria-describedby":n?`${i} ${s}`:`${i}`,"aria-invalid":!!n,...e})});it.displayName="FormControl";const un=v.forwardRef(({className:e,...t},n)=>{const{formDescriptionId:r}=Qy();return a.jsx("p",{ref:n,id:r,className:Me("text-sm text-muted-foreground",e),...t})});un.displayName="FormDescription";const st=v.forwardRef(({className:e,children:t,...n},r)=>{const{error:i,formMessageId:s}=Qy(),o=i?String(i==null?void 0:i.message):t;return o?a.jsx("p",{ref:r,id:s,className:Me("text-sm font-medium text-destructive",e),...n,children:o}):null});st.displayName="FormMessage";const St=v.forwardRef(({className:e,type:t,...n},r)=>a.jsx("input",{type:t,className:Me("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...n}));St.displayName="Input";const Qe=v.forwardRef(({className:e,...t},n)=>a.jsx("textarea",{className:Me("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));Qe.displayName="Textarea";const qX=Le.object({audienceBrief:Le.string().min(10,{message:"Audience brief must be at least 10 characters."}),researchObjective:Le.string().optional(),personaCount:Le.string().min(1,{message:"Number of personas is required."}),dataFile:Le.instanceof(FileList).optional()});function KX({onSubmit:e,isGenerating:t}){const[n,r]=v.useState(!1),[i,s]=v.useState(!1),[o,l]=v.useState({audience_brief:[],research_objective:[]}),[c,u]=v.useState(!1),[d,f]=v.useState(null),h=Ky({resolver:Xy(qX),defaultValues:{audienceBrief:"",researchObjective:"",personaCount:"5"}}),p=h.watch("audienceBrief"),g=h.watch("researchObjective"),m=async()=>{var w,j,S,N,P,_,A,O,$,T,M;const b=p==null?void 0:p.trim(),y=g==null?void 0:g.trim();if(!b||b.length<10){pe.error("Audience brief too short",{description:"Please enter at least 10 characters in the audience brief"});return}if(!y||y.length<10){pe.error("Research objective too short",{description:"Please enter at least 10 characters in the research objective"});return}u(!0),f(null);try{const R=await Us.enhanceAudienceBrief(b,y);l(R.data.suggestions||{audience_brief:[],research_objective:[]}),r(!0),s(!1);const H=(((j=(w=R.data.suggestions)==null?void 0:w.audience_brief)==null?void 0:j.length)||0)+(((N=(S=R.data.suggestions)==null?void 0:S.research_objective)==null?void 0:N.length)||0);pe.success("Enhancement suggestions generated",{description:`Generated ${H} suggestions to improve your research inputs`})}catch(R){console.error("Error enhancing audience brief:",R);let H="Please try again or modify your brief",F="Failed to generate suggestions";if(R&&typeof R=="object"){const V=R;V.code==="ECONNABORTED"||(P=V.message)!=null&&P.includes("timeout")?(F="Request timeout",H="The AI took too long to analyze your brief. Please try again."):((_=V.response)==null?void 0:_.status)===500?(F="Server error",H=((O=(A=V.response)==null?void 0:A.data)==null?void 0:O.message)||"The server encountered an error. Please try again later."):(($=V.response)==null?void 0:$.status)===400?(F="Invalid brief",H=((M=(T=V.response)==null?void 0:T.data)==null?void 0:M.message)||"Please check your audience brief and try again."):V.message&&(H=V.message)}else R instanceof Error&&(H=R.message);f(H),pe.error(F,{description:H,duration:5e3})}finally{u(!1)}},x=()=>{s(!i)};return a.jsx(Zy,{...h,children:a.jsxs("form",{onSubmit:h.handleSubmit(e),className:"space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-6",children:[a.jsx(at,{control:h.control,name:"audienceBrief",render:({field:b})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Audience Brief"}),a.jsx(it,{children:a.jsx(Qe,{placeholder:"Describe your target audience and research goals...",className:"h-40",...b})}),a.jsx(un,{children:"Provide details about the demographics, behaviors, and attitudes you want to explore"}),a.jsx(st,{})]})}),a.jsx(at,{control:h.control,name:"researchObjective",render:({field:b})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Research Objective"}),a.jsx(it,{children:a.jsx(Qe,{placeholder:"What is the main research topic or objective you want to explore?",className:"h-32",...b})}),a.jsx(un,{children:"Specify your research focus to generate more targeted persona goals, frustrations, and scenarios"}),a.jsx(st,{})]})}),a.jsx("div",{className:"space-y-3",children:a.jsx(oe,{type:"button",variant:"outline",size:"sm",onClick:m,disabled:!p||p.trim().length<10||!g||g.trim().length<10||c||t,className:"flex items-center gap-2 hover-transition",children:c?a.jsxs(a.Fragment,{children:[a.jsx($c,{className:"h-4 w-4 animate-spin"}),"Analyzing Research Inputs..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Nl,{className:"h-4 w-4"}),"Enhance Brief"]})})})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsx(at,{control:h.control,name:"dataFile",render:({field:{value:b,onChange:y,...w}})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Customer Data (Optional)"}),a.jsx(it,{children:a.jsxs("div",{className:"border-2 border-dashed border-slate-200 rounded-lg p-6 flex flex-col items-center justify-center bg-slate-50 hover:bg-slate-100 transition cursor-pointer",children:[a.jsx(xR,{className:"h-10 w-10 text-slate-400 mb-2"}),a.jsx("p",{className:"text-sm text-slate-600 mb-1",children:"Upload customer data for more accurate personas"}),a.jsx("p",{className:"text-xs text-slate-500 mb-3",children:"Supports PDF, Office docs, images, and more"}),a.jsx(St,{...w,type:"file",multiple:!0,accept:".pdf,.docx,.pptx,.xlsx,.html,.xml,.rtf,.pages,.key,.epub,.txt,.csv,.jpg,.jpeg,.png",onChange:j=>{y(j.target.files)},className:"hidden",id:"data-file-input"}),a.jsxs(oe,{type:"button",variant:"outline",size:"sm",onClick:()=>{var j;return(j=document.getElementById("data-file-input"))==null?void 0:j.click()},children:[a.jsx(NR,{className:"mr-2 h-4 w-4"}),"Select Files"]}),b&&b.length>0&&a.jsx("p",{className:"text-xs text-primary mt-2",children:b.length===1?b[0].name:`${b.length} files selected`})]})}),a.jsx(un,{children:"Upload existing customer data to create more realistic personas"}),a.jsx(st,{})]})}),a.jsxs("div",{className:"bg-muted/30 p-4 rounded-lg border border-border",children:[a.jsxs("div",{className:"flex items-center mb-2",children:[a.jsx(Ww,{className:"h-5 w-5 text-muted-foreground mr-2"}),a.jsx("h3",{className:"font-sf font-medium",children:"What's included?"})]}),a.jsxs("ul",{className:"space-y-2 text-sm text-muted-foreground",children:[a.jsxs("li",{className:"flex items-center",children:[a.jsx(Yd,{className:"h-4 w-4 text-green-500 mr-2"}),"Demographic profiles based on your brief"]}),a.jsxs("li",{className:"flex items-center",children:[a.jsx(Yd,{className:"h-4 w-4 text-green-500 mr-2"}),"Personality traits and behavioral patterns"]}),a.jsxs("li",{className:"flex items-center",children:[a.jsx(Yd,{className:"h-4 w-4 text-green-500 mr-2"}),"Consumer preferences and interests"]}),a.jsxs("li",{className:"flex items-center",children:[a.jsx(Yd,{className:"h-4 w-4 text-green-500 mr-2"}),"Review and refine capabilities"]})]})]})]})]}),n&&a.jsxs("div",{className:"glass-panel rounded-lg p-4 border border-border bg-muted/30",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("h3",{className:"font-sf font-medium text-sm flex items-center gap-2",children:[a.jsx(Nl,{className:"h-4 w-4 text-primary"}),"Enhancement Suggestions:"]}),a.jsx(oe,{type:"button",variant:"ghost",size:"sm",onClick:x,className:"h-6 w-6 p-0 hover:bg-slate-200",title:i?"Expand suggestions":"Collapse suggestions",children:i?a.jsx(ja,{className:"h-4 w-4"}):a.jsx(pp,{className:"h-4 w-4"})})]}),!i&&a.jsx(a.Fragment,{children:d?a.jsx("div",{className:"text-sm text-red-600 bg-red-50 p-3 rounded-md",children:d}):a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx("div",{children:o.audience_brief.length>0?a.jsxs("div",{children:[a.jsxs("h4",{className:"font-sf font-medium text-sm text-slate-800 mb-2 flex items-center gap-2",children:[a.jsx(Hn,{className:"h-4 w-4 text-blue-600"}),"Suggestions for your Audience Brief:"]}),a.jsx("ul",{className:"space-y-2 text-sm text-slate-700",children:o.audience_brief.map((b,y)=>a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"text-blue-600 mt-1.5 text-xs",children:"โ€ข"}),a.jsx("span",{className:"flex-1",children:b})]},y))})]}):a.jsx("div",{className:"text-sm text-muted-foreground",children:"No audience brief suggestions available"})}),a.jsx("div",{children:o.research_objective.length>0?a.jsxs("div",{children:[a.jsxs("h4",{className:"font-sf font-medium text-sm text-slate-800 mb-2 flex items-center gap-2",children:[a.jsx(Ww,{className:"h-4 w-4 text-green-600"}),"Suggestions for your Research Objective:"]}),a.jsx("ul",{className:"space-y-2 text-sm text-slate-700",children:o.research_objective.map((b,y)=>a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"text-green-600 mt-1.5 text-xs",children:"โ€ข"}),a.jsx("span",{className:"flex-1",children:b})]},y))})]}):a.jsx("div",{className:"text-sm text-muted-foreground",children:"No research objective suggestions available"})}),o.audience_brief.length===0&&o.research_objective.length===0&&a.jsx("div",{className:"col-span-full text-sm text-muted-foreground text-center",children:"No suggestions available"})]})})]}),a.jsx(at,{control:h.control,name:"personaCount",render:({field:b})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Number of Personas to Generate"}),a.jsx(it,{children:a.jsx(St,{type:"number",min:"1",max:"20",...b})}),a.jsx(un,{children:"How many synthetic users do you need for your research?"}),a.jsx(st,{})]})}),a.jsxs("div",{className:"flex flex-col items-end",children:[a.jsx(oe,{type:"submit",disabled:t,className:"min-w-36",children:t?a.jsxs(a.Fragment,{children:[a.jsx($c,{className:"mr-2 h-4 w-4 animate-spin"}),"AI Generating..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Hn,{className:"mr-2 h-4 w-4"}),"Generate Personas"]})}),t&&a.jsx("div",{className:"text-xs text-muted-foreground mt-2",children:"Generating multiple personas in parallel. This may take 1-2 minutes..."})]})]})})}const Ge=v.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:Me("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));Ge.displayName="Card";const $r=v.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:Me("flex flex-col space-y-1.5 p-6",e),...t}));$r.displayName="CardHeader";const Xr=v.forwardRef(({className:e,...t},n)=>a.jsx("h3",{ref:n,className:Me("text-2xl font-semibold leading-none tracking-tight",e),...t}));Xr.displayName="CardTitle";const FN=v.forwardRef(({className:e,...t},n)=>a.jsx("p",{ref:n,className:Me("text-sm text-muted-foreground",e),...t}));FN.displayName="CardDescription";const tt=v.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:Me("p-6 pt-0",e),...t}));tt.displayName="CardContent";const BN=v.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:Me("flex items-center p-6 pt-0",e),...t}));BN.displayName="CardFooter";const XX=e=>{const t=e==null?void 0:e.toLowerCase(),n="/semblance/";switch(t){case"male":return`${n}male_avatar.png`;case"female":return`${n}female_avatar.png`;case"non-binary":case"nonbinary":case"non binary":return`${n}nonbinary_avatar.png`;default:return`${n}male_avatar.png`}},Zu=e=>e.avatar||XX(e.gender);function zN({user:e,selected:t=!1,onClick:n,showDetailedDialog:r=!1,onSelectionToggle:i,showAddToFolderButton:s=!1,onAddToFolder:o,showModalInsteadOfNavigate:l=!1,onOpenPersonaModal:c}){const u=Cn();v.useState(!1);const[d,f]=v.useState(e),h=e._id||e.id,p=x=>{x.stopPropagation(),u(`/synthetic-users/${h}`)};d.oceanTraits&&(d.oceanTraits.openness,d.oceanTraits.conscientiousness,d.oceanTraits.extraversion,d.oceanTraits.agreeableness,d.oceanTraits.neuroticism);const g=x=>{var w,j;const b=x.target;b.closest("button")&&((j=(w=b.closest("button"))==null?void 0:w.textContent)!=null&&j.includes("View Details"))||(i?i(x):n&&n(x))},m=x=>{x.stopPropagation(),l&&c?c(d):p(x)};return a.jsxs("div",{className:Me("persona-card glass-card rounded-xl p-4 cursor-pointer hover:shadow-md button-transition",t&&"selected ring-2 ring-primary"),onClick:g,children:[a.jsx("div",{className:"persona-card-overlay"}),a.jsx("div",{className:"persona-card-checkmark",children:a.jsx(ha,{className:"h-4 w-4 text-primary"})}),a.jsx("div",{className:"relative z-10",children:a.jsxs("div",{className:"flex items-start space-x-4",children:[a.jsx("div",{className:"h-12 w-12 rounded-full bg-muted flex items-center justify-center",children:a.jsx("img",{src:Zu(d),alt:`${d.name} avatar`,className:"h-12 w-12 rounded-full object-cover"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"flex items-center justify-between gap-2",children:a.jsx("h3",{className:"text-sm font-medium truncate flex-1",children:d.name})}),a.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[d.age," โ€ข ",d.gender]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:d.occupation}),a.jsx("p",{className:"text-xs text-muted-foreground",children:d.location}),a.jsx("div",{className:"mt-2",children:d.aiSynthesizedBio?a.jsxs("p",{className:"text-xs text-slate-700 line-clamp-3 leading-relaxed",children:[d.aiSynthesizedBio,d.aiSynthesizedBio.length>150&&"..."]}):a.jsxs("p",{className:"text-xs text-muted-foreground italic line-clamp-3",children:['"',d.personality,'"']})}),d.qualitativeAttributes&&d.qualitativeAttributes.length>0&&a.jsx("div",{className:"mt-3",children:a.jsx("div",{className:"flex flex-wrap gap-1",children:d.qualitativeAttributes.slice(0,3).map((x,b)=>a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-blue-50 text-blue-700 text-xs rounded-full",children:[a.jsx(EG,{className:"h-3 w-3"}),x]},b))})}),d.topPersonalityTraits&&d.topPersonalityTraits.length>0&&a.jsx("div",{className:"mt-2",children:a.jsx("div",{className:"flex flex-wrap gap-1",children:d.topPersonalityTraits.slice(0,3).map((x,b)=>a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-purple-50 text-purple-700 text-xs rounded-full",children:[a.jsx(fa,{className:"h-3 w-3"}),x]},b))})}),a.jsx("div",{className:"mt-3 flex justify-end",children:a.jsx(oe,{variant:"ghost",size:"sm",onClick:m,children:"View Details"})})]})]})})]})}var UN="Collapsible",[YX,$D]=Er(UN),[ZX,VN]=YX(UN),ID=v.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:s,onOpenChange:o,...l}=e,[c=!1,u]=ii({prop:r,defaultProp:i,onChange:o});return a.jsx(ZX,{scope:n,disabled:s,contentId:wi(),open:c,onOpenToggle:v.useCallback(()=>u(d=>!d),[u]),children:a.jsx(qe.div,{"data-state":qN(c),"data-disabled":s?"":void 0,...l,ref:t})})});ID.displayName=UN;var MD="CollapsibleTrigger",WN=v.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,i=VN(MD,n);return a.jsx(qe.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":qN(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:t,onClick:Te(e.onClick,i.onOpenToggle)})});WN.displayName=MD;var HN="CollapsibleContent",GN=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=VN(HN,e.__scopeCollapsible);return a.jsx(er,{present:n||i.open,children:({present:s})=>a.jsx(QX,{...r,ref:t,present:s})})});GN.displayName=HN;var QX=v.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:i,...s}=e,o=VN(HN,n),[l,c]=v.useState(r),u=v.useRef(null),d=dt(t,u),f=v.useRef(0),h=f.current,p=v.useRef(0),g=p.current,m=o.open||l,x=v.useRef(m),b=v.useRef();return v.useEffect(()=>{const y=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(y)},[]),Jn(()=>{const y=u.current;if(y){b.current=b.current||{transitionDuration:y.style.transitionDuration,animationName:y.style.animationName},y.style.transitionDuration="0s",y.style.animationName="none";const w=y.getBoundingClientRect();f.current=w.height,p.current=w.width,x.current||(y.style.transitionDuration=b.current.transitionDuration,y.style.animationName=b.current.animationName),c(r)}},[o.open,r]),a.jsx(qe.div,{"data-state":qN(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!m,...s,ref:d,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:m&&i})});function qN(e){return e?"open":"closed"}var RD=ID,JX=WN,eY=GN;const xp=RD,bp=WN,wp=GN;function tY({generatedPersonas:e,selectedPersonas:t,isGenerating:n,onPersonaSelection:r,onRefinePersonas:i,onApprovePersonas:s,onBackToGenerator:o}){const l=Cn(),[c,u]=v.useState(""),[d,f]=v.useState(!1),h=p=>{l(`/synthetic-users/${p}?fromReview=true`)};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"font-sf text-lg font-medium",children:"Review Generated Personas"}),a.jsxs("div",{className:"text-sm text-muted-foreground",children:[t.length," of ",e.length," selected"]})]}),a.jsx("div",{className:"space-y-4",children:e.map(p=>a.jsx(Ge,{className:`border ${t.includes(p.id)?"border-primary/50 bg-primary/5":""} cursor-pointer`,onClick:()=>h(p.id),children:a.jsx(tt,{className:"p-4",children:a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsx("div",{className:"flex-1",children:a.jsxs("div",{className:"flex items-center",children:[a.jsx("input",{type:"checkbox",id:`persona-${p.id}`,checked:t.includes(p.id),onChange:g=>{g.stopPropagation(),r(p.id)},className:"mr-3 h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium",children:p.name}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:[p.age," โ€ข ",p.gender," โ€ข ",p.occupation]})]})]})}),a.jsx(zN,{user:p,showDetailedDialog:!1,onClick:g=>{g.stopPropagation(),h(p.id)}})]})})},p.id))}),a.jsx("div",{className:"space-y-4 pt-4 border-t",children:a.jsxs("div",{children:[a.jsx("div",{className:"flex justify-between items-start mb-4",children:a.jsxs(oe,{variant:"outline",onClick:o,children:[a.jsx(Kf,{className:"mr-2 h-4 w-4"}),"Back to Generator"]})}),a.jsxs(xp,{open:d,onOpenChange:f,className:"w-full space-y-4",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx(bp,{asChild:!0,children:a.jsxs(oe,{variant:"outline",className:"flex items-center gap-2",children:[a.jsx($c,{className:"h-4 w-4"}),"Refine Personas",a.jsx(ja,{className:"h-4 w-4 ml-1 transition-transform duration-200",style:{transform:d?"rotate(180deg)":"rotate(0deg)"}})]})}),a.jsxs(oe,{onClick:s,disabled:t.length===0,children:[a.jsx(Yd,{className:"mr-2 h-4 w-4"}),"Approve Selected (",t.length,")"]})]}),a.jsx(wp,{children:a.jsx(Ge,{className:"border shadow-sm w-full mt-4",children:a.jsx(tt,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"refinement-prompt",className:"text-sm font-medium block mb-2",children:"Refinement Instructions"}),a.jsx(Qe,{id:"refinement-prompt",placeholder:"Example: Make all personas 5 years younger, or ensure everyone is from different locations...",value:c,onChange:p=>u(p.target.value),className:"min-h-[100px] w-full resize-y"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Use natural language to describe how you'd like to refine the selected personas."})]}),a.jsxs(oe,{onClick:()=>i(c),disabled:n||c.trim()==="",className:"w-full",children:[n?a.jsx($c,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx($c,{className:"mr-2 h-4 w-4"}),"Apply Refinements"]})]})})})})]})]})})]})}async function nY(e,t,n,r,i){console.log(`generateSyntheticPersonas called with targetFolderId: ${i||"none"}`);try{if(console.log(`Generating ${n} synthetic personas using two-stage approach...`),e.trim().length<10)throw new Error("Audience brief is too short. Please provide more context for better persona generation.");let s;if(r&&r.length>0){console.log(`Uploading ${r.length} customer data files...`);try{s=(await Us.uploadCustomerData(r)).data.session_id,console.log(`Customer data uploaded with session ID: ${s}`)}catch(l){throw console.error("Failed to upload customer data:",l),new Error("Failed to upload customer data files. Please try again.")}}const o=await Us.batchGenerateWithStages(e,t,n,.8,s);if(o.data){const l=o.data.partial_success===!0,c=o.data.personas&&o.data.personas.length>0,u=o.data.errors&&o.data.errors.length>0;if(c){if(console.log(`Generated ${o.data.personas.length} personas with two-stage process${u?` (${o.data.errors.length} failed)`:""}`),i){const f=o.data.personas.map(h=>({...h,folderId:i}));try{const h=f.map(p=>{if(p.id||p._id){const g=p._id||p.id;return console.log(`Updating persona ${p.name||g} with folder ID: ${i}`),Nn.update(g,{...p,folderId:i}).catch(m=>(console.error(`Error updating folder ID for persona ${p.name||g}:`,m),null))}return Promise.resolve(null)});await Promise.allSettled(h),console.log(`Added ${f.length} personas to folder ID: ${i}`)}catch(h){console.error("Error updating personas with folder ID:",h)}if(s)try{await Us.cleanupCustomerData(s),console.log(`Cleaned up customer data for session: ${s}`)}catch(h){console.warn("Failed to cleanup customer data:",h)}return l||u?{...o.data,personas:f,length:f.length}:{...o.data,personas:f}}if(s)try{await Us.cleanupCustomerData(s),console.log(`Cleaned up customer data for session: ${s}`)}catch(d){console.warn("Failed to cleanup customer data:",d)}if(l||u)return{...o.data.personas,length:o.data.personas.length,partial_success:l,errors:o.data.errors};if(s)try{await Us.cleanupCustomerData(s),console.log(`Cleaned up customer data for session: ${s}`)}catch(d){console.warn("Failed to cleanup customer data:",d)}return o.data.personas}else if(u){if(s)try{await Us.cleanupCustomerData(s),console.log(`Cleaned up customer data for session: ${s}`)}catch(d){console.warn("Failed to cleanup customer data:",d)}throw new Error(`Failed to generate personas: ${o.data.errors.length} generation attempts failed.`)}else throw new Error("No personas returned from API")}else throw new Error("Invalid response format from API")}catch(s){if(customerDataSessionId)try{await Us.cleanupCustomerData(customerDataSessionId),console.log(`Cleaned up customer data for session: ${customerDataSessionId}`)}catch(o){console.warn("Failed to cleanup customer data:",o)}throw console.error("Error generating AI personas:",s),s}}function DD(){const[e,t]=v.useState([]),n=async s=>{const o=[];for(const l of s){const c={...l};c._id&&typeof c._id=="string"&&c._id.startsWith("local-")&&delete c._id;const u=await Nn.create(c);console.log("Persona saved to database:",u.data),o.push({...l,id:u.data._id||u.data.id,_id:u.data._id||u.data.id,isDbPersona:!0})}t(o)},r=async()=>{const s=await Nn.getAll();return s&&s.data&&Array.isArray(s.data)?(console.log("Personas loaded from database:",s.data.length),s.data.map(o=>({...o,id:o._id||o.id,isDbPersona:!0}))):[]};return v.useEffect(()=>{(async()=>{const o=await r();t(o)})()},[]),{storedPersonas:e,savePersonas:n,loadPersonas:r,clearPersonas:async()=>{const s=await r();for(const o of s)o._id&&await Nn.delete(o._id);t([])}}}function rY({targetFolderId:e,targetFolderName:t}){const n=rs(),r=Cn(),{loadPersonas:i,savePersonas:s}=DD(),[o,l]=v.useState(!1),[c,u]=v.useState([]),[d,f]=v.useState([]),[h,p]=v.useState(!1),[g,m]=v.useState(0);v.useEffect(()=>{const S=new URLSearchParams(n.search),N=S.get("mode"),P=S.get("tab"),_=S.get("step");if(N==="create"&&P==="ai"&&_==="review"){const A=i();A.length>0&&(u(A),f(A.map(O=>O.id)),p(!0))}},[n,i]);async function x(S){var N,P,_,A,O,$,T,M,R,H;try{l(!0),m(0);const F=parseInt(S.personaCount);if(isNaN(F)||F<1||F>10){pe.error("Invalid number of personas",{description:"Please enter a number between 1 and 10"}),l(!1);return}m(5);const V=setInterval(()=>{m(ee=>ee<90?ee+Math.random()*5:ee)},500),I=F<=2?"30-60 seconds":F<=4?"1-2 minutes":F<=6?"2-3 minutes":"3-5 minutes";F>4&&pe.info("Generation may take longer",{description:`Generating ${F} personas at once may result in some timeouts. If this happens, the successfully created personas will still be saved.`,duration:8e3}),pe.info("Generating AI personas in parallel",{description:`Creating ${F} synthetic personas based on your brief. This may take ${I}. Please be patient.`,duration:1e4}),e&&t?(console.log(`Target folder for new personas: ID=${e}, Name=${t}`),pe.info(`Creating personas in "${t}" folder`,{duration:3e3})):console.log("No target folder specified for new personas");const L=await nY(S.audienceBrief,S.researchObjective,F,S.dataFile,e),Z=L.personas||L;if(clearInterval(V),m(100),Z&&Z.length>0)L.partial_success||L.errors&&L.errors.length>0?(pe.success("Some personas generated successfully",{description:`${Z.length} synthetic personas were created. ${((N=L.errors)==null?void 0:N.length)||0} failed due to timeout or other errors.`,duration:8e3}),L.errors&&L.errors.length>0&&setTimeout(()=>{pe.error("Some personas failed to generate",{description:`${L.errors.length} personas timed out. The server took too long to generate them. The successfully generated personas have been saved${e?" in the selected folder":""}.`,duration:1e4})},1e3)):pe.success("Personas generated and saved successfully",{description:`${Z.length} synthetic personas have been created and saved ${e?`to the "${t}" folder`:"to the database"}.`}),r("/synthetic-users");else throw new Error("No personas were generated")}catch(F){console.error("Error generating personas:",F);let V="Please try again or adjust your parameters",I="Failed to generate personas";F.code==="ECONNABORTED"||(P=F.message)!=null&&P.includes("timeout")||((_=F.response)==null?void 0:_.status)===504?(I="Generation timeout",V="AI persona generation timed out. This often happens when generating multiple complex personas. Try generating fewer personas (2-3) or try again later."):((A=F.response)==null?void 0:A.status)===500?(I="Server error",($=(O=F.response)==null?void 0:O.data)!=null&&$.message?V=F.response.data.message:(M=(T=F.response)==null?void 0:T.data)!=null&&M.error?V=F.response.data.error:V="The server encountered an error processing your request. Please try again later."):((R=F.response)==null?void 0:R.status)===401?(I="Authentication required",V="Please log in to generate personas."):(H=F.message)!=null&&H.includes("504 Deadline Exceeded")?(I="Generation timeout",V="The AI model took too long to generate personas. Try generating fewer personas or simplify your brief."):F instanceof Error&&(V=F.message),pe.error(I,{description:V,duration:6e3})}finally{setTimeout(()=>{l(!1),m(0)},500)}}const b=S=>{f(N=>N.includes(S)?N.filter(P=>P!==S):[...N,S])},y=(S,N)=>{const P=N.toLowerCase();return S.map(_=>{const A={..._};if(P.includes("younger")){const O=parseInt(A.age);A.age=(O-5).toString()}else if(P.includes("older")){const O=parseInt(A.age);A.age=(O+5).toString()}if(P.includes("different locations")&&(A.location=`${A.location} (Diversified)`),P.includes("more extroverted")?A.personality=`Extroverted, ${A.personality.toLowerCase()}`:P.includes("more introverted")&&(A.personality=`Introverted, ${A.personality.toLowerCase()}`),P.includes("diverse")){const O=["tech-savvy","traditional","innovative","conservative","creative"],$=O[Math.floor(Math.random()*O.length)];A.personality=`${$}, ${A.personality}`}return A})},w=S=>{if(!S.trim()){pe.error("Please provide refinement instructions");return}l(!0),setTimeout(()=>{try{const N=c.filter(A=>d.includes(A.id)),P=y(N,S),_=c.map(A=>P.find($=>$.id===A.id)||A);u(_),l(!1),s(_),pe.success("Personas refined based on your instructions",{description:"Review the updated profiles"})}catch(N){console.error("Error refining personas:",N),pe.error("Failed to refine personas",{description:"Please try different instructions"}),l(!1)}},1500)},j=()=>{const S=c.filter(N=>d.includes(N.id));pe.success(`${S.length} personas approved`,{description:"Added to your synthetic persona library"}),s(S),r("/synthetic-users")};return a.jsxs("div",{className:"glass-panel rounded-xl p-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[a.jsx(Hn,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"AI Persona Recruiter"})]}),o&&a.jsxs("div",{className:"mb-6",children:[a.jsxs("div",{className:"flex justify-between items-center mb-2",children:[a.jsx("span",{className:"text-sm font-medium",children:"Generating personas in parallel..."}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[Math.round(g),"%"]})]}),a.jsx(tl,{value:g,className:"h-2"})]}),h?a.jsx(tY,{generatedPersonas:c,selectedPersonas:d,isGenerating:o,onPersonaSelection:b,onRefinePersonas:w,onApprovePersonas:j,onBackToGenerator:()=>p(!1)}):a.jsx(KX,{onSubmit:x,isGenerating:o})]})}const No=new Map;function LD(e){const{id:t,title:n,description:r,type:i="default",duration:s}=e;let o;switch(i){case"success":o=pe.success(n,{description:r,duration:s});break;case"error":o=pe.error(n,{description:r,duration:s});break;case"warning":o=pe.warning(n,{description:r,duration:s});break;case"info":o=pe.info(n,{description:r,duration:s});break;default:o=pe(n,{description:r,duration:s});break}return No.set(t,o.toString()),t}function iY(e,t){const n=No.get(e);if(!n)return console.warn(`Toast with ID "${e}" not found. Creating new toast instead.`),LD({id:e,...t,title:t.title||"Updated"}),!1;const{title:r,description:i,type:s="default",duration:o}=t;pe.dismiss(n);let l;switch(s){case"success":l=pe.success(r,{description:i,duration:o});break;case"error":l=pe.error(r,{description:i,duration:o});break;case"warning":l=pe.warning(r,{description:i,duration:o});break;case"info":l=pe.info(r,{description:i,duration:o});break;default:l=pe(r,{description:i,duration:o});break}return No.set(e,l.toString()),!0}function sY(e){const t=No.get(e);return t?(pe.dismiss(t),No.delete(e),!0):(console.warn(`Toast with ID "${e}" not found.`),!1)}function aY(e){return No.has(e)}function oY(){No.forEach(e=>{pe.dismiss(e)}),No.clear()}const Ze={success:pe.success,error:pe.error,warning:pe.warning,info:pe.info,loading:pe.loading,dismiss:pe.dismiss,createPersistent:LD,updatePersistent:iY,dismissPersistent:sY,hasPersistent:aY,dismissAllPersistent:oY};function dh(e,[t,n]){return Math.min(n,Math.max(t,e))}function lY(e,t=[]){let n=[];function r(s,o){const l=v.createContext(o),c=n.length;n=[...n,o];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[e][c])||l,x=v.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:x,children:p})}function d(f,h){const p=(h==null?void 0:h[e][c])||l,g=v.useContext(p);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return u.displayName=s+"Provider",[u,d]}const i=()=>{const s=n.map(o=>v.createContext(o));return function(l){const c=(l==null?void 0:l[e])||s;return v.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return i.scopeName=e,[r,cY(i,...t)]}function cY(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...l,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}function jp(e){const t=e+"CollectionProvider",[n,r]=lY(t),[i,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=p=>{const{scope:g,children:m}=p,x=C.useRef(null),b=C.useRef(new Map).current;return a.jsx(i,{scope:g,itemMap:b,collectionRef:x,children:m})};o.displayName=t;const l=e+"CollectionSlot",c=C.forwardRef((p,g)=>{const{scope:m,children:x}=p,b=s(l,m),y=dt(g,b.collectionRef);return a.jsx(ca,{ref:y,children:x})});c.displayName=l;const u=e+"CollectionItemSlot",d="data-radix-collection-item",f=C.forwardRef((p,g)=>{const{scope:m,children:x,...b}=p,y=C.useRef(null),w=dt(g,y),j=s(u,m);return C.useEffect(()=>(j.itemMap.set(y,{ref:y,...b}),()=>void j.itemMap.delete(y))),a.jsx(ca,{[d]:"",ref:w,children:x})});f.displayName=u;function h(p){const g=s(e+"CollectionConsumer",p);return C.useCallback(()=>{const x=g.collectionRef.current;if(!x)return[];const b=Array.from(x.querySelectorAll(`[${d}]`));return Array.from(g.itemMap.values()).sort((j,S)=>b.indexOf(j.ref.current)-b.indexOf(S.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:o,Slot:c,ItemSlot:f},h,r]}var uY=v.createContext(void 0);function ko(e){const t=v.useContext(uY);return e||t||"ltr"}var X0=0;function KN(){v.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??gE()),document.body.insertAdjacentElement("beforeend",e[1]??gE()),X0++,()=>{X0===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),X0--}},[])}function gE(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Y0="focusScope.autoFocusOnMount",Z0="focusScope.autoFocusOnUnmount",vE={bubbles:!1,cancelable:!0},dY="FocusScope",Jy=v.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=e,[l,c]=v.useState(null),u=$n(i),d=$n(s),f=v.useRef(null),h=dt(t,m=>c(m)),p=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let m=function(w){if(p.paused||!l)return;const j=w.target;l.contains(j)?f.current=j:Ia(f.current,{select:!0})},x=function(w){if(p.paused||!l)return;const j=w.relatedTarget;j!==null&&(l.contains(j)||Ia(f.current,{select:!0}))},b=function(w){if(document.activeElement===document.body)for(const S of w)S.removedNodes.length>0&&Ia(l)};document.addEventListener("focusin",m),document.addEventListener("focusout",x);const y=new MutationObserver(b);return l&&y.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",x),y.disconnect()}}},[r,l,p.paused]),v.useEffect(()=>{if(l){xE.add(p);const m=document.activeElement;if(!l.contains(m)){const b=new CustomEvent(Y0,vE);l.addEventListener(Y0,u),l.dispatchEvent(b),b.defaultPrevented||(fY(vY(FD(l)),{select:!0}),document.activeElement===m&&Ia(l))}return()=>{l.removeEventListener(Y0,u),setTimeout(()=>{const b=new CustomEvent(Z0,vE);l.addEventListener(Z0,d),l.dispatchEvent(b),b.defaultPrevented||Ia(m??document.body,{select:!0}),l.removeEventListener(Z0,d),xE.remove(p)},0)}}},[l,u,d,p]);const g=v.useCallback(m=>{if(!n&&!r||p.paused)return;const x=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,b=document.activeElement;if(x&&b){const y=m.currentTarget,[w,j]=hY(y);w&&j?!m.shiftKey&&b===j?(m.preventDefault(),n&&Ia(w,{select:!0})):m.shiftKey&&b===w&&(m.preventDefault(),n&&Ia(j,{select:!0})):b===y&&m.preventDefault()}},[n,r,p.paused]);return a.jsx(qe.div,{tabIndex:-1,...o,ref:h,onKeyDown:g})});Jy.displayName=dY;function fY(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Ia(r,{select:t}),document.activeElement!==n)return}function hY(e){const t=FD(e),n=yE(t,e),r=yE(t.reverse(),e);return[n,r]}function FD(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function yE(e,t){for(const n of e)if(!pY(n,{upTo:t}))return n}function pY(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function mY(e){return e instanceof HTMLInputElement&&"select"in e}function Ia(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&mY(e)&&t&&e.select()}}var xE=gY();function gY(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=bE(e,t),e.unshift(t)},remove(t){var n;e=bE(e,t),(n=e[0])==null||n.resume()}}}function bE(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function vY(e){return e.filter(t=>t.tagName!=="A")}function Sp(e){const t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var yY=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Jl=new WeakMap,cm=new WeakMap,um={},Q0=0,BD=function(e){return e&&(e.host||BD(e.parentNode))},xY=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=BD(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},bY=function(e,t,n,r){var i=xY(t,Array.isArray(e)?e:[e]);um[n]||(um[n]=new WeakMap);var s=um[n],o=[],l=new Set,c=new Set(i),u=function(f){!f||l.has(f)||(l.add(f),u(f.parentNode))};i.forEach(u);var d=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(h){if(l.has(h))d(h);else try{var p=h.getAttribute(r),g=p!==null&&p!=="false",m=(Jl.get(h)||0)+1,x=(s.get(h)||0)+1;Jl.set(h,m),s.set(h,x),o.push(h),m===1&&g&&cm.set(h,!0),x===1&&h.setAttribute(n,"true"),g||h.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",h,b)}})};return d(t),l.clear(),Q0++,function(){o.forEach(function(f){var h=Jl.get(f)-1,p=s.get(f)-1;Jl.set(f,h),s.set(f,p),h||(cm.has(f)||f.removeAttribute(r),cm.delete(f)),p||f.removeAttribute(n)}),Q0--,Q0||(Jl=new WeakMap,Jl=new WeakMap,cm=new WeakMap,um={})}},XN=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),i=yY(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live]"))),bY(r,i,n,"aria-hidden")):function(){return null}},gs=function(){return gs=Object.assign||function(t){for(var n,r=1,i=arguments.length;r"u")return DY;var t=LY(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},BY=WD(),Mc="data-scroll-locked",zY=function(e,t,n,r){var i=e.left,s=e.top,o=e.right,l=e.gap;return n===void 0&&(n="margin"),` - .`.concat(jY,` { - overflow: hidden `).concat(r,`; - padding-right: `).concat(l,"px ").concat(r,`; - } - body[`).concat(Mc,`] { - overflow: hidden `).concat(r,`; - overscroll-behavior: contain; - `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&` - padding-left: `.concat(i,`px; - padding-top: `).concat(s,`px; - padding-right: `).concat(o,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(l,"px ").concat(r,`; - `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),` - } - - .`).concat(Gm,` { - right: `).concat(l,"px ").concat(r,`; - } - - .`).concat(qm,` { - margin-right: `).concat(l,"px ").concat(r,`; - } - - .`).concat(Gm," .").concat(Gm,` { - right: 0 `).concat(r,`; - } - - .`).concat(qm," .").concat(qm,` { - margin-right: 0 `).concat(r,`; - } - - body[`).concat(Mc,`] { - `).concat(SY,": ").concat(l,`px; - } -`)},jE=function(){var e=parseInt(document.body.getAttribute(Mc)||"0",10);return isFinite(e)?e:0},UY=function(){v.useEffect(function(){return document.body.setAttribute(Mc,(jE()+1).toString()),function(){var e=jE()-1;e<=0?document.body.removeAttribute(Mc):document.body.setAttribute(Mc,e.toString())}},[])},VY=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?"margin":r;UY();var s=v.useMemo(function(){return FY(i)},[i]);return v.createElement(BY,{styles:zY(s,!t,i,n?"":"!important")})},a1=!1;if(typeof window<"u")try{var dm=Object.defineProperty({},"passive",{get:function(){return a1=!0,!0}});window.addEventListener("test",dm,dm),window.removeEventListener("test",dm,dm)}catch{a1=!1}var ec=a1?{passive:!1}:!1,WY=function(e){return e.tagName==="TEXTAREA"},HD=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!WY(e)&&n[t]==="visible")},HY=function(e){return HD(e,"overflowY")},GY=function(e){return HD(e,"overflowX")},SE=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=GD(e,r);if(i){var s=qD(e,r),o=s[1],l=s[2];if(o>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},qY=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},KY=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},GD=function(e,t){return e==="v"?HY(t):GY(t)},qD=function(e,t){return e==="v"?qY(t):KY(t)},XY=function(e,t){return e==="h"&&t==="rtl"?-1:1},YY=function(e,t,n,r,i){var s=XY(e,window.getComputedStyle(t).direction),o=s*r,l=n.target,c=t.contains(l),u=!1,d=o>0,f=0,h=0;do{var p=qD(e,l),g=p[0],m=p[1],x=p[2],b=m-x-s*g;(g||b)&&GD(e,l)&&(f+=b,h+=g),l instanceof ShadowRoot?l=l.host:l=l.parentNode}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&(Math.abs(f)<1||!i)||!d&&(Math.abs(h)<1||!i))&&(u=!0),u},fm=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},NE=function(e){return[e.deltaX,e.deltaY]},_E=function(e){return e&&"current"in e?e.current:e},ZY=function(e,t){return e[0]===t[0]&&e[1]===t[1]},QY=function(e){return` - .block-interactivity-`.concat(e,` {pointer-events: none;} - .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},JY=0,tc=[];function eZ(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),i=v.useState(JY++)[0],s=v.useState(WD)[0],o=v.useRef(e);v.useEffect(function(){o.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(i));var m=wY([e.lockRef.current],(e.shards||[]).map(_E),!0).filter(Boolean);return m.forEach(function(x){return x.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),m.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(i))})}}},[e.inert,e.lockRef.current,e.shards]);var l=v.useCallback(function(m,x){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!o.current.allowPinchZoom;var b=fm(m),y=n.current,w="deltaX"in m?m.deltaX:y[0]-b[0],j="deltaY"in m?m.deltaY:y[1]-b[1],S,N=m.target,P=Math.abs(w)>Math.abs(j)?"h":"v";if("touches"in m&&P==="h"&&N.type==="range")return!1;var _=SE(P,N);if(!_)return!0;if(_?S=P:(S=P==="v"?"h":"v",_=SE(P,N)),!_)return!1;if(!r.current&&"changedTouches"in m&&(w||j)&&(r.current=S),!S)return!0;var A=r.current||S;return YY(A,x,m,A==="h"?w:j,!0)},[]),c=v.useCallback(function(m){var x=m;if(!(!tc.length||tc[tc.length-1]!==s)){var b="deltaY"in x?NE(x):fm(x),y=t.current.filter(function(S){return S.name===x.type&&(S.target===x.target||x.target===S.shadowParent)&&ZY(S.delta,b)})[0];if(y&&y.should){x.cancelable&&x.preventDefault();return}if(!y){var w=(o.current.shards||[]).map(_E).filter(Boolean).filter(function(S){return S.contains(x.target)}),j=w.length>0?l(x,w[0]):!o.current.noIsolation;j&&x.cancelable&&x.preventDefault()}}},[]),u=v.useCallback(function(m,x,b,y){var w={name:m,delta:x,target:b,should:y,shadowParent:tZ(b)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(j){return j!==w})},1)},[]),d=v.useCallback(function(m){n.current=fm(m),r.current=void 0},[]),f=v.useCallback(function(m){u(m.type,NE(m),m.target,l(m,e.lockRef.current))},[]),h=v.useCallback(function(m){u(m.type,fm(m),m.target,l(m,e.lockRef.current))},[]);v.useEffect(function(){return tc.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,ec),document.addEventListener("touchmove",c,ec),document.addEventListener("touchstart",d,ec),function(){tc=tc.filter(function(m){return m!==s}),document.removeEventListener("wheel",c,ec),document.removeEventListener("touchmove",c,ec),document.removeEventListener("touchstart",d,ec)}},[]);var p=e.removeScrollBar,g=e.inert;return v.createElement(v.Fragment,null,g?v.createElement(s,{styles:QY(i)}):null,p?v.createElement(VY,{gapMode:e.gapMode}):null)}function tZ(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const nZ=OY(VD,eZ);var tx=v.forwardRef(function(e,t){return v.createElement(ex,gs({},e,{ref:t,sideCar:nZ}))});tx.classNames=ex.classNames;var rZ=[" ","Enter","ArrowUp","ArrowDown"],iZ=[" ","Enter"],Np="Select",[nx,rx,sZ]=jp(Np),[Qu,xOe]=Er(Np,[sZ,Wu]),ix=Wu(),[aZ,To]=Qu(Np),[oZ,lZ]=Qu(Np),KD=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:s,value:o,defaultValue:l,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:h,required:p,form:g}=e,m=ix(t),[x,b]=v.useState(null),[y,w]=v.useState(null),[j,S]=v.useState(!1),N=ko(u),[P=!1,_]=ii({prop:r,defaultProp:i,onChange:s}),[A,O]=ii({prop:o,defaultProp:l,onChange:c}),$=v.useRef(null),T=x?g||!!x.closest("form"):!0,[M,R]=v.useState(new Set),H=Array.from(M).map(F=>F.props.value).join(";");return a.jsx(FM,{...m,children:a.jsxs(aZ,{required:p,scope:t,trigger:x,onTriggerChange:b,valueNode:y,onValueNodeChange:w,valueNodeHasChildren:j,onValueNodeHasChildrenChange:S,contentId:wi(),value:A,onValueChange:O,open:P,onOpenChange:_,dir:N,triggerPointerDownPosRef:$,disabled:h,children:[a.jsx(nx.Provider,{scope:t,children:a.jsx(oZ,{scope:e.__scopeSelect,onNativeOptionAdd:v.useCallback(F=>{R(V=>new Set(V).add(F))},[]),onNativeOptionRemove:v.useCallback(F=>{R(V=>{const I=new Set(V);return I.delete(F),I})},[]),children:n})}),T?a.jsxs(x4,{"aria-hidden":!0,required:p,tabIndex:-1,name:d,autoComplete:f,value:A,onChange:F=>O(F.target.value),disabled:h,form:g,children:[A===void 0?a.jsx("option",{value:""}):null,Array.from(M)]},H):null]})})};KD.displayName=Np;var XD="SelectTrigger",YD=v.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...i}=e,s=ix(n),o=To(XD,n),l=o.disabled||r,c=dt(t,o.onTriggerChange),u=rx(n),d=v.useRef("touch"),[f,h,p]=b4(m=>{const x=u().filter(w=>!w.disabled),b=x.find(w=>w.value===o.value),y=w4(x,m,b);y!==void 0&&o.onValueChange(y.value)}),g=m=>{l||(o.onOpenChange(!0),p()),m&&(o.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return a.jsx(lN,{asChild:!0,...s,children:a.jsx(qe.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":y4(o.value)?"":void 0,...i,ref:c,onClick:Te(i.onClick,m=>{m.currentTarget.focus(),d.current!=="mouse"&&g(m)}),onPointerDown:Te(i.onPointerDown,m=>{d.current=m.pointerType;const x=m.target;x.hasPointerCapture(m.pointerId)&&x.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(g(m),m.preventDefault())}),onKeyDown:Te(i.onKeyDown,m=>{const x=f.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&h(m.key),!(x&&m.key===" ")&&rZ.includes(m.key)&&(g(),m.preventDefault())})})})});YD.displayName=XD;var ZD="SelectValue",QD=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,children:s,placeholder:o="",...l}=e,c=To(ZD,n),{onValueNodeHasChildrenChange:u}=c,d=s!==void 0,f=dt(t,c.onValueNodeChange);return Jn(()=>{u(d)},[u,d]),a.jsx(qe.span,{...l,ref:f,style:{pointerEvents:"none"},children:y4(c.value)?a.jsx(a.Fragment,{children:o}):s})});QD.displayName=ZD;var cZ="SelectIcon",JD=v.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...i}=e;return a.jsx(qe.span,{"aria-hidden":!0,...i,ref:t,children:r||"โ–ผ"})});JD.displayName=cZ;var uZ="SelectPortal",e4=e=>a.jsx($y,{asChild:!0,...e});e4.displayName=uZ;var El="SelectContent",t4=v.forwardRef((e,t)=>{const n=To(El,e.__scopeSelect),[r,i]=v.useState();if(Jn(()=>{i(new DocumentFragment)},[]),!n.open){const s=r;return s?Vi.createPortal(a.jsx(n4,{scope:e.__scopeSelect,children:a.jsx(nx.Slot,{scope:e.__scopeSelect,children:a.jsx("div",{children:e.children})})}),s):null}return a.jsx(r4,{...e,ref:t})});t4.displayName=El;var $i=10,[n4,$o]=Qu(El),dZ="SelectContentImpl",r4=v.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:o,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:g,hideWhenDetached:m,avoidCollisions:x,...b}=e,y=To(El,n),[w,j]=v.useState(null),[S,N]=v.useState(null),P=dt(t,fe=>j(fe)),[_,A]=v.useState(null),[O,$]=v.useState(null),T=rx(n),[M,R]=v.useState(!1),H=v.useRef(!1);v.useEffect(()=>{if(w)return XN(w)},[w]),KN();const F=v.useCallback(fe=>{const[Ne,...he]=T().map(ie=>ie.ref.current),[ue]=he.slice(-1),Ee=document.activeElement;for(const ie of fe)if(ie===Ee||(ie==null||ie.scrollIntoView({block:"nearest"}),ie===Ne&&S&&(S.scrollTop=0),ie===ue&&S&&(S.scrollTop=S.scrollHeight),ie==null||ie.focus(),document.activeElement!==Ee))return},[T,S]),V=v.useCallback(()=>F([_,w]),[F,_,w]);v.useEffect(()=>{M&&V()},[M,V]);const{onOpenChange:I,triggerPointerDownPosRef:L}=y;v.useEffect(()=>{if(w){let fe={x:0,y:0};const Ne=ue=>{var Ee,ie;fe={x:Math.abs(Math.round(ue.pageX)-(((Ee=L.current)==null?void 0:Ee.x)??0)),y:Math.abs(Math.round(ue.pageY)-(((ie=L.current)==null?void 0:ie.y)??0))}},he=ue=>{fe.x<=10&&fe.y<=10?ue.preventDefault():w.contains(ue.target)||I(!1),document.removeEventListener("pointermove",Ne),L.current=null};return L.current!==null&&(document.addEventListener("pointermove",Ne),document.addEventListener("pointerup",he,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Ne),document.removeEventListener("pointerup",he,{capture:!0})}}},[w,I,L]),v.useEffect(()=>{const fe=()=>I(!1);return window.addEventListener("blur",fe),window.addEventListener("resize",fe),()=>{window.removeEventListener("blur",fe),window.removeEventListener("resize",fe)}},[I]);const[Z,ee]=b4(fe=>{const Ne=T().filter(Ee=>!Ee.disabled),he=Ne.find(Ee=>Ee.ref.current===document.activeElement),ue=w4(Ne,fe,he);ue&&setTimeout(()=>ue.ref.current.focus())}),re=v.useCallback((fe,Ne,he)=>{const ue=!H.current&&!he;(y.value!==void 0&&y.value===Ne||ue)&&(A(fe),ue&&(H.current=!0))},[y.value]),me=v.useCallback(()=>w==null?void 0:w.focus(),[w]),z=v.useCallback((fe,Ne,he)=>{const ue=!H.current&&!he;(y.value!==void 0&&y.value===Ne||ue)&&$(fe)},[y.value]),ae=r==="popper"?o1:i4,de=ae===o1?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:g,hideWhenDetached:m,avoidCollisions:x}:{};return a.jsx(n4,{scope:n,content:w,viewport:S,onViewportChange:N,itemRefCallback:re,selectedItem:_,onItemLeave:me,itemTextRefCallback:z,focusSelectedItem:V,selectedItemText:O,position:r,isPositioned:M,searchRef:Z,children:a.jsx(tx,{as:ca,allowPinchZoom:!0,children:a.jsx(Jy,{asChild:!0,trapped:y.open,onMountAutoFocus:fe=>{fe.preventDefault()},onUnmountAutoFocus:Te(i,fe=>{var Ne;(Ne=y.trigger)==null||Ne.focus({preventScroll:!0}),fe.preventDefault()}),children:a.jsx(dp,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:fe=>fe.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:a.jsx(ae,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:fe=>fe.preventDefault(),...b,...de,onPlaced:()=>R(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Te(b.onKeyDown,fe=>{const Ne=fe.ctrlKey||fe.altKey||fe.metaKey;if(fe.key==="Tab"&&fe.preventDefault(),!Ne&&fe.key.length===1&&ee(fe.key),["ArrowUp","ArrowDown","Home","End"].includes(fe.key)){let ue=T().filter(Ee=>!Ee.disabled).map(Ee=>Ee.ref.current);if(["ArrowUp","End"].includes(fe.key)&&(ue=ue.slice().reverse()),["ArrowUp","ArrowDown"].includes(fe.key)){const Ee=fe.target,ie=ue.indexOf(Ee);ue=ue.slice(ie+1)}setTimeout(()=>F(ue)),fe.preventDefault()}})})})})})})});r4.displayName=dZ;var fZ="SelectItemAlignedPosition",i4=v.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...i}=e,s=To(El,n),o=$o(El,n),[l,c]=v.useState(null),[u,d]=v.useState(null),f=dt(t,P=>d(P)),h=rx(n),p=v.useRef(!1),g=v.useRef(!0),{viewport:m,selectedItem:x,selectedItemText:b,focusSelectedItem:y}=o,w=v.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&u&&m&&x&&b){const P=s.trigger.getBoundingClientRect(),_=u.getBoundingClientRect(),A=s.valueNode.getBoundingClientRect(),O=b.getBoundingClientRect();if(s.dir!=="rtl"){const Ee=O.left-_.left,ie=A.left-Ee,Xe=P.left-ie,K=P.width+Xe,ve=Math.max(K,_.width),Se=window.innerWidth-$i,$e=dh(ie,[$i,Math.max($i,Se-ve)]);l.style.minWidth=K+"px",l.style.left=$e+"px"}else{const Ee=_.right-O.right,ie=window.innerWidth-A.right-Ee,Xe=window.innerWidth-P.right-ie,K=P.width+Xe,ve=Math.max(K,_.width),Se=window.innerWidth-$i,$e=dh(ie,[$i,Math.max($i,Se-ve)]);l.style.minWidth=K+"px",l.style.right=$e+"px"}const $=h(),T=window.innerHeight-$i*2,M=m.scrollHeight,R=window.getComputedStyle(u),H=parseInt(R.borderTopWidth,10),F=parseInt(R.paddingTop,10),V=parseInt(R.borderBottomWidth,10),I=parseInt(R.paddingBottom,10),L=H+F+M+I+V,Z=Math.min(x.offsetHeight*5,L),ee=window.getComputedStyle(m),re=parseInt(ee.paddingTop,10),me=parseInt(ee.paddingBottom,10),z=P.top+P.height/2-$i,ae=T-z,de=x.offsetHeight/2,fe=x.offsetTop+de,Ne=H+F+fe,he=L-Ne;if(Ne<=z){const Ee=$.length>0&&x===$[$.length-1].ref.current;l.style.bottom="0px";const ie=u.clientHeight-m.offsetTop-m.offsetHeight,Xe=Math.max(ae,de+(Ee?me:0)+ie+V),K=Ne+Xe;l.style.height=K+"px"}else{const Ee=$.length>0&&x===$[0].ref.current;l.style.top="0px";const Xe=Math.max(z,H+m.offsetTop+(Ee?re:0)+de)+he;l.style.height=Xe+"px",m.scrollTop=Ne-z+m.offsetTop}l.style.margin=`${$i}px 0`,l.style.minHeight=Z+"px",l.style.maxHeight=T+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[h,s.trigger,s.valueNode,l,u,m,x,b,s.dir,r]);Jn(()=>w(),[w]);const[j,S]=v.useState();Jn(()=>{u&&S(window.getComputedStyle(u).zIndex)},[u]);const N=v.useCallback(P=>{P&&g.current===!0&&(w(),y==null||y(),g.current=!1)},[w,y]);return a.jsx(pZ,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:p,onScrollButtonChange:N,children:a.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:j},children:a.jsx(qe.div,{...i,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});i4.displayName=fZ;var hZ="SelectPopperPosition",o1=v.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=$i,...s}=e,o=ix(n);return a.jsx(cN,{...o,...s,ref:t,align:r,collisionPadding:i,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});o1.displayName=hZ;var[pZ,YN]=Qu(El,{}),l1="SelectViewport",s4=v.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...i}=e,s=$o(l1,n),o=YN(l1,n),l=dt(t,s.onViewportChange),c=v.useRef(0);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),a.jsx(nx.Slot,{scope:n,children:a.jsx(qe.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:Te(i.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:h}=o;if(h!=null&&h.current&&f){const p=Math.abs(c.current-d.scrollTop);if(p>0){const g=window.innerHeight-$i*2,m=parseFloat(f.style.minHeight),x=parseFloat(f.style.height),b=Math.max(m,x);if(b0?j:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});s4.displayName=l1;var a4="SelectGroup",[mZ,gZ]=Qu(a4),vZ=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=wi();return a.jsx(mZ,{scope:n,id:i,children:a.jsx(qe.div,{role:"group","aria-labelledby":i,...r,ref:t})})});vZ.displayName=a4;var o4="SelectLabel",l4=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=gZ(o4,n);return a.jsx(qe.div,{id:i.id,...r,ref:t})});l4.displayName=o4;var Hg="SelectItem",[yZ,c4]=Qu(Hg),u4=v.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:s,...o}=e,l=To(Hg,n),c=$o(Hg,n),u=l.value===r,[d,f]=v.useState(s??""),[h,p]=v.useState(!1),g=dt(t,y=>{var w;return(w=c.itemRefCallback)==null?void 0:w.call(c,y,r,i)}),m=wi(),x=v.useRef("touch"),b=()=>{i||(l.onValueChange(r),l.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return a.jsx(yZ,{scope:n,value:r,disabled:i,textId:m,isSelected:u,onItemTextChange:v.useCallback(y=>{f(w=>w||((y==null?void 0:y.textContent)??"").trim())},[]),children:a.jsx(nx.ItemSlot,{scope:n,value:r,disabled:i,textValue:d,children:a.jsx(qe.div,{role:"option","aria-labelledby":m,"data-highlighted":h?"":void 0,"aria-selected":u&&h,"data-state":u?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...o,ref:g,onFocus:Te(o.onFocus,()=>p(!0)),onBlur:Te(o.onBlur,()=>p(!1)),onClick:Te(o.onClick,()=>{x.current!=="mouse"&&b()}),onPointerUp:Te(o.onPointerUp,()=>{x.current==="mouse"&&b()}),onPointerDown:Te(o.onPointerDown,y=>{x.current=y.pointerType}),onPointerMove:Te(o.onPointerMove,y=>{var w;x.current=y.pointerType,i?(w=c.onItemLeave)==null||w.call(c):x.current==="mouse"&&y.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Te(o.onPointerLeave,y=>{var w;y.currentTarget===document.activeElement&&((w=c.onItemLeave)==null||w.call(c))}),onKeyDown:Te(o.onKeyDown,y=>{var j;((j=c.searchRef)==null?void 0:j.current)!==""&&y.key===" "||(iZ.includes(y.key)&&b(),y.key===" "&&y.preventDefault())})})})})});u4.displayName=Hg;var Jd="SelectItemText",d4=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,...s}=e,o=To(Jd,n),l=$o(Jd,n),c=c4(Jd,n),u=lZ(Jd,n),[d,f]=v.useState(null),h=dt(t,b=>f(b),c.onItemTextChange,b=>{var y;return(y=l.itemTextRefCallback)==null?void 0:y.call(l,b,c.value,c.disabled)}),p=d==null?void 0:d.textContent,g=v.useMemo(()=>a.jsx("option",{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:m,onNativeOptionRemove:x}=u;return Jn(()=>(m(g),()=>x(g)),[m,x,g]),a.jsxs(a.Fragment,{children:[a.jsx(qe.span,{id:c.textId,...s,ref:h}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Vi.createPortal(s.children,o.valueNode):null]})});d4.displayName=Jd;var f4="SelectItemIndicator",h4=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return c4(f4,n).isSelected?a.jsx(qe.span,{"aria-hidden":!0,...r,ref:t}):null});h4.displayName=f4;var c1="SelectScrollUpButton",p4=v.forwardRef((e,t)=>{const n=$o(c1,e.__scopeSelect),r=YN(c1,e.__scopeSelect),[i,s]=v.useState(!1),o=dt(t,r.onScrollButtonChange);return Jn(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollTop>0;s(u)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),i?a.jsx(g4,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});p4.displayName=c1;var u1="SelectScrollDownButton",m4=v.forwardRef((e,t)=>{const n=$o(u1,e.__scopeSelect),r=YN(u1,e.__scopeSelect),[i,s]=v.useState(!1),o=dt(t,r.onScrollButtonChange);return Jn(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),i?a.jsx(g4,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});m4.displayName=u1;var g4=v.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=e,s=$o("SelectScrollButton",n),o=v.useRef(null),l=rx(n),c=v.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return v.useEffect(()=>()=>c(),[c]),Jn(()=>{var d;const u=l().find(f=>f.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[l]),a.jsx(qe.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:Te(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:Te(i.onPointerMove,()=>{var u;(u=s.onItemLeave)==null||u.call(s),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:Te(i.onPointerLeave,()=>{c()})})}),xZ="SelectSeparator",v4=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return a.jsx(qe.div,{"aria-hidden":!0,...r,ref:t})});v4.displayName=xZ;var d1="SelectArrow",bZ=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=ix(n),s=To(d1,n),o=$o(d1,n);return s.open&&o.position==="popper"?a.jsx(uN,{...i,...r,ref:t}):null});bZ.displayName=d1;function y4(e){return e===""||e===void 0}var x4=v.forwardRef((e,t)=>{const{value:n,...r}=e,i=v.useRef(null),s=dt(t,i),o=Sp(n);return v.useEffect(()=>{const l=i.current,c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==n&&d){const f=new Event("change",{bubbles:!0});d.call(l,n),l.dispatchEvent(f)}},[o,n]),a.jsx(dN,{asChild:!0,children:a.jsx("select",{...r,ref:s,defaultValue:n})})});x4.displayName="BubbleSelect";function b4(e){const t=$n(e),n=v.useRef(""),r=v.useRef(0),i=v.useCallback(o=>{const l=n.current+o;t(l),function c(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>c(""),1e3))}(l)},[t]),s=v.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,s]}function w4(e,t,n){const i=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let o=wZ(e,Math.max(s,0));i.length===1&&(o=o.filter(u=>u!==n));const c=o.find(u=>u.textValue.toLowerCase().startsWith(i.toLowerCase()));return c!==n?c:void 0}function wZ(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var jZ=KD,j4=YD,SZ=QD,NZ=JD,_Z=e4,S4=t4,PZ=s4,N4=l4,_4=u4,CZ=d4,AZ=h4,P4=p4,C4=m4,A4=v4;const Xn=jZ,Yn=SZ,Fn=v.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(j4,{ref:r,className:Me("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,a.jsx(NZ,{asChild:!0,children:a.jsx(ja,{className:"h-4 w-4 opacity-50"})})]}));Fn.displayName=j4.displayName;const E4=v.forwardRef(({className:e,...t},n)=>a.jsx(P4,{ref:n,className:Me("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(pp,{className:"h-4 w-4"})}));E4.displayName=P4.displayName;const O4=v.forwardRef(({className:e,...t},n)=>a.jsx(C4,{ref:n,className:Me("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(ja,{className:"h-4 w-4"})}));O4.displayName=C4.displayName;const Bn=v.forwardRef(({className:e,children:t,position:n="popper",...r},i)=>a.jsx(_Z,{children:a.jsxs(S4,{ref:i,className:Me("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[a.jsx(E4,{}),a.jsx(PZ,{className:Me("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),a.jsx(O4,{})]})}));Bn.displayName=S4.displayName;const EZ=v.forwardRef(({className:e,...t},n)=>a.jsx(N4,{ref:n,className:Me("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));EZ.displayName=N4.displayName;const be=v.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(_4,{ref:r,className:Me("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(AZ,{children:a.jsx(ha,{className:"h-4 w-4"})})}),a.jsx(CZ,{children:t})]}));be.displayName=_4.displayName;const OZ=v.forwardRef(({className:e,...t},n)=>a.jsx(A4,{ref:n,className:Me("-mx-1 my-1 h-px bg-muted",e),...t}));OZ.displayName=A4.displayName;var k4=["PageUp","PageDown"],T4=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],$4={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Ju="Slider",[f1,kZ,TZ]=jp(Ju),[I4,bOe]=Er(Ju,[TZ]),[$Z,sx]=I4(Ju),M4=v.forwardRef((e,t)=>{const{name:n,min:r=0,max:i=100,step:s=1,orientation:o="horizontal",disabled:l=!1,minStepsBetweenThumbs:c=0,defaultValue:u=[r],value:d,onValueChange:f=()=>{},onValueCommit:h=()=>{},inverted:p=!1,form:g,...m}=e,x=v.useRef(new Set),b=v.useRef(0),w=o==="horizontal"?IZ:MZ,[j=[],S]=ii({prop:d,defaultProp:u,onChange:$=>{var M;(M=[...x.current][b.current])==null||M.focus(),f($)}}),N=v.useRef(j);function P($){const T=BZ(j,$);O($,T)}function _($){O($,b.current)}function A(){const $=N.current[b.current];j[b.current]!==$&&h(j)}function O($,T,{commit:M}={commit:!1}){const R=WZ(s),H=HZ(Math.round(($-r)/s)*s+r,R),F=dh(H,[r,i]);S((V=[])=>{const I=LZ(V,F,T);if(VZ(I,c*s)){b.current=I.indexOf(F);const L=String(I)!==String(V);return L&&M&&h(I),L?I:V}else return V})}return a.jsx($Z,{scope:e.__scopeSlider,name:n,disabled:l,min:r,max:i,valueIndexToChangeRef:b,thumbs:x.current,values:j,orientation:o,form:g,children:a.jsx(f1.Provider,{scope:e.__scopeSlider,children:a.jsx(f1.Slot,{scope:e.__scopeSlider,children:a.jsx(w,{"aria-disabled":l,"data-disabled":l?"":void 0,...m,ref:t,onPointerDown:Te(m.onPointerDown,()=>{l||(N.current=j)}),min:r,max:i,inverted:p,onSlideStart:l?void 0:P,onSlideMove:l?void 0:_,onSlideEnd:l?void 0:A,onHomeKeyDown:()=>!l&&O(r,0,{commit:!0}),onEndKeyDown:()=>!l&&O(i,j.length-1,{commit:!0}),onStepKeyDown:({event:$,direction:T})=>{if(!l){const H=k4.includes($.key)||$.shiftKey&&T4.includes($.key)?10:1,F=b.current,V=j[F],I=s*H*T;O(V+I,F,{commit:!0})}}})})})})});M4.displayName=Ju;var[R4,D4]=I4(Ju,{startEdge:"left",endEdge:"right",size:"width",direction:1}),IZ=v.forwardRef((e,t)=>{const{min:n,max:r,dir:i,inverted:s,onSlideStart:o,onSlideMove:l,onSlideEnd:c,onStepKeyDown:u,...d}=e,[f,h]=v.useState(null),p=dt(t,w=>h(w)),g=v.useRef(),m=ko(i),x=m==="ltr",b=x&&!s||!x&&s;function y(w){const j=g.current||f.getBoundingClientRect(),S=[0,j.width],P=ZN(S,b?[n,r]:[r,n]);return g.current=j,P(w-j.left)}return a.jsx(R4,{scope:e.__scopeSlider,startEdge:b?"left":"right",endEdge:b?"right":"left",direction:b?1:-1,size:"width",children:a.jsx(L4,{dir:m,"data-orientation":"horizontal",...d,ref:p,style:{...d.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:w=>{const j=y(w.clientX);o==null||o(j)},onSlideMove:w=>{const j=y(w.clientX);l==null||l(j)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:w=>{const S=$4[b?"from-left":"from-right"].includes(w.key);u==null||u({event:w,direction:S?-1:1})}})})}),MZ=v.forwardRef((e,t)=>{const{min:n,max:r,inverted:i,onSlideStart:s,onSlideMove:o,onSlideEnd:l,onStepKeyDown:c,...u}=e,d=v.useRef(null),f=dt(t,d),h=v.useRef(),p=!i;function g(m){const x=h.current||d.current.getBoundingClientRect(),b=[0,x.height],w=ZN(b,p?[r,n]:[n,r]);return h.current=x,w(m-x.top)}return a.jsx(R4,{scope:e.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:a.jsx(L4,{"data-orientation":"vertical",...u,ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:m=>{const x=g(m.clientY);s==null||s(x)},onSlideMove:m=>{const x=g(m.clientY);o==null||o(x)},onSlideEnd:()=>{h.current=void 0,l==null||l()},onStepKeyDown:m=>{const b=$4[p?"from-bottom":"from-top"].includes(m.key);c==null||c({event:m,direction:b?-1:1})}})})}),L4=v.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:i,onSlideEnd:s,onHomeKeyDown:o,onEndKeyDown:l,onStepKeyDown:c,...u}=e,d=sx(Ju,n);return a.jsx(qe.span,{...u,ref:t,onKeyDown:Te(e.onKeyDown,f=>{f.key==="Home"?(o(f),f.preventDefault()):f.key==="End"?(l(f),f.preventDefault()):k4.concat(T4).includes(f.key)&&(c(f),f.preventDefault())}),onPointerDown:Te(e.onPointerDown,f=>{const h=f.target;h.setPointerCapture(f.pointerId),f.preventDefault(),d.thumbs.has(h)?h.focus():r(f)}),onPointerMove:Te(e.onPointerMove,f=>{f.target.hasPointerCapture(f.pointerId)&&i(f)}),onPointerUp:Te(e.onPointerUp,f=>{const h=f.target;h.hasPointerCapture(f.pointerId)&&(h.releasePointerCapture(f.pointerId),s(f))})})}),F4="SliderTrack",B4=v.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,i=sx(F4,n);return a.jsx(qe.span,{"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation,...r,ref:t})});B4.displayName=F4;var h1="SliderRange",z4=v.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,i=sx(h1,n),s=D4(h1,n),o=v.useRef(null),l=dt(t,o),c=i.values.length,u=i.values.map(h=>V4(h,i.min,i.max)),d=c>1?Math.min(...u):0,f=100-Math.max(...u);return a.jsx(qe.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,...r,ref:l,style:{...e.style,[s.startEdge]:d+"%",[s.endEdge]:f+"%"}})});z4.displayName=h1;var p1="SliderThumb",U4=v.forwardRef((e,t)=>{const n=kZ(e.__scopeSlider),[r,i]=v.useState(null),s=dt(t,l=>i(l)),o=v.useMemo(()=>r?n().findIndex(l=>l.ref.current===r):-1,[n,r]);return a.jsx(RZ,{...e,ref:s,index:o})}),RZ=v.forwardRef((e,t)=>{const{__scopeSlider:n,index:r,name:i,...s}=e,o=sx(p1,n),l=D4(p1,n),[c,u]=v.useState(null),d=dt(t,y=>u(y)),f=c?o.form||!!c.closest("form"):!0,h=hp(c),p=o.values[r],g=p===void 0?0:V4(p,o.min,o.max),m=FZ(r,o.values.length),x=h==null?void 0:h[l.size],b=x?zZ(x,g,l.direction):0;return v.useEffect(()=>{if(c)return o.thumbs.add(c),()=>{o.thumbs.delete(c)}},[c,o.thumbs]),a.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[l.startEdge]:`calc(${g}% + ${b}px)`},children:[a.jsx(f1.ItemSlot,{scope:e.__scopeSlider,children:a.jsx(qe.span,{role:"slider","aria-label":e["aria-label"]||m,"aria-valuemin":o.min,"aria-valuenow":p,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,tabIndex:o.disabled?void 0:0,...s,ref:d,style:p===void 0?{display:"none"}:e.style,onFocus:Te(e.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),f&&a.jsx(DZ,{name:i??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:p},r)]})});U4.displayName=p1;var DZ=e=>{const{value:t,...n}=e,r=v.useRef(null),i=Sp(t);return v.useEffect(()=>{const s=r.current,o=window.HTMLInputElement.prototype,c=Object.getOwnPropertyDescriptor(o,"value").set;if(i!==t&&c){const u=new Event("input",{bubbles:!0});c.call(s,t),s.dispatchEvent(u)}},[i,t]),a.jsx("input",{style:{display:"none"},...n,ref:r,defaultValue:t})};function LZ(e=[],t,n){const r=[...e];return r[n]=t,r.sort((i,s)=>i-s)}function V4(e,t,n){const s=100/(n-t)*(e-t);return dh(s,[0,100])}function FZ(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function BZ(e,t){if(e.length===1)return 0;const n=e.map(i=>Math.abs(i-t)),r=Math.min(...n);return n.indexOf(r)}function zZ(e,t,n){const r=e/2,s=ZN([0,50],[0,r]);return(r-s(t)*n)*n}function UZ(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function VZ(e,t){if(t>0){const n=UZ(e);return Math.min(...n)>=t}return!0}function ZN(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function WZ(e){return(String(e).split(".")[1]||"").length}function HZ(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var W4=M4,GZ=B4,qZ=z4,KZ=U4;const On=v.forwardRef(({className:e,...t},n)=>a.jsxs(W4,{ref:n,className:Me("relative flex w-full touch-none select-none items-center",e),...t,children:[a.jsx(GZ,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:a.jsx(qZ,{className:"absolute h-full bg-primary"})}),a.jsx(KZ,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));On.displayName=W4.displayName;var QN="Switch",[XZ,wOe]=Er(QN),[YZ,ZZ]=XZ(QN),H4=v.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:i,defaultChecked:s,required:o,disabled:l,value:c="on",onCheckedChange:u,form:d,...f}=e,[h,p]=v.useState(null),g=dt(t,w=>p(w)),m=v.useRef(!1),x=h?d||!!h.closest("form"):!0,[b=!1,y]=ii({prop:i,defaultProp:s,onChange:u});return a.jsxs(YZ,{scope:n,checked:b,disabled:l,children:[a.jsx(qe.button,{type:"button",role:"switch","aria-checked":b,"aria-required":o,"data-state":K4(b),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:g,onClick:Te(e.onClick,w=>{y(j=>!j),x&&(m.current=w.isPropagationStopped(),m.current||w.stopPropagation())})}),x&&a.jsx(QZ,{control:h,bubbles:!m.current,name:r,value:c,checked:b,required:o,disabled:l,form:d,style:{transform:"translateX(-100%)"}})]})});H4.displayName=QN;var G4="SwitchThumb",q4=v.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,i=ZZ(G4,n);return a.jsx(qe.span,{"data-state":K4(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:t})});q4.displayName=G4;var QZ=e=>{const{control:t,checked:n,bubbles:r=!0,...i}=e,s=v.useRef(null),o=Sp(n),l=hp(t);return v.useEffect(()=>{const c=s.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(o!==n&&f){const h=new Event("click",{bubbles:r});f.call(c,n),c.dispatchEvent(h)}},[o,n,r]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function K4(e){return e?"checked":"unchecked"}var X4=H4,JZ=q4;const fh=v.forwardRef(({className:e,...t},n)=>a.jsx(X4,{className:Me("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:a.jsx(JZ,{className:Me("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));fh.displayName=X4.displayName;function eQ(e,t=[]){let n=[];function r(s,o){const l=v.createContext(o),c=n.length;n=[...n,o];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[e][c])||l,x=v.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:x,children:p})}function d(f,h){const p=(h==null?void 0:h[e][c])||l,g=v.useContext(p);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return u.displayName=s+"Provider",[u,d]}const i=()=>{const s=n.map(o=>v.createContext(o));return function(l){const c=(l==null?void 0:l[e])||s;return v.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return i.scopeName=e,[r,tQ(i,...t)]}function tQ(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(s)[`__scope${u}`];return{...l,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var nb="rovingFocusGroup.onEntryFocus",nQ={bubbles:!1,cancelable:!0},ax="RovingFocusGroup",[m1,Y4,rQ]=jp(ax),[iQ,ed]=eQ(ax,[rQ]),[sQ,aQ]=iQ(ax),Z4=v.forwardRef((e,t)=>a.jsx(m1.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(m1.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(oQ,{...e,ref:t})})}));Z4.displayName=ax;var oQ=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,h=v.useRef(null),p=dt(t,h),g=ko(s),[m=null,x]=ii({prop:o,defaultProp:l,onChange:c}),[b,y]=v.useState(!1),w=$n(u),j=Y4(n),S=v.useRef(!1),[N,P]=v.useState(0);return v.useEffect(()=>{const _=h.current;if(_)return _.addEventListener(nb,w),()=>_.removeEventListener(nb,w)},[w]),a.jsx(sQ,{scope:n,orientation:r,dir:g,loop:i,currentTabStopId:m,onItemFocus:v.useCallback(_=>x(_),[x]),onItemShiftTab:v.useCallback(()=>y(!0),[]),onFocusableItemAdd:v.useCallback(()=>P(_=>_+1),[]),onFocusableItemRemove:v.useCallback(()=>P(_=>_-1),[]),children:a.jsx(qe.div,{tabIndex:b||N===0?-1:0,"data-orientation":r,...f,ref:p,style:{outline:"none",...e.style},onMouseDown:Te(e.onMouseDown,()=>{S.current=!0}),onFocus:Te(e.onFocus,_=>{const A=!S.current;if(_.target===_.currentTarget&&A&&!b){const O=new CustomEvent(nb,nQ);if(_.currentTarget.dispatchEvent(O),!O.defaultPrevented){const $=j().filter(F=>F.focusable),T=$.find(F=>F.active),M=$.find(F=>F.id===m),H=[T,M,...$].filter(Boolean).map(F=>F.ref.current);eL(H,d)}}S.current=!1}),onBlur:Te(e.onBlur,()=>y(!1))})})}),Q4="RovingFocusGroupItem",J4=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,...o}=e,l=wi(),c=s||l,u=aQ(Q4,n),d=u.currentTabStopId===c,f=Y4(n),{onFocusableItemAdd:h,onFocusableItemRemove:p}=u;return v.useEffect(()=>{if(r)return h(),()=>p()},[r,h,p]),a.jsx(m1.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:a.jsx(qe.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...o,ref:t,onMouseDown:Te(e.onMouseDown,g=>{r?u.onItemFocus(c):g.preventDefault()}),onFocus:Te(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:Te(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){u.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const m=uQ(g,u.orientation,u.dir);if(m!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let b=f().filter(y=>y.focusable).map(y=>y.ref.current);if(m==="last")b.reverse();else if(m==="prev"||m==="next"){m==="prev"&&b.reverse();const y=b.indexOf(g.currentTarget);b=u.loop?dQ(b,y+1):b.slice(y+1)}setTimeout(()=>eL(b))}})})})});J4.displayName=Q4;var lQ={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function cQ(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function uQ(e,t,n){const r=cQ(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return lQ[r]}function eL(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function dQ(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var JN=Z4,e_=J4,t_="Tabs",[fQ,jOe]=Er(t_,[ed]),tL=ed(),[hQ,n_]=fQ(t_),nL=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:s,orientation:o="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=ko(l),[f,h]=ii({prop:r,onChange:i,defaultProp:s});return a.jsx(hQ,{scope:n,baseId:wi(),value:f,onValueChange:h,orientation:o,dir:d,activationMode:c,children:a.jsx(qe.div,{dir:d,"data-orientation":o,...u,ref:t})})});nL.displayName=t_;var rL="TabsList",iL=v.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,s=n_(rL,n),o=tL(n);return a.jsx(JN,{asChild:!0,...o,orientation:s.orientation,dir:s.dir,loop:r,children:a.jsx(qe.div,{role:"tablist","aria-orientation":s.orientation,...i,ref:t})})});iL.displayName=rL;var sL="TabsTrigger",aL=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...s}=e,o=n_(sL,n),l=tL(n),c=cL(o.baseId,r),u=uL(o.baseId,r),d=r===o.value;return a.jsx(e_,{asChild:!0,...l,focusable:!i,active:d,children:a.jsx(qe.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:c,...s,ref:t,onMouseDown:Te(e.onMouseDown,f=>{!i&&f.button===0&&f.ctrlKey===!1?o.onValueChange(r):f.preventDefault()}),onKeyDown:Te(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&o.onValueChange(r)}),onFocus:Te(e.onFocus,()=>{const f=o.activationMode!=="manual";!d&&!i&&f&&o.onValueChange(r)})})})});aL.displayName=sL;var oL="TabsContent",lL=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:s,...o}=e,l=n_(oL,n),c=cL(l.baseId,r),u=uL(l.baseId,r),d=r===l.value,f=v.useRef(d);return v.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),a.jsx(er,{present:i||d,children:({present:h})=>a.jsx(qe.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!h,id:u,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:h&&s})})});lL.displayName=oL;function cL(e,t){return`${e}-trigger-${t}`}function uL(e,t){return`${e}-content-${t}`}var pQ=nL,dL=iL,fL=aL,hL=lL;const Io=pQ,Sa=v.forwardRef(({className:e,...t},n)=>a.jsx(dL,{ref:n,className:Me("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Sa.displayName=dL.displayName;const Ft=v.forwardRef(({className:e,...t},n)=>a.jsx(fL,{ref:n,className:Me("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));Ft.displayName=fL.displayName;const Bt=v.forwardRef(({className:e,...t},n)=>a.jsx(hL,{ref:n,className:Me("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Bt.displayName=hL.displayName;const mQ=Le.object({name:Le.string().min(2,{message:"Name must be at least 2 characters."}),age:Le.string().min(1,{message:"Age is required."}),gender:Le.string().min(1,{message:"Gender is required."}),occupation:Le.string().min(2,{message:"Occupation is required."}),education:Le.string().min(1,{message:"Education is required."}),location:Le.string().min(2,{message:"Location is required."}),ethnicity:Le.string().optional(),personality:Le.string(),interests:Le.string(),hasPurchasingPower:Le.boolean().optional(),hasChildren:Le.boolean().optional(),techSavviness:Le.number().min(0).max(100),brandLoyalty:Le.number().min(0).max(100),priceConsciousness:Le.number().min(0).max(100),environmentalConcern:Le.number().min(0).max(100),socialGrade:Le.string().optional(),householdIncome:Le.string().optional(),householdComposition:Le.string().optional(),livingSituation:Le.string().optional(),goals:Le.array(Le.string()).optional(),frustrations:Le.array(Le.string()).optional(),motivations:Le.array(Le.string()).optional(),scenarios:Le.array(Le.string()).optional(),scenarioType:Le.string().optional(),oceanTraits:Le.object({openness:Le.number().min(0).max(100),conscientiousness:Le.number().min(0).max(100),extraversion:Le.number().min(0).max(100),agreeableness:Le.number().min(0).max(100),neuroticism:Le.number().min(0).max(100)}).optional(),thinkFeelDo:Le.object({thinks:Le.array(Le.string()),feels:Le.array(Le.string()),does:Le.array(Le.string())}).optional(),mediaConsumption:Le.string().optional(),deviceUsage:Le.string().optional(),shoppingHabits:Le.string().optional(),brandPreferences:Le.string().optional(),communicationPreferences:Le.string().optional(),paymentMethods:Le.string().optional(),purchaseBehaviour:Le.string().optional(),coreValues:Le.string().optional(),lifestyleChoices:Le.string().optional(),socialActivities:Le.string().optional(),categoryKnowledge:Le.string().optional(),decisionInfluences:Le.string().optional(),painPoints:Le.string().optional(),journeyContext:Le.string().optional(),keyTouchpoints:Le.string().optional(),selfDeterminationNeeds:Le.object({autonomy:Le.string(),competence:Le.string(),relatedness:Le.string()}).optional(),fears:Le.array(Le.string()).optional(),narrative:Le.string().optional(),additionalInformation:Le.string().optional()});function gQ({targetFolderId:e,targetFolderName:t}){const[n,r]=v.useState(1),[i,s]=v.useState(!1),[o,l]=v.useState(!1),[c,u]=v.useState(0),d=Cn(),{isAuthenticated:f,login:h}=Ul();v.useEffect(()=>{u(0)},[]),v.useEffect(()=>{(async()=>{if(!f&&!o){l(!0);try{console.log("Attempting auto login with default credentials"),await h("user","pass"),console.log("Auto login successful");const P=localStorage.getItem("auth_token");P?(console.log("Token successfully stored:",P.substring(0,10)+"..."),Ze.success("Logged in automatically with default account")):(console.error("Token not stored after successful login"),Ze.error("Authentication problem, token not stored"))}catch(P){console.error("Auto login failed:",P)}finally{l(!1)}}})()},[]);const p=Ky({resolver:Xy(mQ),defaultValues:{name:"",age:"",gender:"",occupation:"",education:"",location:"",ethnicity:"",personality:"",interests:"",hasPurchasingPower:!1,hasChildren:!1,techSavviness:50,brandLoyalty:50,priceConsciousness:50,environmentalConcern:50,socialGrade:"",householdIncome:"",householdComposition:"",livingSituation:"",goals:[],frustrations:[],motivations:[],scenarios:[],scenarioType:"",oceanTraits:{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},thinkFeelDo:{thinks:[],feels:[],does:[]},mediaConsumption:"",deviceUsage:"",shoppingHabits:"",brandPreferences:"",communicationPreferences:"",paymentMethods:"",purchaseBehaviour:"",coreValues:"",lifestyleChoices:"",socialActivities:"",categoryKnowledge:"",decisionInfluences:"",painPoints:"",journeyContext:"",keyTouchpoints:"",selfDeterminationNeeds:{autonomy:"",competence:"",relatedness:""},fears:[],narrative:"",additionalInformation:""}}),g=N=>{const P=p.getValues(N)||[];p.setValue(N,[...P,""])},m=(N,P,_)=>{const O=[...p.getValues(N)||[]];O[P]=_,p.setValue(N,O)},x=(N,P)=>{const A=[...p.getValues(N)||[]];A.splice(P,1),p.setValue(N,A)},b=N=>{const P=p.getValues("thinkFeelDo")||{thinks:[],feels:[],does:[]},_={...P,[N]:[...P[N]||[],""]};p.setValue("thinkFeelDo",_)},y=(N,P,_)=>{const A=p.getValues("thinkFeelDo")||{thinks:[],feels:[],does:[]},O=[...A[N]||[]];O[P]=_;const $={...A,[N]:O};p.setValue("thinkFeelDo",$)},w=(N,P)=>{const _=p.getValues("thinkFeelDo")||{thinks:[],feels:[],does:[]},A=[..._[N]||[]];A.splice(P,1);const O={..._,[N]:A};p.setValue("thinkFeelDo",O)},j=(N,P)=>{const A={...p.getValues("oceanTraits")||{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},[N]:P};p.setValue("oceanTraits",A)};async function S(N,P=!1){var _,A,O,$,T;if(P&&c>=1){console.log("Max retry attempts reached, stopping retry loop"),Ze.error("Authentication failed after multiple attempts",{description:"Please try logging in manually (user/pass)"}),d("/login",{state:{from:"/synthetic-users"}}),s(!1);return}P?(u(M=>M+1),console.log(`Retry attempt ${c+1}`)):u(0),s(!0);try{if(!f)try{console.log("Not authenticated, attempting login with default credentials before submission"),await h("user","pass"),console.log("Login successful before persona creation")}catch(L){console.error("Login failed before persona creation:",L),Ze.error("Authentication required",{description:"Please log in before creating personas. Default: user/pass"}),d("/login",{state:{from:"/synthetic-users"}}),s(!1);return}const M=`persona-generation-${Date.now()}`,R=e&&t?` in "${t}" folder`:"",H=n>1?`${n} personas`:"persona";console.log(`UserCreator - Creating ${H}${R}`),Ze.createPersistent({id:M,title:`Generating ${H}...`,description:`Creating synthetic user profile${n>1?"s":""}${R}`,type:"info"});const F={...N,oceanTraits:N.oceanTraits||{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},thinkFeelDo:N.thinkFeelDo||{thinks:[],feels:[],does:[]},folderId:e||void 0},V={id:`temp-${Date.now()}`,...F},I=JSON.parse(localStorage.getItem("tempPersonas")||"[]");if(I.push(V),localStorage.setItem("tempPersonas",JSON.stringify(I)),n===1)try{if(!localStorage.getItem("auth_token")){console.error("No authentication token found"),Ze.error("Authentication required",{description:"No valid token found. Please log in again."});try{console.log("No token found, attempting new login"),await h("user","pass"),console.log("Login successful, token:",((_=localStorage.getItem("auth_token"))==null?void 0:_.substring(0,10))+"...")}catch(ee){throw console.error("Login retry failed:",ee),new Error("Authentication failed after retry")}}console.log("Sending persona creation request to API with auth token");const Z=await Nn.create(F);console.log("Persona created successfully:",Z),Ze.updatePersistent(M,{title:"Synthetic user created successfully",description:`Created profile for ${N.name}`,type:"success"})}catch(L){throw console.error("Error creating persona via API:",L),L.response&&L.response.status===401&&Ze.error("Authentication error",{description:"Failed to authenticate with server. Please try again."}),L}else{const L=[];L.push(F);for(let Z=1;Z{d("/synthetic-users")},300)}catch(M){if(console.error("Error creating personas:",M),M.response&&M.response.status===401||M.message&&M.message.includes("Authentication failed")&&c<1)try{console.log("Got auth error, attempting login retry with default credentials"),localStorage.removeItem("auth_token");const R=await e1.login("user","pass");if((O=R==null?void 0:R.data)!=null&&O.access_token){localStorage.setItem("auth_token",R.data.access_token),localStorage.setItem("user",JSON.stringify(R.data.user)),console.log("Manual login successful, got new token:",R.data.access_token.substring(0,10)+"..."),Ze.info("Logged in with default account, retrying submission..."),setTimeout(()=>{S(N,!0)},500);return}else throw new Error("No access token received")}catch(R){console.error("Login retry failed:",R),Ze.error("Authentication error",{description:"Cannot authenticate with server. Please contact support."})}else Ze.updatePersistent(generationToastId,{title:"Failed to create synthetic users",description:((T=($=M.response)==null?void 0:$.data)==null?void 0:T.message)||M.message||"An unexpected error occurred",type:"error"})}finally{s(!1)}}return a.jsxs("div",{className:"glass-panel rounded-xl p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsx("h2",{className:"text-2xl font-sf font-semibold",children:"Create Synthetic Users"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(oe,{variant:"outline",size:"sm",onClick:()=>r(Math.max(1,n-1)),children:"-"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Hn,{size:16,className:"text-muted-foreground"}),a.jsx("span",{className:"text-sm font-medium",children:n})]}),a.jsx(oe,{variant:"outline",size:"sm",onClick:()=>r(n+1),children:"+"})]})]}),a.jsx(Zy,{...p,children:a.jsxs("form",{onSubmit:p.handleSubmit(S),className:"space-y-6",children:[a.jsxs(Io,{defaultValue:"basic",children:[a.jsxs(Sa,{className:"grid w-full grid-cols-6",children:[a.jsx(Ft,{value:"basic",children:"Basic"}),a.jsx(Ft,{value:"cooper",children:"Cooper"}),a.jsx(Ft,{value:"personality",children:"Personality"}),a.jsx(Ft,{value:"demographics",children:"Demographics"}),a.jsx(Ft,{value:"lifestyle",children:"Lifestyle"}),a.jsx(Ft,{value:"extended",children:"Extended"})]}),a.jsx(Bt,{value:"basic",className:"mt-6",children:a.jsx(Ge,{children:a.jsx(tt,{className:"p-6",children:a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx(at,{control:p.control,name:"name",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Name"}),a.jsx(it,{children:a.jsx(St,{placeholder:"Jane Smith",...N})}),a.jsx(st,{})]})}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(at,{control:p.control,name:"age",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Age Range"}),a.jsxs(Xn,{onValueChange:N.onChange,defaultValue:N.value,children:[a.jsx(it,{children:a.jsx(Fn,{children:a.jsx(Yn,{placeholder:"Select age range"})})}),a.jsxs(Bn,{children:[a.jsx(be,{value:"18-24",children:"18-24"}),a.jsx(be,{value:"25-34",children:"25-34"}),a.jsx(be,{value:"35-44",children:"35-44"}),a.jsx(be,{value:"45-54",children:"45-54"}),a.jsx(be,{value:"55-64",children:"55-64"}),a.jsx(be,{value:"65+",children:"65+"})]})]}),a.jsx(st,{})]})}),a.jsx(at,{control:p.control,name:"gender",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Gender"}),a.jsxs(Xn,{onValueChange:N.onChange,defaultValue:N.value,children:[a.jsx(it,{children:a.jsx(Fn,{children:a.jsx(Yn,{placeholder:"Select gender"})})}),a.jsxs(Bn,{children:[a.jsx(be,{value:"Male",children:"Male"}),a.jsx(be,{value:"Female",children:"Female"}),a.jsx(be,{value:"Non-binary",children:"Non-binary"}),a.jsx(be,{value:"Other",children:"Other"})]})]}),a.jsx(st,{})]})})]}),a.jsx(at,{control:p.control,name:"occupation",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Occupation"}),a.jsx(it,{children:a.jsx(St,{placeholder:"Software Engineer",...N})}),a.jsx(st,{})]})}),a.jsx(at,{control:p.control,name:"education",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Education"}),a.jsxs(Xn,{onValueChange:N.onChange,defaultValue:N.value,children:[a.jsx(it,{children:a.jsx(Fn,{children:a.jsx(Yn,{placeholder:"Select education level"})})}),a.jsxs(Bn,{children:[a.jsx(be,{value:"High School",children:"High School"}),a.jsx(be,{value:"Some College",children:"Some College"}),a.jsx(be,{value:"Associate's Degree",children:"Associate's Degree"}),a.jsx(be,{value:"Bachelor's Degree",children:"Bachelor's Degree"}),a.jsx(be,{value:"Master's Degree",children:"Master's Degree"}),a.jsx(be,{value:"PhD",children:"PhD"})]})]}),a.jsx(st,{})]})}),a.jsx(at,{control:p.control,name:"location",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Location"}),a.jsx(it,{children:a.jsx(St,{placeholder:"New York, USA",...N})}),a.jsx(st,{})]})}),a.jsx(at,{control:p.control,name:"ethnicity",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Ethnicity (Optional)"}),a.jsxs(Xn,{onValueChange:N.onChange,defaultValue:N.value,children:[a.jsx(it,{children:a.jsx(Fn,{children:a.jsx(Yn,{placeholder:"Select ethnicity"})})}),a.jsxs(Bn,{children:[a.jsx(be,{value:"white",children:"White"}),a.jsx(be,{value:"black",children:"Black"}),a.jsx(be,{value:"asian",children:"Asian"}),a.jsx(be,{value:"hispanic",children:"Hispanic/Latino"}),a.jsx(be,{value:"native-american",children:"Native American"}),a.jsx(be,{value:"middle-eastern",children:"Middle Eastern"}),a.jsx(be,{value:"mixed",children:"Mixed"}),a.jsx(be,{value:"other",children:"Other"}),a.jsx(be,{value:"prefer-not-to-say",children:"Prefer not to say"})]})]}),a.jsx(st,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(at,{control:p.control,name:"personality",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Personality Traits"}),a.jsx(it,{children:a.jsx(Qe,{placeholder:"Curious, analytical, detail-oriented",...N,rows:3})}),a.jsx(un,{children:"Describe key personality traits that define this user"}),a.jsx(st,{})]})}),a.jsx(at,{control:p.control,name:"interests",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Interests"}),a.jsx(it,{children:a.jsx(Qe,{placeholder:"Technology, fitness, cooking, travel",...N,rows:3})}),a.jsx(un,{children:"List interests, hobbies and activities this user enjoys"}),a.jsx(st,{})]})}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h3",{className:"font-medium text-sm",children:"Behavioral Attributes"}),a.jsx(at,{control:p.control,name:"techSavviness",render:({field:N})=>a.jsxs(nt,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(rt,{children:"Tech Savviness"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[N.value,"%"]})]}),a.jsx(it,{children:a.jsx(On,{min:0,max:100,step:1,value:[N.value],onValueChange:P=>N.onChange(P[0])})}),a.jsx(st,{})]})}),a.jsx(at,{control:p.control,name:"brandLoyalty",render:({field:N})=>a.jsxs(nt,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(rt,{children:"Brand Loyalty"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[N.value,"%"]})]}),a.jsx(it,{children:a.jsx(On,{min:0,max:100,step:1,value:[N.value],onValueChange:P=>N.onChange(P[0])})}),a.jsx(st,{})]})}),a.jsx(at,{control:p.control,name:"priceConsciousness",render:({field:N})=>a.jsxs(nt,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(rt,{children:"Price Consciousness"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[N.value,"%"]})]}),a.jsx(it,{children:a.jsx(On,{min:0,max:100,step:1,value:[N.value],onValueChange:P=>N.onChange(P[0])})}),a.jsx(st,{})]})}),a.jsx(at,{control:p.control,name:"environmentalConcern",render:({field:N})=>a.jsxs(nt,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(rt,{children:"Environmental Concern"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[N.value,"%"]})]}),a.jsx(it,{children:a.jsx(On,{min:0,max:100,step:1,value:[N.value],onValueChange:P=>N.onChange(P[0])})}),a.jsx(st,{})]})}),a.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-2",children:[a.jsx(at,{control:p.control,name:"hasPurchasingPower",render:({field:N})=>a.jsxs(nt,{className:"flex items-center justify-between",children:[a.jsx(rt,{children:"Purchasing Power"}),a.jsx(it,{children:a.jsx(fh,{checked:N.value,onCheckedChange:N.onChange})}),a.jsx(st,{})]})}),a.jsx(at,{control:p.control,name:"hasChildren",render:({field:N})=>a.jsxs(nt,{className:"flex items-center justify-between",children:[a.jsx(rt,{children:"Has Children"}),a.jsx(it,{children:a.jsx(fh,{checked:N.value,onCheckedChange:N.onChange})}),a.jsx(st,{})]})})]})]})]})]})})})}),a.jsxs(Bt,{value:"cooper",className:"mt-6 space-y-6",children:[a.jsx(Ge,{children:a.jsxs(tt,{className:"p-6",children:[a.jsxs("div",{className:"mb-4",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Goals"}),(p.watch("goals")||[]).map((N,P)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(St,{value:N,onChange:_=>m("goals",P,_.target.value),placeholder:"Enter a goal"}),a.jsx(oe,{variant:"ghost",size:"icon",type:"button",onClick:()=>x("goals",P),children:a.jsx(gn,{className:"h-4 w-4 text-muted-foreground"})})]},P)),a.jsxs(oe,{variant:"outline",size:"sm",type:"button",onClick:()=>g("goals"),className:"mt-2",children:[a.jsx(or,{className:"h-4 w-4 mr-2"}),"Add Goal"]})]}),a.jsxs("div",{className:"mb-4 pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Frustrations"}),(p.watch("frustrations")||[]).map((N,P)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(St,{value:N,onChange:_=>m("frustrations",P,_.target.value),placeholder:"Enter a frustration"}),a.jsx(oe,{variant:"ghost",size:"icon",type:"button",onClick:()=>x("frustrations",P),children:a.jsx(gn,{className:"h-4 w-4 text-muted-foreground"})})]},P)),a.jsxs(oe,{variant:"outline",size:"sm",type:"button",onClick:()=>g("frustrations"),className:"mt-2",children:[a.jsx(or,{className:"h-4 w-4 mr-2"}),"Add Frustration"]})]}),a.jsxs("div",{className:"mb-4 pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Motivations"}),(p.watch("motivations")||[]).map((N,P)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(St,{value:N,onChange:_=>m("motivations",P,_.target.value),placeholder:"Enter a motivation"}),a.jsx(oe,{variant:"ghost",size:"icon",type:"button",onClick:()=>x("motivations",P),children:a.jsx(gn,{className:"h-4 w-4 text-muted-foreground"})})]},P)),a.jsxs(oe,{variant:"outline",size:"sm",type:"button",onClick:()=>g("motivations"),className:"mt-2",children:[a.jsx(or,{className:"h-4 w-4 mr-2"}),"Add Motivation"]})]})]})}),a.jsx(Ge,{children:a.jsxs(tt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Think, Feel, Do"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Thinks"}),((p.watch("thinkFeelDo")||{thinks:[],feels:[],does:[]}).thinks||[]).map((N,P)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(St,{value:N,onChange:_=>y("thinks",P,_.target.value),placeholder:"What they think"}),a.jsx(oe,{variant:"ghost",size:"icon",type:"button",onClick:()=>w("thinks",P),children:a.jsx(gn,{className:"h-4 w-4 text-muted-foreground"})})]},P)),a.jsxs(oe,{variant:"outline",size:"sm",type:"button",onClick:()=>b("thinks"),className:"mt-2",children:[a.jsx(or,{className:"h-4 w-4 mr-2"}),"Add Thought"]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Feels"}),((p.watch("thinkFeelDo")||{thinks:[],feels:[],does:[]}).feels||[]).map((N,P)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(St,{value:N,onChange:_=>y("feels",P,_.target.value),placeholder:"What they feel"}),a.jsx(oe,{variant:"ghost",size:"icon",type:"button",onClick:()=>w("feels",P),children:a.jsx(gn,{className:"h-4 w-4 text-muted-foreground"})})]},P)),a.jsxs(oe,{variant:"outline",size:"sm",type:"button",onClick:()=>b("feels"),className:"mt-2",children:[a.jsx(or,{className:"h-4 w-4 mr-2"}),"Add Feeling"]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Does"}),((p.watch("thinkFeelDo")||{thinks:[],feels:[],does:[]}).does||[]).map((N,P)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(St,{value:N,onChange:_=>y("does",P,_.target.value),placeholder:"What they do"}),a.jsx(oe,{variant:"ghost",size:"icon",type:"button",onClick:()=>w("does",P),children:a.jsx(gn,{className:"h-4 w-4 text-muted-foreground"})})]},P)),a.jsxs(oe,{variant:"outline",size:"sm",type:"button",onClick:()=>b("does"),className:"mt-2",children:[a.jsx(or,{className:"h-4 w-4 mr-2"}),"Add Action"]})]})]})]})}),a.jsx(Ge,{children:a.jsx(tt,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsx(at,{control:p.control,name:"scenarioType",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Scenario Section Title"}),a.jsx(it,{children:a.jsx(St,{placeholder:"Life Scenarios",...N})}),a.jsx(un,{children:'Custom title for the scenarios section (e.g., "Customer Journey", "Use Cases")'}),a.jsx(st,{})]})}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Usage Scenarios"}),(p.watch("scenarios")||[]).map((N,P)=>a.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[a.jsx(Qe,{value:N,onChange:_=>m("scenarios",P,_.target.value),rows:2,placeholder:"Describe a usage scenario"}),a.jsx(oe,{variant:"ghost",size:"icon",type:"button",onClick:()=>x("scenarios",P),className:"mt-2",children:a.jsx(gn,{className:"h-4 w-4 text-muted-foreground"})})]},P)),a.jsxs(oe,{variant:"outline",size:"sm",type:"button",onClick:()=>g("scenarios"),className:"mt-2",children:[a.jsx(or,{className:"h-4 w-4 mr-2"}),"Add Scenario"]})]})]})})})]}),a.jsx(Bt,{value:"personality",className:"mt-6",children:a.jsx(Ge,{children:a.jsxs(tt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"OCEAN Personality Traits"}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Openness to Experience"}),a.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{openness:50}).openness||50,"%"]})]}),a.jsx(On,{value:[(p.watch("oceanTraits")||{openness:50}).openness||50],onValueChange:N=>j("openness",N[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Creativity, curiosity, and openness to new ideas"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Conscientiousness"}),a.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{conscientiousness:50}).conscientiousness||50,"%"]})]}),a.jsx(On,{value:[(p.watch("oceanTraits")||{conscientiousness:50}).conscientiousness||50],onValueChange:N=>j("conscientiousness",N[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Organization, responsibility, and self-discipline"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Extraversion"}),a.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{extraversion:50}).extraversion||50,"%"]})]}),a.jsx(On,{value:[(p.watch("oceanTraits")||{extraversion:50}).extraversion||50],onValueChange:N=>j("extraversion",N[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Sociability, assertiveness, and talkativeness"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Agreeableness"}),a.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{agreeableness:50}).agreeableness||50,"%"]})]}),a.jsx(On,{value:[(p.watch("oceanTraits")||{agreeableness:50}).agreeableness||50],onValueChange:N=>j("agreeableness",N[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Compassion, cooperation, and concern for others"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Neuroticism"}),a.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{neuroticism:50}).neuroticism||50,"%"]})]}),a.jsx(On,{value:[(p.watch("oceanTraits")||{neuroticism:50}).neuroticism||50],onValueChange:N=>j("neuroticism",N[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Emotional reactivity, anxiety, and sensitivity to stress"})]})]})]})})}),a.jsx(Bt,{value:"demographics",className:"mt-6",children:a.jsx(Ge,{children:a.jsxs(tt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Demographic Information"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx(at,{control:p.control,name:"socialGrade",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Social Grade"}),a.jsxs(Xn,{onValueChange:N.onChange,defaultValue:N.value,children:[a.jsx(it,{children:a.jsx(Fn,{children:a.jsx(Yn,{placeholder:"Select social grade"})})}),a.jsxs(Bn,{children:[a.jsx(be,{value:"A",children:"A - Higher managerial"}),a.jsx(be,{value:"B",children:"B - Intermediate managerial"}),a.jsx(be,{value:"C1",children:"C1 - Supervisory or clerical"}),a.jsx(be,{value:"C2",children:"C2 - Skilled manual workers"}),a.jsx(be,{value:"D",children:"D - Semi and unskilled manual workers"}),a.jsx(be,{value:"E",children:"E - State pensioners, unemployed"})]})]}),a.jsx(st,{})]})}),a.jsx(at,{control:p.control,name:"householdIncome",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Household Income"}),a.jsxs(Xn,{onValueChange:N.onChange,defaultValue:N.value,children:[a.jsx(it,{children:a.jsx(Fn,{children:a.jsx(Yn,{placeholder:"Select income range"})})}),a.jsxs(Bn,{children:[a.jsx(be,{value:"Under $25k",children:"Under $25,000"}),a.jsx(be,{value:"$25k-$50k",children:"$25,000 - $50,000"}),a.jsx(be,{value:"$50k-$75k",children:"$50,000 - $75,000"}),a.jsx(be,{value:"$75k-$100k",children:"$75,000 - $100,000"}),a.jsx(be,{value:"$100k-$150k",children:"$100,000 - $150,000"}),a.jsx(be,{value:"$150k-$250k",children:"$150,000 - $250,000"}),a.jsx(be,{value:"Over $250k",children:"Over $250,000"}),a.jsx(be,{value:"Prefer not to say",children:"Prefer not to say"})]})]}),a.jsx(st,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(at,{control:p.control,name:"householdComposition",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Household Composition"}),a.jsxs(Xn,{onValueChange:N.onChange,defaultValue:N.value,children:[a.jsx(it,{children:a.jsx(Fn,{children:a.jsx(Yn,{placeholder:"Select household type"})})}),a.jsxs(Bn,{children:[a.jsx(be,{value:"Single person",children:"Single person"}),a.jsx(be,{value:"Couple without children",children:"Couple without children"}),a.jsx(be,{value:"Couple with children",children:"Couple with children"}),a.jsx(be,{value:"Single parent",children:"Single parent"}),a.jsx(be,{value:"Multi-generational",children:"Multi-generational"}),a.jsx(be,{value:"Shared housing",children:"Shared housing"}),a.jsx(be,{value:"Other",children:"Other"})]})]}),a.jsx(st,{})]})}),a.jsx(at,{control:p.control,name:"livingSituation",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Living Situation"}),a.jsxs(Xn,{onValueChange:N.onChange,defaultValue:N.value,children:[a.jsx(it,{children:a.jsx(Fn,{children:a.jsx(Yn,{placeholder:"Select living situation"})})}),a.jsxs(Bn,{children:[a.jsx(be,{value:"Own home",children:"Own home"}),a.jsx(be,{value:"Rent apartment",children:"Rent apartment"}),a.jsx(be,{value:"Rent house",children:"Rent house"}),a.jsx(be,{value:"Live with family",children:"Live with family"}),a.jsx(be,{value:"Student housing",children:"Student housing"}),a.jsx(be,{value:"Assisted living",children:"Assisted living"}),a.jsx(be,{value:"Other",children:"Other"})]})]}),a.jsx(st,{})]})})]})]})]})})}),a.jsx(Bt,{value:"lifestyle",className:"mt-6",children:a.jsx(Ge,{children:a.jsxs(tt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Lifestyle & Behavior"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx(at,{control:p.control,name:"mediaConsumption",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Media Consumption"}),a.jsx(it,{children:a.jsx(Qe,{placeholder:"TV shows, podcasts, news sources, social media platforms",...N,rows:3})}),a.jsx(un,{children:"Describe media consumption habits and preferences"}),a.jsx(st,{})]})}),a.jsx(at,{control:p.control,name:"deviceUsage",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Device Usage"}),a.jsx(it,{children:a.jsx(Qe,{placeholder:"Smartphone, laptop, tablet, smart TV, gaming console",...N,rows:3})}),a.jsx(un,{children:"Primary devices and usage patterns"}),a.jsx(st,{})]})}),a.jsx(at,{control:p.control,name:"shoppingHabits",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Shopping Habits"}),a.jsx(it,{children:a.jsx(Qe,{placeholder:"Online vs in-store, frequency, preferred retailers",...N,rows:3})}),a.jsx(un,{children:"Shopping behavior and preferences"}),a.jsx(st,{})]})}),a.jsx(at,{control:p.control,name:"brandPreferences",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Brand Preferences"}),a.jsx(it,{children:a.jsx(Qe,{placeholder:"Favorite brands, brand values alignment",...N,rows:3})}),a.jsx(un,{children:"Preferred brands and reasoning"}),a.jsx(st,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(at,{control:p.control,name:"communicationPreferences",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Communication Preferences"}),a.jsx(it,{children:a.jsx(Qe,{placeholder:"Email, phone, text, video calls, in-person",...N,rows:3})}),a.jsx(un,{children:"Preferred communication methods and channels"}),a.jsx(st,{})]})}),a.jsx(at,{control:p.control,name:"paymentMethods",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Payment Methods"}),a.jsx(it,{children:a.jsx(Qe,{placeholder:"Credit cards, digital wallets, cash, BNPL",...N,rows:3})}),a.jsx(un,{children:"Preferred payment methods and financial tools"}),a.jsx(st,{})]})}),a.jsx(at,{control:p.control,name:"purchaseBehaviour",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Purchase Behavior"}),a.jsx(it,{children:a.jsx(Qe,{placeholder:"Research habits, decision factors, impulse vs planned buying",...N,rows:3})}),a.jsx(un,{children:"How they approach making purchase decisions"}),a.jsx(st,{})]})})]})]})]})})}),a.jsxs(Bt,{value:"extended",className:"mt-6 space-y-6",children:[a.jsx(Ge,{children:a.jsxs(tt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Extended Profile"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx(at,{control:p.control,name:"coreValues",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Core Values"}),a.jsx(it,{children:a.jsx(Qe,{placeholder:"Key principles and values that guide decisions",...N,rows:3})}),a.jsx(st,{})]})}),a.jsx(at,{control:p.control,name:"lifestyleChoices",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Lifestyle Choices"}),a.jsx(it,{children:a.jsx(Qe,{placeholder:"Health, fitness, diet, work-life balance preferences",...N,rows:3})}),a.jsx(st,{})]})}),a.jsx(at,{control:p.control,name:"socialActivities",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Social Activities"}),a.jsx(it,{children:a.jsx(Qe,{placeholder:"Social hobbies, community involvement, networking",...N,rows:3})}),a.jsx(st,{})]})}),a.jsx(at,{control:p.control,name:"categoryKnowledge",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Category Knowledge"}),a.jsx(it,{children:a.jsx(Qe,{placeholder:"Expertise in specific product/service categories",...N,rows:3})}),a.jsx(st,{})]})}),a.jsx(at,{control:p.control,name:"decisionInfluences",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Decision Influences"}),a.jsx(it,{children:a.jsx(Qe,{placeholder:"What factors most influence their decisions",...N,rows:3})}),a.jsx(st,{})]})}),a.jsx(at,{control:p.control,name:"painPoints",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Pain Points"}),a.jsx(it,{children:a.jsx(Qe,{placeholder:"Common challenges and friction points",...N,rows:3})}),a.jsx(st,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(at,{control:p.control,name:"journeyContext",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Journey Context"}),a.jsx(it,{children:a.jsx(Qe,{placeholder:"Current life stage and contextual factors",...N,rows:3})}),a.jsx(st,{})]})}),a.jsx(at,{control:p.control,name:"keyTouchpoints",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Key Touchpoints"}),a.jsx(it,{children:a.jsx(Qe,{placeholder:"Important interaction points and channels",...N,rows:3})}),a.jsx(st,{})]})}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h4",{className:"font-medium text-sm",children:"Self-Determination Needs"}),a.jsx(at,{control:p.control,name:"selfDeterminationNeeds.autonomy",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Autonomy"}),a.jsx(it,{children:a.jsx(Qe,{placeholder:"Need for independence and self-direction",...N,rows:2})}),a.jsx(st,{})]})}),a.jsx(at,{control:p.control,name:"selfDeterminationNeeds.competence",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Competence"}),a.jsx(it,{children:a.jsx(Qe,{placeholder:"Need to feel capable and effective",...N,rows:2})}),a.jsx(st,{})]})}),a.jsx(at,{control:p.control,name:"selfDeterminationNeeds.relatedness",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Relatedness"}),a.jsx(it,{children:a.jsx(Qe,{placeholder:"Need for connection and belonging",...N,rows:2})}),a.jsx(st,{})]})})]})]})]})]})}),a.jsx(Ge,{children:a.jsx(tt,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Fears & Concerns"}),(p.watch("fears")||[]).map((N,P)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(St,{value:N,onChange:_=>m("fears",P,_.target.value),placeholder:"Enter a fear or concern"}),a.jsx(oe,{variant:"ghost",size:"icon",type:"button",onClick:()=>x("fears",P),children:a.jsx(gn,{className:"h-4 w-4 text-muted-foreground"})})]},P)),a.jsxs(oe,{variant:"outline",size:"sm",type:"button",onClick:()=>g("fears"),className:"mt-2",children:[a.jsx(or,{className:"h-4 w-4 mr-2"}),"Add Fear/Concern"]})]}),a.jsx(at,{control:p.control,name:"narrative",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Personal Narrative"}),a.jsx(it,{children:a.jsx(Qe,{placeholder:"Personal story, background, key life experiences",...N,rows:4})}),a.jsx(un,{children:"A brief narrative that captures their personal story"}),a.jsx(st,{})]})}),a.jsx(at,{control:p.control,name:"additionalInformation",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Additional Information"}),a.jsx(it,{children:a.jsx(Qe,{placeholder:"Any other relevant details or context",...N,rows:4})}),a.jsx(un,{children:"Additional context or details not covered elsewhere"}),a.jsx(st,{})]})})]})})})]})]}),a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsx(oe,{variant:"outline",type:"button",onClick:()=>p.reset(),children:"Reset"}),a.jsxs(oe,{type:"submit",disabled:i,children:[i?a.jsx(yG,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(wN,{className:"mr-2 h-4 w-4"}),i?"Creating...":`Create ${n>1?`${n} Users`:"User"}`]})]})]})})]})}var g1=["Enter"," "],vQ=["ArrowDown","PageUp","Home"],pL=["ArrowUp","PageDown","End"],yQ=[...vQ,...pL],xQ={ltr:[...g1,"ArrowRight"],rtl:[...g1,"ArrowLeft"]},bQ={ltr:["ArrowLeft"],rtl:["ArrowRight"]},_p="Menu",[hh,wQ,jQ]=jp(_p),[Vl,mL]=Er(_p,[jQ,Wu,ed]),ox=Wu(),gL=ed(),[SQ,Wl]=Vl(_p),[NQ,Pp]=Vl(_p),vL=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:s,modal:o=!0}=e,l=ox(t),[c,u]=v.useState(null),d=v.useRef(!1),f=$n(s),h=ko(i);return v.useEffect(()=>{const p=()=>{d.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>d.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),a.jsx(FM,{...l,children:a.jsx(SQ,{scope:t,open:n,onOpenChange:f,content:c,onContentChange:u,children:a.jsx(NQ,{scope:t,onClose:v.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:h,modal:o,children:r})})})};vL.displayName=_p;var _Q="MenuAnchor",r_=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=ox(n);return a.jsx(lN,{...i,...r,ref:t})});r_.displayName=_Q;var i_="MenuPortal",[PQ,yL]=Vl(i_,{forceMount:void 0}),xL=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:i}=e,s=Wl(i_,t);return a.jsx(PQ,{scope:t,forceMount:n,children:a.jsx(er,{present:n||s.open,children:a.jsx($y,{asChild:!0,container:i,children:r})})})};xL.displayName=i_;var ji="MenuContent",[CQ,s_]=Vl(ji),bL=v.forwardRef((e,t)=>{const n=yL(ji,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=Wl(ji,e.__scopeMenu),o=Pp(ji,e.__scopeMenu);return a.jsx(hh.Provider,{scope:e.__scopeMenu,children:a.jsx(er,{present:r||s.open,children:a.jsx(hh.Slot,{scope:e.__scopeMenu,children:o.modal?a.jsx(AQ,{...i,ref:t}):a.jsx(EQ,{...i,ref:t})})})})}),AQ=v.forwardRef((e,t)=>{const n=Wl(ji,e.__scopeMenu),r=v.useRef(null),i=dt(t,r);return v.useEffect(()=>{const s=r.current;if(s)return XN(s)},[]),a.jsx(a_,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Te(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),EQ=v.forwardRef((e,t)=>{const n=Wl(ji,e.__scopeMenu);return a.jsx(a_,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),a_=v.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:p,disableOutsideScroll:g,...m}=e,x=Wl(ji,n),b=Pp(ji,n),y=ox(n),w=gL(n),j=wQ(n),[S,N]=v.useState(null),P=v.useRef(null),_=dt(t,P,x.onContentChange),A=v.useRef(0),O=v.useRef(""),$=v.useRef(0),T=v.useRef(null),M=v.useRef("right"),R=v.useRef(0),H=g?tx:v.Fragment,F=g?{as:ca,allowPinchZoom:!0}:void 0,V=L=>{var fe,Ne;const Z=O.current+L,ee=j().filter(he=>!he.disabled),re=document.activeElement,me=(fe=ee.find(he=>he.ref.current===re))==null?void 0:fe.textValue,z=ee.map(he=>he.textValue),ae=zQ(z,Z,me),de=(Ne=ee.find(he=>he.textValue===ae))==null?void 0:Ne.ref.current;(function he(ue){O.current=ue,window.clearTimeout(A.current),ue!==""&&(A.current=window.setTimeout(()=>he(""),1e3))})(Z),de&&setTimeout(()=>de.focus())};v.useEffect(()=>()=>window.clearTimeout(A.current),[]),KN();const I=v.useCallback(L=>{var ee,re;return M.current===((ee=T.current)==null?void 0:ee.side)&&VQ(L,(re=T.current)==null?void 0:re.area)},[]);return a.jsx(CQ,{scope:n,searchRef:O,onItemEnter:v.useCallback(L=>{I(L)&&L.preventDefault()},[I]),onItemLeave:v.useCallback(L=>{var Z;I(L)||((Z=P.current)==null||Z.focus(),N(null))},[I]),onTriggerLeave:v.useCallback(L=>{I(L)&&L.preventDefault()},[I]),pointerGraceTimerRef:$,onPointerGraceIntentChange:v.useCallback(L=>{T.current=L},[]),children:a.jsx(H,{...F,children:a.jsx(Jy,{asChild:!0,trapped:i,onMountAutoFocus:Te(s,L=>{var Z;L.preventDefault(),(Z=P.current)==null||Z.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:a.jsx(dp,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:p,children:a.jsx(JN,{asChild:!0,...w,dir:b.dir,orientation:"vertical",loop:r,currentTabStopId:S,onCurrentTabStopIdChange:N,onEntryFocus:Te(c,L=>{b.isUsingKeyboardRef.current||L.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(cN,{role:"menu","aria-orientation":"vertical","data-state":RL(x.open),"data-radix-menu-content":"",dir:b.dir,...y,...m,ref:_,style:{outline:"none",...m.style},onKeyDown:Te(m.onKeyDown,L=>{const ee=L.target.closest("[data-radix-menu-content]")===L.currentTarget,re=L.ctrlKey||L.altKey||L.metaKey,me=L.key.length===1;ee&&(L.key==="Tab"&&L.preventDefault(),!re&&me&&V(L.key));const z=P.current;if(L.target!==z||!yQ.includes(L.key))return;L.preventDefault();const de=j().filter(fe=>!fe.disabled).map(fe=>fe.ref.current);pL.includes(L.key)&&de.reverse(),FQ(de)}),onBlur:Te(e.onBlur,L=>{L.currentTarget.contains(L.target)||(window.clearTimeout(A.current),O.current="")}),onPointerMove:Te(e.onPointerMove,ph(L=>{const Z=L.target,ee=R.current!==L.clientX;if(L.currentTarget.contains(Z)&&ee){const re=L.clientX>R.current?"right":"left";M.current=re,R.current=L.clientX}}))})})})})})})});bL.displayName=ji;var OQ="MenuGroup",o_=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return a.jsx(qe.div,{role:"group",...r,ref:t})});o_.displayName=OQ;var kQ="MenuLabel",wL=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return a.jsx(qe.div,{...r,ref:t})});wL.displayName=kQ;var Gg="MenuItem",PE="menu.itemSelect",lx=v.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...i}=e,s=v.useRef(null),o=Pp(Gg,e.__scopeMenu),l=s_(Gg,e.__scopeMenu),c=dt(t,s),u=v.useRef(!1),d=()=>{const f=s.current;if(!n&&f){const h=new CustomEvent(PE,{bubbles:!0,cancelable:!0});f.addEventListener(PE,p=>r==null?void 0:r(p),{once:!0}),yM(f,h),h.defaultPrevented?u.current=!1:o.onClose()}};return a.jsx(jL,{...i,ref:c,disabled:n,onClick:Te(e.onClick,d),onPointerDown:f=>{var h;(h=e.onPointerDown)==null||h.call(e,f),u.current=!0},onPointerUp:Te(e.onPointerUp,f=>{var h;u.current||(h=f.currentTarget)==null||h.click()}),onKeyDown:Te(e.onKeyDown,f=>{const h=l.searchRef.current!=="";n||h&&f.key===" "||g1.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});lx.displayName=Gg;var jL=v.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...s}=e,o=s_(Gg,n),l=gL(n),c=v.useRef(null),u=dt(t,c),[d,f]=v.useState(!1),[h,p]=v.useState("");return v.useEffect(()=>{const g=c.current;g&&p((g.textContent??"").trim())},[s.children]),a.jsx(hh.ItemSlot,{scope:n,disabled:r,textValue:i??h,children:a.jsx(e_,{asChild:!0,...l,focusable:!r,children:a.jsx(qe.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...s,ref:u,onPointerMove:Te(e.onPointerMove,ph(g=>{r?o.onItemLeave(g):(o.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Te(e.onPointerLeave,ph(g=>o.onItemLeave(g))),onFocus:Te(e.onFocus,()=>f(!0)),onBlur:Te(e.onBlur,()=>f(!1))})})})}),TQ="MenuCheckboxItem",SL=v.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...i}=e;return a.jsx(AL,{scope:e.__scopeMenu,checked:n,children:a.jsx(lx,{role:"menuitemcheckbox","aria-checked":qg(n)?"mixed":n,...i,ref:t,"data-state":c_(n),onSelect:Te(i.onSelect,()=>r==null?void 0:r(qg(n)?!0:!n),{checkForDefaultPrevented:!1})})})});SL.displayName=TQ;var NL="MenuRadioGroup",[$Q,IQ]=Vl(NL,{value:void 0,onValueChange:()=>{}}),_L=v.forwardRef((e,t)=>{const{value:n,onValueChange:r,...i}=e,s=$n(r);return a.jsx($Q,{scope:e.__scopeMenu,value:n,onValueChange:s,children:a.jsx(o_,{...i,ref:t})})});_L.displayName=NL;var PL="MenuRadioItem",CL=v.forwardRef((e,t)=>{const{value:n,...r}=e,i=IQ(PL,e.__scopeMenu),s=n===i.value;return a.jsx(AL,{scope:e.__scopeMenu,checked:s,children:a.jsx(lx,{role:"menuitemradio","aria-checked":s,...r,ref:t,"data-state":c_(s),onSelect:Te(r.onSelect,()=>{var o;return(o=i.onValueChange)==null?void 0:o.call(i,n)},{checkForDefaultPrevented:!1})})})});CL.displayName=PL;var l_="MenuItemIndicator",[AL,MQ]=Vl(l_,{checked:!1}),EL=v.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...i}=e,s=MQ(l_,n);return a.jsx(er,{present:r||qg(s.checked)||s.checked===!0,children:a.jsx(qe.span,{...i,ref:t,"data-state":c_(s.checked)})})});EL.displayName=l_;var RQ="MenuSeparator",OL=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return a.jsx(qe.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});OL.displayName=RQ;var DQ="MenuArrow",kL=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,i=ox(n);return a.jsx(uN,{...i,...r,ref:t})});kL.displayName=DQ;var LQ="MenuSub",[SOe,TL]=Vl(LQ),ef="MenuSubTrigger",$L=v.forwardRef((e,t)=>{const n=Wl(ef,e.__scopeMenu),r=Pp(ef,e.__scopeMenu),i=TL(ef,e.__scopeMenu),s=s_(ef,e.__scopeMenu),o=v.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=s,u={__scopeMenu:e.__scopeMenu},d=v.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return v.useEffect(()=>d,[d]),v.useEffect(()=>{const f=l.current;return()=>{window.clearTimeout(f),c(null)}},[l,c]),a.jsx(r_,{asChild:!0,...u,children:a.jsx(jL,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":RL(n.open),...e,ref:Ey(t,i.onTriggerChange),onClick:f=>{var h;(h=e.onClick)==null||h.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Te(e.onPointerMove,ph(f=>{s.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(s.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:Te(e.onPointerLeave,ph(f=>{var p,g;d();const h=(p=n.content)==null?void 0:p.getBoundingClientRect();if(h){const m=(g=n.content)==null?void 0:g.dataset.side,x=m==="right",b=x?-5:5,y=h[x?"left":"right"],w=h[x?"right":"left"];s.onPointerGraceIntentChange({area:[{x:f.clientX+b,y:f.clientY},{x:y,y:h.top},{x:w,y:h.top},{x:w,y:h.bottom},{x:y,y:h.bottom}],side:m}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>s.onPointerGraceIntentChange(null),300)}else{if(s.onTriggerLeave(f),f.defaultPrevented)return;s.onPointerGraceIntentChange(null)}})),onKeyDown:Te(e.onKeyDown,f=>{var p;const h=s.searchRef.current!=="";e.disabled||h&&f.key===" "||xQ[r.dir].includes(f.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),f.preventDefault())})})})});$L.displayName=ef;var IL="MenuSubContent",ML=v.forwardRef((e,t)=>{const n=yL(ji,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,s=Wl(ji,e.__scopeMenu),o=Pp(ji,e.__scopeMenu),l=TL(IL,e.__scopeMenu),c=v.useRef(null),u=dt(t,c);return a.jsx(hh.Provider,{scope:e.__scopeMenu,children:a.jsx(er,{present:r||s.open,children:a.jsx(hh.Slot,{scope:e.__scopeMenu,children:a.jsx(a_,{id:l.contentId,"aria-labelledby":l.triggerId,...i,ref:u,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var f;o.isUsingKeyboardRef.current&&((f=c.current)==null||f.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:Te(e.onFocusOutside,d=>{d.target!==l.trigger&&s.onOpenChange(!1)}),onEscapeKeyDown:Te(e.onEscapeKeyDown,d=>{o.onClose(),d.preventDefault()}),onKeyDown:Te(e.onKeyDown,d=>{var p;const f=d.currentTarget.contains(d.target),h=bQ[o.dir].includes(d.key);f&&h&&(s.onOpenChange(!1),(p=l.trigger)==null||p.focus(),d.preventDefault())})})})})})});ML.displayName=IL;function RL(e){return e?"open":"closed"}function qg(e){return e==="indeterminate"}function c_(e){return qg(e)?"indeterminate":e?"checked":"unchecked"}function FQ(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function BQ(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function zQ(e,t,n){const i=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let o=BQ(e,Math.max(s,0));i.length===1&&(o=o.filter(u=>u!==n));const c=o.find(u=>u.toLowerCase().startsWith(i.toLowerCase()));return c!==n?c:void 0}function UQ(e,t){const{x:n,y:r}=e;let i=!1;for(let s=0,o=t.length-1;sr!=d>r&&n<(u-l)*(r-c)/(d-c)+l&&(i=!i)}return i}function VQ(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return UQ(n,t)}function ph(e){return t=>t.pointerType==="mouse"?e(t):void 0}var WQ=vL,HQ=r_,GQ=xL,qQ=bL,KQ=o_,XQ=wL,YQ=lx,ZQ=SL,QQ=_L,JQ=CL,eJ=EL,tJ=OL,nJ=kL,rJ=$L,iJ=ML,u_="DropdownMenu",[sJ,NOe]=Er(u_,[mL]),Or=mL(),[aJ,DL]=sJ(u_),LL=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:s,onOpenChange:o,modal:l=!0}=e,c=Or(t),u=v.useRef(null),[d=!1,f]=ii({prop:i,defaultProp:s,onChange:o});return a.jsx(aJ,{scope:t,triggerId:wi(),triggerRef:u,contentId:wi(),open:d,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(h=>!h),[f]),modal:l,children:a.jsx(WQ,{...c,open:d,onOpenChange:f,dir:r,modal:l,children:n})})};LL.displayName=u_;var FL="DropdownMenuTrigger",BL=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,s=DL(FL,n),o=Or(n);return a.jsx(HQ,{asChild:!0,...o,children:a.jsx(qe.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:Ey(t,s.triggerRef),onPointerDown:Te(e.onPointerDown,l=>{!r&&l.button===0&&l.ctrlKey===!1&&(s.onOpenToggle(),s.open||l.preventDefault())}),onKeyDown:Te(e.onKeyDown,l=>{r||(["Enter"," "].includes(l.key)&&s.onOpenToggle(),l.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});BL.displayName=FL;var oJ="DropdownMenuPortal",zL=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Or(t);return a.jsx(GQ,{...r,...n})};zL.displayName=oJ;var UL="DropdownMenuContent",VL=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=DL(UL,n),s=Or(n),o=v.useRef(!1);return a.jsx(qQ,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...r,ref:t,onCloseAutoFocus:Te(e.onCloseAutoFocus,l=>{var c;o.current||(c=i.triggerRef.current)==null||c.focus(),o.current=!1,l.preventDefault()}),onInteractOutside:Te(e.onInteractOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!i.modal||d)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});VL.displayName=UL;var lJ="DropdownMenuGroup",cJ=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Or(n);return a.jsx(KQ,{...i,...r,ref:t})});cJ.displayName=lJ;var uJ="DropdownMenuLabel",WL=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Or(n);return a.jsx(XQ,{...i,...r,ref:t})});WL.displayName=uJ;var dJ="DropdownMenuItem",HL=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Or(n);return a.jsx(YQ,{...i,...r,ref:t})});HL.displayName=dJ;var fJ="DropdownMenuCheckboxItem",GL=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Or(n);return a.jsx(ZQ,{...i,...r,ref:t})});GL.displayName=fJ;var hJ="DropdownMenuRadioGroup",pJ=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Or(n);return a.jsx(QQ,{...i,...r,ref:t})});pJ.displayName=hJ;var mJ="DropdownMenuRadioItem",qL=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Or(n);return a.jsx(JQ,{...i,...r,ref:t})});qL.displayName=mJ;var gJ="DropdownMenuItemIndicator",KL=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Or(n);return a.jsx(eJ,{...i,...r,ref:t})});KL.displayName=gJ;var vJ="DropdownMenuSeparator",XL=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Or(n);return a.jsx(tJ,{...i,...r,ref:t})});XL.displayName=vJ;var yJ="DropdownMenuArrow",xJ=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Or(n);return a.jsx(nJ,{...i,...r,ref:t})});xJ.displayName=yJ;var bJ="DropdownMenuSubTrigger",YL=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Or(n);return a.jsx(rJ,{...i,...r,ref:t})});YL.displayName=bJ;var wJ="DropdownMenuSubContent",ZL=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,i=Or(n);return a.jsx(iJ,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});ZL.displayName=wJ;var jJ=LL,SJ=BL,NJ=zL,QL=VL,JL=WL,e3=HL,t3=GL,n3=qL,r3=KL,i3=XL,s3=YL,a3=ZL;const v1=jJ,y1=SJ,_J=v.forwardRef(({className:e,inset:t,children:n,...r},i)=>a.jsxs(s3,{ref:i,className:Me("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...r,children:[n,a.jsx(ds,{className:"ml-auto h-4 w-4"})]}));_J.displayName=s3.displayName;const PJ=v.forwardRef(({className:e,...t},n)=>a.jsx(a3,{ref:n,className:Me("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));PJ.displayName=a3.displayName;const Kg=v.forwardRef(({className:e,sideOffset:t=4,...n},r)=>a.jsx(NJ,{children:a.jsx(QL,{ref:r,sideOffset:t,className:Me("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));Kg.displayName=QL.displayName;const Xo=v.forwardRef(({className:e,inset:t,...n},r)=>a.jsx(e3,{ref:r,className:Me("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));Xo.displayName=e3.displayName;const CJ=v.forwardRef(({className:e,children:t,checked:n,...r},i)=>a.jsxs(t3,{ref:i,className:Me("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(r3,{children:a.jsx(ha,{className:"h-4 w-4"})})}),t]}));CJ.displayName=t3.displayName;const AJ=v.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(n3,{ref:r,className:Me("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(r3,{children:a.jsx(ff,{className:"h-2 w-2 fill-current"})})}),t]}));AJ.displayName=n3.displayName;const EJ=v.forwardRef(({className:e,inset:t,...n},r)=>a.jsx(JL,{ref:r,className:Me("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));EJ.displayName=JL.displayName;const OJ=v.forwardRef(({className:e,...t},n)=>a.jsx(i3,{ref:n,className:Me("-mx-1 my-1 h-px bg-muted",e),...t}));OJ.displayName=i3.displayName;var d_="Dialog",[o3,l3]=Er(d_),[kJ,ss]=o3(d_),c3=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!0}=e,l=v.useRef(null),c=v.useRef(null),[u=!1,d]=ii({prop:r,defaultProp:i,onChange:s});return a.jsx(kJ,{scope:t,triggerRef:l,contentRef:c,contentId:wi(),titleId:wi(),descriptionId:wi(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(f=>!f),[d]),modal:o,children:n})};c3.displayName=d_;var u3="DialogTrigger",d3=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=ss(u3,n),s=dt(t,i.triggerRef);return a.jsx(qe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":p_(i.open),...r,ref:s,onClick:Te(e.onClick,i.onOpenToggle)})});d3.displayName=u3;var f_="DialogPortal",[TJ,f3]=o3(f_,{forceMount:void 0}),h3=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:i}=e,s=ss(f_,t);return a.jsx(TJ,{scope:t,forceMount:n,children:v.Children.map(r,o=>a.jsx(er,{present:n||s.open,children:a.jsx($y,{asChild:!0,container:i,children:o})}))})};h3.displayName=f_;var Xg="DialogOverlay",p3=v.forwardRef((e,t)=>{const n=f3(Xg,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,s=ss(Xg,e.__scopeDialog);return s.modal?a.jsx(er,{present:r||s.open,children:a.jsx($J,{...i,ref:t})}):null});p3.displayName=Xg;var $J=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=ss(Xg,n);return a.jsx(tx,{as:ca,allowPinchZoom:!0,shards:[i.contentRef],children:a.jsx(qe.div,{"data-state":p_(i.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Ol="DialogContent",m3=v.forwardRef((e,t)=>{const n=f3(Ol,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,s=ss(Ol,e.__scopeDialog);return a.jsx(er,{present:r||s.open,children:s.modal?a.jsx(IJ,{...i,ref:t}):a.jsx(MJ,{...i,ref:t})})});m3.displayName=Ol;var IJ=v.forwardRef((e,t)=>{const n=ss(Ol,e.__scopeDialog),r=v.useRef(null),i=dt(t,n.contentRef,r);return v.useEffect(()=>{const s=r.current;if(s)return XN(s)},[]),a.jsx(g3,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Te(e.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:Te(e.onPointerDownOutside,s=>{const o=s.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&s.preventDefault()}),onFocusOutside:Te(e.onFocusOutside,s=>s.preventDefault())})}),MJ=v.forwardRef((e,t)=>{const n=ss(Ol,e.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return a.jsx(g3,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,s),s.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),g3=v.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=e,l=ss(Ol,n),c=v.useRef(null),u=dt(t,c);return KN(),a.jsxs(a.Fragment,{children:[a.jsx(Jy,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:a.jsx(dp,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":p_(l.open),...o,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(DJ,{titleId:l.titleId}),a.jsx(FJ,{contentRef:c,descriptionId:l.descriptionId})]})]})}),h_="DialogTitle",v3=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=ss(h_,n);return a.jsx(qe.h2,{id:i.titleId,...r,ref:t})});v3.displayName=h_;var y3="DialogDescription",x3=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=ss(y3,n);return a.jsx(qe.p,{id:i.descriptionId,...r,ref:t})});x3.displayName=y3;var b3="DialogClose",w3=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,i=ss(b3,n);return a.jsx(qe.button,{type:"button",...r,ref:t,onClick:Te(e.onClick,()=>i.onOpenChange(!1))})});w3.displayName=b3;function p_(e){return e?"open":"closed"}var j3="DialogTitleWarning",[RJ,S3]=c7(j3,{contentName:Ol,titleName:h_,docsSlug:"dialog"}),DJ=({titleId:e})=>{const t=S3(j3),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. - -If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. - -For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return v.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},LJ="DialogDescriptionWarning",FJ=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${S3(LJ).contentName}}.`;return v.useEffect(()=>{var s;const i=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},N3=c3,BJ=d3,_3=h3,m_=p3,g_=m3,v_=v3,y_=x3,x_=w3,P3="AlertDialog",[zJ,_Oe]=Er(P3,[l3]),Na=l3(),C3=e=>{const{__scopeAlertDialog:t,...n}=e,r=Na(t);return a.jsx(N3,{...r,...n,modal:!0})};C3.displayName=P3;var UJ="AlertDialogTrigger",VJ=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,i=Na(n);return a.jsx(BJ,{...i,...r,ref:t})});VJ.displayName=UJ;var WJ="AlertDialogPortal",A3=e=>{const{__scopeAlertDialog:t,...n}=e,r=Na(t);return a.jsx(_3,{...r,...n})};A3.displayName=WJ;var HJ="AlertDialogOverlay",E3=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,i=Na(n);return a.jsx(m_,{...i,...r,ref:t})});E3.displayName=HJ;var Rc="AlertDialogContent",[GJ,qJ]=zJ(Rc),O3=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...i}=e,s=Na(n),o=v.useRef(null),l=dt(t,o),c=v.useRef(null);return a.jsx(RJ,{contentName:Rc,titleName:k3,docsSlug:"alert-dialog",children:a.jsx(GJ,{scope:n,cancelRef:c,children:a.jsxs(g_,{role:"alertdialog",...s,...i,ref:l,onOpenAutoFocus:Te(i.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=c.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:[a.jsx(JS,{children:r}),a.jsx(XJ,{contentRef:o})]})})})});O3.displayName=Rc;var k3="AlertDialogTitle",T3=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,i=Na(n);return a.jsx(v_,{...i,...r,ref:t})});T3.displayName=k3;var $3="AlertDialogDescription",I3=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,i=Na(n);return a.jsx(y_,{...i,...r,ref:t})});I3.displayName=$3;var KJ="AlertDialogAction",M3=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,i=Na(n);return a.jsx(x_,{...i,...r,ref:t})});M3.displayName=KJ;var R3="AlertDialogCancel",D3=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=qJ(R3,n),s=Na(n),o=dt(t,i);return a.jsx(x_,{...s,...r,ref:o})});D3.displayName=R3;var XJ=({contentRef:e})=>{const t=`\`${Rc}\` requires a description for the component to be accessible for screen reader users. - -You can add a description to the \`${Rc}\` by passing a \`${$3}\` component as a child, which also benefits sighted users by adding visible context to the dialog. - -Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Rc}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. - -For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return v.useEffect(()=>{var r;document.getElementById((r=e.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},YJ=C3,ZJ=A3,L3=E3,F3=O3,B3=M3,z3=D3,U3=T3,V3=I3;const x1=YJ,QJ=ZJ,W3=v.forwardRef(({className:e,...t},n)=>a.jsx(L3,{className:Me("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));W3.displayName=L3.displayName;const Yg=v.forwardRef(({className:e,...t},n)=>a.jsxs(QJ,{children:[a.jsx(W3,{}),a.jsx(F3,{ref:n,className:Me("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));Yg.displayName=F3.displayName;const Zg=({className:e,...t})=>a.jsx("div",{className:Me("flex flex-col space-y-2 text-center sm:text-left",e),...t});Zg.displayName="AlertDialogHeader";const Qg=({className:e,...t})=>a.jsx("div",{className:Me("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Qg.displayName="AlertDialogFooter";const Jg=v.forwardRef(({className:e,...t},n)=>a.jsx(U3,{ref:n,className:Me("text-lg font-semibold",e),...t}));Jg.displayName=U3.displayName;const ev=v.forwardRef(({className:e,...t},n)=>a.jsx(V3,{ref:n,className:Me("text-sm text-muted-foreground",e),...t}));ev.displayName=V3.displayName;const tv=v.forwardRef(({className:e,...t},n)=>a.jsx(B3,{ref:n,className:Me(ON(),e),...t}));tv.displayName=B3.displayName;const nv=v.forwardRef(({className:e,...t},n)=>a.jsx(z3,{ref:n,className:Me(ON({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));nv.displayName=z3.displayName;const cu=N3,JJ=_3,H3=v.forwardRef(({className:e,...t},n)=>a.jsx(m_,{ref:n,className:Me("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));H3.displayName=m_.displayName;const kl=v.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(JJ,{children:[a.jsx(H3,{}),a.jsxs(g_,{ref:r,className:Me("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,a.jsxs(x_,{className:"absolute right-4 top-4 z-[100] rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[a.jsx(js,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));kl.displayName=g_.displayName;const Tl=({className:e,...t})=>a.jsx("div",{className:Me("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Tl.displayName="DialogHeader";const uu=({className:e,...t})=>a.jsx("div",{className:Me("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});uu.displayName="DialogFooter";const $l=v.forwardRef(({className:e,...t},n)=>a.jsx(v_,{ref:n,className:Me("text-lg font-semibold leading-none tracking-tight",e),...t}));$l.displayName=v_.displayName;const mh=v.forwardRef(({className:e,...t},n)=>a.jsx(y_,{ref:n,className:Me("text-sm text-muted-foreground",e),...t}));mh.displayName=y_.displayName;var b_="Radio",[eee,G3]=Er(b_),[tee,nee]=eee(b_),q3=v.forwardRef((e,t)=>{const{__scopeRadio:n,name:r,checked:i=!1,required:s,disabled:o,value:l="on",onCheck:c,form:u,...d}=e,[f,h]=v.useState(null),p=dt(t,x=>h(x)),g=v.useRef(!1),m=f?u||!!f.closest("form"):!0;return a.jsxs(tee,{scope:n,checked:i,disabled:o,children:[a.jsx(qe.button,{type:"button",role:"radio","aria-checked":i,"data-state":Y3(i),"data-disabled":o?"":void 0,disabled:o,value:l,...d,ref:p,onClick:Te(e.onClick,x=>{i||c==null||c(),m&&(g.current=x.isPropagationStopped(),g.current||x.stopPropagation())})}),m&&a.jsx(ree,{control:f,bubbles:!g.current,name:r,value:l,checked:i,required:s,disabled:o,form:u,style:{transform:"translateX(-100%)"}})]})});q3.displayName=b_;var K3="RadioIndicator",X3=v.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:r,...i}=e,s=nee(K3,n);return a.jsx(er,{present:r||s.checked,children:a.jsx(qe.span,{"data-state":Y3(s.checked),"data-disabled":s.disabled?"":void 0,...i,ref:t})})});X3.displayName=K3;var ree=e=>{const{control:t,checked:n,bubbles:r=!0,...i}=e,s=v.useRef(null),o=Sp(n),l=hp(t);return v.useEffect(()=>{const c=s.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(o!==n&&f){const h=new Event("click",{bubbles:r});f.call(c,n),c.dispatchEvent(h)}},[o,n,r]),a.jsx("input",{type:"radio","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Y3(e){return e?"checked":"unchecked"}var iee=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],w_="RadioGroup",[see,POe]=Er(w_,[ed,G3]),Z3=ed(),Q3=G3(),[aee,oee]=see(w_),J3=v.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:r,defaultValue:i,value:s,required:o=!1,disabled:l=!1,orientation:c,dir:u,loop:d=!0,onValueChange:f,...h}=e,p=Z3(n),g=ko(u),[m,x]=ii({prop:s,defaultProp:i,onChange:f});return a.jsx(aee,{scope:n,name:r,required:o,disabled:l,value:m,onValueChange:x,children:a.jsx(JN,{asChild:!0,...p,orientation:c,dir:g,loop:d,children:a.jsx(qe.div,{role:"radiogroup","aria-required":o,"aria-orientation":c,"data-disabled":l?"":void 0,dir:g,...h,ref:t})})})});J3.displayName=w_;var e5="RadioGroupItem",t5=v.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:r,...i}=e,s=oee(e5,n),o=s.disabled||r,l=Z3(n),c=Q3(n),u=v.useRef(null),d=dt(t,u),f=s.value===i.value,h=v.useRef(!1);return v.useEffect(()=>{const p=m=>{iee.includes(m.key)&&(h.current=!0)},g=()=>h.current=!1;return document.addEventListener("keydown",p),document.addEventListener("keyup",g),()=>{document.removeEventListener("keydown",p),document.removeEventListener("keyup",g)}},[]),a.jsx(e_,{asChild:!0,...l,focusable:!o,active:f,children:a.jsx(q3,{disabled:o,required:s.required,checked:f,...c,...i,name:s.name,ref:d,onCheck:()=>s.onValueChange(i.value),onKeyDown:Te(p=>{p.key==="Enter"&&p.preventDefault()}),onFocus:Te(i.onFocus,()=>{var p;h.current&&((p=u.current)==null||p.click())})})})});t5.displayName=e5;var lee="RadioGroupIndicator",n5=v.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...r}=e,i=Q3(n);return a.jsx(X3,{...i,...r,ref:t})});n5.displayName=lee;var r5=J3,i5=t5,cee=n5;const s5=v.forwardRef(({className:e,...t},n)=>a.jsx(r5,{className:Me("grid gap-2",e),...t,ref:n}));s5.displayName=r5.displayName;const b1=v.forwardRef(({className:e,...t},n)=>a.jsx(i5,{ref:n,className:Me("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:a.jsx(cee,{className:"flex items-center justify-center",children:a.jsx(ff,{className:"h-2.5 w-2.5 fill-current text-current"})})}));b1.displayName=i5.displayName;var j_="Checkbox",[uee,COe]=Er(j_),[dee,fee]=uee(j_),a5=v.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:s,required:o,disabled:l,value:c="on",onCheckedChange:u,form:d,...f}=e,[h,p]=v.useState(null),g=dt(t,j=>p(j)),m=v.useRef(!1),x=h?d||!!h.closest("form"):!0,[b=!1,y]=ii({prop:i,defaultProp:s,onChange:u}),w=v.useRef(b);return v.useEffect(()=>{const j=h==null?void 0:h.form;if(j){const S=()=>y(w.current);return j.addEventListener("reset",S),()=>j.removeEventListener("reset",S)}},[h,y]),a.jsxs(dee,{scope:n,state:b,disabled:l,children:[a.jsx(qe.button,{type:"button",role:"checkbox","aria-checked":fo(b)?"mixed":b,"aria-required":o,"data-state":c5(b),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:g,onKeyDown:Te(e.onKeyDown,j=>{j.key==="Enter"&&j.preventDefault()}),onClick:Te(e.onClick,j=>{y(S=>fo(S)?!0:!S),x&&(m.current=j.isPropagationStopped(),m.current||j.stopPropagation())})}),x&&a.jsx(hee,{control:h,bubbles:!m.current,name:r,value:c,checked:b,required:o,disabled:l,form:d,style:{transform:"translateX(-100%)"},defaultChecked:fo(s)?!1:s})]})});a5.displayName=j_;var o5="CheckboxIndicator",l5=v.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...i}=e,s=fee(o5,n);return a.jsx(er,{present:r||fo(s.state)||s.state===!0,children:a.jsx(qe.span,{"data-state":c5(s.state),"data-disabled":s.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});l5.displayName=o5;var hee=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:i,...s}=e,o=v.useRef(null),l=Sp(n),c=hp(t);v.useEffect(()=>{const d=o.current,f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(l!==n&&p){const g=new Event("click",{bubbles:r});d.indeterminate=fo(n),p.call(d,fo(n)?!1:n),d.dispatchEvent(g)}},[l,n,r]);const u=v.useRef(fo(n)?!1:n);return a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i??u.current,...s,tabIndex:-1,ref:o,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function fo(e){return e==="indeterminate"}function c5(e){return fo(e)?"indeterminate":e?"checked":"unchecked"}var u5=a5,pee=l5;const gh=v.forwardRef(({className:e,...t},n)=>a.jsx(u5,{ref:n,className:Me("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:a.jsx(pee,{className:Me("flex items-center justify-center text-current"),children:a.jsx(ha,{className:"h-4 w-4"})})}));gh.displayName=u5.displayName;const S_=({isActive:e,isComplete:t,hasError:n,label:r,onComplete:i,className:s})=>{const[o,l]=v.useState(0),[c,u]=v.useState("progressing"),[d,f]=v.useState(!1),h=v.useRef(null),p=v.useRef(null),g=()=>{h.current&&(clearInterval(h.current),h.current=null),p.current&&(clearTimeout(p.current),p.current=null)},m=()=>{g(),l(0),u("progressing"),f(!1)},x=j=>{g(),u("completing");const S=100-j,N=50,P=500/N,_=S/P;let A=0;h.current=setInterval(()=>{A++;const O=j+_*A;O>=100||A>=P?(l(100),u("completed"),g(),p.current=setTimeout(()=>{u("hiding"),setTimeout(()=>{m(),i==null||i()},300)},2e3)):l(O)},N)},b=()=>{c==="progressing"&&x(o)},y=()=>{c==="waiting"&&x(90)},w=()=>{g()};return v.useEffect(()=>{if(e&&!d){f(!0),l(0),u("progressing");const j=90/540;let S=0;h.current=setInterval(()=>{S+=j,S>=90?(l(90),u("waiting"),g()):l(S)},100)}return t&&c==="progressing"&&b(),t&&c==="waiting"&&y(),n&&(c==="progressing"||c==="waiting")&&w(),!e&&d&&m(),()=>{e||g()}},[e,t,n,c,d]),v.useEffect(()=>()=>{g()},[]),d?a.jsxs("div",{className:Me("w-full space-y-2",s),children:[r&&a.jsxs("div",{className:"flex justify-between items-center text-sm text-muted-foreground",children:[a.jsx("span",{children:c==="waiting"?`${r} - finalizing...`:r}),a.jsxs("span",{children:[Math.round(o),"%"]})]}),a.jsx(tl,{value:o,className:Me("w-full transition-all duration-200",n&&"opacity-75",c==="completed"&&"bg-green-100")}),n&&a.jsx("div",{className:"text-sm text-red-600",children:"Generation failed. Please try again."}),c==="completed"&&!n&&a.jsx("div",{className:"text-sm text-green-600",children:"Generation completed successfully!"})]}):null},wn="all",mee=()=>{var Wt,zt,mr,Je;const e=v.useCallback(()=>{document.body.style.pointerEvents==="none"&&(console.log("ensureBodyInteractive: Fixing body pointer-events..."),document.body.style.pointerEvents="auto")},[]),t=Cn(),{loadPersonas:n}=DD(),[r,i]=v.useState("view"),[s,o]=v.useState("ai"),[l,c]=v.useState("");v.useState(null);const[u,d]=v.useState(wn),[f,h]=v.useState(!1),[p,g]=v.useState(""),[m,x]=v.useState([]),[b,y]=v.useState([]),[w,j]=v.useState(!0);v.useState(null);const[S,N]=v.useState(new Set),[P,_]=v.useState(!1),[A,O]=v.useState(null),[$,T]=v.useState(""),[M,R]=v.useState(!1),[H,F]=v.useState(null),[V,I]=v.useState(!1),[L,Z]=v.useState(null),[ee,re]=v.useState(!1),[me,z]=v.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]}),[ae,de]=v.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]}),[fe,Ne]=v.useState(!1),[he,ue]=v.useState(!1),[Ee,ie]=v.useState(!1),Xe=()=>{Ne(!1),ue(!1),ie(!1)},K=X=>{const G={age:new Set,gender:new Set,occupation:new Set,location:new Set,techSavviness:new Set,ethnicity:new Set};return X.forEach(q=>{if(q.age&&G.age.add(q.age),q.gender&&G.gender.add(q.gender),q.occupation&&G.occupation.add(q.occupation),q.location&&G.location.add(q.location),q.techSavviness!==void 0){const k=q.techSavviness<30?"Low (0-30)":q.techSavviness<70?"Medium (31-70)":"High (71-100)";G.techSavviness.add(k)}q.ethnicity&&G.ethnicity.add(q.ethnicity)}),{age:Array.from(G.age).sort(),gender:Array.from(G.gender).sort(),occupation:Array.from(G.occupation).sort(),location:Array.from(G.location).sort(),techSavviness:Array.from(G.techSavviness).sort((q,k)=>{const B=["Low (0-30)","Medium (31-70)","High (71-100)"];return B.indexOf(q)-B.indexOf(k)}),ethnicity:Array.from(G.ethnicity).sort()}},ve=()=>{re(!1),setTimeout(()=>{z({...ae})},0)},Se=()=>{de({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]})},$e=(X,G)=>{de(q=>{const k={...q};return k[X].includes(G)?k[X]=k[X].filter(B=>B!==G):k[X]=[...k[X],G],k})},E=async()=>{j(!0);try{const q=(await Nn.getAll()).data;{const B=[...q.map(W=>({...W,id:W.id||W._id}))];try{(async()=>{const ne=await n();console.log("Loaded stored personas (for debugging only):",ne?ne.length:0)})()}catch(W){console.warn("Error loading stored personas:",W)}x(B)}}catch(G){console.error("Error fetching personas:",G),Ze.error("Failed to load personas"),x([])}finally{j(!1)}},D=(X,G)=>(X.forEach(q=>{if(q.folderId){const k=G.find(B=>B.id===q.folderId);k&&!k.personaIds.includes(q.id)&&k.personaIds.push(q.id)}}),G.forEach(q=>{q.personaIds=q.personaIds.filter(k=>{const B=X.find(W=>W.id===k);return B&&(!B.folderId||B.folderId===q.id)})}),G);v.useEffect(()=>{let X=!0;const G=localStorage.getItem("persona-folders");let q=[];if(G)try{q=JSON.parse(G),y(q)}catch(B){console.error("Failed to parse stored folders:",B)}return(async()=>{if(await E(),X&&m.length>0){const B=D(m,q);y(B)}})(),()=>{X=!1}},[e]),v.useEffect(()=>{var X;if(r==="view")E();else if(r==="create"&&(console.log(`Switching to create mode with folder: ${u}, ${u!==wn?"NOT default":"IS default"}`),u!==wn)){const G=(X=b.find(q=>q.id===u))==null?void 0:X.name;console.log(`Selected folder for creation: ${u} (${G})`)}},[r]),v.useEffect(()=>{if(m.length>0){const X=b.map(q=>({...q,personaIds:[...q.personaIds]})),G=D(m,X);y(G)}},[m]),v.useEffect(()=>{E();const X=()=>{window.location.pathname.includes("/synthetic-users")&&!window.location.pathname.includes("/synthetic-users/")&&(console.log("Navigation to synthetic users page detected, refreshing data"),E())},G=()=>{console.log("Synthetic users navigation event detected, refreshing data"),E()};console.log("Setting up MutationObserver for body style");const q=new MutationObserver(k=>{k.forEach(B=>{B.type==="attributes"&&B.attributeName==="style"&&document.body.style.pointerEvents==="none"&&(console.log("MutationObserver detected pointer-events: none, fixing..."),e())})});return q.observe(document.body,{attributes:!0,attributeFilter:["style"]}),e(),window.addEventListener("popstate",X),window.addEventListener("syntheticUsersNavigation",G),()=>{window.removeEventListener("popstate",X),window.removeEventListener("syntheticUsersNavigation",G),console.log("Disconnecting MutationObserver"),q.disconnect()}},[]),v.useEffect(()=>{b.length>0&&localStorage.setItem("persona-folders",JSON.stringify(b))},[b]),v.useEffect(()=>{if(m.length>0&&b.length>0){const X=D(m,[...b]);JSON.stringify(X)!==JSON.stringify(b)&&y(X)}},[m,b.length]);const U=()=>{if(!p.trim()){Ze.error("Please enter a folder name");return}const X={id:`folder-${Date.now()}`,name:p.trim(),personaIds:[]};y([...b,X]),g(""),h(!1),Ze.success(`Folder "${p}" created`)},Q=()=>{g(""),h(!1)},te=X=>{O(X),T(X.name)},Y=()=>{if(!A||!$.trim()){O(null);return}const X=b.map(G=>G.id===A.id?{...G,name:$.trim()}:G);y(X),O(null),Ze.success(`Folder renamed to "${$}"`)},xe=()=>{O(null),T("")},je=X=>{F(X),R(!0)},Fe=()=>{H&&(y(b.filter(X=>X.id!==H.id)),u===H.id&&d(wn),R(!1),F(null),Ze.success(`Folder "${H.name}" deleted`))},ce=async(X,G)=>{var W;const q=X||S,k=G||L;if(!k||q.size===0)return;const B=Array.from(q);try{const ne=b.map(Ie=>{if(Ie.id===k){const ft=[...Ie.personaIds];return B.forEach(Ct=>{ft.includes(Ct)||ft.push(Ct)}),{...Ie,personaIds:ft}}else return{...Ie,personaIds:Ie.personaIds.filter(ft=>!B.includes(ft))}});y(ne),localStorage.setItem("persona-folders",JSON.stringify(ne));const J=B.map(async Ie=>{try{const ft=m.find(Ct=>Ct.id===Ie);if(ft){const Ct={...ft,folderId:k===wn?null:k},pt=ft._id||ft.id;return await Nn.update(pt,Ct),{success:!0,id:Ie}}return{success:!1,id:Ie,error:"Persona not found locally"}}catch(ft){return console.error(`Failed to update folder for persona ${Ie}:`,ft),{success:!1,id:Ie,error:ft}}}),ye=await Promise.all(J),se=ye.filter(Ie=>Ie.success).map(Ie=>Ie.id),Pe=ye.filter(Ie=>!Ie.success),_e=m.map(Ie=>se.includes(Ie.id)?{...Ie,folderId:k===wn?null:k}:Ie);x(_e);const et=k===wn?"All Personas":((W=b.find(Ie=>Ie.id===k))==null?void 0:W.name)||"folder";return se.length>0&&Ze.success(`Moved ${se.length} persona${se.length!==1?"s":""} to ${et}`),Pe.length>0&&(Ze.error(`Failed to move ${Pe.length} persona${Pe.length!==1?"s":""}.`),console.error("Failed updates:",Pe)),X||N(new Set),{success:se.length>0,successCount:se.length,failureCount:Pe.length}}catch(ne){return console.error("Error moving personas to folder:",ne),Ze.error("An unexpected error occurred while moving personas."),{success:!1,error:ne}}},ke=async()=>{var W;if(S.size===0||u===wn)return;const X=Array.from(S),G=b.map(ne=>ne.id===u?{...ne,personaIds:ne.personaIds.filter(J=>!X.includes(J))}:ne);y(G);const q=[],k=[];for(const ne of X)try{const J=m.find(ye=>ye.id===ne);if(J){const ye={...J,folderId:null},se=J._id||J.id;await Nn.update(se,ye),q.push(ne)}}catch(J){console.error(`Failed to update persona ${ne}:`,J),k.push(ne)}x(ne=>ne.map(J=>q.includes(J.id)?{...J,folderId:null}:J)),N(new Set);const B=((W=b.find(ne=>ne.id===u))==null?void 0:W.name)||"folder";q.length>0&&Ze.success(`Removed ${q.length} persona${q.length!==1?"s":""} from ${B}`),k.length>0&&Ze.error(`Failed to remove ${k.length} persona${k.length!==1?"s":""} from ${B}`)},Be=X=>{N(G=>{const q=new Set(G);return q.has(X)?q.delete(X):q.add(X),q})},mt=()=>{S.size===Pt.length?N(new Set):N(new Set(Pt.map(X=>X.id)))},_t=async()=>{if(S.size===0)return;const X=Array.from(S);N(new Set),_(!1),j(!0);const G=[],q=[];for(const k of X)try{const B=m.find(ne=>ne.id===k);if(!B){console.error(`Could not find persona with id: ${k}`),q.push(k);continue}let W=k;B._id&&(W=B._id.toString()),console.log(`Attempting to delete persona: ${W}`),await Nn.delete(W),G.push(k)}catch(B){console.error(`Failed to delete persona ${k}:`,B),q.push(k)}x(k=>k.filter(B=>!G.includes(B.id))),y(k=>{const B=k.map(W=>({...W,personaIds:W.personaIds.filter(ne=>!G.includes(ne))}));return localStorage.setItem("persona-folders",JSON.stringify(B)),B}),j(!1),setTimeout(()=>{G.length>0&&Ze.success(`Successfully deleted ${G.length} persona${G.length!==1?"s":""}`),q.length>0&&Ze.error(`Failed to delete ${q.length} persona${q.length!==1?"s":""}`),(G.length>0||q.length>0)&&E()},50)},Pt=m.filter(X=>{const G=X.name.toLowerCase().includes(l.toLowerCase())||X.occupation.toLowerCase().includes(l.toLowerCase())||X.location.toLowerCase().includes(l.toLowerCase()),q=(me.age.length===0||me.age.includes(X.age))&&(me.gender.length===0||me.gender.includes(X.gender))&&(me.occupation.length===0||me.occupation.includes(X.occupation))&&(me.location.length===0||me.location.includes(X.location))&&(me.ethnicity.length===0||X.ethnicity&&me.ethnicity.includes(X.ethnicity))&&(me.techSavviness.length===0||X.techSavviness!==void 0&&me.techSavviness.includes(X.techSavviness<30?"Low (0-30)":X.techSavviness<70?"Medium (31-70)":"High (71-100)"))&&!0;if(u===wn||X.folderId===u)return G&&q;const k=b.find(B=>B.id===u);return k&&k.personaIds.includes(X.id)&&G&&q}),qt=(X,G)=>{const q=new Date().toISOString().split("T")[0],k=X.length;let B=`# Persona Summary Report - -`;return B+=`**Folder:** ${G} -`,B+=`**Date:** ${q} -`,B+=`**Total Personas:** ${k} - -`,k===0?(B+=`No personas found in this folder. -`,B):(X.forEach((W,ne)=>{B+=`## ${W.name} - -`,B+=`### Demographics -`,B+=`- **Age:** ${W.age} -`,B+=`- **Gender:** ${W.gender} -`,B+=`- **Occupation:** ${W.occupation} -`,B+=`- **Location:** ${W.location} - -`,W.aiSynthesizedBio&&(B+=`### AI-Synthesized Bio -`,B+=`${W.aiSynthesizedBio} - -`),W.qualitativeAttributes&&W.qualitativeAttributes.length>0&&(B+=`### Key Attributes -`,W.qualitativeAttributes.forEach(J=>{B+=`- ๐Ÿท๏ธ ${J} -`}),B+=` -`),W.topPersonalityTraits&&W.topPersonalityTraits.length>0&&(B+=`### Top Personality Traits -`,W.topPersonalityTraits.forEach(J=>{B+=`- ๐Ÿง  ${J} -`}),B+=` -`),ne{var q,k,B,W,ne;const X=u===wn?"All Personas":((q=b.find(J=>J.id===u))==null?void 0:q.name)||"Unknown Folder";if(Pt.length===0){Ze.error("No personas to download");return}const G=Pt.map(J=>J._id||J.id);Ne(!0),ue(!1),ie(!1),j(!0);try{Ze.info("Generating persona summaries...",{description:`Processing ${Pt.length} persona${Pt.length!==1?"s":""} with AI`});const J=await Us.batchGenerateSummaries(G,.7),{summaries:ye,summary_stats:se,errors:Pe}=J.data,_e=new Date().toISOString().split("T")[0],et=`persona-summary-${X.toLowerCase().replace(/\s+/g,"-")}-${_e}.md`;let Ie=`# Persona Summary Report - -`;Ie+=`**Folder:** ${X} -`,Ie+=`**Date:** ${_e} -`,Ie+=`**Total Personas:** ${se.total_requested} -`,Ie+=`**Successfully Processed:** ${se.total_successful} -`,se.total_failed>0&&(Ie+=`**Failed to Process:** ${se.total_failed} -`),Ie+=` ---- - -`,ye.length===0?Ie+=`No persona summaries could be generated. -`:ye.forEach((pt,tr)=>{Ie+=`# ${pt.persona_name} - -`,Ie+=`${pt.summary} - -`,tr0||((B=Pe.missing_personas)==null?void 0:B.length)>0)&&(Ie+=` ---- - -## Processing Errors - -`,((W=Pe.failed_summaries)==null?void 0:W.length)>0&&(Ie+=`### Failed to Generate Summaries -`,Pe.failed_summaries.forEach(pt=>{Ie+=`- **${pt.persona_name}** (ID: ${pt.persona_id}): ${pt.error} -`}),Ie+=` -`),((ne=Pe.missing_personas)==null?void 0:ne.length)>0&&(Ie+=`### Missing Personas -`,Pe.missing_personas.forEach(pt=>{Ie+=`- ID: ${pt} -`})));const ft=document.createElement("a"),Ct=new Blob([Ie],{type:"text/markdown"});ft.href=URL.createObjectURL(Ct),ft.download=et,document.body.appendChild(ft),ft.click(),document.body.removeChild(ft),ue(!0),se.total_successful===se.total_requested?Ze.success("Persona summary downloaded",{description:`Successfully processed all ${se.total_successful} persona${se.total_successful!==1?"s":""} from "${X}"`}):Ze.success("Persona summary downloaded with warnings",{description:`Processed ${se.total_successful} of ${se.total_requested} personas from "${X}"`})}catch(J){console.error("Error generating persona summaries:",J),ie(!0),Ze.error("AI summary generation failed, creating basic summary",{description:"Using simplified format due to processing error"});try{const ye=new Date().toISOString().split("T")[0],se=`persona-summary-basic-${X.toLowerCase().replace(/\s+/g,"-")}-${ye}.md`,Pe=qt(Pt,X),_e=document.createElement("a"),et=new Blob([Pe],{type:"text/markdown"});_e.href=URL.createObjectURL(et),_e.download=se,document.body.appendChild(_e),_e.click(),document.body.removeChild(_e)}catch{Ze.error("Failed to create persona summary",{description:"Unable to generate summary in any format"})}}finally{j(!1)}};return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(ea,{}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center mb-8",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"font-sf text-3xl font-bold text-slate-900",children:"Synthetic Personas"}),a.jsx("p",{className:"text-slate-600 mt-1",children:"Create and manage AI-generated research participants"})]}),a.jsx("div",{className:"mt-4 sm:mt-0 flex flex-col items-end gap-3",children:a.jsxs("div",{className:"flex items-center gap-3",children:[r==="view"&&Pt.length>0&&a.jsxs(oe,{variant:"outline",onClick:mn,disabled:fe,className:"flex items-center gap-2 hover-transition",children:[a.jsx(Ku,{className:"h-4 w-4"}),fe?"Generating Summary...":"Download Persona Summary"]}),a.jsx(oe,{onClick:()=>i(r==="view"?"create":"view"),className:"hover-transition",children:r==="view"?"Create New Personas":"View All Personas"})]})})]}),r==="view"&&Pt.length>0&&fe&&a.jsx("div",{className:"mb-6",children:a.jsx(S_,{isActive:fe,isComplete:he,hasError:Ee,label:"Generating comprehensive persona summaries",onComplete:Xe,className:"max-w-4xl mx-auto"})}),r==="view"?a.jsx(a.Fragment,{children:a.jsxs("div",{className:"flex flex-col md:flex-row gap-6 mb-6",children:[a.jsxs("div",{className:"w-full md:w-64 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"text-sm font-medium",children:"Folders"}),a.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>h(!0),className:"h-7 w-7 p-0",children:a.jsx(bR,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("button",{onClick:()=>d(wn),className:`w-full flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${u===wn?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(Li,{className:"h-4 w-4"}),a.jsx("span",{children:"All Personas"})]}),b.map(X=>a.jsx("div",{className:"flex items-center justify-between group",children:A&&A.id===X.id?a.jsxs("div",{className:"flex-1 flex items-center px-3 py-2 space-x-2",children:[a.jsx(Li,{className:"h-4 w-4"}),a.jsx(St,{value:$,onChange:G=>T(G.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:G=>{G.key==="Enter"?Y():G.key==="Escape"&&xe()}}),a.jsx(oe,{size:"sm",variant:"ghost",onClick:Y,className:"h-7 w-7 p-0",children:a.jsx(ha,{className:"h-4 w-4"})}),a.jsx(oe,{size:"sm",variant:"ghost",onClick:xe,className:"h-7 w-7 p-0",children:a.jsx(js,{className:"h-4 w-4"})})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>d(X.id),className:`flex-1 flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${u===X.id?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(Li,{className:"h-4 w-4"}),a.jsx("span",{children:X.name}),a.jsx("span",{className:"text-muted-foreground text-xs ml-auto",children:X.personaIds.length})]}),a.jsxs(v1,{children:[a.jsx(y1,{asChild:!0,children:a.jsx(oe,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100",children:a.jsx(Vw,{className:"h-4 w-4"})})}),a.jsxs(Kg,{align:"end",children:[a.jsx(Xo,{onClick:()=>te(X),children:"Rename"}),a.jsx(Xo,{className:"text-red-600",onClick:()=>je(X),children:"Delete"})]})]})]})},X.id)),f&&a.jsxs("div",{className:"flex items-center px-3 py-2 space-x-2",children:[a.jsxs("div",{className:"flex-1 flex items-center space-x-2",children:[a.jsx(Li,{className:"h-4 w-4"}),a.jsx(St,{value:p,onChange:X=>g(X.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:X=>{X.key==="Enter"?U():X.key==="Escape"&&Q()}})]}),a.jsx(oe,{size:"sm",variant:"ghost",onClick:U,className:"h-7 w-7 p-0",children:a.jsx(ha,{className:"h-4 w-4"})}),a.jsx(oe,{size:"sm",variant:"ghost",onClick:Q,className:"h-7 w-7 p-0",children:a.jsx(js,{className:"h-4 w-4"})})]})]})]}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-6",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx(jN,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(St,{placeholder:"Search personas by name, occupation, or location...",className:"pl-10 bg-white",value:l,onChange:X=>c(X.target.value)})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[S.size>0&&a.jsxs(v1,{children:[a.jsx(y1,{asChild:!0,children:a.jsxs(oe,{variant:"outline",size:"sm",className:"flex items-center gap-2",onClick:X=>{X.stopPropagation()},children:[a.jsxs("span",{children:["Actions (",S.size,")"]}),a.jsx(Vw,{className:"h-4 w-4"})]})}),a.jsxs(Kg,{align:"end",onCloseAutoFocus:X=>{X.preventDefault()},children:[a.jsxs(Xo,{className:"flex items-center gap-2 cursor-pointer",onClick:X=>{X.preventDefault(),X.stopPropagation(),_(!0)},children:[a.jsx(gn,{className:"h-4 w-4"}),"Delete"]}),a.jsxs(Xo,{className:"flex items-center gap-2 cursor-pointer",onClick:X=>{X.preventDefault(),X.stopPropagation(),I(!0)},children:[a.jsx(Li,{className:"h-4 w-4"}),"Move to folder"]}),u!==wn&&a.jsxs(Xo,{className:"flex items-center gap-2 cursor-pointer",onClick:X=>{X.preventDefault(),X.stopPropagation(),ke()},children:[a.jsx(js,{className:"h-4 w-4"}),"Remove from ",((Wt=b.find(X=>X.id===u))==null?void 0:Wt.name)||"folder"]})]})]}),a.jsxs(oe,{variant:"outline",className:"flex items-center gap-2",onClick:()=>re(!0),children:[a.jsx(bN,{className:"h-4 w-4"}),a.jsxs("span",{children:["Filter",Object.values(me).some(X=>X.length>0)?` (${Object.values(me).reduce((X,G)=>X+G.length,0)})`:""]})]})]})]}),a.jsxs("div",{className:"glass-panel rounded-xl p-6 mb-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Hn,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:u===wn?"Your Synthetic Persona Library":((zt=b.find(X=>X.id===u))==null?void 0:zt.name)||"Personas"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:["(",Pt.length,")"]})]}),Pt.length>0&&a.jsxs("div",{className:"flex items-center",children:[a.jsx(gh,{id:"select-all",checked:Pt.length>0&&S.size===Pt.length,onCheckedChange:mt,className:"mr-2"}),a.jsx("label",{htmlFor:"select-all",className:"text-sm cursor-pointer",children:"Select All"})]})]}),Pt.length>0?a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-1 lg:grid-cols-2 xl:grid-cols-2 gap-4",children:Pt.map(X=>a.jsx("div",{className:"relative group",children:a.jsx(zN,{user:X,selected:S.has(X.id),onClick:()=>t(`/synthetic-users/${X._id||X.id}`),onSelectionToggle:G=>{G.stopPropagation(),Be(X.id)},showAddToFolderButton:!1})},X.id))}):a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-muted-foreground",children:"No personas found matching your criteria."})})]}),a.jsx(x1,{open:P,onOpenChange:X=>{_(X||!1)},children:a.jsxs(Yg,{onInteractOutside:X=>{X.preventDefault()},children:[a.jsxs(Zg,{children:[a.jsx(Jg,{children:"Delete Personas"}),a.jsxs(ev,{children:["Are you sure you want to delete ",S.size," selected persona",S.size!==1?"s":"","? This action cannot be undone."]})]}),a.jsxs(Qg,{children:[a.jsx(nv,{onClick:()=>{setTimeout(()=>N(new Set),50)},children:"Cancel"}),a.jsx(tv,{onClick:_t,className:"bg-red-600 hover:bg-red-700",children:"Delete"})]})]})}),a.jsx(x1,{open:M,onOpenChange:X=>{R(X||!1)},children:a.jsxs(Yg,{children:[a.jsxs(Zg,{children:[a.jsx(Jg,{children:"Delete Folder"}),a.jsxs(ev,{children:['Are you sure you want to delete the folder "',H==null?void 0:H.name,'"?',a.jsx("br",{}),a.jsx("br",{}),a.jsx("strong",{children:"Note:"})," Any personas in this folder will not be deleted - they will still be available under 'All Personas' after folder deletion."]})]}),a.jsxs(Qg,{children:[a.jsx(nv,{children:"Cancel"}),a.jsx(tv,{onClick:Fe,className:"bg-red-600 hover:bg-red-700",children:"Delete"})]})]})}),a.jsx(cu,{open:V,onOpenChange:X=>{I(X||!1)},children:a.jsxs(kl,{className:"z-50",children:[a.jsxs(Tl,{children:[a.jsx($l,{children:"Move to Folder"}),a.jsxs(mh,{children:["Choose a folder to move ",S.size," selected persona",S.size!==1?"s":""," to."]})]}),a.jsx("div",{className:"py-4",children:a.jsxs(s5,{value:L||"",onValueChange:Z,className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(b1,{value:wn,id:"folder-all"}),a.jsxs(uo,{htmlFor:"folder-all",className:"flex items-center gap-2",children:[a.jsx(Li,{className:"h-4 w-4"}),a.jsx("span",{children:"All Personas (Remove from folders)"})]})]}),b.map(X=>a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(b1,{value:X.id,id:`folder-${X.id}`}),a.jsxs(uo,{htmlFor:`folder-${X.id}`,className:"flex items-center gap-2",children:[a.jsx(Li,{className:"h-4 w-4"}),a.jsx("span",{children:X.name})]})]},X.id))]})}),a.jsxs(uu,{children:[a.jsx(oe,{variant:"outline",onClick:X=>{X.preventDefault(),X.stopPropagation(),I(!1),Z(null)},children:"Cancel"}),a.jsx(oe,{onClick:async X=>{if(X.preventDefault(),X.stopPropagation(),!L)return;const G=new Set(S),q=L;if(I(!1),Z(null),q&&G.size>0){j(!0);try{await ce(G,q)}finally{j(!1),N(new Set)}}},disabled:!L,children:"Move"})]})]})}),a.jsx(cu,{open:ee,onOpenChange:X=>{X?(re(X),de({...me})):(S.size>0&&N(new Set),re(!1))},children:a.jsxs(kl,{className:"max-w-4xl max-h-[80vh] flex flex-col",onInteractOutside:X=>{X.preventDefault()},children:[a.jsx("div",{className:"sticky top-0 bg-background border-b shadow-sm pb-4 z-10",children:a.jsxs(Tl,{children:[a.jsx($l,{children:"Filter Personas"}),a.jsx(mh,{children:"Select attributes to filter personas by. Multiple selections within a category use OR logic, different categories use AND logic. Filter options dynamically update to show only relevant values."})]})}),a.jsxs("div",{className:"flex-1 overflow-y-auto px-1 py-4 space-y-6",children:[Object.values(ae).some(X=>X.length>0)&&a.jsx("div",{className:"bg-muted/30 p-3 rounded-md",children:a.jsxs("p",{className:"text-sm text-muted-foreground",children:[Object.values(ae).reduce((X,G)=>X+G.length,0)," active filters"]})}),a.jsx("div",{className:"space-y-4",children:(()=>{const X=B=>{const W={...ae};W[B]=[];const ne=m.filter(J=>Object.entries(W).every(([ye,se])=>{if(se.length===0)return!0;const Pe=ye;if(Pe==="techSavviness"&&J.techSavviness!==void 0){const _e=J.techSavviness<30?"Low (0-30)":J.techSavviness<70?"Medium (31-70)":"High (71-100)";return se.includes(_e)}else{if(Pe==="age"&&J.age)return se.includes(J.age);if(Pe==="gender"&&J.gender)return se.includes(J.gender);if(Pe==="occupation"&&J.occupation)return se.includes(J.occupation);if(Pe==="location"&&J.location)return se.includes(J.location);if(Pe==="ethnicity"&&J.ethnicity)return se.includes(J.ethnicity)}return!0}));return K(ne)},G=Object.values(ae).every(B=>B.length===0),q=K(m),k=(B,W,ne,J=1)=>{const ye=ae[W],se=[...new Set([...ne,...ye])].sort();return se.length===0?null:a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium mb-3",children:B}),a.jsx("div",{className:`grid grid-cols-1 ${J===2?"sm:grid-cols-2":J===3?"sm:grid-cols-2 md:grid-cols-3":""} gap-2`,children:se.map(Pe=>{const _e=ae[W].includes(Pe),et=ne.includes(Pe);return a.jsxs("div",{className:`flex items-center space-x-2 ${!et&&!_e?"opacity-50":""}`,children:[a.jsx(gh,{id:`${W}-${Pe}`,checked:_e,onCheckedChange:()=>$e(W,Pe),disabled:!et&&!_e}),a.jsxs(uo,{htmlFor:`${W}-${Pe}`,className:"truncate overflow-hidden",children:[Pe,_e&&!et&&a.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:"(no matches)"})]})]},Pe)})})]})};return a.jsxs(a.Fragment,{children:[k("Gender","gender",G?q.gender:X("gender").gender,3),k("Age","age",G?q.age:X("age").age,3),k("Ethnicity","ethnicity",G?q.ethnicity:X("ethnicity").ethnicity,2),k("Location","location",G?q.location:X("location").location,2),k("Occupation","occupation",G?q.occupation:X("occupation").occupation,2),k("Tech Savviness","techSavviness",G?q.techSavviness:X("techSavviness").techSavviness,3),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-6"})]})})()})]}),a.jsx("div",{className:"sticky bottom-0 bg-background border-t shadow-[0_-2px_4px_rgba(0,0,0,0.05)] pt-4 z-10",children:a.jsxs(uu,{children:[a.jsx(oe,{variant:"outline",onClick:Se,children:"Reset"}),a.jsx(oe,{onClick:ve,children:"Apply Filters"})]})})]})})]})]})}):a.jsxs(Io,{defaultValue:"ai",onValueChange:X=>o(X),children:[a.jsxs(Sa,{className:"grid w-full grid-cols-2 mb-6",children:[a.jsx(Ft,{value:"ai",children:"AI Recruiter"}),a.jsx(Ft,{value:"manual",children:"Manual Creation"})]}),a.jsxs(Bt,{value:"ai",children:[console.log(`Rendering AIRecruiter with targetFolderId: ${u!==wn?u:"null"}`),console.log("Current folders:",b.map(X=>({id:X.id,name:X.name}))),a.jsx(rY,{targetFolderId:u!==wn?u:null,targetFolderName:u!==wn?(mr=b.find(X=>X.id===u))==null?void 0:mr.name:null})]}),a.jsx(Bt,{value:"manual",children:a.jsx(gQ,{targetFolderId:u!==wn?u:null,targetFolderName:u!==wn?(Je=b.find(X=>X.id===u))==null?void 0:Je.name:null})})]})]})]})},gee="modulepreload",vee=function(e){return"/semblance/"+e},CE={},yee=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));i=Promise.allSettled(n.map(c=>{if(c=vee(c),c in CE)return;CE[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":gee,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((h,p)=>{f.addEventListener("load",h),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return i.then(o=>{for(const l of o||[])l.status==="rejected"&&s(l.reason);return t().catch(s)})};function xee(){for(var e=arguments.length,t=new Array(e),n=0;nr=>{t.forEach(i=>i(r))},t)}const cx=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function td(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function N_(e){return"nodeType"in e}function Ur(e){var t,n;return e?td(e)?e:N_(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function __(e){const{Document:t}=Ur(e);return e instanceof t}function Cp(e){return td(e)?!1:e instanceof Ur(e).HTMLElement}function d5(e){return e instanceof Ur(e).SVGElement}function nd(e){return e?td(e)?e.document:N_(e)?__(e)?e:Cp(e)||d5(e)?e.ownerDocument:document:document:document}const Os=cx?v.useLayoutEffect:v.useEffect;function P_(e){const t=v.useRef(e);return Os(()=>{t.current=e}),v.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i{e.current=setInterval(r,i)},[]),n=v.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function vh(e,t){t===void 0&&(t=[e]);const n=v.useRef(e);return Os(()=>{n.current!==e&&(n.current=e)},t),n}function Ap(e,t){const n=v.useRef();return v.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function rv(e){const t=P_(e),n=v.useRef(null),r=v.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function w1(e){const t=v.useRef();return v.useEffect(()=>{t.current=e},[e]),t.current}let rb={};function Ep(e,t){return v.useMemo(()=>{if(t)return t;const n=rb[e]==null?0:rb[e]+1;return rb[e]=n,e+"-"+n},[e,t])}function f5(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i{const l=Object.entries(o);for(const[c,u]of l){const d=s[c];d!=null&&(s[c]=d+e*u)}return s},{...t})}}const Dc=f5(1),yh=f5(-1);function wee(e){return"clientX"in e&&"clientY"in e}function C_(e){if(!e)return!1;const{KeyboardEvent:t}=Ur(e.target);return t&&e instanceof t}function jee(e){if(!e)return!1;const{TouchEvent:t}=Ur(e.target);return t&&e instanceof t}function j1(e){if(jee(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return wee(e)?{x:e.clientX,y:e.clientY}:null}const du=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[du.Translate.toString(e),du.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),AE="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function See(e){return e.matches(AE)?e:e.querySelector(AE)}const Nee={display:"none"};function _ee(e){let{id:t,value:n}=e;return C.createElement("div",{id:t,style:Nee},n)}function Pee(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return C.createElement("div",{id:t,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function Cee(){const[e,t]=v.useState("");return{announce:v.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const h5=v.createContext(null);function Aee(e){const t=v.useContext(h5);v.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function Eee(){const[e]=v.useState(()=>new Set),t=v.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[v.useCallback(r=>{let{type:i,event:s}=r;e.forEach(o=>{var l;return(l=o[i])==null?void 0:l.call(o,s)})},[e]),t]}const Oee={draggable:` - To pick up a draggable item, press the space bar. - While dragging, use the arrow keys to move the item. - Press space again to drop the item in its new position, or press escape to cancel. - `},kee={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Tee(e){let{announcements:t=kee,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Oee}=e;const{announce:s,announcement:o}=Cee(),l=Ep("DndLiveRegion"),[c,u]=v.useState(!1);if(v.useEffect(()=>{u(!0)},[]),Aee(v.useMemo(()=>({onDragStart(f){let{active:h}=f;s(t.onDragStart({active:h}))},onDragMove(f){let{active:h,over:p}=f;t.onDragMove&&s(t.onDragMove({active:h,over:p}))},onDragOver(f){let{active:h,over:p}=f;s(t.onDragOver({active:h,over:p}))},onDragEnd(f){let{active:h,over:p}=f;s(t.onDragEnd({active:h,over:p}))},onDragCancel(f){let{active:h,over:p}=f;s(t.onDragCancel({active:h,over:p}))}}),[s,t])),!c)return null;const d=C.createElement(C.Fragment,null,C.createElement(_ee,{id:r,value:i.draggable}),C.createElement(Pee,{id:l,announcement:o}));return n?Vi.createPortal(d,n):d}var Tn;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Tn||(Tn={}));function iv(){}function EE(e,t){return v.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function $ee(){for(var e=arguments.length,t=new Array(e),n=0;n[...t].filter(r=>r!=null),[...t])}const ts=Object.freeze({x:0,y:0});function p5(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function m5(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Iee(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function OE(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function g5(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function kE(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const Mee=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=kE(t,t.left,t.top),s=[];for(const o of r){const{id:l}=o,c=n.get(l);if(c){const u=p5(kE(c),i);s.push({id:l,data:{droppableContainer:o,value:u}})}}return s.sort(m5)},Ree=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=OE(t),s=[];for(const o of r){const{id:l}=o,c=n.get(l);if(c){const u=OE(c),d=i.reduce((h,p,g)=>h+p5(u[g],p),0),f=Number((d/4).toFixed(4));s.push({id:l,data:{droppableContainer:o,value:f}})}}return s.sort(m5)};function Dee(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),s=Math.min(t.top+t.height,e.top+e.height),o=i-r,l=s-n;if(r{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const s of r){const{id:o}=s,l=n.get(o);if(l){const c=Dee(l,t);c>0&&i.push({id:o,data:{droppableContainer:s,value:c}})}}return i.sort(Iee)};function Fee(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function v5(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ts}function Bee(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),s=1;s({...o,top:o.top+e*l.y,bottom:o.bottom+e*l.y,left:o.left+e*l.x,right:o.right+e*l.x}),{...n})}}const zee=Bee(1);function Uee(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Vee(e,t,n){const r=Uee(t);if(!r)return e;const{scaleX:i,scaleY:s,x:o,y:l}=r,c=e.left-o-(1-i)*parseFloat(n),u=e.top-l-(1-s)*parseFloat(n.slice(n.indexOf(" ")+1)),d=i?e.width/i:e.width,f=s?e.height/s:e.height;return{width:d,height:f,top:u,right:c+d,bottom:u+f,left:c}}const Wee={ignoreTransform:!1};function rd(e,t){t===void 0&&(t=Wee);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:d}=Ur(e).getComputedStyle(e);u&&(n=Vee(n,u,d))}const{top:r,left:i,width:s,height:o,bottom:l,right:c}=n;return{top:r,left:i,width:s,height:o,bottom:l,right:c}}function TE(e){return rd(e,{ignoreTransform:!0})}function Hee(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Gee(e,t){return t===void 0&&(t=Ur(e).getComputedStyle(e)),t.position==="fixed"}function qee(e,t){t===void 0&&(t=Ur(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const s=t[i];return typeof s=="string"?n.test(s):!1})}function ux(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(__(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Cp(i)||d5(i)||n.includes(i))return n;const s=Ur(e).getComputedStyle(i);return i!==e&&qee(i,s)&&n.push(i),Gee(i,s)?n:r(i.parentNode)}return e?r(e):n}function y5(e){const[t]=ux(e,1);return t??null}function ib(e){return!cx||!e?null:td(e)?e:N_(e)?__(e)||e===nd(e).scrollingElement?window:Cp(e)?e:null:null}function x5(e){return td(e)?e.scrollX:e.scrollLeft}function b5(e){return td(e)?e.scrollY:e.scrollTop}function S1(e){return{x:x5(e),y:b5(e)}}var zn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(zn||(zn={}));function w5(e){return!cx||!e?!1:e===document.scrollingElement}function j5(e){const t={x:0,y:0},n=w5(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,o=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:i,isLeft:s,isBottom:o,isRight:l,maxScroll:r,minScroll:t}}const Kee={x:.2,y:.2};function Xee(e,t,n,r,i){let{top:s,left:o,right:l,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=Kee);const{isTop:u,isBottom:d,isLeft:f,isRight:h}=j5(e),p={x:0,y:0},g={x:0,y:0},m={height:t.height*i.y,width:t.width*i.x};return!u&&s<=t.top+m.height?(p.y=zn.Backward,g.y=r*Math.abs((t.top+m.height-s)/m.height)):!d&&c>=t.bottom-m.height&&(p.y=zn.Forward,g.y=r*Math.abs((t.bottom-m.height-c)/m.height)),!h&&l>=t.right-m.width?(p.x=zn.Forward,g.x=r*Math.abs((t.right-m.width-l)/m.width)):!f&&o<=t.left+m.width&&(p.x=zn.Backward,g.x=r*Math.abs((t.left+m.width-o)/m.width)),{direction:p,speed:g}}function Yee(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:o}=window;return{top:0,left:0,right:s,bottom:o,width:s,height:o}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function S5(e){return e.reduce((t,n)=>Dc(t,S1(n)),ts)}function Zee(e){return e.reduce((t,n)=>t+x5(n),0)}function Qee(e){return e.reduce((t,n)=>t+b5(n),0)}function Jee(e,t){if(t===void 0&&(t=rd),!e)return;const{top:n,left:r,bottom:i,right:s}=t(e);y5(e)&&(i<=0||s<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const ete=[["x",["left","right"],Zee],["y",["top","bottom"],Qee]];class A_{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=ux(n),i=S5(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[s,o,l]of ete)for(const c of o)Object.defineProperty(this,c,{get:()=>{const u=l(r),d=i[s]-u;return this.rect[c]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class mf{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function tte(e){const{EventTarget:t}=Ur(e);return e instanceof t?e:nd(e)}function sb(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var hi;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(hi||(hi={}));function $E(e){e.preventDefault()}function nte(e){e.stopPropagation()}var kt;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(kt||(kt={}));const N5={start:[kt.Space,kt.Enter],cancel:[kt.Esc],end:[kt.Space,kt.Enter,kt.Tab]},rte=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case kt.Right:return{...n,x:n.x+25};case kt.Left:return{...n,x:n.x-25};case kt.Down:return{...n,y:n.y+25};case kt.Up:return{...n,y:n.y-25}}};class E_{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new mf(nd(n)),this.windowListeners=new mf(Ur(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(hi.Resize,this.handleCancel),this.windowListeners.add(hi.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(hi.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&Jee(r),n(ts)}handleKeyDown(t){if(C_(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:s=N5,coordinateGetter:o=rte,scrollBehavior:l="smooth"}=i,{code:c}=t;if(s.end.includes(c)){this.handleEnd(t);return}if(s.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:u}=r.current,d=u?{x:u.left,y:u.top}:ts;this.referenceCoordinates||(this.referenceCoordinates=d);const f=o(t,{active:n,context:r.current,currentCoordinates:d});if(f){const h=yh(f,d),p={x:0,y:0},{scrollableAncestors:g}=r.current;for(const m of g){const x=t.code,{isTop:b,isRight:y,isLeft:w,isBottom:j,maxScroll:S,minScroll:N}=j5(m),P=Yee(m),_={x:Math.min(x===kt.Right?P.right-P.width/2:P.right,Math.max(x===kt.Right?P.left:P.left+P.width/2,f.x)),y:Math.min(x===kt.Down?P.bottom-P.height/2:P.bottom,Math.max(x===kt.Down?P.top:P.top+P.height/2,f.y))},A=x===kt.Right&&!y||x===kt.Left&&!w,O=x===kt.Down&&!j||x===kt.Up&&!b;if(A&&_.x!==f.x){const $=m.scrollLeft+h.x,T=x===kt.Right&&$<=S.x||x===kt.Left&&$>=N.x;if(T&&!h.y){m.scrollTo({left:$,behavior:l});return}T?p.x=m.scrollLeft-$:p.x=x===kt.Right?m.scrollLeft-S.x:m.scrollLeft-N.x,p.x&&m.scrollBy({left:-p.x,behavior:l});break}else if(O&&_.y!==f.y){const $=m.scrollTop+h.y,T=x===kt.Down&&$<=S.y||x===kt.Up&&$>=N.y;if(T&&!h.x){m.scrollTo({top:$,behavior:l});return}T?p.y=m.scrollTop-$:p.y=x===kt.Down?m.scrollTop-S.y:m.scrollTop-N.y,p.y&&m.scrollBy({top:-p.y,behavior:l});break}}this.handleMove(t,Dc(yh(f,this.referenceCoordinates),p))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}E_.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=N5,onActivation:i}=t,{active:s}=n;const{code:o}=e.nativeEvent;if(r.start.includes(o)){const l=s.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),i==null||i({event:e.nativeEvent}),!0)}return!1}}];function IE(e){return!!(e&&"distance"in e)}function ME(e){return!!(e&&"delay"in e)}class O_{constructor(t,n,r){var i;r===void 0&&(r=tte(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:s}=t,{target:o}=s;this.props=t,this.events=n,this.document=nd(o),this.documentListeners=new mf(this.document),this.listeners=new mf(r),this.windowListeners=new mf(Ur(o)),this.initialCoordinates=(i=j1(s))!=null?i:ts,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(hi.Resize,this.handleCancel),this.windowListeners.add(hi.DragStart,$E),this.windowListeners.add(hi.VisibilityChange,this.handleCancel),this.windowListeners.add(hi.ContextMenu,$E),this.documentListeners.add(hi.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(ME(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(IE(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:i}=this.props;i(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(hi.Click,nte,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(hi.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:s}=this,{onMove:o,options:{activationConstraint:l}}=s;if(!i)return;const c=(n=j1(t))!=null?n:ts,u=yh(i,c);if(!r&&l){if(IE(l)){if(l.tolerance!=null&&sb(u,l.tolerance))return this.handleCancel();if(sb(u,l.distance))return this.handleStart()}if(ME(l)&&sb(u,l.tolerance))return this.handleCancel();this.handlePending(l,u);return}t.cancelable&&t.preventDefault(),o(c)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===kt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const ite={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class k_ extends O_{constructor(t){const{event:n}=t,r=nd(n.target);super(t,ite,r)}}k_.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const ste={move:{name:"mousemove"},end:{name:"mouseup"}};var N1;(function(e){e[e.RightClick=2]="RightClick"})(N1||(N1={}));class ate extends O_{constructor(t){super(t,ste,nd(t.event.target))}}ate.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===N1.RightClick?!1:(r==null||r({event:n}),!0)}}];const ab={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class ote extends O_{constructor(t){super(t,ab)}static setup(){return window.addEventListener(ab.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(ab.move.name,t)};function t(){}}}ote.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r==null||r({event:n}),!0)}}];var gf;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(gf||(gf={}));var sv;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(sv||(sv={}));function lte(e){let{acceleration:t,activator:n=gf.Pointer,canScroll:r,draggingRect:i,enabled:s,interval:o=5,order:l=sv.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:h}=e;const p=ute({delta:f,disabled:!s}),[g,m]=bee(),x=v.useRef({x:0,y:0}),b=v.useRef({x:0,y:0}),y=v.useMemo(()=>{switch(n){case gf.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case gf.DraggableRect:return i}},[n,i,c]),w=v.useRef(null),j=v.useCallback(()=>{const N=w.current;if(!N)return;const P=x.current.x*b.current.x,_=x.current.y*b.current.y;N.scrollBy(P,_)},[]),S=v.useMemo(()=>l===sv.TreeOrder?[...u].reverse():u,[l,u]);v.useEffect(()=>{if(!s||!u.length||!y){m();return}for(const N of S){if((r==null?void 0:r(N))===!1)continue;const P=u.indexOf(N),_=d[P];if(!_)continue;const{direction:A,speed:O}=Xee(N,_,y,t,h);for(const $ of["x","y"])p[$][A[$]]||(O[$]=0,A[$]=0);if(O.x>0||O.y>0){m(),w.current=N,g(j,o),x.current=O,b.current=A;return}}x.current={x:0,y:0},b.current={x:0,y:0},m()},[t,j,r,m,s,o,JSON.stringify(y),JSON.stringify(p),g,u,S,d,JSON.stringify(h)])}const cte={x:{[zn.Backward]:!1,[zn.Forward]:!1},y:{[zn.Backward]:!1,[zn.Forward]:!1}};function ute(e){let{delta:t,disabled:n}=e;const r=w1(t);return Ap(i=>{if(n||!r||!i)return cte;const s={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[zn.Backward]:i.x[zn.Backward]||s.x===-1,[zn.Forward]:i.x[zn.Forward]||s.x===1},y:{[zn.Backward]:i.y[zn.Backward]||s.y===-1,[zn.Forward]:i.y[zn.Forward]||s.y===1}}},[n,t,r])}function dte(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Ap(i=>{var s;return t==null?null:(s=r??i)!=null?s:null},[r,t])}function fte(e,t){return v.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,s=i.activators.map(o=>({eventName:o.eventName,handler:t(o.handler,r)}));return[...n,...s]},[]),[e,t])}var xh;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(xh||(xh={}));var _1;(function(e){e.Optimized="optimized"})(_1||(_1={}));const RE=new Map;function hte(e,t){let{dragging:n,dependencies:r,config:i}=t;const[s,o]=v.useState(null),{frequency:l,measure:c,strategy:u}=i,d=v.useRef(e),f=x(),h=vh(f),p=v.useCallback(function(b){b===void 0&&(b=[]),!h.current&&o(y=>y===null?b:y.concat(b.filter(w=>!y.includes(w))))},[h]),g=v.useRef(null),m=Ap(b=>{if(f&&!n)return RE;if(!b||b===RE||d.current!==e||s!=null){const y=new Map;for(let w of e){if(!w)continue;if(s&&s.length>0&&!s.includes(w.id)&&w.rect.current){y.set(w.id,w.rect.current);continue}const j=w.node.current,S=j?new A_(c(j),j):null;w.rect.current=S,S&&y.set(w.id,S)}return y}return b},[e,s,n,f,c]);return v.useEffect(()=>{d.current=e},[e]),v.useEffect(()=>{f||p()},[n,f]),v.useEffect(()=>{s&&s.length>0&&o(null)},[JSON.stringify(s)]),v.useEffect(()=>{f||typeof l!="number"||g.current!==null||(g.current=setTimeout(()=>{p(),g.current=null},l))},[l,f,p,...r]),{droppableRects:m,measureDroppableContainers:p,measuringScheduled:s!=null};function x(){switch(u){case xh.Always:return!1;case xh.BeforeDragging:return n;default:return!n}}}function _5(e,t){return Ap(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function pte(e,t){return _5(e,t)}function mte(e){let{callback:t,disabled:n}=e;const r=P_(t),i=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,n]);return v.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function dx(e){let{callback:t,disabled:n}=e;const r=P_(t),i=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[n]);return v.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function gte(e){return new A_(rd(e),e)}function DE(e,t,n){t===void 0&&(t=gte);const[r,i]=v.useState(null);function s(){i(c=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=c??n)!=null?u:null}const d=t(e);return JSON.stringify(c)===JSON.stringify(d)?c:d})}const o=mte({callback(c){if(e)for(const u of c){const{type:d,target:f}=u;if(d==="childList"&&f instanceof HTMLElement&&f.contains(e)){s();break}}}}),l=dx({callback:s});return Os(()=>{s(),e?(l==null||l.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),o==null||o.disconnect())},[e]),r}function vte(e){const t=_5(e);return v5(e,t)}const LE=[];function yte(e){const t=v.useRef(e),n=Ap(r=>e?r&&r!==LE&&e&&t.current&&e.parentNode===t.current.parentNode?r:ux(e):LE,[e]);return v.useEffect(()=>{t.current=e},[e]),n}function xte(e){const[t,n]=v.useState(null),r=v.useRef(e),i=v.useCallback(s=>{const o=ib(s.target);o&&n(l=>l?(l.set(o,S1(o)),new Map(l)):null)},[]);return v.useEffect(()=>{const s=r.current;if(e!==s){o(s);const l=e.map(c=>{const u=ib(c);return u?(u.addEventListener("scroll",i,{passive:!0}),[u,S1(u)]):null}).filter(c=>c!=null);n(l.length?new Map(l):null),r.current=e}return()=>{o(e),o(s)};function o(l){l.forEach(c=>{const u=ib(c);u==null||u.removeEventListener("scroll",i)})}},[i,e]),v.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,o)=>Dc(s,o),ts):S5(e):ts,[e,t])}function FE(e,t){t===void 0&&(t=[]);const n=v.useRef(null);return v.useEffect(()=>{n.current=null},t),v.useEffect(()=>{const r=e!==ts;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?yh(e,n.current):ts}function bte(e){v.useEffect(()=>{if(!cx)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function wte(e,t){return v.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:s}=r;return n[i]=o=>{s(o,t)},n},{}),[e,t])}function P5(e){return v.useMemo(()=>e?Hee(e):null,[e])}const BE=[];function jte(e,t){t===void 0&&(t=rd);const[n]=e,r=P5(n?Ur(n):null),[i,s]=v.useState(BE);function o(){s(()=>e.length?e.map(c=>w5(c)?r:new A_(t(c),c)):BE)}const l=dx({callback:o});return Os(()=>{l==null||l.disconnect(),o(),e.forEach(c=>l==null?void 0:l.observe(c))},[e]),i}function Ste(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Cp(t)?t:e}function Nte(e){let{measure:t}=e;const[n,r]=v.useState(null),i=v.useCallback(u=>{for(const{target:d}of u)if(Cp(d)){r(f=>{const h=t(d);return f?{...f,width:h.width,height:h.height}:h});break}},[t]),s=dx({callback:i}),o=v.useCallback(u=>{const d=Ste(u);s==null||s.disconnect(),d&&(s==null||s.observe(d)),r(d?t(d):null)},[t,s]),[l,c]=rv(o);return v.useMemo(()=>({nodeRef:l,rect:n,setRef:c}),[n,l,c])}const _te=[{sensor:k_,options:{}},{sensor:E_,options:{}}],Pte={current:{}},Km={draggable:{measure:TE},droppable:{measure:TE,strategy:xh.WhileDragging,frequency:_1.Optimized},dragOverlay:{measure:rd}};class vf extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const Cte={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new vf,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:iv},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Km,measureDroppableContainers:iv,windowRect:null,measuringScheduled:!1},Ate={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:iv,draggableNodes:new Map,over:null,measureDroppableContainers:iv},fx=v.createContext(Ate),C5=v.createContext(Cte);function Ete(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new vf}}}function Ote(e,t){switch(t.type){case Tn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Tn.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Tn.DragEnd:case Tn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Tn.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new vf(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Tn.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const o=new vf(e.droppable.containers);return o.set(n,{...s,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case Tn.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const s=new vf(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function kte(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=v.useContext(fx),s=w1(r),o=w1(n==null?void 0:n.id);return v.useEffect(()=>{if(!t&&!r&&s&&o!=null){if(!C_(s)||document.activeElement===s.target)return;const l=i.get(o);if(!l)return;const{activatorNode:c,node:u}=l;if(!c.current&&!u.current)return;requestAnimationFrame(()=>{for(const d of[c.current,u.current]){if(!d)continue;const f=See(d);if(f){f.focus();break}}})}},[r,t,i,o,s]),null}function Tte(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,s)=>s({transform:i,...r}),n):n}function $te(e){return v.useMemo(()=>({draggable:{...Km.draggable,...e==null?void 0:e.draggable},droppable:{...Km.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Km.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function Ite(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const s=v.useRef(!1),{x:o,y:l}=typeof i=="boolean"?{x:i,y:i}:i;Os(()=>{if(!o&&!l||!t){s.current=!1;return}if(s.current||!r)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const d=n(u),f=v5(d,r);if(o||(f.x=0),l||(f.y=0),s.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=y5(u);h&&h.scrollBy({top:f.y,left:f.x})}},[t,o,l,r,n])}const A5=v.createContext({...ts,scaleX:1,scaleY:1});var La;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(La||(La={}));const Mte=v.memo(function(t){var n,r,i,s;let{id:o,accessibility:l,autoScroll:c=!0,children:u,sensors:d=_te,collisionDetection:f=Lee,measuring:h,modifiers:p,...g}=t;const m=v.useReducer(Ote,void 0,Ete),[x,b]=m,[y,w]=Eee(),[j,S]=v.useState(La.Uninitialized),N=j===La.Initialized,{draggable:{active:P,nodes:_,translate:A},droppable:{containers:O}}=x,$=P!=null?_.get(P):null,T=v.useRef({initial:null,translated:null}),M=v.useMemo(()=>{var k;return P!=null?{id:P,data:(k=$==null?void 0:$.data)!=null?k:Pte,rect:T}:null},[P,$]),R=v.useRef(null),[H,F]=v.useState(null),[V,I]=v.useState(null),L=vh(g,Object.values(g)),Z=Ep("DndDescribedBy",o),ee=v.useMemo(()=>O.getEnabled(),[O]),re=$te(h),{droppableRects:me,measureDroppableContainers:z,measuringScheduled:ae}=hte(ee,{dragging:N,dependencies:[A.x,A.y],config:re.droppable}),de=dte(_,P),fe=v.useMemo(()=>V?j1(V):null,[V]),Ne=q(),he=pte(de,re.draggable.measure);Ite({activeNode:P!=null?_.get(P):null,config:Ne.layoutShiftCompensation,initialRect:he,measure:re.draggable.measure});const ue=DE(de,re.draggable.measure,he),Ee=DE(de?de.parentElement:null),ie=v.useRef({activatorEvent:null,active:null,activeNode:de,collisionRect:null,collisions:null,droppableRects:me,draggableNodes:_,draggingNode:null,draggingNodeRect:null,droppableContainers:O,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Xe=O.getNodeFor((n=ie.current.over)==null?void 0:n.id),K=Nte({measure:re.dragOverlay.measure}),ve=(r=K.nodeRef.current)!=null?r:de,Se=N?(i=K.rect)!=null?i:ue:null,$e=!!(K.nodeRef.current&&K.rect),E=vte($e?null:ue),D=P5(ve?Ur(ve):null),U=yte(N?Xe??de:null),Q=jte(U),te=Tte(p,{transform:{x:A.x-E.x,y:A.y-E.y,scaleX:1,scaleY:1},activatorEvent:V,active:M,activeNodeRect:ue,containerNodeRect:Ee,draggingNodeRect:Se,over:ie.current.over,overlayNodeRect:K.rect,scrollableAncestors:U,scrollableAncestorRects:Q,windowRect:D}),Y=fe?Dc(fe,A):null,xe=xte(U),je=FE(xe),Fe=FE(xe,[ue]),ce=Dc(te,je),ke=Se?zee(Se,te):null,Be=M&&ke?f({active:M,collisionRect:ke,droppableRects:me,droppableContainers:ee,pointerCoordinates:Y}):null,mt=g5(Be,"id"),[_t,Pt]=v.useState(null),qt=$e?te:Dc(te,Fe),mn=Fee(qt,(s=_t==null?void 0:_t.rect)!=null?s:null,ue),Wt=v.useRef(null),zt=v.useCallback((k,B)=>{let{sensor:W,options:ne}=B;if(R.current==null)return;const J=_.get(R.current);if(!J)return;const ye=k.nativeEvent,se=new W({active:R.current,activeNode:J,event:ye,options:ne,context:ie,onAbort(_e){if(!_.get(_e))return;const{onDragAbort:Ie}=L.current,ft={id:_e};Ie==null||Ie(ft),y({type:"onDragAbort",event:ft})},onPending(_e,et,Ie,ft){if(!_.get(_e))return;const{onDragPending:pt}=L.current,tr={id:_e,constraint:et,initialCoordinates:Ie,offset:ft};pt==null||pt(tr),y({type:"onDragPending",event:tr})},onStart(_e){const et=R.current;if(et==null)return;const Ie=_.get(et);if(!Ie)return;const{onDragStart:ft}=L.current,Ct={activatorEvent:ye,active:{id:et,data:Ie.data,rect:T}};Vi.unstable_batchedUpdates(()=>{ft==null||ft(Ct),S(La.Initializing),b({type:Tn.DragStart,initialCoordinates:_e,active:et}),y({type:"onDragStart",event:Ct}),F(Wt.current),I(ye)})},onMove(_e){b({type:Tn.DragMove,coordinates:_e})},onEnd:Pe(Tn.DragEnd),onCancel:Pe(Tn.DragCancel)});Wt.current=se;function Pe(_e){return async function(){const{active:Ie,collisions:ft,over:Ct,scrollAdjustedTranslate:pt}=ie.current;let tr=null;if(Ie&&pt){const{cancelDrop:Ea}=L.current;tr={activatorEvent:ye,active:Ie,collisions:ft,delta:pt,over:Ct},_e===Tn.DragEnd&&typeof Ea=="function"&&await Promise.resolve(Ea(tr))&&(_e=Tn.DragCancel)}R.current=null,Vi.unstable_batchedUpdates(()=>{b({type:_e}),S(La.Uninitialized),Pt(null),F(null),I(null),Wt.current=null;const Ea=_e===Tn.DragEnd?"onDragEnd":"onDragCancel";if(tr){const l0=L.current[Ea];l0==null||l0(tr),y({type:Ea,event:tr})}})}}},[_]),mr=v.useCallback((k,B)=>(W,ne)=>{const J=W.nativeEvent,ye=_.get(ne);if(R.current!==null||!ye||J.dndKit||J.defaultPrevented)return;const se={active:ye};k(W,B.options,se)===!0&&(J.dndKit={capturedBy:B.sensor},R.current=ne,zt(W,B))},[_,zt]),Je=fte(d,mr);bte(d),Os(()=>{ue&&j===La.Initializing&&S(La.Initialized)},[ue,j]),v.useEffect(()=>{const{onDragMove:k}=L.current,{active:B,activatorEvent:W,collisions:ne,over:J}=ie.current;if(!B||!W)return;const ye={active:B,activatorEvent:W,collisions:ne,delta:{x:ce.x,y:ce.y},over:J};Vi.unstable_batchedUpdates(()=>{k==null||k(ye),y({type:"onDragMove",event:ye})})},[ce.x,ce.y]),v.useEffect(()=>{const{active:k,activatorEvent:B,collisions:W,droppableContainers:ne,scrollAdjustedTranslate:J}=ie.current;if(!k||R.current==null||!B||!J)return;const{onDragOver:ye}=L.current,se=ne.get(mt),Pe=se&&se.rect.current?{id:se.id,rect:se.rect.current,data:se.data,disabled:se.disabled}:null,_e={active:k,activatorEvent:B,collisions:W,delta:{x:J.x,y:J.y},over:Pe};Vi.unstable_batchedUpdates(()=>{Pt(Pe),ye==null||ye(_e),y({type:"onDragOver",event:_e})})},[mt]),Os(()=>{ie.current={activatorEvent:V,active:M,activeNode:de,collisionRect:ke,collisions:Be,droppableRects:me,draggableNodes:_,draggingNode:ve,draggingNodeRect:Se,droppableContainers:O,over:_t,scrollableAncestors:U,scrollAdjustedTranslate:ce},T.current={initial:Se,translated:ke}},[M,de,Be,ke,_,ve,Se,me,O,_t,U,ce]),lte({...Ne,delta:A,draggingRect:ke,pointerCoordinates:Y,scrollableAncestors:U,scrollableAncestorRects:Q});const X=v.useMemo(()=>({active:M,activeNode:de,activeNodeRect:ue,activatorEvent:V,collisions:Be,containerNodeRect:Ee,dragOverlay:K,draggableNodes:_,droppableContainers:O,droppableRects:me,over:_t,measureDroppableContainers:z,scrollableAncestors:U,scrollableAncestorRects:Q,measuringConfiguration:re,measuringScheduled:ae,windowRect:D}),[M,de,ue,V,Be,Ee,K,_,O,me,_t,z,U,Q,re,ae,D]),G=v.useMemo(()=>({activatorEvent:V,activators:Je,active:M,activeNodeRect:ue,ariaDescribedById:{draggable:Z},dispatch:b,draggableNodes:_,over:_t,measureDroppableContainers:z}),[V,Je,M,ue,b,Z,_,_t,z]);return C.createElement(h5.Provider,{value:w},C.createElement(fx.Provider,{value:G},C.createElement(C5.Provider,{value:X},C.createElement(A5.Provider,{value:mn},u)),C.createElement(kte,{disabled:(l==null?void 0:l.restoreFocus)===!1})),C.createElement(Tee,{...l,hiddenTextDescribedById:Z}));function q(){const k=(H==null?void 0:H.autoScrollEnabled)===!1,B=typeof c=="object"?c.enabled===!1:c===!1,W=N&&!k&&!B;return typeof c=="object"?{...c,enabled:W}:{enabled:W}}}),Rte=v.createContext(null),zE="button",Dte="Draggable";function Lte(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const s=Ep(Dte),{activators:o,activatorEvent:l,active:c,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:h}=v.useContext(fx),{role:p=zE,roleDescription:g="draggable",tabIndex:m=0}=i??{},x=(c==null?void 0:c.id)===t,b=v.useContext(x?A5:Rte),[y,w]=rv(),[j,S]=rv(),N=wte(o,t),P=vh(n);Os(()=>(f.set(t,{id:t,key:s,node:y,activatorNode:j,data:P}),()=>{const A=f.get(t);A&&A.key===s&&f.delete(t)}),[f,t]);const _=v.useMemo(()=>({role:p,tabIndex:m,"aria-disabled":r,"aria-pressed":x&&p===zE?!0:void 0,"aria-roledescription":g,"aria-describedby":d.draggable}),[r,p,m,x,g,d.draggable]);return{active:c,activatorEvent:l,activeNodeRect:u,attributes:_,isDragging:x,listeners:r?void 0:N,node:y,over:h,setNodeRef:w,setActivatorNodeRef:S,transform:b}}function Fte(){return v.useContext(C5)}const Bte="Droppable",zte={timeout:25};function Ute(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const s=Ep(Bte),{active:o,dispatch:l,over:c,measureDroppableContainers:u}=v.useContext(fx),d=v.useRef({disabled:n}),f=v.useRef(!1),h=v.useRef(null),p=v.useRef(null),{disabled:g,updateMeasurementsFor:m,timeout:x}={...zte,...i},b=vh(m??r),y=v.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{u(Array.isArray(b.current)?b.current:[b.current]),p.current=null},x)},[x]),w=dx({callback:y,disabled:g||!o}),j=v.useCallback((_,A)=>{w&&(A&&(w.unobserve(A),f.current=!1),_&&w.observe(_))},[w]),[S,N]=rv(j),P=vh(t);return v.useEffect(()=>{!w||!S.current||(w.disconnect(),f.current=!1,w.observe(S.current))},[S,w]),v.useEffect(()=>(l({type:Tn.RegisterDroppable,element:{id:r,key:s,disabled:n,node:S,rect:h,data:P}}),()=>l({type:Tn.UnregisterDroppable,key:s,id:r})),[r]),v.useEffect(()=>{n!==d.current.disabled&&(l({type:Tn.SetDroppableDisabled,id:r,key:s,disabled:n}),d.current.disabled=n)},[r,s,n,l]),{active:o,rect:h,isOver:(c==null?void 0:c.id)===r,node:S,over:c,setNodeRef:N}}function av(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Vte(e,t){return e.reduce((n,r,i)=>{const s=t.get(r);return s&&(n[i]=s),n},Array(e.length))}function hm(e){return e!==null&&e>=0}function Wte(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{let{rects:t,activeIndex:n,overIndex:r,index:i}=e;const s=av(t,r,n),o=t[i],l=s[i];return!l||!o?null:{x:l.left-o.left,y:l.top-o.top,scaleX:l.width/o.width,scaleY:l.height/o.height}},pm={scaleX:1,scaleY:1},$d=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:i,rects:s,overIndex:o}=e;const l=(t=s[n])!=null?t:r;if(!l)return null;if(i===n){const u=s[o];return u?{x:0,y:nn&&i<=o?{x:0,y:-l.height-c,...pm}:i=o?{x:0,y:l.height+c,...pm}:{x:0,y:0,...pm}};function Gte(e,t,n){const r=e[t],i=e[t-1],s=e[t+1];return r?nr.map(N=>typeof N=="object"&&"id"in N?N.id:N),[r]),g=o!=null,m=o?p.indexOf(o.id):-1,x=u?p.indexOf(u.id):-1,b=v.useRef(p),y=!Wte(p,b.current),w=x!==-1&&m===-1||y,j=Hte(s);Os(()=>{y&&g&&d(p)},[y,p,g,d]),v.useEffect(()=>{b.current=p},[p]);const S=v.useMemo(()=>({activeIndex:m,containerId:f,disabled:j,disableTransforms:w,items:p,overIndex:x,useDragOverlay:h,sortedRects:Vte(p,c),strategy:i}),[m,f,j.draggable,j.droppable,w,p,x,c,h,i]);return C.createElement(k5.Provider,{value:S},t)}const qte=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return av(n,r,i).indexOf(t)},Kte=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:s,newIndex:o,previousItems:l,previousContainerId:c,transition:u}=e;return!u||!r||l!==s&&i===o?!1:n?!0:o!==i&&t===c},Xte={duration:200,easing:"ease"},T5="transform",Yte=du.Transition.toString({property:T5,duration:0,easing:"linear"}),Zte={roleDescription:"sortable"};function Qte(e){let{disabled:t,index:n,node:r,rect:i}=e;const[s,o]=v.useState(null),l=v.useRef(n);return Os(()=>{if(!t&&n!==l.current&&r.current){const c=i.current;if(c){const u=rd(r.current,{ignoreTransform:!0}),d={x:c.left-u.left,y:c.top-u.top,scaleX:c.width/u.width,scaleY:c.height/u.height};(d.x||d.y)&&o(d)}}n!==l.current&&(l.current=n)},[t,n,r,i]),v.useEffect(()=>{s&&o(null)},[s]),s}function UE(e){let{animateLayoutChanges:t=Kte,attributes:n,disabled:r,data:i,getNewIndex:s=qte,id:o,strategy:l,resizeObserverConfig:c,transition:u=Xte}=e;const{items:d,containerId:f,activeIndex:h,disabled:p,disableTransforms:g,sortedRects:m,overIndex:x,useDragOverlay:b,strategy:y}=v.useContext(k5),w=Jte(r,p),j=d.indexOf(o),S=v.useMemo(()=>({sortable:{containerId:f,index:j,items:d},...i}),[f,i,j,d]),N=v.useMemo(()=>d.slice(d.indexOf(o)),[d,o]),{rect:P,node:_,isOver:A,setNodeRef:O}=Ute({id:o,data:S,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:N,...c}}),{active:$,activatorEvent:T,activeNodeRect:M,attributes:R,setNodeRef:H,listeners:F,isDragging:V,over:I,setActivatorNodeRef:L,transform:Z}=Lte({id:o,data:S,attributes:{...Zte,...n},disabled:w.draggable}),ee=xee(O,H),re=!!$,me=re&&!g&&hm(h)&&hm(x),z=!b&&V,ae=z&&me?Z:null,fe=me?ae??(l??y)({rects:m,activeNodeRect:M,activeIndex:h,overIndex:x,index:j}):null,Ne=hm(h)&&hm(x)?s({id:o,items:d,activeIndex:h,overIndex:x}):j,he=$==null?void 0:$.id,ue=v.useRef({activeId:he,items:d,newIndex:Ne,containerId:f}),Ee=d!==ue.current.items,ie=t({active:$,containerId:f,isDragging:V,isSorting:re,id:o,index:j,items:d,newIndex:ue.current.newIndex,previousItems:ue.current.items,previousContainerId:ue.current.containerId,transition:u,wasDragging:ue.current.activeId!=null}),Xe=Qte({disabled:!ie,index:j,node:_,rect:P});return v.useEffect(()=>{re&&ue.current.newIndex!==Ne&&(ue.current.newIndex=Ne),f!==ue.current.containerId&&(ue.current.containerId=f),d!==ue.current.items&&(ue.current.items=d)},[re,Ne,f,d]),v.useEffect(()=>{if(he===ue.current.activeId)return;if(he!=null&&ue.current.activeId==null){ue.current.activeId=he;return}const ve=setTimeout(()=>{ue.current.activeId=he},50);return()=>clearTimeout(ve)},[he]),{active:$,activeIndex:h,attributes:R,data:S,rect:P,index:j,newIndex:Ne,items:d,isOver:A,isSorting:re,isDragging:V,listeners:F,node:_,overIndex:x,over:I,setNodeRef:ee,setActivatorNodeRef:L,setDroppableNodeRef:O,setDraggableNodeRef:H,transform:Xe??fe,transition:K()};function K(){if(Xe||Ee&&ue.current.newIndex===j)return Yte;if(!(z&&!C_(T)||!u)&&(re||ie))return du.Transition.toString({...u,property:T5})}}function Jte(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}function ov(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const ene=[kt.Down,kt.Right,kt.Up,kt.Left],tne=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:s,over:o,scrollableAncestors:l}}=t;if(ene.includes(e.code)){if(e.preventDefault(),!n||!r)return;const c=[];s.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const h=i.get(f.id);if(h)switch(e.code){case kt.Down:r.toph.top&&c.push(f);break;case kt.Left:r.left>h.left&&c.push(f);break;case kt.Right:r.left1&&(d=u[1].id),d!=null){const f=s.get(n.id),h=s.get(d),p=h?i.get(h.id):null,g=h==null?void 0:h.node.current;if(g&&p&&f&&h){const x=ux(g).some((N,P)=>l[P]!==N),b=$5(f,h),y=nne(f,h),w=x||!b?{x:0,y:0}:{x:y?r.width-p.width:0,y:y?r.height-p.height:0},j={x:p.left,y:p.top};return w.x&&w.y?j:yh(j,w)}}}};function $5(e,t){return!ov(e)||!ov(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function nne(e,t){return!ov(e)||!ov(t)||!$5(e,t)?!1:e.data.current.sortable.index{const{discussionGuide:t,moderatorStatus:n,onSectionSelect:r,onSetPosition:i,onSave:s,showProgress:o=!0,collapsible:l=!0,defaultExpanded:c=!1,className:u,onDownload:d,isDownloading:f=!1,focusGroupId:h}=e;console.log("DiscussionGuideViewer props received ["+(e.key||"no-key")+"]:",{defaultExpanded:c,showProgress:o,collapsible:l,discussionGuideType:typeof t,propDefaultExpanded:e.defaultExpanded,allProps:e});const p=typeof t=="string",[g,m]=v.useState(null),[x,b]=v.useState(!1),y=v.useMemo(()=>p?null:x&&g?(console.log("๐Ÿ”„ Using pending updates for display"),g):t,[t,p,g,x]);v.useEffect(()=>{if(!x||!g)return;const K=t;K&&JSON.stringify(K)===JSON.stringify(g)&&(console.log("โœ… Props updated to match pending changes, clearing pending updates"),m(null),b(!1))},[t,g,x]);const[w,j]=v.useState(new Set),[S,N]=v.useState(null),[P,_]=v.useState(null),[A,O]=v.useState(!1),$=$ee(EE(k_,{activationConstraint:{distance:8}}),EE(E_,{coordinateGetter:tne}));v.useEffect(()=>{var K,ve,Se,$e;if(S&&y){const E=y.sections.find(D=>D.id===S);if(E&&P){const D=((K=P.activities)==null?void 0:K.map(Y=>Y.id).join(","))||"",U=((ve=E.activities)==null?void 0:ve.map(Y=>Y.id).join(","))||"",Q=((Se=P.questions)==null?void 0:Se.map(Y=>Y.id).join(","))||"",te=(($e=E.questions)==null?void 0:$e.map(Y=>Y.id).join(","))||"";(D!==U||Q!==te)&&(console.log("๐Ÿ“ Syncing editing section with updated guide structure"),_({...E}))}}},[y,S,P]);const T=K=>{N(K.id),_({...K}),j(ve=>new Set(ve).add(K.id))},M=()=>{N(null),_(null)},R=K=>{P&&_({...P,...K})},H=(K,ve,Se)=>{var D;if(!P)return;const $e=Se==="question"?"questions":"activities",E=((D=P[$e])==null?void 0:D.map(U=>U.id===K?{...U,...ve}:U))||[];_({...P,[$e]:E})},F=(K,ve)=>{var E;if(!P)return;const Se=ve==="question"?"questions":"activities",$e=((E=P[Se])==null?void 0:E.filter(D=>D.id!==K))||[];_({...P,[Se]:$e})},V=K=>{if(!P)return;const ve={id:`${K}_${Date.now()}`,type:K==="question"?"open_question":"moderator_statement",content:`New ${K}`,probes:K==="question"?[]:void 0},Se=K==="question"?"questions":"activities",$e=P[Se]||[];_({...P,[Se]:[...$e,ve]})},I=async()=>{if(!(!P||!y||!s)){O(!0);try{const K={...y,sections:y.sections.map(ve=>ve.id===P.id?P:ve)};await s(K),N(null),_(null),pe.success("Section updated successfully")}catch(K){console.error("Failed to save section:",K),pe.error("Failed to save section changes")}finally{O(!1)}}},L=async K=>{if(!(!y||!s))try{const ve={...y,sections:y.sections.filter(Se=>Se.id!==K)};await s(ve),S===K&&(N(null),_(null)),pe.success("Section deleted successfully")}catch(ve){console.error("Failed to delete section:",ve),pe.error("Failed to delete section")}},Z=v.useCallback(async(K,ve)=>{if(!y||!s)return;const Se=[...y.sections],[$e]=Se.splice(K,1);Se.splice(ve,0,$e);const E={...y,sections:Se};m(E),b(!0),console.log("๐Ÿ’พ Calling onSave with updated guide (section move)..."),console.log("๐Ÿ“Š Section order before:",y.sections.map(D=>D.id)),console.log("๐Ÿ“Š Section order after:",E.sections.map(D=>D.id));try{await s(E),console.log("โœ… onSave completed successfully (section move)")}catch(D){console.error("โŒ onSave failed (section move), reverting:",D),m(null),b(!1)}},[y,s]),ee=v.useCallback(async(K,ve,Se,$e)=>{if(!y||!s)return;console.log("๐Ÿ’พ moveItem called:",{sectionId:K,itemType:ve,fromIndex:Se,toIndex:$e});const E={...y,sections:y.sections.map(D=>{if(D.id===K){const U=ve==="question"?"questions":"activities",Q=D[U]||[],te=av(Q,Se,$e);return console.log("๐Ÿ“ Section items reordered:",{sectionId:K,itemsKey:U,beforeIds:Q.map(Y=>Y.id),afterIds:te.map(Y=>Y.id)}),{...D,[U]:te}}return D})};m(E),b(!0),console.log("๐Ÿ’พ Calling onSave with updated guide..."),console.log("๐Ÿ“Š Passing guide to onSave:",E);try{await s(E),console.log("โœ… onSave completed successfully")}catch(D){console.error("โŒ onSave failed, reverting optimistic update:",D),m(null),b(!1)}},[y,s]),re=v.useCallback(async(K,ve,Se,$e,E)=>{if(!y||!s)return;console.log("๐Ÿ’พ moveSubsectionItem called:",{sectionId:K,subsectionIndex:ve,itemType:Se,fromIndex:$e,toIndex:E});const D={...y,sections:y.sections.map(U=>{if(U.id===K&&U.subsections){const Q=[...U.subsections],te=Q[ve];if(te){const Y=Se==="question"?"questions":"activities",xe=te[Y]||[],je=av(xe,$e,E);console.log("๐Ÿ“ Subsection items reordered:",{sectionId:K,subsectionIndex:ve,itemsKey:Y,beforeIds:xe.map(Fe=>Fe.id),afterIds:je.map(Fe=>Fe.id)}),Q[ve]={...te,[Y]:je}}return{...U,subsections:Q}}return U})};m(D),b(!0),console.log("๐Ÿ’พ Calling onSave with updated guide (subsection)...");try{await s(D),console.log("โœ… onSave completed successfully (subsection)")}catch(U){console.error("โŒ onSave failed (subsection), reverting:",U),m(null),b(!1)}},[y,s]),me=v.useCallback(async K=>{var D,U,Q,te;const{active:ve,over:Se}=K;if(console.log("๐ŸŽฏ Drag END:",{activeId:ve.id,overId:Se==null?void 0:Se.id,hasOver:!!Se,sameId:ve.id===(Se==null?void 0:Se.id),hasGuide:!!y,timestamp:new Date().toISOString()}),!Se||ve.id===Se.id||!y){console.log("โŒ Drag end early return");return}const $e=String(ve.id),E=String(Se.id);if($e.startsWith("section-")&&E.startsWith("section-")){const Y=y.sections.findIndex(je=>`section-${je.id}`===$e),xe=y.sections.findIndex(je=>`section-${je.id}`===E);Y!==-1&&xe!==-1&&await Z(Y,xe)}else if($e.includes("-item-")&&E.includes("-item-")){const Y=$e.match(/^(.*?)-(subsection-\d+-)?(question|activity)-item-(.*)$/),xe=E.match(/^(.*?)-(subsection-\d+-)?(question|activity)-item-(.*)$/);if(Y&&xe){const[,je,Fe,ce]=Y,[,ke,Be,mt]=xe;if(console.log("๐Ÿ” Item drag match:",{activeId:$e,overId:E,activeSectionId:je,activeSubsection:Fe,activeItemType:ce,overSectionId:ke,overSubsection:Be,overItemType:mt}),je===ke&&Fe===Be&&ce===mt){const _t=y.sections.find(Pt=>Pt.id===je);if(_t){const Pt=ce==="question"?"questions":"activities";if(Fe){const qt=parseInt(((D=Fe.match(/subsection-(\d+)-/))==null?void 0:D[1])||"0"),mn=(U=_t.subsections)==null?void 0:U[qt];if(mn){const Wt=mn[Pt]||[],zt=Wt.findIndex(Je=>$e.endsWith(`-item-${Je.id}`)),mr=Wt.findIndex(Je=>E.endsWith(`-item-${Je.id}`));console.log("๐Ÿ“ฆ Subsection item reorder:",{subsectionIndex:qt,oldIndex:zt,newIndex:mr,itemsLength:Wt.length}),zt!==-1&&mr!==-1?(console.log("๐Ÿš€ About to call moveSubsectionItem..."),await re(je,qt,ce,zt,mr)):console.log("โŒ Not calling moveSubsectionItem - invalid indexes:",{oldIndex:zt,newIndex:mr})}}else{const qt=_t[Pt]||[],mn=qt.findIndex(zt=>`${je}-${ce}-item-${zt.id}`===$e),Wt=qt.findIndex(zt=>`${ke}-${mt}-item-${zt.id}`===E);console.log("๐Ÿ“ฆ Section item reorder:",{oldIndex:mn,newIndex:Wt,itemsLength:qt.length,activeId:$e,overId:E,itemIds:qt.map(zt=>zt.id),expectedActiveId:`${je}-${ce}-item-${(Q=qt[mn])==null?void 0:Q.id}`,expectedOverId:`${ke}-${mt}-item-${(te=qt[Wt])==null?void 0:te.id}`,oldIndexValid:mn!==-1,newIndexValid:Wt!==-1,willCallMoveItem:mn!==-1&&Wt!==-1}),mn!==-1&&Wt!==-1?(console.log("๐Ÿš€ About to call moveItem..."),await ee(je,ce,mn,Wt)):console.log("โŒ Not calling moveItem - invalid indexes")}}}}}},[y,Z,ee,re]);v.useEffect(()=>{var K;if(console.log("DiscussionGuideViewer useEffect:",{defaultExpanded:c,isLegacyFormat:p,hasStructuredGuide:!!y,sectionsCount:((K=y==null?void 0:y.sections)==null?void 0:K.length)||0,discussionGuideType:typeof t,discussionGuide:t}),c&&y&&y.sections){const ve=y.sections.map(Se=>Se.id);console.log("Pre-expanding sections:",ve),j(new Set(ve))}else c||j(new Set)},[c,y,t,p]);const z=K=>{const ve=new Set(w);ve.has(K)?ve.delete(K):ve.add(K),j(ve)},ae=K=>{if(!n||n.legacy_format)return"pending";const ve=n.moderator_position.section_index;return(n.progress||0)>=100||K{if(!n||n.legacy_format)return"pending";const{section_index:E,subsection_index:D,item_index:U,item_type:Q}=n.moderator_position;if(Ka.jsxs("div",{className:Me("space-y-4",u),children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(di,{className:"h-5 w-5 text-slate-600"}),a.jsx("h3",{className:"font-semibold text-slate-900",children:"Discussion Guide"}),a.jsx(lr,{variant:"outline",className:"text-xs",children:"Legacy Format"})]}),a.jsx("div",{className:"whitespace-pre-line bg-slate-50 p-4 rounded-lg text-sm border",children:t})]}),Ne=(K,ve)=>K===`New ${ve}`,he=({id:K,item:ve,sectionIndex:Se,itemIndex:$e,itemType:E,subsectionIndex:D,disabled:U=!1})=>{const{attributes:Q,listeners:te,setNodeRef:Y,transform:xe,transition:je,isDragging:Fe}=UE({id:K,disabled:U}),ce={transform:du.Transform.toString(xe),transition:je,opacity:Fe?.5:1,zIndex:Fe?1e3:"auto"},ke=U?{}:{...Q,...te};return a.jsx("div",{ref:Y,style:ce,children:Ee(ve,Se,$e,E,D,ke)})},ue=({id:K,section:ve,sectionIndex:Se,disabled:$e=!1})=>{const{attributes:E,listeners:D,setNodeRef:U,transform:Q,transition:te,isDragging:Y}=UE({id:K,disabled:$e}),xe={transform:du.Transform.toString(Q),transition:te,opacity:Y?.5:1,zIndex:Y?1e3:"auto"};return a.jsx("div",{ref:U,style:xe,children:ie(ve,Se,$e?{}:{...E,...D})})},Ee=(K,ve,Se,$e,E,D)=>{var Fe;const U=y==null?void 0:y.sections[ve],Q=S===(U==null?void 0:U.id),te=de(ve,Se,$e,E),Y=te==="current",xe=te==="completed",je=Ne(K.content,$e);return Q?a.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg border bg-white border-blue-200",children:[s&&a.jsx("div",{className:"flex-shrink-0 cursor-grab hover:cursor-grab active:cursor-grabbing hover:text-slate-700 transition-colors p-1.5 rounded hover:bg-slate-200 border border-transparent hover:border-slate-300",...D,title:"Drag to reorder this item",children:a.jsx(RA,{className:"h-4 w-4 text-slate-500 hover:text-slate-700"})}),a.jsx("div",{className:"flex-shrink-0 mt-1",children:a.jsx(ff,{className:"h-4 w-4 text-slate-400"})}),a.jsxs("div",{className:"flex-1 min-w-0 space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(lr,{variant:"outline",className:"text-xs",children:$e==="activity"?a.jsxs(a.Fragment,{children:[a.jsx(Hs,{className:"h-3 w-3 mr-1"}),typeof K.type=="string"?K.type.replace("_"," "):String(K.type||"unknown")]}):a.jsxs(a.Fragment,{children:[a.jsx(di,{className:"h-3 w-3 mr-1"}),typeof K.type=="string"?K.type.replace("_"," "):String(K.type||"unknown")]})}),K.time_limit&&a.jsxs("div",{className:"flex items-center gap-1 text-xs text-slate-500",children:[a.jsx(Xf,{className:"h-3 w-3"}),a.jsx(St,{type:"number",value:K.time_limit,onChange:ce=>H(K.id,{time_limit:parseInt(ce.target.value)||void 0},$e),className:"w-16 h-6 text-xs",placeholder:"min"}),"min"]})]}),a.jsx(Qe,{value:je?"":K.content,onChange:ce=>H(K.id,{content:ce.target.value},$e),placeholder:je?K.content:"Enter content...",className:"min-h-[60px]"}),$e==="question"&&a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium text-slate-700 mb-1 block",children:"Probe Questions (one per line)"}),a.jsx(Qe,{value:((Fe=K.probes)==null?void 0:Fe.join(` -`))||"",onChange:ce=>{const ke=ce.target.value.trim()?ce.target.value.split(` -`).filter(Be=>Be.trim()):[];H(K.id,{probes:ke},$e)},placeholder:"Enter probe questions, one per line...",className:"min-h-[40px]"})]})]}),a.jsx("div",{className:"flex-shrink-0",children:a.jsx(oe,{size:"sm",variant:"ghost",onClick:()=>F(K.id,$e),className:"h-8 w-8 p-0 text-red-600 hover:text-red-700",children:a.jsx(gn,{className:"h-3 w-3"})})})]},K.id):a.jsxs("div",{className:Me("flex items-start gap-3 p-3 rounded-lg border transition-colors",Y&&"bg-blue-50 border-blue-200",xe&&"bg-green-50 border-green-200",!Y&&!xe&&"bg-slate-50 border-slate-200",r&&"cursor-pointer hover:bg-slate-100"),onClick:()=>r==null?void 0:r(y.sections[ve].id,K.id),children:[a.jsx("div",{className:"flex-shrink-0 mt-1",children:xe?a.jsx(Cg,{className:"h-4 w-4 text-green-600"}):Y?a.jsx(Uw,{className:"h-4 w-4 text-blue-600"}):a.jsx(ff,{className:"h-4 w-4 text-slate-400"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[a.jsx(lr,{variant:"outline",className:"text-xs whitespace-nowrap",children:$e==="activity"?a.jsxs(a.Fragment,{children:[a.jsx(Hs,{className:"h-3 w-3 mr-1"}),typeof K.type=="string"?K.type.replace("_"," "):String(K.type||"unknown")]}):a.jsxs(a.Fragment,{children:[a.jsx(di,{className:"h-3 w-3 mr-1"}),typeof K.type=="string"?K.type.replace("_"," "):String(K.type||"unknown")]})}),K.time_limit&&a.jsxs("div",{className:"flex items-center gap-1 text-xs text-slate-500 whitespace-nowrap",children:[a.jsx(Xf,{className:"h-3 w-3"}),K.time_limit," min"]}),i&&a.jsxs(oe,{size:"sm",variant:"ghost",onClick:ce=>{ce.stopPropagation(),i(y.sections[ve].id,K.id,K.content,y.sections[ve].title,`${$e==="activity"?"Activity":"Question"}: ${K.type.replace("_"," ")}`,K.type)},className:"h-6 px-2 text-xs text-slate-600 hover:text-blue-600 hover:bg-blue-50",title:"Set moderator position to this item",children:[a.jsx(SN,{className:"h-3 w-3 mr-1"}),"Set Position"]})]}),a.jsxs("div",{className:"text-sm text-slate-700 mb-2 break-words",children:[a.jsx("p",{children:typeof K.content=="string"?K.content:String(K.content||"")}),K.type==="creative_review"&&h&&a.jsxs("div",{className:"mt-3 p-3 border rounded-lg bg-slate-50",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(wR,{className:"h-4 w-4 text-slate-600"}),a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Creative Asset"})]}),(()=>{const ce=typeof K.content=="string"?K.content:String(K.content||""),ke=ce.match(/(fg-[a-f0-9]+-[a-f0-9]{32}\.(jpg|jpeg|png))/i)||ce.match(/([a-f0-9]{32}\.(jpg|jpeg|png))/i);if(ke){const Be=ke[1],mt=At.getAssetUrl(h,Be);return a.jsx("img",{src:mt,alt:"Creative asset for review",className:"max-w-full h-auto rounded border shadow-sm",style:{maxHeight:"300px"},onError:_t=>{console.error("Failed to load creative asset:",mt),_t.currentTarget.style.display="none"}})}else return a.jsx("div",{className:"text-xs text-slate-500 italic",children:"Creative asset not found or filename not detected"})})()]})]}),K.probes&&K.probes.length>0&&a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-xs font-medium text-slate-600",children:"Probe Questions:"}),a.jsx("ul",{className:"text-xs text-slate-600 space-y-1",children:K.probes.map((ce,ke)=>a.jsxs("li",{className:"flex items-start gap-1",children:[a.jsx("span",{className:"text-slate-400",children:"โ€ข"}),a.jsx("span",{children:typeof ce=="string"?ce:String(ce||"")})]},ke))})]})]})]},K.id)},ie=(K,ve,Se)=>{var Y,xe,je,Fe;const $e=ae(ve),E=w.has(K.id),D=$e==="current",U=$e==="completed",Q=S===K.id,te=Q?P:K;return console.log("renderSection:",{sectionId:K.id,sectionTitle:K.title,defaultExpanded:c,openSectionsHasId:w.has(K.id),finalIsOpen:E,openSectionsSize:w.size,isEditing:Q}),a.jsx("div",{className:"border rounded-lg overflow-hidden",children:a.jsxs(xp,{open:!l||E||Q,onOpenChange:()=>l&&!Q&&z(K.id),children:[a.jsx(bp,{asChild:!0,disabled:Q,children:a.jsxs("div",{className:Me("w-full p-4 flex items-center justify-between transition-colors min-w-0",Q&&"bg-blue-50 border-blue-200",!Q&&D&&"bg-blue-50 border-blue-200",!Q&&U&&"bg-green-50 border-green-200",!Q&&!D&&!U&&"bg-slate-50",l&&!Q&&"cursor-pointer hover:bg-slate-100"),children:[a.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[s&&a.jsx("div",{className:"cursor-grab hover:cursor-grab active:cursor-grabbing hover:text-slate-700 transition-colors p-1.5 rounded hover:bg-slate-200 border border-transparent hover:border-slate-300",...Se,title:"Drag to reorder section",children:a.jsx(RA,{className:"h-5 w-5 text-slate-500 hover:text-slate-700"})}),a.jsx("div",{className:"flex-shrink-0",children:Q?a.jsx(BA,{className:"h-5 w-5 text-blue-600"}):U?a.jsx(Cg,{className:"h-5 w-5 text-green-600"}):D?a.jsx(Uw,{className:"h-5 w-5 text-blue-600"}):a.jsx(ff,{className:"h-5 w-5 text-slate-400"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:Q?a.jsx(St,{value:te.title,onChange:ce=>R({title:ce.target.value}),className:"font-semibold",onClick:ce=>ce.stopPropagation()}):a.jsx("h4",{className:"font-semibold text-slate-900 break-words",children:typeof te.title=="string"?te.title:String(te.title||"")})}),a.jsxs("div",{className:"flex items-center gap-3 text-sm text-slate-600 flex-wrap",children:[te.questions&&a.jsxs("div",{className:"flex items-center gap-1 whitespace-nowrap",children:[a.jsx(di,{className:"h-3 w-3"}),te.questions.length," questions"]}),te.activities&&a.jsxs("div",{className:"flex items-center gap-1 whitespace-nowrap",children:[a.jsx(Hs,{className:"h-3 w-3"}),te.activities.length," activities"]})]})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[Q?a.jsxs("div",{className:"flex gap-2",onClick:ce=>ce.stopPropagation(),children:[a.jsxs(oe,{size:"sm",onClick:I,disabled:A,className:"h-8",children:[a.jsx(wN,{className:"h-3 w-3 mr-1"}),A?"Saving...":"Save"]}),a.jsxs(oe,{size:"sm",variant:"outline",onClick:M,disabled:A,className:"h-8",children:[a.jsx(js,{className:"h-3 w-3 mr-1"}),"Cancel"]})]}):s&&a.jsxs("div",{className:"flex gap-1",onClick:ce=>ce.stopPropagation(),children:[a.jsx(oe,{size:"sm",variant:"ghost",onClick:()=>T(K),className:"h-8 w-8 p-0 text-slate-600 hover:text-blue-600",title:"Edit section",children:a.jsx(BA,{className:"h-3 w-3"})}),a.jsx(oe,{size:"sm",variant:"ghost",onClick:()=>L(K.id),className:"h-8 w-8 p-0 text-slate-600 hover:text-red-600",title:"Delete section",children:a.jsx(gn,{className:"h-3 w-3"})})]}),l&&!Q&&a.jsx("div",{className:"flex-shrink-0",children:E?a.jsx(ja,{className:"h-4 w-4 text-slate-400"}):a.jsx(ds,{className:"h-4 w-4 text-slate-400"})})]})]})}),a.jsx(wp,{children:a.jsxs("div",{className:"p-4 border-t bg-white space-y-3",children:[(te.content||Q)&&a.jsx("div",{children:Q?a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium text-slate-700 mb-1 block",children:"Section Description"}),a.jsx(Qe,{value:te.content||"",onChange:ce=>R({content:ce.target.value}),placeholder:"Enter section description...",className:"min-h-[60px]"})]}):a.jsx("div",{className:"text-sm text-slate-600 p-3 bg-slate-50 rounded-lg",children:typeof te.content=="string"?te.content:String(te.content||"")})}),te.activities&&te.activities.length>0||Q?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("h5",{className:"font-medium text-slate-700 flex items-center gap-2",children:[a.jsx(Hs,{className:"h-4 w-4"}),"Activities"]}),Q&&a.jsxs(oe,{size:"sm",variant:"outline",onClick:()=>V("activity"),className:"h-7",children:[a.jsx(Hs,{className:"h-3 w-3 mr-1"}),"Add Activity"]})]}),a.jsx(Id,{items:((Y=te.activities)==null?void 0:Y.map(ce=>`${K.id}-activity-item-${ce.id}`))||[],strategy:$d,children:a.jsx("div",{className:"space-y-2",children:(xe=te.activities)==null?void 0:xe.map((ce,ke)=>a.jsx(he,{id:`${K.id}-activity-item-${ce.id}`,item:ce,sectionIndex:ve,itemIndex:ke,itemType:"activity",disabled:!Q||!s},ce.id))})})]}):null,te.questions&&te.questions.length>0||Q?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("h5",{className:"font-medium text-slate-700 flex items-center gap-2",children:[a.jsx(di,{className:"h-4 w-4"}),"Questions"]}),Q&&a.jsxs(oe,{size:"sm",variant:"outline",onClick:()=>V("question"),className:"h-7",children:[a.jsx(di,{className:"h-3 w-3 mr-1"}),"Add Question"]})]}),a.jsx(Id,{items:((je=te.questions)==null?void 0:je.map(ce=>`${K.id}-question-item-${ce.id}`))||[],strategy:$d,children:a.jsx("div",{className:"space-y-2",children:(Fe=te.questions)==null?void 0:Fe.map((ce,ke)=>a.jsx(he,{id:`${K.id}-question-item-${ce.id}`,item:ce,sectionIndex:ve,itemIndex:ke,itemType:"question",disabled:!Q||!s},ce.id))})})]}):null,K.subsections&&K.subsections.length>0&&a.jsxs("div",{className:"space-y-3",children:[a.jsx("h5",{className:"font-medium text-slate-700",children:"Subsections"}),a.jsx("div",{className:"space-y-3",children:K.subsections.map((ce,ke)=>{var Be,mt;return a.jsxs("div",{className:"border rounded-lg p-3 bg-slate-50",children:[a.jsx("div",{className:"flex items-center justify-between mb-2 gap-2",children:a.jsx("h6",{className:"font-medium text-slate-800 break-words min-w-0",children:typeof ce.title=="string"?ce.title:String(ce.title||"")})}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(Id,{items:((Be=ce.questions)==null?void 0:Be.map(_t=>`${K.id}-subsection-${ke}-question-item-${_t.id}`))||[],strategy:$d,children:ce.questions.map((_t,Pt)=>a.jsx(he,{id:`${K.id}-subsection-${ke}-question-item-${_t.id}`,item:_t,sectionIndex:ve,itemIndex:Pt,itemType:"question",subsectionIndex:ke,disabled:!Q||!s},_t.id))}),ce.activities&&a.jsx(Id,{items:((mt=ce.activities)==null?void 0:mt.map(_t=>`${K.id}-subsection-${ke}-activity-item-${_t.id}`))||[],strategy:$d,children:ce.activities.map((_t,Pt)=>a.jsx(he,{id:`${K.id}-subsection-${ke}-activity-item-${_t.id}`,item:_t,sectionIndex:ve,itemIndex:Pt,itemType:"activity",subsectionIndex:ke,disabled:!Q||!s},_t.id))})]})]},ce.id)})})]})]})})]})},K.id)},Xe=()=>{if(!o||!n||!y)return null;const K=n.legacy_format?0:n.progress;return a.jsxs("div",{className:"mb-4 p-3 bg-slate-50 rounded-lg",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Session Progress"}),a.jsxs("span",{className:"text-sm text-slate-600",children:[Math.round(K),"%"]})]}),a.jsx("div",{className:"w-full bg-slate-200 rounded-full h-2",children:a.jsx("div",{className:"bg-blue-600 h-2 rounded-full transition-all duration-300",style:{width:`${K}%`}})}),!n.legacy_format&&a.jsxs("div",{className:"mt-2 text-xs text-slate-600 break-words",children:["Currently in: ",a.jsx("span",{className:"font-medium",children:n.current_section})]})]})};return p?fe():y?a.jsxs("div",{className:Me("space-y-4",u),children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(di,{className:"h-5 w-5 text-slate-600"}),a.jsx("h3",{className:"font-semibold text-slate-900",children:typeof y.title=="string"?y.title:String(y.title||"Discussion Guide")}),a.jsxs(lr,{variant:"outline",className:"text-xs",children:[y.total_duration," min"]})]}),d&&a.jsx(oe,{variant:"ghost",size:"sm",onClick:d,disabled:f,className:"h-8",title:"Download Discussion Guide",children:f?a.jsx(_l,{className:"h-4 w-4 animate-spin"}):a.jsx(Ku,{className:"h-4 w-4"})})]}),Xe(),a.jsx(Mte,{sensors:$,collisionDetection:Mee,onDragStart:K=>{console.log("๐Ÿš€ Drag START:",{activeId:K.active.id,timestamp:new Date().toISOString()})},onDragEnd:me,children:a.jsx(Id,{items:y.sections.map(K=>`section-${K.id}`),strategy:$d,children:a.jsx("div",{className:"space-y-3",children:y.sections.map((K,ve)=>a.jsx(ue,{id:`section-${K.id}`,section:K,sectionIndex:ve,disabled:!s},K.id))})})})]}):a.jsxs("div",{className:Me("space-y-4",u),children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(di,{className:"h-5 w-5 text-slate-600"}),a.jsx("h3",{className:"font-semibold text-slate-900",children:"Discussion Guide"})]}),a.jsx("div",{className:"text-center py-8 text-slate-500",children:a.jsx("p",{children:"No discussion guide available"})})]})},(e,t)=>{if(e.defaultExpanded!==t.defaultExpanded||e.showProgress!==t.showProgress||e.collapsible!==t.collapsible||e.className!==t.className||e.isDownloading!==t.isDownloading)return console.log("๐Ÿ”„ DiscussionGuideViewer re-render: prop changes detected"),!1;if(e.onSectionSelect!==t.onSectionSelect)return console.log("๐Ÿ”„ DiscussionGuideViewer re-render: onSectionSelect changed"),!1;if(e.onSetPosition!==t.onSetPosition)return console.log("๐Ÿ”„ DiscussionGuideViewer re-render: onSetPosition changed"),!1;if(e.onSave!==t.onSave)return console.log("๐Ÿ”„ DiscussionGuideViewer re-render: onSave changed"),!1;if(e.onDownload!==t.onDownload)return console.log("๐Ÿ”„ DiscussionGuideViewer re-render: onDownload changed"),!1;const n=JSON.stringify(e.discussionGuide)!==JSON.stringify(t.discussionGuide),r=JSON.stringify(e.moderatorStatus)!==JSON.stringify(t.moderatorStatus);return n?(console.log("๐Ÿ”„ DiscussionGuideViewer re-render: discussionGuide content changed"),!1):r?(console.log("๐Ÿ”„ DiscussionGuideViewer re-render: moderatorStatus changed"),!1):(console.log("โญ๏ธ DiscussionGuideViewer skipping re-render: no meaningful changes"),!0)});var _a="Accordion",ine=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[T_,sne,ane]=jp(_a),[hx,AOe]=Er(_a,[ane,$D]),$_=$D(),M5=C.forwardRef((e,t)=>{const{type:n,...r}=e,i=r,s=r;return a.jsx(T_.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?a.jsx(une,{...s,ref:t}):a.jsx(cne,{...i,ref:t})})});M5.displayName=_a;var[R5,one]=hx(_a),[D5,lne]=hx(_a,{collapsible:!1}),cne=C.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},collapsible:s=!1,...o}=e,[l,c]=ii({prop:n,defaultProp:r,onChange:i});return a.jsx(R5,{scope:e.__scopeAccordion,value:l?[l]:[],onItemOpen:c,onItemClose:C.useCallback(()=>s&&c(""),[s,c]),children:a.jsx(D5,{scope:e.__scopeAccordion,collapsible:s,children:a.jsx(L5,{...o,ref:t})})})}),une=C.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:i=()=>{},...s}=e,[o=[],l]=ii({prop:n,defaultProp:r,onChange:i}),c=C.useCallback(d=>l((f=[])=>[...f,d]),[l]),u=C.useCallback(d=>l((f=[])=>f.filter(h=>h!==d)),[l]);return a.jsx(R5,{scope:e.__scopeAccordion,value:o,onItemOpen:c,onItemClose:u,children:a.jsx(D5,{scope:e.__scopeAccordion,collapsible:!0,children:a.jsx(L5,{...s,ref:t})})})}),[dne,px]=hx(_a),L5=C.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:i,orientation:s="vertical",...o}=e,l=C.useRef(null),c=dt(l,t),u=sne(n),f=ko(i)==="ltr",h=Te(e.onKeyDown,p=>{var _;if(!ine.includes(p.key))return;const g=p.target,m=u().filter(A=>{var O;return!((O=A.ref.current)!=null&&O.disabled)}),x=m.findIndex(A=>A.ref.current===g),b=m.length;if(x===-1)return;p.preventDefault();let y=x;const w=0,j=b-1,S=()=>{y=x+1,y>j&&(y=w)},N=()=>{y=x-1,y{const{__scopeAccordion:n,value:r,...i}=e,s=px(lv,n),o=one(lv,n),l=$_(n),c=wi(),u=r&&o.value.includes(r)||!1,d=s.disabled||e.disabled;return a.jsx(fne,{scope:n,open:u,disabled:d,triggerId:c,children:a.jsx(RD,{"data-orientation":s.orientation,"data-state":H5(u),...l,...i,ref:t,disabled:d,open:u,onOpenChange:f=>{f?o.onItemOpen(r):o.onItemClose(r)}})})});F5.displayName=lv;var B5="AccordionHeader",z5=C.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,i=px(_a,n),s=I_(B5,n);return a.jsx(qe.h3,{"data-orientation":i.orientation,"data-state":H5(s.open),"data-disabled":s.disabled?"":void 0,...r,ref:t})});z5.displayName=B5;var P1="AccordionTrigger",U5=C.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,i=px(_a,n),s=I_(P1,n),o=lne(P1,n),l=$_(n);return a.jsx(T_.ItemSlot,{scope:n,children:a.jsx(JX,{"aria-disabled":s.open&&!o.collapsible||void 0,"data-orientation":i.orientation,id:s.triggerId,...l,...r,ref:t})})});U5.displayName=P1;var V5="AccordionContent",W5=C.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,i=px(_a,n),s=I_(V5,n),o=$_(n);return a.jsx(eY,{role:"region","aria-labelledby":s.triggerId,"data-orientation":i.orientation,...o,...r,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});W5.displayName=V5;function H5(e){return e?"open":"closed"}var hne=M5,pne=F5,mne=z5,G5=U5,q5=W5;const gne=hne,C1=v.forwardRef(({className:e,...t},n)=>a.jsx(pne,{ref:n,className:Me("border-b",e),...t}));C1.displayName="AccordionItem";const A1=v.forwardRef(({className:e,children:t,...n},r)=>a.jsx(mne,{className:"flex",children:a.jsxs(G5,{ref:r,className:Me("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,a.jsx(ja,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));A1.displayName=G5.displayName;const E1=v.forwardRef(({className:e,children:t,...n},r)=>a.jsx(q5,{ref:r,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:a.jsx("div",{className:Me("pb-4 pt-0",e),children:t})}));E1.displayName=q5.displayName;var vne=Array.isArray,Vr=vne,yne=typeof Bp=="object"&&Bp&&Bp.Object===Object&&Bp,K5=yne,xne=K5,bne=typeof self=="object"&&self&&self.Object===Object&&self,wne=xne||bne||Function("return this")(),$s=wne,jne=$s,Sne=jne.Symbol,Op=Sne,VE=Op,X5=Object.prototype,Nne=X5.hasOwnProperty,_ne=X5.toString,Md=VE?VE.toStringTag:void 0;function Pne(e){var t=Nne.call(e,Md),n=e[Md];try{e[Md]=void 0;var r=!0}catch{}var i=_ne.call(e);return r&&(t?e[Md]=n:delete e[Md]),i}var Cne=Pne,Ane=Object.prototype,Ene=Ane.toString;function One(e){return Ene.call(e)}var kne=One,WE=Op,Tne=Cne,$ne=kne,Ine="[object Null]",Mne="[object Undefined]",HE=WE?WE.toStringTag:void 0;function Rne(e){return e==null?e===void 0?Mne:Ine:HE&&HE in Object(e)?Tne(e):$ne(e)}var Pa=Rne;function Dne(e){return e!=null&&typeof e=="object"}var Ca=Dne,Lne=Pa,Fne=Ca,Bne="[object Symbol]";function zne(e){return typeof e=="symbol"||Fne(e)&&Lne(e)==Bne}var id=zne,Une=Vr,Vne=id,Wne=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Hne=/^\w*$/;function Gne(e,t){if(Une(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Vne(e)?!0:Hne.test(e)||!Wne.test(e)||t!=null&&e in Object(t)}var M_=Gne;function qne(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Mo=qne;const sd=Rt(Mo);var Kne=Pa,Xne=Mo,Yne="[object AsyncFunction]",Zne="[object Function]",Qne="[object GeneratorFunction]",Jne="[object Proxy]";function ere(e){if(!Xne(e))return!1;var t=Kne(e);return t==Zne||t==Qne||t==Yne||t==Jne}var R_=ere;const ot=Rt(R_);var tre=$s,nre=tre["__core-js_shared__"],rre=nre,ob=rre,GE=function(){var e=/[^.]+$/.exec(ob&&ob.keys&&ob.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function ire(e){return!!GE&&GE in e}var sre=ire,are=Function.prototype,ore=are.toString;function lre(e){if(e!=null){try{return ore.call(e)}catch{}try{return e+""}catch{}}return""}var Y5=lre,cre=R_,ure=sre,dre=Mo,fre=Y5,hre=/[\\^$.*+?()[\]{}|]/g,pre=/^\[object .+?Constructor\]$/,mre=Function.prototype,gre=Object.prototype,vre=mre.toString,yre=gre.hasOwnProperty,xre=RegExp("^"+vre.call(yre).replace(hre,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function bre(e){if(!dre(e)||ure(e))return!1;var t=cre(e)?xre:pre;return t.test(fre(e))}var wre=bre;function jre(e,t){return e==null?void 0:e[t]}var Sre=jre,Nre=wre,_re=Sre;function Pre(e,t){var n=_re(e,t);return Nre(n)?n:void 0}var Hl=Pre,Cre=Hl,Are=Cre(Object,"create"),mx=Are,qE=mx;function Ere(){this.__data__=qE?qE(null):{},this.size=0}var Ore=Ere;function kre(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Tre=kre,$re=mx,Ire="__lodash_hash_undefined__",Mre=Object.prototype,Rre=Mre.hasOwnProperty;function Dre(e){var t=this.__data__;if($re){var n=t[e];return n===Ire?void 0:n}return Rre.call(t,e)?t[e]:void 0}var Lre=Dre,Fre=mx,Bre=Object.prototype,zre=Bre.hasOwnProperty;function Ure(e){var t=this.__data__;return Fre?t[e]!==void 0:zre.call(t,e)}var Vre=Ure,Wre=mx,Hre="__lodash_hash_undefined__";function Gre(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Wre&&t===void 0?Hre:t,this}var qre=Gre,Kre=Ore,Xre=Tre,Yre=Lre,Zre=Vre,Qre=qre;function ad(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t-1}var mie=pie,gie=gx;function vie(e,t){var n=this.__data__,r=gie(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var yie=vie,xie=tie,bie=cie,wie=fie,jie=mie,Sie=yie;function od(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t0?1:-1},rl=function(t){return kp(t)&&t.indexOf("%")===t.length-1},Oe=function(t){return Wse(t)&&!cd(t)},Mn=function(t){return Oe(t)||kp(t)},Kse=0,ud=function(t){var n=++Kse;return"".concat(t||"").concat(n)},Sr=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Oe(t)&&!kp(t))return r;var s;if(rl(t)){var o=t.indexOf("%");s=n*parseFloat(t.slice(0,o))/100}else s=+t;return cd(s)&&(s=r),i&&s>n&&(s=n),s},Wa=function(t){if(!t)return null;var n=Object.keys(t);return n&&n.length?t[n[0]]:null},Xse=function(t){if(!Array.isArray(t))return!1;for(var n=t.length,r={},i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function tae(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function k1(e){"@babel/helpers - typeof";return k1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},k1(e)}var eO={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart"},ta=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},tO=null,cb=null,G_=function e(t){if(t===tO&&Array.isArray(cb))return cb;var n=[];return v.Children.forEach(t,function(r){gt(r)||(sF.isFragment(r)?n=n.concat(e(r.props.children)):n.push(r))}),cb=n,tO=t,n};function Si(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(function(i){return ta(i)}):r=[ta(t)],G_(e).forEach(function(i){var s=ni(i,"type.displayName")||ni(i,"type.name");r.indexOf(s)!==-1&&n.push(i)}),n}function Kr(e,t){var n=Si(e,t);return n&&n[0]}var nO=function(t){if(!t||!t.props)return!1;var n=t.props,r=n.width,i=n.height;return!(!Oe(r)||r<=0||!Oe(i)||i<=0)},nae=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],rae=function(t){return t&&t.type&&kp(t.type)&&nae.indexOf(t.type)>=0},iae=function(t){return t&&k1(t)==="object"&&"clipDot"in t},sae=function(t,n,r,i){var s,o=(s=lb==null?void 0:lb[i])!==null&&s!==void 0?s:[];return!ot(t)&&(i&&o.includes(n)||Zse.includes(n))||r&&H_.includes(n)},Ke=function(t,n,r){if(!t||typeof t=="function"||typeof t=="boolean")return null;var i=t;if(v.isValidElement(t)&&(i=t.props),!sd(i))return null;var s={};return Object.keys(i).forEach(function(o){var l;sae((l=i)===null||l===void 0?void 0:l[o],o,n,r)&&(s[o]=i[o])}),s},T1=function e(t,n){if(t===n)return!0;var r=v.Children.count(t);if(r!==v.Children.count(n))return!1;if(r===0)return!0;if(r===1)return rO(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function uae(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function I1(e){var t=e.children,n=e.width,r=e.height,i=e.viewBox,s=e.className,o=e.style,l=e.title,c=e.desc,u=cae(e,lae),d=i||{width:n,height:r,x:0,y:0},f=ht("recharts-surface",s);return C.createElement("svg",$1({},Ke(u,!0,"svg"),{className:f,width:n,height:r,style:o,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height)}),C.createElement("title",null,l),C.createElement("desc",null,c),t)}var dae=["children","className"];function M1(){return M1=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function hae(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var Et=C.forwardRef(function(e,t){var n=e.children,r=e.className,i=fae(e,dae),s=ht("recharts-layer",r);return C.createElement("g",M1({className:s},Ke(i,!0),{ref:t}),n)}),Ki=function(t,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;si?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var s=Array(i);++r=r?e:gae(e,t,n)}var yae=vae,xae="\\ud800-\\udfff",bae="\\u0300-\\u036f",wae="\\ufe20-\\ufe2f",jae="\\u20d0-\\u20ff",Sae=bae+wae+jae,Nae="\\ufe0e\\ufe0f",_ae="\\u200d",Pae=RegExp("["+_ae+xae+Sae+Nae+"]");function Cae(e){return Pae.test(e)}var oF=Cae;function Aae(e){return e.split("")}var Eae=Aae,lF="\\ud800-\\udfff",Oae="\\u0300-\\u036f",kae="\\ufe20-\\ufe2f",Tae="\\u20d0-\\u20ff",$ae=Oae+kae+Tae,Iae="\\ufe0e\\ufe0f",Mae="["+lF+"]",R1="["+$ae+"]",D1="\\ud83c[\\udffb-\\udfff]",Rae="(?:"+R1+"|"+D1+")",cF="[^"+lF+"]",uF="(?:\\ud83c[\\udde6-\\uddff]){2}",dF="[\\ud800-\\udbff][\\udc00-\\udfff]",Dae="\\u200d",fF=Rae+"?",hF="["+Iae+"]?",Lae="(?:"+Dae+"(?:"+[cF,uF,dF].join("|")+")"+hF+fF+")*",Fae=hF+fF+Lae,Bae="(?:"+[cF+R1+"?",R1,uF,dF,Mae].join("|")+")",zae=RegExp(D1+"(?="+D1+")|"+Bae+Fae,"g");function Uae(e){return e.match(zae)||[]}var Vae=Uae,Wae=Eae,Hae=oF,Gae=Vae;function qae(e){return Hae(e)?Gae(e):Wae(e)}var Kae=qae,Xae=yae,Yae=oF,Zae=Kae,Qae=eF;function Jae(e){return function(t){t=Qae(t);var n=Yae(t)?Zae(t):void 0,r=n?n[0]:t.charAt(0),i=n?Xae(n,1).join(""):t.slice(1);return r[e]()+i}}var eoe=Jae,toe=eoe,noe=toe("toUpperCase"),roe=noe;const Ox=Rt(roe);function Xt(e){return function(){return e}}const pF=Math.cos,dv=Math.sin,as=Math.sqrt,fv=Math.PI,kx=2*fv,L1=Math.PI,F1=2*L1,Go=1e-6,ioe=F1-Go;function mF(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return mF;const n=10**t;return function(r){this._+=r[0];for(let i=1,s=r.length;iGo)if(!(Math.abs(f*c-u*d)>Go)||!s)this._append`L${this._x1=t},${this._y1=n}`;else{let p=r-o,g=i-l,m=c*c+u*u,x=p*p+g*g,b=Math.sqrt(m),y=Math.sqrt(h),w=s*Math.tan((L1-Math.acos((m+h-x)/(2*b*y)))/2),j=w/y,S=w/b;Math.abs(j-1)>Go&&this._append`L${t+j*d},${n+j*f}`,this._append`A${s},${s},0,0,${+(f*p>d*g)},${this._x1=t+S*c},${this._y1=n+S*u}`}}arc(t,n,r,i,s,o){if(t=+t,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let l=r*Math.cos(i),c=r*Math.sin(i),u=t+l,d=n+c,f=1^o,h=o?i-s:s-i;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>Go||Math.abs(this._y1-d)>Go)&&this._append`L${u},${d}`,r&&(h<0&&(h=h%F1+F1),h>ioe?this._append`A${r},${r},0,1,${f},${t-l},${n-c}A${r},${r},0,1,${f},${this._x1=u},${this._y1=d}`:h>Go&&this._append`A${r},${r},0,${+(h>=L1)},${f},${this._x1=t+r*Math.cos(s)},${this._y1=n+r*Math.sin(s)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function q_(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new aoe(t)}function K_(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function gF(e){this._context=e}gF.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Tx(e){return new gF(e)}function vF(e){return e[0]}function yF(e){return e[1]}function xF(e,t){var n=Xt(!0),r=null,i=Tx,s=null,o=q_(l);e=typeof e=="function"?e:e===void 0?vF:Xt(e),t=typeof t=="function"?t:t===void 0?yF:Xt(t);function l(c){var u,d=(c=K_(c)).length,f,h=!1,p;for(r==null&&(s=i(p=o())),u=0;u<=d;++u)!(u=p;--g)l.point(w[g],j[g]);l.lineEnd(),l.areaEnd()}b&&(w[h]=+e(x,h,f),j[h]=+t(x,h,f),l.point(r?+r(x,h,f):w[h],n?+n(x,h,f):j[h]))}if(y)return l=null,y+""||null}function d(){return xF().defined(i).curve(o).context(s)}return u.x=function(f){return arguments.length?(e=typeof f=="function"?f:Xt(+f),r=null,u):e},u.x0=function(f){return arguments.length?(e=typeof f=="function"?f:Xt(+f),u):e},u.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Xt(+f),u):r},u.y=function(f){return arguments.length?(t=typeof f=="function"?f:Xt(+f),n=null,u):t},u.y0=function(f){return arguments.length?(t=typeof f=="function"?f:Xt(+f),u):t},u.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Xt(+f),u):n},u.lineX0=u.lineY0=function(){return d().x(e).y(t)},u.lineY1=function(){return d().x(e).y(n)},u.lineX1=function(){return d().x(r).y(t)},u.defined=function(f){return arguments.length?(i=typeof f=="function"?f:Xt(!!f),u):i},u.curve=function(f){return arguments.length?(o=f,s!=null&&(l=o(s)),u):o},u.context=function(f){return arguments.length?(f==null?s=l=null:l=o(s=f),u):s},u}class bF{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function ooe(e){return new bF(e,!0)}function loe(e){return new bF(e,!1)}const X_={draw(e,t){const n=as(t/fv);e.moveTo(n,0),e.arc(0,0,n,0,kx)}},coe={draw(e,t){const n=as(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},wF=as(1/3),uoe=wF*2,doe={draw(e,t){const n=as(t/uoe),r=n*wF;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},foe={draw(e,t){const n=as(t),r=-n/2;e.rect(r,r,n,n)}},hoe=.8908130915292852,jF=dv(fv/10)/dv(7*fv/10),poe=dv(kx/10)*jF,moe=-pF(kx/10)*jF,goe={draw(e,t){const n=as(t*hoe),r=poe*n,i=moe*n;e.moveTo(0,-n),e.lineTo(r,i);for(let s=1;s<5;++s){const o=kx*s/5,l=pF(o),c=dv(o);e.lineTo(c*n,-l*n),e.lineTo(l*r-c*i,c*r+l*i)}e.closePath()}},ub=as(3),voe={draw(e,t){const n=-as(t/(ub*3));e.moveTo(0,n*2),e.lineTo(-ub*n,-n),e.lineTo(ub*n,-n),e.closePath()}},oi=-.5,li=as(3)/2,B1=1/as(12),yoe=(B1/2+1)*3,xoe={draw(e,t){const n=as(t/yoe),r=n/2,i=n*B1,s=r,o=n*B1+n,l=-s,c=o;e.moveTo(r,i),e.lineTo(s,o),e.lineTo(l,c),e.lineTo(oi*r-li*i,li*r+oi*i),e.lineTo(oi*s-li*o,li*s+oi*o),e.lineTo(oi*l-li*c,li*l+oi*c),e.lineTo(oi*r+li*i,oi*i-li*r),e.lineTo(oi*s+li*o,oi*o-li*s),e.lineTo(oi*l+li*c,oi*c-li*l),e.closePath()}};function boe(e,t){let n=null,r=q_(i);e=typeof e=="function"?e:Xt(e||X_),t=typeof t=="function"?t:Xt(t===void 0?64:+t);function i(){let s;if(n||(n=s=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),s)return n=null,s+""||null}return i.type=function(s){return arguments.length?(e=typeof s=="function"?s:Xt(s),i):e},i.size=function(s){return arguments.length?(t=typeof s=="function"?s:Xt(+s),i):t},i.context=function(s){return arguments.length?(n=s??null,i):n},i}function hv(){}function pv(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function SF(e){this._context=e}SF.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:pv(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:pv(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function woe(e){return new SF(e)}function NF(e){this._context=e}NF.prototype={areaStart:hv,areaEnd:hv,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:pv(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function joe(e){return new NF(e)}function _F(e){this._context=e}_F.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:pv(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Soe(e){return new _F(e)}function PF(e){this._context=e}PF.prototype={areaStart:hv,areaEnd:hv,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function Noe(e){return new PF(e)}function sO(e){return e<0?-1:1}function aO(e,t,n){var r=e._x1-e._x0,i=t-e._x1,s=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),l=(s*i+o*r)/(r+i);return(sO(s)+sO(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(l))||0}function oO(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function db(e,t,n){var r=e._x0,i=e._y0,s=e._x1,o=e._y1,l=(s-r)/3;e._context.bezierCurveTo(r+l,i+l*t,s-l,o-l*n,s,o)}function mv(e){this._context=e}mv.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:db(this,this._t0,oO(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,db(this,oO(this,n=aO(this,e,t)),n);break;default:db(this,this._t0,n=aO(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function CF(e){this._context=new AF(e)}(CF.prototype=Object.create(mv.prototype)).point=function(e,t){mv.prototype.point.call(this,t,e)};function AF(e){this._context=e}AF.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,s){this._context.bezierCurveTo(t,e,r,n,s,i)}};function _oe(e){return new mv(e)}function Poe(e){return new CF(e)}function EF(e){this._context=e}EF.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=lO(e),i=lO(t),s=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/s[t];for(s[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function Aoe(e){return new $x(e,.5)}function Eoe(e){return new $x(e,0)}function Ooe(e){return new $x(e,1)}function fu(e,t){if((o=e.length)>1)for(var n=1,r,i,s=e[t[0]],o,l=s.length;n=0;)n[t]=t;return n}function koe(e,t){return e[t]}function Toe(e){const t=[];return t.key=e,t}function $oe(){var e=Xt([]),t=z1,n=fu,r=koe;function i(s){var o=Array.from(e.apply(this,arguments),Toe),l,c=o.length,u=-1,d;for(const f of s)for(l=0,++u;l0){for(var n,r,i=0,s=e[0].length,o;i0){for(var n=0,r=e[t[0]],i,s=r.length;n0)||!((s=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,s,o;r=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Uoe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var OF={symbolCircle:X_,symbolCross:coe,symbolDiamond:doe,symbolSquare:foe,symbolStar:goe,symbolTriangle:voe,symbolWye:xoe},Voe=Math.PI/180,Woe=function(t){var n="symbol".concat(Ox(t));return OF[n]||X_},Hoe=function(t,n,r){if(n==="area")return t;switch(r){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var i=18*Voe;return 1.25*t*t*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},Goe=function(t,n){OF["symbol".concat(Ox(t))]=n},Y_=function(t){var n=t.type,r=n===void 0?"circle":n,i=t.size,s=i===void 0?64:i,o=t.sizeType,l=o===void 0?"area":o,c=zoe(t,Doe),u=uO(uO({},c),{},{type:r,size:s,sizeType:l}),d=function(){var x=Woe(r),b=boe().type(x).size(Hoe(s,l,r));return b()},f=u.className,h=u.cx,p=u.cy,g=Ke(u,!0);return h===+h&&p===+p&&s===+s?C.createElement("path",U1({},g,{className:ht("recharts-symbols",f),transform:"translate(".concat(h,", ").concat(p,")"),d:d()})):null};Y_.registerSymbol=Goe;function hu(e){"@babel/helpers - typeof";return hu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hu(e)}function V1(){return V1=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);var y=p.inactive?u:p.color;return C.createElement("li",V1({className:x,style:f,key:"legend-item-".concat(g)},Il(r.props,p,g)),C.createElement(I1,{width:o,height:o,viewBox:d,style:h},r.renderIcon(p)),C.createElement("span",{className:"recharts-legend-item-text",style:{color:y}},m?m(b,p,g):b))})}},{key:"render",value:function(){var r=this.props,i=r.payload,s=r.layout,o=r.align;if(!i||!i.length)return null;var l={padding:0,margin:0,textAlign:s==="horizontal"?o:"left"};return C.createElement("ul",{className:"recharts-default-legend",style:l},this.renderItems())}}])}(v.PureComponent);wh(Z_,"displayName","Legend");wh(Z_,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var nle=vx;function rle(){this.__data__=new nle,this.size=0}var ile=rle;function sle(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}var ale=sle;function ole(e){return this.__data__.get(e)}var lle=ole;function cle(e){return this.__data__.has(e)}var ule=cle,dle=vx,fle=L_,hle=F_,ple=200;function mle(e,t){var n=this.__data__;if(n instanceof dle){var r=n.__data__;if(!fle||r.lengthl))return!1;var u=s.get(e),d=s.get(t);if(u&&d)return u==t&&d==e;var f=-1,h=!0,p=n&Dle?new $le:void 0;for(s.set(e,t),s.set(t,e);++f-1&&e%1==0&&e-1&&e%1==0&&e<=zce}var tP=Uce,Vce=Pa,Wce=tP,Hce=Ca,Gce="[object Arguments]",qce="[object Array]",Kce="[object Boolean]",Xce="[object Date]",Yce="[object Error]",Zce="[object Function]",Qce="[object Map]",Jce="[object Number]",eue="[object Object]",tue="[object RegExp]",nue="[object Set]",rue="[object String]",iue="[object WeakMap]",sue="[object ArrayBuffer]",aue="[object DataView]",oue="[object Float32Array]",lue="[object Float64Array]",cue="[object Int8Array]",uue="[object Int16Array]",due="[object Int32Array]",fue="[object Uint8Array]",hue="[object Uint8ClampedArray]",pue="[object Uint16Array]",mue="[object Uint32Array]",Jt={};Jt[oue]=Jt[lue]=Jt[cue]=Jt[uue]=Jt[due]=Jt[fue]=Jt[hue]=Jt[pue]=Jt[mue]=!0;Jt[Gce]=Jt[qce]=Jt[sue]=Jt[Kce]=Jt[aue]=Jt[Xce]=Jt[Yce]=Jt[Zce]=Jt[Qce]=Jt[Jce]=Jt[eue]=Jt[tue]=Jt[nue]=Jt[rue]=Jt[iue]=!1;function gue(e){return Hce(e)&&Wce(e.length)&&!!Jt[Vce(e)]}var vue=gue;function yue(e){return function(t){return e(t)}}var zF=yue,xv={exports:{}};xv.exports;(function(e,t){var n=K5,r=t&&!t.nodeType&&t,i=r&&!0&&e&&!e.nodeType&&e,s=i&&i.exports===r,o=s&&n.process,l=function(){try{var c=i&&i.require&&i.require("util").types;return c||o&&o.binding&&o.binding("util")}catch{}}();e.exports=l})(xv,xv.exports);var xue=xv.exports,bue=vue,wue=zF,vO=xue,yO=vO&&vO.isTypedArray,jue=yO?wue(yO):bue,UF=jue,Sue=Pce,Nue=J_,_ue=Vr,Pue=BF,Cue=eP,Aue=UF,Eue=Object.prototype,Oue=Eue.hasOwnProperty;function kue(e,t){var n=_ue(e),r=!n&&Nue(e),i=!n&&!r&&Pue(e),s=!n&&!r&&!i&&Aue(e),o=n||r||i||s,l=o?Sue(e.length,String):[],c=l.length;for(var u in e)(t||Oue.call(e,u))&&!(o&&(u=="length"||i&&(u=="offset"||u=="parent")||s&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||Cue(u,c)))&&l.push(u);return l}var Tue=kue,$ue=Object.prototype;function Iue(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||$ue;return e===n}var Mue=Iue;function Rue(e,t){return function(n){return e(t(n))}}var VF=Rue,Due=VF,Lue=Due(Object.keys,Object),Fue=Lue,Bue=Mue,zue=Fue,Uue=Object.prototype,Vue=Uue.hasOwnProperty;function Wue(e){if(!Bue(e))return zue(e);var t=[];for(var n in Object(e))Vue.call(e,n)&&n!="constructor"&&t.push(n);return t}var Hue=Wue,Gue=R_,que=tP;function Kue(e){return e!=null&&que(e.length)&&!Gue(e)}var Tp=Kue,Xue=Tue,Yue=Hue,Zue=Tp;function Que(e){return Zue(e)?Xue(e):Yue(e)}var Ix=Que,Jue=pce,ede=Nce,tde=Ix;function nde(e){return Jue(e,tde,ede)}var rde=nde,xO=rde,ide=1,sde=Object.prototype,ade=sde.hasOwnProperty;function ode(e,t,n,r,i,s){var o=n&ide,l=xO(e),c=l.length,u=xO(t),d=u.length;if(c!=d&&!o)return!1;for(var f=c;f--;){var h=l[f];if(!(o?h in t:ade.call(t,h)))return!1}var p=s.get(e),g=s.get(t);if(p&&g)return p==t&&g==e;var m=!0;s.set(e,t),s.set(t,e);for(var x=o;++f-1}var she=ihe;function ahe(e,t,n){for(var r=-1,i=e==null?0:e.length;++r=whe){var u=t?null:xhe(e);if(u)return bhe(u);o=!1,i=yhe,c=new mhe}else c=t?[]:l;e:for(;++r=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Dhe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Lhe(e){return e.value}function Fhe(e,t){if(C.isValidElement(e))return C.cloneElement(e,t);if(typeof e=="function")return C.createElement(e,t);t.ref;var n=Rhe(t,Ahe);return C.createElement(Z_,n)}var MO=1,na=function(e){function t(){var n;Ehe(this,t);for(var r=arguments.length,i=new Array(r),s=0;sMO||Math.abs(i.height-this.lastBoundingBox.height)>MO)&&(this.lastBoundingBox.width=i.width,this.lastBoundingBox.height=i.height,r&&r(i)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,r&&r(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?Ls({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(r){var i=this.props,s=i.layout,o=i.align,l=i.verticalAlign,c=i.margin,u=i.chartWidth,d=i.chartHeight,f,h;if(!r||(r.left===void 0||r.left===null)&&(r.right===void 0||r.right===null))if(o==="center"&&s==="vertical"){var p=this.getBBoxSnapshot();f={left:((u||0)-p.width)/2}}else f=o==="right"?{right:c&&c.right||0}:{left:c&&c.left||0};if(!r||(r.top===void 0||r.top===null)&&(r.bottom===void 0||r.bottom===null))if(l==="middle"){var g=this.getBBoxSnapshot();h={top:((d||0)-g.height)/2}}else h=l==="bottom"?{bottom:c&&c.bottom||0}:{top:c&&c.top||0};return Ls(Ls({},f),h)}},{key:"render",value:function(){var r=this,i=this.props,s=i.content,o=i.width,l=i.height,c=i.wrapperStyle,u=i.payloadUniqBy,d=i.payload,f=Ls(Ls({position:"absolute",width:o||"auto",height:l||"auto"},this.getDefaultPosition(c)),c);return C.createElement("div",{className:"recharts-legend-wrapper",style:f,ref:function(p){r.wrapperNode=p}},Fhe(s,Ls(Ls({},this.props),{},{payload:YF(d,u,Lhe)})))}}],[{key:"getWithHeight",value:function(r,i){var s=Ls(Ls({},this.defaultProps),r.props),o=s.layout;return o==="vertical"&&Oe(r.props.height)?{height:r.props.height}:o==="horizontal"?{width:r.props.width||i}:null}}])}(v.PureComponent);Mx(na,"displayName","Legend");Mx(na,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var RO=Op,Bhe=J_,zhe=Vr,DO=RO?RO.isConcatSpreadable:void 0;function Uhe(e){return zhe(e)||Bhe(e)||!!(DO&&e&&e[DO])}var Vhe=Uhe,Whe=LF,Hhe=Vhe;function JF(e,t,n,r,i){var s=-1,o=e.length;for(n||(n=Hhe),i||(i=[]);++s0&&n(l)?t>1?JF(l,t-1,n,r,i):Whe(i,l):r||(i[i.length]=l)}return i}var e6=JF;function Ghe(e){return function(t,n,r){for(var i=-1,s=Object(t),o=r(t),l=o.length;l--;){var c=o[e?l:++i];if(n(s[c],c,s)===!1)break}return t}}var qhe=Ghe,Khe=qhe,Xhe=Khe(),Yhe=Xhe,Zhe=Yhe,Qhe=Ix;function Jhe(e,t){return e&&Zhe(e,t,Qhe)}var t6=Jhe,epe=Tp;function tpe(e,t){return function(n,r){if(n==null)return n;if(!epe(n))return e(n,r);for(var i=n.length,s=t?i:-1,o=Object(n);(t?s--:++st||s&&o&&c&&!l&&!u||r&&o&&c||!n&&c||!i)return 1;if(!r&&!s&&!u&&e=l)return c;var u=n[r];return c*(u=="desc"?-1:1)}}return e.index-t.index}var mpe=ppe,mb=z_,gpe=U_,vpe=Is,ype=n6,xpe=upe,bpe=zF,wpe=mpe,jpe=hd,Spe=Vr;function Npe(e,t,n){t.length?t=mb(t,function(s){return Spe(s)?function(o){return gpe(o,s.length===1?s[0]:s)}:s}):t=[jpe];var r=-1;t=mb(t,bpe(vpe));var i=ype(e,function(s,o,l){var c=mb(t,function(u){return u(s)});return{criteria:c,index:++r,value:s}});return xpe(i,function(s,o){return wpe(s,o,n)})}var _pe=Npe;function Ppe(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var Cpe=Ppe,Ape=Cpe,FO=Math.max;function Epe(e,t,n){return t=FO(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,s=FO(r.length-t,0),o=Array(s);++i0){if(++t>=Fpe)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Vpe=Upe,Wpe=Lpe,Hpe=Vpe,Gpe=Hpe(Wpe),qpe=Gpe,Kpe=hd,Xpe=Ope,Ype=qpe;function Zpe(e,t){return Ype(Xpe(e,t,Kpe),e+"")}var Qpe=Zpe,Jpe=D_,eme=Tp,tme=eP,nme=Mo;function rme(e,t,n){if(!nme(n))return!1;var r=typeof t;return(r=="number"?eme(n)&&tme(t,n.length):r=="string"&&t in n)?Jpe(n[t],e):!1}var Rx=rme,ime=e6,sme=_pe,ame=Qpe,zO=Rx,ome=ame(function(e,t){if(e==null)return[];var n=t.length;return n>1&&zO(e,t[0],t[1])?t=[]:n>2&&zO(t[0],t[1],t[2])&&(t=[t[0]]),sme(e,ime(t,1),[])}),lme=ome;const iP=Rt(lme);function jh(e){"@babel/helpers - typeof";return jh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jh(e)}function Z1(){return Z1=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=t.x),"".concat(Rd,"-left"),Oe(n)&&t&&Oe(t.x)&&n=t.y),"".concat(Rd,"-top"),Oe(r)&&t&&Oe(t.y)&&rm?Math.max(d,c[r]):Math.max(f,c[r])}function Sme(e){var t=e.translateX,n=e.translateY,r=e.useTranslate3d;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function Nme(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.offsetTopLeft,i=e.position,s=e.reverseDirection,o=e.tooltipBox,l=e.useTranslate3d,c=e.viewBox,u,d,f;return o.height>0&&o.width>0&&n?(d=WO({allowEscapeViewBox:t,coordinate:n,key:"x",offsetTopLeft:r,position:i,reverseDirection:s,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),f=WO({allowEscapeViewBox:t,coordinate:n,key:"y",offsetTopLeft:r,position:i,reverseDirection:s,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),u=Sme({translateX:d,translateY:f,useTranslate3d:l})):u=wme,{cssProperties:u,cssClasses:jme({translateX:d,translateY:f,coordinate:n})}}function mu(e){"@babel/helpers - typeof";return mu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mu(e)}function HO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function GO(e){for(var t=1;tqO||Math.abs(r.height-this.state.lastBoundingBox.height)>qO)&&this.setState({lastBoundingBox:{width:r.width,height:r.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var r,i;this.props.active&&this.updateBBox(),this.state.dismissed&&(((r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==this.state.dismissedAtCoordinate.x||((i=this.props.coordinate)===null||i===void 0?void 0:i.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var r=this,i=this.props,s=i.active,o=i.allowEscapeViewBox,l=i.animationDuration,c=i.animationEasing,u=i.children,d=i.coordinate,f=i.hasPayload,h=i.isAnimationActive,p=i.offset,g=i.position,m=i.reverseDirection,x=i.useTranslate3d,b=i.viewBox,y=i.wrapperStyle,w=Nme({allowEscapeViewBox:o,coordinate:d,offsetTopLeft:p,position:g,reverseDirection:m,tooltipBox:this.state.lastBoundingBox,useTranslate3d:x,viewBox:b}),j=w.cssClasses,S=w.cssProperties,N=GO(GO({transition:h&&s?"transform ".concat(l,"ms ").concat(c):void 0},S),{},{pointerEvents:"none",visibility:!this.state.dismissed&&s&&f?"visible":"hidden",position:"absolute",top:0,left:0},y);return C.createElement("div",{tabIndex:-1,className:j,style:N,ref:function(_){r.wrapperNode=_}},u)}}])}(v.PureComponent),Ime=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},Xi={isSsr:Ime(),get:function(t){return Xi[t]},set:function(t,n){if(typeof t=="string")Xi[t]=n;else{var r=Object.keys(t);r&&r.length&&r.forEach(function(i){Xi[i]=t[i]})}}};function gu(e){"@babel/helpers - typeof";return gu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gu(e)}function KO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function XO(e){for(var t=1;t0;return C.createElement($me,{allowEscapeViewBox:o,animationDuration:l,animationEasing:c,isAnimationActive:h,active:s,coordinate:d,hasPayload:N,offset:p,position:x,reverseDirection:b,useTranslate3d:y,viewBox:w,wrapperStyle:j},Wme(u,XO(XO({},this.props),{},{payload:S})))}}])}(v.PureComponent);sP(cr,"displayName","Tooltip");sP(cr,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!Xi.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var Hme=$s,Gme=function(){return Hme.Date.now()},qme=Gme,Kme=/\s/;function Xme(e){for(var t=e.length;t--&&Kme.test(e.charAt(t)););return t}var Yme=Xme,Zme=Yme,Qme=/^\s+/;function Jme(e){return e&&e.slice(0,Zme(e)+1).replace(Qme,"")}var ege=Jme,tge=ege,YO=Mo,nge=id,ZO=NaN,rge=/^[-+]0x[0-9a-f]+$/i,ige=/^0b[01]+$/i,sge=/^0o[0-7]+$/i,age=parseInt;function oge(e){if(typeof e=="number")return e;if(nge(e))return ZO;if(YO(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=YO(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=tge(e);var n=ige.test(e);return n||sge.test(e)?age(e.slice(2),n?2:8):rge.test(e)?ZO:+e}var l6=oge,lge=Mo,vb=qme,QO=l6,cge="Expected a function",uge=Math.max,dge=Math.min;function fge(e,t,n){var r,i,s,o,l,c,u=0,d=!1,f=!1,h=!0;if(typeof e!="function")throw new TypeError(cge);t=QO(t)||0,lge(n)&&(d=!!n.leading,f="maxWait"in n,s=f?uge(QO(n.maxWait)||0,t):s,h="trailing"in n?!!n.trailing:h);function p(N){var P=r,_=i;return r=i=void 0,u=N,o=e.apply(_,P),o}function g(N){return u=N,l=setTimeout(b,t),d?p(N):o}function m(N){var P=N-c,_=N-u,A=t-P;return f?dge(A,s-_):A}function x(N){var P=N-c,_=N-u;return c===void 0||P>=t||P<0||f&&_>=s}function b(){var N=vb();if(x(N))return y(N);l=setTimeout(b,m(N))}function y(N){return l=void 0,h&&r?p(N):(r=i=void 0,o)}function w(){l!==void 0&&clearTimeout(l),u=0,r=c=i=l=void 0}function j(){return l===void 0?o:y(vb())}function S(){var N=vb(),P=x(N);if(r=arguments,i=this,c=N,P){if(l===void 0)return g(c);if(f)return clearTimeout(l),l=setTimeout(b,t),p(c)}return l===void 0&&(l=setTimeout(b,t)),o}return S.cancel=w,S.flush=j,S}var hge=fge,pge=hge,mge=Mo,gge="Expected a function";function vge(e,t,n){var r=!0,i=!0;if(typeof e!="function")throw new TypeError(gge);return mge(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),pge(e,t,{leading:r,maxWait:t,trailing:i})}var yge=vge;const c6=Rt(yge);function Nh(e){"@babel/helpers - typeof";return Nh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nh(e)}function JO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ym(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(M=c6(M,m,{trailing:!0,leading:!1}));var R=new ResizeObserver(M),H=S.current.getBoundingClientRect(),F=H.width,V=H.height;return $(F,V),R.observe(S.current),function(){R.disconnect()}},[$,m]);var T=v.useMemo(function(){var M=A.containerWidth,R=A.containerHeight;if(M<0||R<0)return null;Ki(rl(o)||rl(c),`The width(%s) and height(%s) are both fixed numbers, - maybe you don't need to use a ResponsiveContainer.`,o,c),Ki(!n||n>0,"The aspect(%s) must be greater than zero.",n);var H=rl(o)?M:o,F=rl(c)?R:c;n&&n>0&&(H?F=H/n:F&&(H=F*n),h&&F>h&&(F=h)),Ki(H>0||F>0,`The width(%s) and height(%s) of chart should be greater than 0, - please check the style of container, or the props width(%s) and height(%s), - or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the - height and width.`,H,F,o,c,d,f,n);var V=!Array.isArray(p)&&ta(p.type).endsWith("Chart");return C.Children.map(p,function(I){return sF.isElement(I)?v.cloneElement(I,ym({width:H,height:F},V?{style:ym({height:"100%",width:"100%",maxHeight:F,maxWidth:H},I.props.style)}:{})):I})},[n,p,c,h,f,d,A,o]);return C.createElement("div",{id:x?"".concat(x):void 0,className:ht("recharts-responsive-container",b),style:ym(ym({},j),{},{width:o,height:c,minWidth:d,minHeight:f,maxHeight:h}),ref:S},T)}),$p=function(t){return null};$p.displayName="Cell";function _h(e){"@babel/helpers - typeof";return _h=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_h(e)}function t2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function tj(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Xi.isSsr)return{width:0,height:0};var r=Tge(n),i=JSON.stringify({text:t,copyStyle:r});if(nc.widthCache[i])return nc.widthCache[i];try{var s=document.getElementById(n2);s||(s=document.createElement("span"),s.setAttribute("id",n2),s.setAttribute("aria-hidden","true"),document.body.appendChild(s));var o=tj(tj({},kge),r);Object.assign(s.style,o),s.textContent="".concat(t);var l=s.getBoundingClientRect(),c={width:l.width,height:l.height};return nc.widthCache[i]=c,++nc.cacheCount>Oge&&(nc.cacheCount=0,nc.widthCache={}),c}catch{return{width:0,height:0}}},$ge=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function Ph(e){"@babel/helpers - typeof";return Ph=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ph(e)}function Sv(e,t){return Dge(e)||Rge(e,t)||Mge(e,t)||Ige()}function Ige(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mge(e,t){if(e){if(typeof e=="string")return r2(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r2(e,t)}}function r2(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Zge(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function c2(e,t){return tve(e)||eve(e,t)||Jge(e,t)||Qge()}function Qge(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Jge(e,t){if(e){if(typeof e=="string")return u2(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u2(e,t)}}function u2(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:[];return H.reduce(function(F,V){var I=V.word,L=V.width,Z=F[F.length-1];if(Z&&(i==null||s||Z.width+L+rV.width?F:V})};if(!d)return p;for(var m="โ€ฆ",x=function(H){var F=f.slice(0,H),V=h6({breakAll:u,style:c,children:F+m}).wordsWithComputedWidth,I=h(V),L=I.length>o||g(I).width>Number(i);return[L,I]},b=0,y=f.length-1,w=0,j;b<=y&&w<=f.length-1;){var S=Math.floor((b+y)/2),N=S-1,P=x(N),_=c2(P,2),A=_[0],O=_[1],$=x(S),T=c2($,1),M=T[0];if(!A&&!M&&(b=S+1),A&&M&&(y=S-1),!A&&M){j=O;break}w++}return j||p},d2=function(t){var n=gt(t)?[]:t.toString().split(f6);return[{words:n}]},rve=function(t){var n=t.width,r=t.scaleToFit,i=t.children,s=t.style,o=t.breakAll,l=t.maxLines;if((n||r)&&!Xi.isSsr){var c,u,d=h6({breakAll:o,children:i,style:s});if(d){var f=d.wordsWithComputedWidth,h=d.spaceWidth;c=f,u=h}else return d2(i);return nve({breakAll:o,children:i,maxLines:l,style:s},c,u,n,r)}return d2(i)},f2="#808080",Ml=function(t){var n=t.x,r=n===void 0?0:n,i=t.y,s=i===void 0?0:i,o=t.lineHeight,l=o===void 0?"1em":o,c=t.capHeight,u=c===void 0?"0.71em":c,d=t.scaleToFit,f=d===void 0?!1:d,h=t.textAnchor,p=h===void 0?"start":h,g=t.verticalAnchor,m=g===void 0?"end":g,x=t.fill,b=x===void 0?f2:x,y=l2(t,Xge),w=v.useMemo(function(){return rve({breakAll:y.breakAll,children:y.children,maxLines:y.maxLines,scaleToFit:f,style:y.style,width:y.width})},[y.breakAll,y.children,y.maxLines,f,y.style,y.width]),j=y.dx,S=y.dy,N=y.angle,P=y.className,_=y.breakAll,A=l2(y,Yge);if(!Mn(r)||!Mn(s))return null;var O=r+(Oe(j)?j:0),$=s+(Oe(S)?S:0),T;switch(m){case"start":T=yb("calc(".concat(u,")"));break;case"middle":T=yb("calc(".concat((w.length-1)/2," * -").concat(l," + (").concat(u," / 2))"));break;default:T=yb("calc(".concat(w.length-1," * -").concat(l,")"));break}var M=[];if(f){var R=w[0].width,H=y.width;M.push("scale(".concat((Oe(H)?H/R:1)/R,")"))}return N&&M.push("rotate(".concat(N,", ").concat(O,", ").concat($,")")),M.length&&(A.transform=M.join(" ")),C.createElement("text",nj({},Ke(A,!0),{x:O,y:$,className:ht("recharts-text",P),textAnchor:p,fill:b.includes("url")?f2:b}),w.map(function(F,V){var I=F.words.join(_?"":" ");return C.createElement("tspan",{x:O,dy:V===0?T:l,key:"".concat(I,"-").concat(V)},I)}))};function ho(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function ive(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function aP(e){let t,n,r;e.length!==2?(t=ho,n=(l,c)=>ho(e(l),c),r=(l,c)=>e(l)-c):(t=e===ho||e===ive?e:sve,n=e,r=e);function i(l,c,u=0,d=l.length){if(u>>1;n(l[f],c)<0?u=f+1:d=f}while(u>>1;n(l[f],c)<=0?u=f+1:d=f}while(uu&&r(l[f-1],c)>-r(l[f],c)?f-1:f}return{left:i,center:o,right:s}}function sve(){return 0}function p6(e){return e===null?NaN:+e}function*ave(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const ove=aP(ho),Ip=ove.right;aP(p6).center;class h2 extends Map{constructor(t,n=uve){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,i]of t)this.set(r,i)}get(t){return super.get(p2(this,t))}has(t){return super.has(p2(this,t))}set(t,n){return super.set(lve(this,t),n)}delete(t){return super.delete(cve(this,t))}}function p2({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function lve({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function cve({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function uve(e){return e!==null&&typeof e=="object"?e.valueOf():e}function dve(e=ho){if(e===ho)return m6;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function m6(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const fve=Math.sqrt(50),hve=Math.sqrt(10),pve=Math.sqrt(2);function Nv(e,t,n){const r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),s=r/Math.pow(10,i),o=s>=fve?10:s>=hve?5:s>=pve?2:1;let l,c,u;return i<0?(u=Math.pow(10,-i)/o,l=Math.round(e*u),c=Math.round(t*u),l/ut&&--c,u=-u):(u=Math.pow(10,i)*o,l=Math.round(e/u),c=Math.round(t/u),l*ut&&--c),c0))return[];if(e===t)return[e];const r=t=i))return[];const l=s-i+1,c=new Array(l);if(r)if(o<0)for(let u=0;u=r)&&(n=r);return n}function g2(e,t){let n;for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function g6(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?m6:dve(i);r>n;){if(r-n>600){const c=r-n+1,u=t-n+1,d=Math.log(c),f=.5*Math.exp(2*d/3),h=.5*Math.sqrt(d*f*(c-f)/c)*(u-c/2<0?-1:1),p=Math.max(n,Math.floor(t-u*f/c+h)),g=Math.min(r,Math.floor(t+(c-u)*f/c+h));g6(e,t,p,g,i)}const s=e[t];let o=n,l=r;for(Dd(e,n,t),i(e[r],s)>0&&Dd(e,n,r);o0;)--l}i(e[n],s)===0?Dd(e,n,l):(++l,Dd(e,l,r)),l<=t&&(n=l+1),t<=l&&(r=l-1)}return e}function Dd(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function mve(e,t,n){if(e=Float64Array.from(ave(e)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return g2(e);if(t>=1)return m2(e);var r,i=(r-1)*t,s=Math.floor(i),o=m2(g6(e,s).subarray(0,s+1)),l=g2(e.subarray(s+1));return o+(l-o)*(i-s)}}function gve(e,t,n=p6){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,s=Math.floor(i),o=+n(e[s],s,e),l=+n(e[s+1],s+1,e);return o+(l-o)*(i-s)}}function vve(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,s=new Array(i);++r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?bm(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?bm(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=xve.exec(e))?new Rr(t[1],t[2],t[3],1):(t=bve.exec(e))?new Rr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=wve.exec(e))?bm(t[1],t[2],t[3],t[4]):(t=jve.exec(e))?bm(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Sve.exec(e))?S2(t[1],t[2]/100,t[3]/100,1):(t=Nve.exec(e))?S2(t[1],t[2]/100,t[3]/100,t[4]):v2.hasOwnProperty(e)?b2(v2[e]):e==="transparent"?new Rr(NaN,NaN,NaN,0):null}function b2(e){return new Rr(e>>16&255,e>>8&255,e&255,1)}function bm(e,t,n,r){return r<=0&&(e=t=n=NaN),new Rr(e,t,n,r)}function Cve(e){return e instanceof Mp||(e=Oh(e)),e?(e=e.rgb(),new Rr(e.r,e.g,e.b,e.opacity)):new Rr}function oj(e,t,n,r){return arguments.length===1?Cve(e):new Rr(e,t,n,r??1)}function Rr(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}lP(Rr,oj,y6(Mp,{brighter(e){return e=e==null?_v:Math.pow(_v,e),new Rr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ah:Math.pow(Ah,e),new Rr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Rr(gl(this.r),gl(this.g),gl(this.b),Pv(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:w2,formatHex:w2,formatHex8:Ave,formatRgb:j2,toString:j2}));function w2(){return`#${il(this.r)}${il(this.g)}${il(this.b)}`}function Ave(){return`#${il(this.r)}${il(this.g)}${il(this.b)}${il((isNaN(this.opacity)?1:this.opacity)*255)}`}function j2(){const e=Pv(this.opacity);return`${e===1?"rgb(":"rgba("}${gl(this.r)}, ${gl(this.g)}, ${gl(this.b)}${e===1?")":`, ${e})`}`}function Pv(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function gl(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function il(e){return e=gl(e),(e<16?"0":"")+e.toString(16)}function S2(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ui(e,t,n,r)}function x6(e){if(e instanceof Ui)return new Ui(e.h,e.s,e.l,e.opacity);if(e instanceof Mp||(e=Oh(e)),!e)return new Ui;if(e instanceof Ui)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),s=Math.max(t,n,r),o=NaN,l=s-i,c=(s+i)/2;return l?(t===s?o=(n-r)/l+(n0&&c<1?0:o,new Ui(o,l,c,e.opacity)}function Eve(e,t,n,r){return arguments.length===1?x6(e):new Ui(e,t,n,r??1)}function Ui(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}lP(Ui,Eve,y6(Mp,{brighter(e){return e=e==null?_v:Math.pow(_v,e),new Ui(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ah:Math.pow(Ah,e),new Ui(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Rr(xb(e>=240?e-240:e+120,i,r),xb(e,i,r),xb(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Ui(N2(this.h),wm(this.s),wm(this.l),Pv(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Pv(this.opacity);return`${e===1?"hsl(":"hsla("}${N2(this.h)}, ${wm(this.s)*100}%, ${wm(this.l)*100}%${e===1?")":`, ${e})`}`}}));function N2(e){return e=(e||0)%360,e<0?e+360:e}function wm(e){return Math.max(0,Math.min(1,e||0))}function xb(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const cP=e=>()=>e;function Ove(e,t){return function(n){return e+n*t}}function kve(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Tve(e){return(e=+e)==1?b6:function(t,n){return n-t?kve(t,n,e):cP(isNaN(t)?n:t)}}function b6(e,t){var n=t-e;return n?Ove(e,n):cP(isNaN(e)?t:e)}const _2=function e(t){var n=Tve(t);function r(i,s){var o=n((i=oj(i)).r,(s=oj(s)).r),l=n(i.g,s.g),c=n(i.b,s.b),u=b6(i.opacity,s.opacity);return function(d){return i.r=o(d),i.g=l(d),i.b=c(d),i.opacity=u(d),i+""}}return r.gamma=e,r}(1);function $ve(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(s){for(i=0;in&&(s=t.slice(n,s),l[o]?l[o]+=s:l[++o]=s),(r=r[0])===(i=i[0])?l[o]?l[o]+=i:l[++o]=i:(l[++o]=null,c.push({i:o,x:Cv(r,i)})),n=bb.lastIndex;return nt&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function Wve(e,t,n){var r=e[0],i=e[1],s=t[0],o=t[1];return i2?Hve:Wve,c=u=null,f}function f(h){return h==null||isNaN(h=+h)?s:(c||(c=l(e.map(r),t,n)))(r(o(h)))}return f.invert=function(h){return o(i((u||(u=l(t,e.map(r),Cv)))(h)))},f.domain=function(h){return arguments.length?(e=Array.from(h,Av),d()):e.slice()},f.range=function(h){return arguments.length?(t=Array.from(h),d()):t.slice()},f.rangeRound=function(h){return t=Array.from(h),n=uP,d()},f.clamp=function(h){return arguments.length?(o=h?!0:Nr,d()):o!==Nr},f.interpolate=function(h){return arguments.length?(n=h,d()):n},f.unknown=function(h){return arguments.length?(s=h,f):s},function(h,p){return r=h,i=p,d()}}function dP(){return Dx()(Nr,Nr)}function Gve(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Ev(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function vu(e){return e=Ev(Math.abs(e)),e?e[1]:NaN}function qve(e,t){return function(n,r){for(var i=n.length,s=[],o=0,l=e[0],c=0;i>0&&l>0&&(c+l+1>r&&(l=Math.max(1,r-c)),s.push(n.substring(i-=l,i+l)),!((c+=l+1)>r));)l=e[o=(o+1)%e.length];return s.reverse().join(t)}}function Kve(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var Xve=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function kh(e){if(!(t=Xve.exec(e)))throw new Error("invalid format: "+e);var t;return new fP({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}kh.prototype=fP.prototype;function fP(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}fP.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Yve(e){e:for(var t=e.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var w6;function Zve(e,t){var n=Ev(e,t);if(!n)return e+"";var r=n[0],i=n[1],s=i-(w6=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return s===o?r:s>o?r+new Array(s-o+1).join("0"):s>0?r.slice(0,s)+"."+r.slice(s):"0."+new Array(1-s).join("0")+Ev(e,Math.max(0,t+s-1))[0]}function C2(e,t){var n=Ev(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const A2={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:Gve,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>C2(e*100,t),r:C2,s:Zve,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function E2(e){return e}var O2=Array.prototype.map,k2=["y","z","a","f","p","n","ยต","m","","k","M","G","T","P","E","Z","Y"];function Qve(e){var t=e.grouping===void 0||e.thousands===void 0?E2:qve(O2.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",s=e.numerals===void 0?E2:Kve(O2.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",l=e.minus===void 0?"โˆ’":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function u(f){f=kh(f);var h=f.fill,p=f.align,g=f.sign,m=f.symbol,x=f.zero,b=f.width,y=f.comma,w=f.precision,j=f.trim,S=f.type;S==="n"?(y=!0,S="g"):A2[S]||(w===void 0&&(w=12),j=!0,S="g"),(x||h==="0"&&p==="=")&&(x=!0,h="0",p="=");var N=m==="$"?n:m==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():"",P=m==="$"?r:/[%p]/.test(S)?o:"",_=A2[S],A=/[defgprs%]/.test(S);w=w===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,w)):Math.max(0,Math.min(20,w));function O($){var T=N,M=P,R,H,F;if(S==="c")M=_($)+M,$="";else{$=+$;var V=$<0||1/$<0;if($=isNaN($)?c:_(Math.abs($),w),j&&($=Yve($)),V&&+$==0&&g!=="+"&&(V=!1),T=(V?g==="("?g:l:g==="-"||g==="("?"":g)+T,M=(S==="s"?k2[8+w6/3]:"")+M+(V&&g==="("?")":""),A){for(R=-1,H=$.length;++RF||F>57){M=(F===46?i+$.slice(R+1):$.slice(R))+M,$=$.slice(0,R);break}}}y&&!x&&($=t($,1/0));var I=T.length+$.length+M.length,L=I>1)+T+$+M+L.slice(I);break;default:$=L+T+$+M;break}return s($)}return O.toString=function(){return f+""},O}function d(f,h){var p=u((f=kh(f),f.type="f",f)),g=Math.max(-8,Math.min(8,Math.floor(vu(h)/3)))*3,m=Math.pow(10,-g),x=k2[8+g/3];return function(b){return p(m*b)+x}}return{format:u,formatPrefix:d}}var jm,hP,j6;Jve({thousands:",",grouping:[3],currency:["$",""]});function Jve(e){return jm=Qve(e),hP=jm.format,j6=jm.formatPrefix,jm}function eye(e){return Math.max(0,-vu(Math.abs(e)))}function tye(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(vu(t)/3)))*3-vu(Math.abs(e)))}function nye(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,vu(t)-vu(e))+1}function S6(e,t,n,r){var i=sj(e,t,n),s;switch(r=kh(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(s=tye(i,o))&&(r.precision=s),j6(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(s=nye(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=s-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(s=eye(i))&&(r.precision=s-(r.type==="%")*2);break}}return hP(r)}function Ro(e){var t=e.domain;return e.ticks=function(n){var r=t();return rj(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return S6(i[0],i[i.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),i=0,s=r.length-1,o=r[i],l=r[s],c,u,d=10;for(l0;){if(u=ij(o,l,n),u===c)return r[i]=o,r[s]=l,t(r);if(u>0)o=Math.floor(o/u)*u,l=Math.ceil(l/u)*u;else if(u<0)o=Math.ceil(o*u)/u,l=Math.floor(l*u)/u;else break;c=u}return e},e}function Ov(){var e=dP();return e.copy=function(){return Rp(e,Ov())},Ai.apply(e,arguments),Ro(e)}function N6(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,Av),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return N6(e).unknown(t)},e=arguments.length?Array.from(e,Av):[0,1],Ro(n)}function _6(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],s=e[r],o;return sMath.pow(e,t)}function oye(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function I2(e){return(t,n)=>-e(-t,n)}function pP(e){const t=e(T2,$2),n=t.domain;let r=10,i,s;function o(){return i=oye(r),s=aye(r),n()[0]<0?(i=I2(i),s=I2(s),e(rye,iye)):e(T2,$2),t}return t.base=function(l){return arguments.length?(r=+l,o()):r},t.domain=function(l){return arguments.length?(n(l),o()):n()},t.ticks=l=>{const c=n();let u=c[0],d=c[c.length-1];const f=d0){for(;h<=p;++h)for(g=1;gd)break;b.push(m)}}else for(;h<=p;++h)for(g=r-1;g>=1;--g)if(m=h>0?g/s(-h):g*s(h),!(md)break;b.push(m)}b.length*2{if(l==null&&(l=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=kh(c)).precision==null&&(c.trim=!0),c=hP(c)),l===1/0)return c;const u=Math.max(1,r*l/t.ticks().length);return d=>{let f=d/s(Math.round(i(d)));return f*rn(_6(n(),{floor:l=>s(Math.floor(i(l))),ceil:l=>s(Math.ceil(i(l)))})),t}function P6(){const e=pP(Dx()).domain([1,10]);return e.copy=()=>Rp(e,P6()).base(e.base()),Ai.apply(e,arguments),e}function M2(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function R2(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function mP(e){var t=1,n=e(M2(t),R2(t));return n.constant=function(r){return arguments.length?e(M2(t=+r),R2(t)):t},Ro(n)}function C6(){var e=mP(Dx());return e.copy=function(){return Rp(e,C6()).constant(e.constant())},Ai.apply(e,arguments)}function D2(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function lye(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function cye(e){return e<0?-e*e:e*e}function gP(e){var t=e(Nr,Nr),n=1;function r(){return n===1?e(Nr,Nr):n===.5?e(lye,cye):e(D2(n),D2(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},Ro(t)}function vP(){var e=gP(Dx());return e.copy=function(){return Rp(e,vP()).exponent(e.exponent())},Ai.apply(e,arguments),e}function uye(){return vP.apply(null,arguments).exponent(.5)}function L2(e){return Math.sign(e)*e*e}function dye(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function A6(){var e=dP(),t=[0,1],n=!1,r;function i(s){var o=dye(e(s));return isNaN(o)?r:n?Math.round(o):o}return i.invert=function(s){return e.invert(L2(s))},i.domain=function(s){return arguments.length?(e.domain(s),i):e.domain()},i.range=function(s){return arguments.length?(e.range((t=Array.from(s,Av)).map(L2)),i):t.slice()},i.rangeRound=function(s){return i.range(s).round(!0)},i.round=function(s){return arguments.length?(n=!!s,i):n},i.clamp=function(s){return arguments.length?(e.clamp(s),i):e.clamp()},i.unknown=function(s){return arguments.length?(r=s,i):r},i.copy=function(){return A6(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},Ai.apply(i,arguments),Ro(i)}function E6(){var e=[],t=[],n=[],r;function i(){var o=0,l=Math.max(1,t.length);for(n=new Array(l-1);++o0?n[l-1]:e[0],l=n?[r[n-1],t]:[r[u-1],r[u]]},o.unknown=function(c){return arguments.length&&(s=c),o},o.thresholds=function(){return r.slice()},o.copy=function(){return O6().domain([e,t]).range(i).unknown(s)},Ai.apply(Ro(o),arguments)}function k6(){var e=[.5],t=[0,1],n,r=1;function i(s){return s!=null&&s<=s?t[Ip(e,s,0,r)]:n}return i.domain=function(s){return arguments.length?(e=Array.from(s),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(s){return arguments.length?(t=Array.from(s),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(s){var o=t.indexOf(s);return[e[o-1],e[o]]},i.unknown=function(s){return arguments.length?(n=s,i):n},i.copy=function(){return k6().domain(e).range(t).unknown(n)},Ai.apply(i,arguments)}const wb=new Date,jb=new Date;function Rn(e,t,n,r){function i(s){return e(s=arguments.length===0?new Date:new Date(+s)),s}return i.floor=s=>(e(s=new Date(+s)),s),i.ceil=s=>(e(s=new Date(s-1)),t(s,1),e(s),s),i.round=s=>{const o=i(s),l=i.ceil(s);return s-o(t(s=new Date(+s),o==null?1:Math.floor(o)),s),i.range=(s,o,l)=>{const c=[];if(s=i.ceil(s),l=l==null?1:Math.floor(l),!(s0))return c;let u;do c.push(u=new Date(+s)),t(s,l),e(s);while(uRn(o=>{if(o>=o)for(;e(o),!s(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;t(o,-1),!s(o););else for(;--l>=0;)for(;t(o,1),!s(o););}),n&&(i.count=(s,o)=>(wb.setTime(+s),jb.setTime(+o),e(wb),e(jb),Math.floor(n(wb,jb))),i.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?i.filter(r?o=>r(o)%s===0:o=>i.count(0,o)%s===0):i)),i}const kv=Rn(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);kv.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Rn(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):kv);kv.range;const Ys=1e3,xi=Ys*60,Zs=xi*60,ga=Zs*24,yP=ga*7,F2=ga*30,Sb=ga*365,sl=Rn(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Ys)},(e,t)=>(t-e)/Ys,e=>e.getUTCSeconds());sl.range;const xP=Rn(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Ys)},(e,t)=>{e.setTime(+e+t*xi)},(e,t)=>(t-e)/xi,e=>e.getMinutes());xP.range;const bP=Rn(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*xi)},(e,t)=>(t-e)/xi,e=>e.getUTCMinutes());bP.range;const wP=Rn(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Ys-e.getMinutes()*xi)},(e,t)=>{e.setTime(+e+t*Zs)},(e,t)=>(t-e)/Zs,e=>e.getHours());wP.range;const jP=Rn(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*Zs)},(e,t)=>(t-e)/Zs,e=>e.getUTCHours());jP.range;const Dp=Rn(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*xi)/ga,e=>e.getDate()-1);Dp.range;const Lx=Rn(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/ga,e=>e.getUTCDate()-1);Lx.range;const T6=Rn(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/ga,e=>Math.floor(e/ga));T6.range;function Gl(e){return Rn(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*xi)/yP)}const Fx=Gl(0),Tv=Gl(1),fye=Gl(2),hye=Gl(3),yu=Gl(4),pye=Gl(5),mye=Gl(6);Fx.range;Tv.range;fye.range;hye.range;yu.range;pye.range;mye.range;function ql(e){return Rn(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/yP)}const Bx=ql(0),$v=ql(1),gye=ql(2),vye=ql(3),xu=ql(4),yye=ql(5),xye=ql(6);Bx.range;$v.range;gye.range;vye.range;xu.range;yye.range;xye.range;const SP=Rn(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());SP.range;const NP=Rn(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());NP.range;const va=Rn(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());va.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Rn(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});va.range;const ya=Rn(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());ya.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Rn(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});ya.range;function $6(e,t,n,r,i,s){const o=[[sl,1,Ys],[sl,5,5*Ys],[sl,15,15*Ys],[sl,30,30*Ys],[s,1,xi],[s,5,5*xi],[s,15,15*xi],[s,30,30*xi],[i,1,Zs],[i,3,3*Zs],[i,6,6*Zs],[i,12,12*Zs],[r,1,ga],[r,2,2*ga],[n,1,yP],[t,1,F2],[t,3,3*F2],[e,1,Sb]];function l(u,d,f){const h=dx).right(o,h);if(p===o.length)return e.every(sj(u/Sb,d/Sb,f));if(p===0)return kv.every(Math.max(sj(u,d,f),1));const[g,m]=o[h/o[p-1][2]53)return null;"w"in ie||(ie.w=1),"Z"in ie?(K=_b(Ld(ie.y,0,1)),ve=K.getUTCDay(),K=ve>4||ve===0?$v.ceil(K):$v(K),K=Lx.offset(K,(ie.V-1)*7),ie.y=K.getUTCFullYear(),ie.m=K.getUTCMonth(),ie.d=K.getUTCDate()+(ie.w+6)%7):(K=Nb(Ld(ie.y,0,1)),ve=K.getDay(),K=ve>4||ve===0?Tv.ceil(K):Tv(K),K=Dp.offset(K,(ie.V-1)*7),ie.y=K.getFullYear(),ie.m=K.getMonth(),ie.d=K.getDate()+(ie.w+6)%7)}else("W"in ie||"U"in ie)&&("w"in ie||(ie.w="u"in ie?ie.u%7:"W"in ie?1:0),ve="Z"in ie?_b(Ld(ie.y,0,1)).getUTCDay():Nb(Ld(ie.y,0,1)).getDay(),ie.m=0,ie.d="W"in ie?(ie.w+6)%7+ie.W*7-(ve+5)%7:ie.w+ie.U*7-(ve+6)%7);return"Z"in ie?(ie.H+=ie.Z/100|0,ie.M+=ie.Z%100,_b(ie)):Nb(ie)}}function _(he,ue,Ee,ie){for(var Xe=0,K=ue.length,ve=Ee.length,Se,$e;Xe=ve)return-1;if(Se=ue.charCodeAt(Xe++),Se===37){if(Se=ue.charAt(Xe++),$e=S[Se in B2?ue.charAt(Xe++):Se],!$e||(ie=$e(he,Ee,ie))<0)return-1}else if(Se!=Ee.charCodeAt(ie++))return-1}return ie}function A(he,ue,Ee){var ie=u.exec(ue.slice(Ee));return ie?(he.p=d.get(ie[0].toLowerCase()),Ee+ie[0].length):-1}function O(he,ue,Ee){var ie=p.exec(ue.slice(Ee));return ie?(he.w=g.get(ie[0].toLowerCase()),Ee+ie[0].length):-1}function $(he,ue,Ee){var ie=f.exec(ue.slice(Ee));return ie?(he.w=h.get(ie[0].toLowerCase()),Ee+ie[0].length):-1}function T(he,ue,Ee){var ie=b.exec(ue.slice(Ee));return ie?(he.m=y.get(ie[0].toLowerCase()),Ee+ie[0].length):-1}function M(he,ue,Ee){var ie=m.exec(ue.slice(Ee));return ie?(he.m=x.get(ie[0].toLowerCase()),Ee+ie[0].length):-1}function R(he,ue,Ee){return _(he,t,ue,Ee)}function H(he,ue,Ee){return _(he,n,ue,Ee)}function F(he,ue,Ee){return _(he,r,ue,Ee)}function V(he){return o[he.getDay()]}function I(he){return s[he.getDay()]}function L(he){return c[he.getMonth()]}function Z(he){return l[he.getMonth()]}function ee(he){return i[+(he.getHours()>=12)]}function re(he){return 1+~~(he.getMonth()/3)}function me(he){return o[he.getUTCDay()]}function z(he){return s[he.getUTCDay()]}function ae(he){return c[he.getUTCMonth()]}function de(he){return l[he.getUTCMonth()]}function fe(he){return i[+(he.getUTCHours()>=12)]}function Ne(he){return 1+~~(he.getUTCMonth()/3)}return{format:function(he){var ue=N(he+="",w);return ue.toString=function(){return he},ue},parse:function(he){var ue=P(he+="",!1);return ue.toString=function(){return he},ue},utcFormat:function(he){var ue=N(he+="",j);return ue.toString=function(){return he},ue},utcParse:function(he){var ue=P(he+="",!0);return ue.toString=function(){return he},ue}}}var B2={"-":"",_:" ",0:"0"},Gn=/^\s*\d+/,_ye=/^%/,Pye=/[\\^$*+?|[\]().{}]/g;function It(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",s=i.length;return r+(s[t.toLowerCase(),n]))}function Aye(e,t,n){var r=Gn.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function Eye(e,t,n){var r=Gn.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function Oye(e,t,n){var r=Gn.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function kye(e,t,n){var r=Gn.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function Tye(e,t,n){var r=Gn.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function z2(e,t,n){var r=Gn.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function U2(e,t,n){var r=Gn.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function $ye(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Iye(e,t,n){var r=Gn.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function Mye(e,t,n){var r=Gn.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function V2(e,t,n){var r=Gn.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Rye(e,t,n){var r=Gn.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function W2(e,t,n){var r=Gn.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function Dye(e,t,n){var r=Gn.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function Lye(e,t,n){var r=Gn.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function Fye(e,t,n){var r=Gn.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function Bye(e,t,n){var r=Gn.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function zye(e,t,n){var r=_ye.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function Uye(e,t,n){var r=Gn.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function Vye(e,t,n){var r=Gn.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function H2(e,t){return It(e.getDate(),t,2)}function Wye(e,t){return It(e.getHours(),t,2)}function Hye(e,t){return It(e.getHours()%12||12,t,2)}function Gye(e,t){return It(1+Dp.count(va(e),e),t,3)}function I6(e,t){return It(e.getMilliseconds(),t,3)}function qye(e,t){return I6(e,t)+"000"}function Kye(e,t){return It(e.getMonth()+1,t,2)}function Xye(e,t){return It(e.getMinutes(),t,2)}function Yye(e,t){return It(e.getSeconds(),t,2)}function Zye(e){var t=e.getDay();return t===0?7:t}function Qye(e,t){return It(Fx.count(va(e)-1,e),t,2)}function M6(e){var t=e.getDay();return t>=4||t===0?yu(e):yu.ceil(e)}function Jye(e,t){return e=M6(e),It(yu.count(va(e),e)+(va(e).getDay()===4),t,2)}function exe(e){return e.getDay()}function txe(e,t){return It(Tv.count(va(e)-1,e),t,2)}function nxe(e,t){return It(e.getFullYear()%100,t,2)}function rxe(e,t){return e=M6(e),It(e.getFullYear()%100,t,2)}function ixe(e,t){return It(e.getFullYear()%1e4,t,4)}function sxe(e,t){var n=e.getDay();return e=n>=4||n===0?yu(e):yu.ceil(e),It(e.getFullYear()%1e4,t,4)}function axe(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+It(t/60|0,"0",2)+It(t%60,"0",2)}function G2(e,t){return It(e.getUTCDate(),t,2)}function oxe(e,t){return It(e.getUTCHours(),t,2)}function lxe(e,t){return It(e.getUTCHours()%12||12,t,2)}function cxe(e,t){return It(1+Lx.count(ya(e),e),t,3)}function R6(e,t){return It(e.getUTCMilliseconds(),t,3)}function uxe(e,t){return R6(e,t)+"000"}function dxe(e,t){return It(e.getUTCMonth()+1,t,2)}function fxe(e,t){return It(e.getUTCMinutes(),t,2)}function hxe(e,t){return It(e.getUTCSeconds(),t,2)}function pxe(e){var t=e.getUTCDay();return t===0?7:t}function mxe(e,t){return It(Bx.count(ya(e)-1,e),t,2)}function D6(e){var t=e.getUTCDay();return t>=4||t===0?xu(e):xu.ceil(e)}function gxe(e,t){return e=D6(e),It(xu.count(ya(e),e)+(ya(e).getUTCDay()===4),t,2)}function vxe(e){return e.getUTCDay()}function yxe(e,t){return It($v.count(ya(e)-1,e),t,2)}function xxe(e,t){return It(e.getUTCFullYear()%100,t,2)}function bxe(e,t){return e=D6(e),It(e.getUTCFullYear()%100,t,2)}function wxe(e,t){return It(e.getUTCFullYear()%1e4,t,4)}function jxe(e,t){var n=e.getUTCDay();return e=n>=4||n===0?xu(e):xu.ceil(e),It(e.getUTCFullYear()%1e4,t,4)}function Sxe(){return"+0000"}function q2(){return"%"}function K2(e){return+e}function X2(e){return Math.floor(+e/1e3)}var rc,L6,F6;Nxe({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Nxe(e){return rc=Nye(e),L6=rc.format,rc.parse,F6=rc.utcFormat,rc.utcParse,rc}function _xe(e){return new Date(e)}function Pxe(e){return e instanceof Date?+e:+new Date(+e)}function _P(e,t,n,r,i,s,o,l,c,u){var d=dP(),f=d.invert,h=d.domain,p=u(".%L"),g=u(":%S"),m=u("%I:%M"),x=u("%I %p"),b=u("%a %d"),y=u("%b %d"),w=u("%B"),j=u("%Y");function S(N){return(c(N)t(i/(e.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,s)=>mve(e,s/r))},n.copy=function(){return V6(t).domain(e)},Aa.apply(n,arguments)}function Ux(){var e=0,t=.5,n=1,r=1,i,s,o,l,c,u=Nr,d,f=!1,h;function p(m){return isNaN(m=+m)?h:(m=.5+((m=+d(m))-s)*(r*mt}var q6=$xe,Ixe=Vx,Mxe=q6,Rxe=hd;function Dxe(e){return e&&e.length?Ixe(e,Rxe,Mxe):void 0}var Lxe=Dxe;const Ja=Rt(Lxe);function Fxe(e,t){return ee.e^s.s<0?1:-1;for(r=s.d.length,i=e.d.length,t=0,n=re.d[t]^s.s<0?1:-1;return r===i?0:r>i^s.s<0?1:-1};We.decimalPlaces=We.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*en;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};We.dividedBy=We.div=function(e){return ia(this,new this.constructor(e))};We.dividedToIntegerBy=We.idiv=function(e){var t=this,n=t.constructor;return Gt(ia(t,new n(e),0,1),n.precision)};We.equals=We.eq=function(e){return!this.cmp(e)};We.exponent=function(){return _n(this)};We.greaterThan=We.gt=function(e){return this.cmp(e)>0};We.greaterThanOrEqualTo=We.gte=function(e){return this.cmp(e)>=0};We.isInteger=We.isint=function(){return this.e>this.d.length-2};We.isNegative=We.isneg=function(){return this.s<0};We.isPositive=We.ispos=function(){return this.s>0};We.isZero=function(){return this.s===0};We.lessThan=We.lt=function(e){return this.cmp(e)<0};We.lessThanOrEqualTo=We.lte=function(e){return this.cmp(e)<1};We.logarithm=We.log=function(e){var t,n=this,r=n.constructor,i=r.precision,s=i+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(Zr))throw Error(Pi+"NaN");if(n.s<1)throw Error(Pi+(n.s?"NaN":"-Infinity"));return n.eq(Zr)?new r(0):(rn=!1,t=ia(Th(n,s),Th(e,s),s),rn=!0,Gt(t,i))};We.minus=We.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?Q6(t,e):Y6(t,(e.s=-e.s,e))};We.modulo=We.mod=function(e){var t,n=this,r=n.constructor,i=r.precision;if(e=new r(e),!e.s)throw Error(Pi+"NaN");return n.s?(rn=!1,t=ia(n,e,0,1).times(e),rn=!0,n.minus(t)):Gt(new r(n),i)};We.naturalExponential=We.exp=function(){return Z6(this)};We.naturalLogarithm=We.ln=function(){return Th(this)};We.negated=We.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};We.plus=We.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?Y6(t,e):Q6(t,(e.s=-e.s,e))};We.precision=We.sd=function(e){var t,n,r,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(vl+e);if(t=_n(i)+1,r=i.d.length-1,n=r*en+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n};We.squareRoot=We.sqrt=function(){var e,t,n,r,i,s,o,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(Pi+"NaN")}for(e=_n(l),rn=!1,i=Math.sqrt(+l),i==0||i==1/0?(t=ys(l.d),(t.length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=gd((e+1)/2)-(e<0||e%2),i==1/0?t="5e"+e:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),r=new c(t)):r=new c(i.toString()),n=c.precision,i=o=n+3;;)if(s=r,r=s.plus(ia(l,s,o+2)).times(.5),ys(s.d).slice(0,o)===(t=ys(r.d)).slice(0,o)){if(t=t.slice(o-3,o+1),i==o&&t=="4999"){if(Gt(s,n+1,0),s.times(s).eq(l)){r=s;break}}else if(t!="9999")break;o+=4}return rn=!0,Gt(r,n)};We.times=We.mul=function(e){var t,n,r,i,s,o,l,c,u,d=this,f=d.constructor,h=d.d,p=(e=new f(e)).d;if(!d.s||!e.s)return new f(0);for(e.s*=d.s,n=d.e+e.e,c=h.length,u=p.length,c=0;){for(t=0,i=c+r;i>r;)l=s[i]+p[r]*h[i-r-1]+t,s[i--]=l%Dn|0,t=l/Dn|0;s[i]=(s[i]+t)%Dn|0}for(;!s[--o];)s.pop();return t?++n:s.shift(),e.d=s,e.e=n,rn?Gt(e,f.precision):e};We.toDecimalPlaces=We.todp=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(ks(e,0,md),t===void 0?t=r.rounding:ks(t,0,8),Gt(n,e+_n(n)+1,t))};We.toExponential=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=Dl(r,!0):(ks(e,0,md),t===void 0?t=i.rounding:ks(t,0,8),r=Gt(new i(r),e+1,t),n=Dl(r,!0,e+1)),n};We.toFixed=function(e,t){var n,r,i=this,s=i.constructor;return e===void 0?Dl(i):(ks(e,0,md),t===void 0?t=s.rounding:ks(t,0,8),r=Gt(new s(i),e+_n(i)+1,t),n=Dl(r.abs(),!1,e+_n(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)};We.toInteger=We.toint=function(){var e=this,t=e.constructor;return Gt(new t(e),_n(e)+1,t.rounding)};We.toNumber=function(){return+this};We.toPower=We.pow=function(e){var t,n,r,i,s,o,l=this,c=l.constructor,u=12,d=+(e=new c(e));if(!e.s)return new c(Zr);if(l=new c(l),!l.s){if(e.s<1)throw Error(Pi+"Infinity");return l}if(l.eq(Zr))return l;if(r=c.precision,e.eq(Zr))return Gt(l,r);if(t=e.e,n=e.d.length-1,o=t>=n,s=l.s,o){if((n=d<0?-d:d)<=X6){for(i=new c(Zr),t=Math.ceil(r/en+4),rn=!1;n%2&&(i=i.times(l),Q2(i.d,t)),n=gd(n/2),n!==0;)l=l.times(l),Q2(l.d,t);return rn=!0,e.s<0?new c(Zr).div(i):Gt(i,r)}}else if(s<0)throw Error(Pi+"NaN");return s=s<0&&e.d[Math.max(t,n)]&1?-1:1,l.s=1,rn=!1,i=e.times(Th(l,r+u)),rn=!0,i=Z6(i),i.s=s,i};We.toPrecision=function(e,t){var n,r,i=this,s=i.constructor;return e===void 0?(n=_n(i),r=Dl(i,n<=s.toExpNeg||n>=s.toExpPos)):(ks(e,1,md),t===void 0?t=s.rounding:ks(t,0,8),i=Gt(new s(i),e,t),n=_n(i),r=Dl(i,e<=n||n<=s.toExpNeg,e)),r};We.toSignificantDigits=We.tosd=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(ks(e,1,md),t===void 0?t=r.rounding:ks(t,0,8)),Gt(new r(n),e,t)};We.toString=We.valueOf=We.val=We.toJSON=We[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=_n(e),n=e.constructor;return Dl(e,t<=n.toExpNeg||t>=n.toExpPos)};function Y6(e,t){var n,r,i,s,o,l,c,u,d=e.constructor,f=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),rn?Gt(t,f):t;if(c=e.d,u=t.d,o=e.e,i=t.e,c=c.slice(),s=o-i,s){for(s<0?(r=c,s=-s,l=u.length):(r=u,i=o,l=c.length),o=Math.ceil(f/en),l=o>l?o+1:l+1,s>l&&(s=l,r.length=1),r.reverse();s--;)r.push(0);r.reverse()}for(l=c.length,s=u.length,l-s<0&&(s=l,r=u,u=c,c=r),n=0;s;)n=(c[--s]=c[s]+u[s]+n)/Dn|0,c[s]%=Dn;for(n&&(c.unshift(n),++i),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=i,rn?Gt(t,f):t}function ks(e,t,n){if(e!==~~e||en)throw Error(vl+e)}function ys(e){var t,n,r,i=e.length-1,s="",o=e[0];if(i>0){for(s+=o,t=1;to?1:-1;else for(l=c=0;li[l]?1:-1;break}return c}function n(r,i,s){for(var o=0;s--;)r[s]-=o,o=r[s]1;)r.shift()}return function(r,i,s,o){var l,c,u,d,f,h,p,g,m,x,b,y,w,j,S,N,P,_,A=r.constructor,O=r.s==i.s?1:-1,$=r.d,T=i.d;if(!r.s)return new A(r);if(!i.s)throw Error(Pi+"Division by zero");for(c=r.e-i.e,P=T.length,S=$.length,p=new A(O),g=p.d=[],u=0;T[u]==($[u]||0);)++u;if(T[u]>($[u]||0)&&--c,s==null?y=s=A.precision:o?y=s+(_n(r)-_n(i))+1:y=s,y<0)return new A(0);if(y=y/en+2|0,u=0,P==1)for(d=0,T=T[0],y++;(u1&&(T=e(T,d),$=e($,d),P=T.length,S=$.length),j=P,m=$.slice(0,P),x=m.length;x=Dn/2&&++N;do d=0,l=t(T,m,P,x),l<0?(b=m[0],P!=x&&(b=b*Dn+(m[1]||0)),d=b/N|0,d>1?(d>=Dn&&(d=Dn-1),f=e(T,d),h=f.length,x=m.length,l=t(f,m,h,x),l==1&&(d--,n(f,P16)throw Error(AP+_n(e));if(!e.s)return new d(Zr);for(t==null?(rn=!1,l=f):l=t,o=new d(.03125);e.abs().gte(.1);)e=e.times(o),u+=5;for(r=Math.log(Ko(2,u))/Math.LN10*2+5|0,l+=r,n=i=s=new d(Zr),d.precision=l;;){if(i=Gt(i.times(e),l),n=n.times(++c),o=s.plus(ia(i,n,l)),ys(o.d).slice(0,l)===ys(s.d).slice(0,l)){for(;u--;)s=Gt(s.times(s),l);return d.precision=f,t==null?(rn=!0,Gt(s,f)):s}s=o}}function _n(e){for(var t=e.e*en,n=e.d[0];n>=10;n/=10)t++;return t}function Pb(e,t,n){if(t>e.LN10.sd())throw rn=!0,n&&(e.precision=n),Error(Pi+"LN10 precision limit exceeded");return Gt(new e(e.LN10),t)}function Fa(e){for(var t="";e--;)t+="0";return t}function Th(e,t){var n,r,i,s,o,l,c,u,d,f=1,h=10,p=e,g=p.d,m=p.constructor,x=m.precision;if(p.s<1)throw Error(Pi+(p.s?"NaN":"-Infinity"));if(p.eq(Zr))return new m(0);if(t==null?(rn=!1,u=x):u=t,p.eq(10))return t==null&&(rn=!0),Pb(m,u);if(u+=h,m.precision=u,n=ys(g),r=n.charAt(0),s=_n(p),Math.abs(s)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)p=p.times(e),n=ys(p.d),r=n.charAt(0),f++;s=_n(p),r>1?(p=new m("0."+n),s++):p=new m(r+"."+n.slice(1))}else return c=Pb(m,u+2,x).times(s+""),p=Th(new m(r+"."+n.slice(1)),u-h).plus(c),m.precision=x,t==null?(rn=!0,Gt(p,x)):p;for(l=o=p=ia(p.minus(Zr),p.plus(Zr),u),d=Gt(p.times(p),u),i=3;;){if(o=Gt(o.times(d),u),c=l.plus(ia(o,new m(i),u)),ys(c.d).slice(0,u)===ys(l.d).slice(0,u))return l=l.times(2),s!==0&&(l=l.plus(Pb(m,u+2,x).times(s+""))),l=ia(l,new m(f),u),m.precision=x,t==null?(rn=!0,Gt(l,x)):l;l=c,i+=2}}function Z2(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(i=t.length;t.charCodeAt(i-1)===48;)--i;if(t=t.slice(r,i),t){if(i-=r,n=n-r-1,e.e=gd(n/en),e.d=[],r=(n+1)%en,n<0&&(r+=en),rIv||e.e<-Iv))throw Error(AP+n)}else e.s=0,e.e=0,e.d=[0];return e}function Gt(e,t,n){var r,i,s,o,l,c,u,d,f=e.d;for(o=1,s=f[0];s>=10;s/=10)o++;if(r=t-o,r<0)r+=en,i=t,u=f[d=0];else{if(d=Math.ceil((r+1)/en),s=f.length,d>=s)return e;for(u=s=f[d],o=1;s>=10;s/=10)o++;r%=en,i=r-en+o}if(n!==void 0&&(s=Ko(10,o-i-1),l=u/s%10|0,c=t<0||f[d+1]!==void 0||u%s,c=n<4?(l||c)&&(n==0||n==(e.s<0?3:2)):l>5||l==5&&(n==4||c||n==6&&(r>0?i>0?u/Ko(10,o-i):0:f[d-1])%10&1||n==(e.s<0?8:7))),t<1||!f[0])return c?(s=_n(e),f.length=1,t=t-s-1,f[0]=Ko(10,(en-t%en)%en),e.e=gd(-t/en)||0):(f.length=1,f[0]=e.e=e.s=0),e;if(r==0?(f.length=d,s=1,d--):(f.length=d+1,s=Ko(10,en-r),f[d]=i>0?(u/Ko(10,o-i)%Ko(10,i)|0)*s:0),c)for(;;)if(d==0){(f[0]+=s)==Dn&&(f[0]=1,++e.e);break}else{if(f[d]+=s,f[d]!=Dn)break;f[d--]=0,s=1}for(r=f.length;f[--r]===0;)f.pop();if(rn&&(e.e>Iv||e.e<-Iv))throw Error(AP+_n(e));return e}function Q6(e,t){var n,r,i,s,o,l,c,u,d,f,h=e.constructor,p=h.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new h(e),rn?Gt(t,p):t;if(c=e.d,f=t.d,r=t.e,u=e.e,c=c.slice(),o=u-r,o){for(d=o<0,d?(n=c,o=-o,l=f.length):(n=f,r=u,l=c.length),i=Math.max(Math.ceil(p/en),l)+2,o>i&&(o=i,n.length=1),n.reverse(),i=o;i--;)n.push(0);n.reverse()}else{for(i=c.length,l=f.length,d=i0;--i)c[l++]=0;for(i=f.length;i>o;){if(c[--i]0?s=s.charAt(0)+"."+s.slice(1)+Fa(r):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(i<0?"e":"e+")+i):i<0?(s="0."+Fa(-i-1)+s,n&&(r=n-o)>0&&(s+=Fa(r))):i>=o?(s+=Fa(i+1-o),n&&(r=n-i-1)>0&&(s=s+"."+Fa(r))):((r=i+1)0&&(i+1===o&&(s+="."),s+=Fa(r))),e.s<0?"-"+s:s}function Q2(e,t){if(e.length>t)return e.length=t,!0}function J6(e){var t,n,r;function i(s){var o=this;if(!(o instanceof i))return new i(s);if(o.constructor=i,s instanceof i){o.s=s.s,o.e=s.e,o.d=(s=s.d)?s.slice():s;return}if(typeof s=="number"){if(s*0!==0)throw Error(vl+s);if(s>0)o.s=1;else if(s<0)s=-s,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(s===~~s&&s<1e7){o.e=0,o.d=[s];return}return Z2(o,s.toString())}else if(typeof s!="string")throw Error(vl+s);if(s.charCodeAt(0)===45?(s=s.slice(1),o.s=-1):o.s=1,a0e.test(s))Z2(o,s);else throw Error(vl+s)}if(i.prototype=We,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=J6,i.config=i.set=o0e,e===void 0&&(e={}),e)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=i[t+1]&&r<=i[t+2])this[n]=r;else throw Error(vl+n+": "+r);if((r=e[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(vl+n+": "+r);return this}var EP=J6(s0e);Zr=new EP(1);const Ht=EP;function l0e(e){return f0e(e)||d0e(e)||u0e(e)||c0e()}function c0e(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function u0e(e,t){if(e){if(typeof e=="string")return uj(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return uj(e,t)}}function d0e(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function f0e(e){if(Array.isArray(e))return uj(e)}function uj(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=t?n.apply(void 0,i):e(t-o,J2(function(){for(var l=arguments.length,c=new Array(l),u=0;ue.length)&&(t=e.length);for(var n=0,r=new Array(t);n"u"||!(Symbol.iterator in Object(e)))){var n=[],r=!0,i=!1,s=void 0;try{for(var o=e[Symbol.iterator](),l;!(r=(l=o.next()).done)&&(n.push(l.value),!(t&&n.length===t));r=!0);}catch(c){i=!0,s=c}finally{try{!r&&o.return!=null&&o.return()}finally{if(i)throw s}}return n}}function C0e(e){if(Array.isArray(e))return e}function iB(e){var t=$h(e,2),n=t[0],r=t[1],i=n,s=r;return n>r&&(i=r,s=n),[i,s]}function sB(e,t,n){if(e.lte(0))return new Ht(0);var r=Gx.getDigitCount(e.toNumber()),i=new Ht(10).pow(r),s=e.div(i),o=r!==1?.05:.1,l=new Ht(Math.ceil(s.div(o).toNumber())).add(n).mul(o),c=l.mul(i);return t?c:new Ht(Math.ceil(c))}function A0e(e,t,n){var r=1,i=new Ht(e);if(!i.isint()&&n){var s=Math.abs(e);s<1?(r=new Ht(10).pow(Gx.getDigitCount(e)-1),i=new Ht(Math.floor(i.div(r).toNumber())).mul(r)):s>1&&(i=new Ht(Math.floor(e)))}else e===0?i=new Ht(Math.floor((t-1)/2)):n||(i=new Ht(Math.floor(e)));var o=Math.floor((t-1)/2),l=g0e(m0e(function(c){return i.add(new Ht(c-o).mul(r)).toNumber()}),dj);return l(0,t)}function aB(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new Ht(0),tickMin:new Ht(0),tickMax:new Ht(0)};var s=sB(new Ht(t).sub(e).div(n-1),r,i),o;e<=0&&t>=0?o=new Ht(0):(o=new Ht(e).add(t).div(2),o=o.sub(new Ht(o).mod(s)));var l=Math.ceil(o.sub(e).div(s).toNumber()),c=Math.ceil(new Ht(t).sub(o).div(s).toNumber()),u=l+c+1;return u>n?aB(e,t,n,r,i+1):(u0?c+(n-u):c,l=t>0?l:l+(n-u)),{step:s,tickMin:o.sub(new Ht(l).mul(s)),tickMax:o.add(new Ht(c).mul(s))})}function E0e(e){var t=$h(e,2),n=t[0],r=t[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(i,2),l=iB([n,r]),c=$h(l,2),u=c[0],d=c[1];if(u===-1/0||d===1/0){var f=d===1/0?[u].concat(hj(dj(0,i-1).map(function(){return 1/0}))):[].concat(hj(dj(0,i-1).map(function(){return-1/0})),[d]);return n>r?fj(f):f}if(u===d)return A0e(u,i,s);var h=aB(u,d,o,s),p=h.step,g=h.tickMin,m=h.tickMax,x=Gx.rangeStep(g,m.add(new Ht(.1).mul(p)),p);return n>r?fj(x):x}function O0e(e,t){var n=$h(e,2),r=n[0],i=n[1],s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=iB([r,i]),l=$h(o,2),c=l[0],u=l[1];if(c===-1/0||u===1/0)return[r,i];if(c===u)return[c];var d=Math.max(t,2),f=sB(new Ht(u).sub(c).div(d-1),s,0),h=[].concat(hj(Gx.rangeStep(new Ht(c),new Ht(u).sub(new Ht(.99).mul(f)),f)),[u]);return r>i?fj(h):h}var k0e=nB(E0e),T0e=nB(O0e),$0e="Invariant failed";function Ll(e,t){throw new Error($0e)}var I0e=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function bu(e){"@babel/helpers - typeof";return bu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},bu(e)}function Mv(){return Mv=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function z0e(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function U0e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function V0e(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0,o=-1,l=(n=r==null?void 0:r.length)!==null&&n!==void 0?n:0;if(l<=1)return 0;if(s&&s.axisType==="angleAxis"&&Math.abs(Math.abs(s.range[1]-s.range[0])-360)<=1e-6)for(var c=s.range,u=0;u0?i[u-1].coordinate:i[l-1].coordinate,f=i[u].coordinate,h=u>=l-1?i[0].coordinate:i[u+1].coordinate,p=void 0;if(jr(f-d)!==jr(h-f)){var g=[];if(jr(h-f)===jr(c[1]-c[0])){p=h;var m=f+c[1]-c[0];g[0]=Math.min(m,(m+d)/2),g[1]=Math.max(m,(m+d)/2)}else{p=d;var x=h+c[1]-c[0];g[0]=Math.min(f,(x+f)/2),g[1]=Math.max(f,(x+f)/2)}var b=[Math.min(f,(p+f)/2),Math.max(f,(p+f)/2)];if(t>b[0]&&t<=b[1]||t>=g[0]&&t<=g[1]){o=i[u].index;break}}else{var y=Math.min(d,h),w=Math.max(d,h);if(t>(y+f)/2&&t<=(w+f)/2){o=i[u].index;break}}}else for(var j=0;j0&&j(r[j].coordinate+r[j-1].coordinate)/2&&t<=(r[j].coordinate+r[j+1].coordinate)/2||j===l-1&&t>(r[j].coordinate+r[j-1].coordinate)/2){o=r[j].index;break}return o},OP=function(t){var n,r=t,i=r.type.displayName,s=(n=t.type)!==null&&n!==void 0&&n.defaultProps?pn(pn({},t.type.defaultProps),t.props):t.props,o=s.stroke,l=s.fill,c;switch(i){case"Line":c=o;break;case"Area":case"Radar":c=o&&o!=="none"?o:l;break;default:c=l;break}return c},abe=function(t){var n=t.barSize,r=t.totalSize,i=t.stackGroups,s=i===void 0?{}:i;if(!s)return{};for(var o={},l=Object.keys(s),c=0,u=l.length;c=0});if(b&&b.length){var y=b[0].type.defaultProps,w=y!==void 0?pn(pn({},y),b[0].props):b[0].props,j=w.barSize,S=w[x];o[S]||(o[S]=[]);var N=gt(j)?n:j;o[S].push({item:b[0],stackList:b.slice(1),barSize:gt(N)?void 0:Sr(N,r,0)})}}return o},obe=function(t){var n=t.barGap,r=t.barCategoryGap,i=t.bandSize,s=t.sizeList,o=s===void 0?[]:s,l=t.maxBarSize,c=o.length;if(c<1)return null;var u=Sr(n,i,0,!0),d,f=[];if(o[0].barSize===+o[0].barSize){var h=!1,p=i/c,g=o.reduce(function(j,S){return j+S.barSize||0},0);g+=(c-1)*u,g>=i&&(g-=(c-1)*u,u=0),g>=i&&p>0&&(h=!0,p*=.9,g=c*p);var m=(i-g)/2>>0,x={offset:m-u,size:0};d=o.reduce(function(j,S){var N={item:S.item,position:{offset:x.offset+x.size+u,size:h?p:S.barSize}},P=[].concat(nk(j),[N]);return x=P[P.length-1].position,S.stackList&&S.stackList.length&&S.stackList.forEach(function(_){P.push({item:_,position:x})}),P},f)}else{var b=Sr(r,i,0,!0);i-2*b-(c-1)*u<=0&&(u=0);var y=(i-2*b-(c-1)*u)/c;y>1&&(y>>=0);var w=l===+l?Math.min(y,l):y;d=o.reduce(function(j,S,N){var P=[].concat(nk(j),[{item:S.item,position:{offset:b+(y+u)*N+(y-w)/2,size:w}}]);return S.stackList&&S.stackList.length&&S.stackList.forEach(function(_){P.push({item:_,position:P[P.length-1].position})}),P},f)}return d},lbe=function(t,n,r,i){var s=r.children,o=r.width,l=r.margin,c=o-(l.left||0)-(l.right||0),u=uB({children:s,legendWidth:c});if(u){var d=i||{},f=d.width,h=d.height,p=u.align,g=u.verticalAlign,m=u.layout;if((m==="vertical"||m==="horizontal"&&g==="middle")&&p!=="center"&&Oe(t[p]))return pn(pn({},t),{},Bc({},p,t[p]+(f||0)));if((m==="horizontal"||m==="vertical"&&p==="center")&&g!=="middle"&&Oe(t[g]))return pn(pn({},t),{},Bc({},g,t[g]+(h||0)))}return t},cbe=function(t,n,r){return gt(n)?!0:t==="horizontal"?n==="yAxis":t==="vertical"||r==="x"?n==="xAxis":r==="y"?n==="yAxis":!0},dB=function(t,n,r,i,s){var o=n.props.children,l=Si(o,qx).filter(function(u){return cbe(i,s,u.props.direction)});if(l&&l.length){var c=l.map(function(u){return u.props.dataKey});return t.reduce(function(u,d){var f=yn(d,r);if(gt(f))return u;var h=Array.isArray(f)?[Wx(f),Ja(f)]:[f,f],p=c.reduce(function(g,m){var x=yn(d,m,0),b=h[0]-Math.abs(Array.isArray(x)?x[0]:x),y=h[1]+Math.abs(Array.isArray(x)?x[1]:x);return[Math.min(b,g[0]),Math.max(y,g[1])]},[1/0,-1/0]);return[Math.min(p[0],u[0]),Math.max(p[1],u[1])]},[1/0,-1/0])}return null},ube=function(t,n,r,i,s){var o=n.map(function(l){return dB(t,l,r,s,i)}).filter(function(l){return!gt(l)});return o&&o.length?o.reduce(function(l,c){return[Math.min(l[0],c[0]),Math.max(l[1],c[1])]},[1/0,-1/0]):null},fB=function(t,n,r,i,s){var o=n.map(function(c){var u=c.props.dataKey;return r==="number"&&u&&dB(t,c,u,i)||bf(t,u,r,s)});if(r==="number")return o.reduce(function(c,u){return[Math.min(c[0],u[0]),Math.max(c[1],u[1])]},[1/0,-1/0]);var l={};return o.reduce(function(c,u){for(var d=0,f=u.length;d=2?jr(l[0]-l[1])*2*u:u,n&&(t.ticks||t.niceTicks)){var d=(t.ticks||t.niceTicks).map(function(f){var h=s?s.indexOf(f):f;return{coordinate:i(h)+u,value:f,offset:u}});return d.filter(function(f){return!cd(f.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(f,h){return{coordinate:i(f)+u,value:f,index:h,offset:u}}):i.ticks&&!r?i.ticks(t.tickCount).map(function(f){return{coordinate:i(f)+u,value:f,offset:u}}):i.domain().map(function(f,h){return{coordinate:i(f)+u,value:s?s[f]:f,index:h,offset:u}})},Cb=new WeakMap,Sm=function(t,n){if(typeof n!="function")return t;Cb.has(t)||Cb.set(t,new WeakMap);var r=Cb.get(t);if(r.has(n))return r.get(n);var i=function(){t.apply(void 0,arguments),n.apply(void 0,arguments)};return r.set(n,i),i},mB=function(t,n,r){var i=t.scale,s=t.type,o=t.layout,l=t.axisType;if(i==="auto")return o==="radial"&&l==="radiusAxis"?{scale:Ch(),realScaleType:"band"}:o==="radial"&&l==="angleAxis"?{scale:Ov(),realScaleType:"linear"}:s==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!r)?{scale:xf(),realScaleType:"point"}:s==="category"?{scale:Ch(),realScaleType:"band"}:{scale:Ov(),realScaleType:"linear"};if(kp(i)){var c="scale".concat(Ox(i));return{scale:(Y2[c]||xf)(),realScaleType:Y2[c]?c:"point"}}return ot(i)?{scale:i}:{scale:xf(),realScaleType:"point"}},ik=1e-4,gB=function(t){var n=t.domain();if(!(!n||n.length<=2)){var r=n.length,i=t.range(),s=Math.min(i[0],i[1])-ik,o=Math.max(i[0],i[1])+ik,l=t(n[0]),c=t(n[r-1]);(lo||co)&&t.domain([n[0],n[r-1]])}},dbe=function(t,n){if(!t)return null;for(var r=0,i=t.length;ri)&&(s[1]=i),s[0]>i&&(s[0]=i),s[1]=0?(t[l][r][0]=s,t[l][r][1]=s+c,s=t[l][r][1]):(t[l][r][0]=o,t[l][r][1]=o+c,o=t[l][r][1])}},pbe=function(t){var n=t.length;if(!(n<=0))for(var r=0,i=t[0].length;r=0?(t[o][r][0]=s,t[o][r][1]=s+l,s=t[o][r][1]):(t[o][r][0]=0,t[o][r][1]=0)}},mbe={sign:hbe,expand:Ioe,none:fu,silhouette:Moe,wiggle:Roe,positive:pbe},gbe=function(t,n,r){var i=n.map(function(l){return l.props.dataKey}),s=mbe[r],o=$oe().keys(i).value(function(l,c){return+yn(l,c,0)}).order(z1).offset(s);return o(t)},vbe=function(t,n,r,i,s,o){if(!t)return null;var l=o?n.reverse():n,c={},u=l.reduce(function(f,h){var p,g=(p=h.type)!==null&&p!==void 0&&p.defaultProps?pn(pn({},h.type.defaultProps),h.props):h.props,m=g.stackId,x=g.hide;if(x)return f;var b=g[r],y=f[b]||{hasStack:!1,stackGroups:{}};if(Mn(m)){var w=y.stackGroups[m]||{numericAxisId:r,cateAxisId:i,items:[]};w.items.push(h),y.hasStack=!0,y.stackGroups[m]=w}else y.stackGroups[ud("_stackId_")]={numericAxisId:r,cateAxisId:i,items:[h]};return pn(pn({},f),{},Bc({},b,y))},c),d={};return Object.keys(u).reduce(function(f,h){var p=u[h];if(p.hasStack){var g={};p.stackGroups=Object.keys(p.stackGroups).reduce(function(m,x){var b=p.stackGroups[x];return pn(pn({},m),{},Bc({},x,{numericAxisId:r,cateAxisId:i,items:b.items,stackedData:gbe(t,b.items,s)}))},g)}return pn(pn({},f),{},Bc({},h,p))},d)},vB=function(t,n){var r=n.realScaleType,i=n.type,s=n.tickCount,o=n.originalDomain,l=n.allowDecimals,c=r||n.scale;if(c!=="auto"&&c!=="linear")return null;if(s&&i==="number"&&o&&(o[0]==="auto"||o[1]==="auto")){var u=t.domain();if(!u.length)return null;var d=k0e(u,s,l);return t.domain([Wx(d),Ja(d)]),{niceTicks:d}}if(s&&i==="number"){var f=t.domain(),h=T0e(f,s,l);return{niceTicks:h}}return null};function sk(e){var t=e.axis,n=e.ticks,r=e.bandSize,i=e.entry,s=e.index,o=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!gt(i[t.dataKey])){var l=cv(n,"value",i[t.dataKey]);if(l)return l.coordinate+r/2}return n[s]?n[s].coordinate+r/2:null}var c=yn(i,gt(o)?t.dataKey:o);return gt(c)?null:t.scale(c)}var ak=function(t){var n=t.axis,r=t.ticks,i=t.offset,s=t.bandSize,o=t.entry,l=t.index;if(n.type==="category")return r[l]?r[l].coordinate+i:null;var c=yn(o,n.dataKey,n.domain[l]);return gt(c)?null:n.scale(c)-s/2+i},ybe=function(t){var n=t.numericAxis,r=n.scale.domain();if(n.type==="number"){var i=Math.min(r[0],r[1]),s=Math.max(r[0],r[1]);return i<=0&&s>=0?0:s<0?s:i}return r[0]},xbe=function(t,n){var r,i=(r=t.type)!==null&&r!==void 0&&r.defaultProps?pn(pn({},t.type.defaultProps),t.props):t.props,s=i.stackId;if(Mn(s)){var o=n[s];if(o){var l=o.items.indexOf(t);return l>=0?o.stackedData[l]:null}}return null},bbe=function(t){return t.reduce(function(n,r){return[Wx(r.concat([n[0]]).filter(Oe)),Ja(r.concat([n[1]]).filter(Oe))]},[1/0,-1/0])},yB=function(t,n,r){return Object.keys(t).reduce(function(i,s){var o=t[s],l=o.stackedData,c=l.reduce(function(u,d){var f=bbe(d.slice(n,r+1));return[Math.min(u[0],f[0]),Math.max(u[1],f[1])]},[1/0,-1/0]);return[Math.min(c[0],i[0]),Math.max(c[1],i[1])]},[1/0,-1/0]).map(function(i){return i===1/0||i===-1/0?0:i})},ok=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,lk=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,vj=function(t,n,r){if(ot(t))return t(n,r);if(!Array.isArray(t))return n;var i=[];if(Oe(t[0]))i[0]=r?t[0]:Math.min(t[0],n[0]);else if(ok.test(t[0])){var s=+ok.exec(t[0])[1];i[0]=n[0]-s}else ot(t[0])?i[0]=t[0](n[0]):i[0]=n[0];if(Oe(t[1]))i[1]=r?t[1]:Math.max(t[1],n[1]);else if(lk.test(t[1])){var o=+lk.exec(t[1])[1];i[1]=n[1]+o}else ot(t[1])?i[1]=t[1](n[1]):i[1]=n[1];return i},Dv=function(t,n,r){if(t&&t.scale&&t.scale.bandwidth){var i=t.scale.bandwidth();if(!r||i>0)return i}if(t&&n&&n.length>=2){for(var s=iP(n,function(f){return f.coordinate}),o=1/0,l=1,c=s.length;le.length)&&(t=e.length);for(var n=0,r=new Array(t);n2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},jB=function(t,n,r,i,s){var o=t.width,l=t.height,c=t.startAngle,u=t.endAngle,d=Sr(t.cx,o,o/2),f=Sr(t.cy,l,l/2),h=wB(o,l,r),p=Sr(t.innerRadius,h,0),g=Sr(t.outerRadius,h,h*.8),m=Object.keys(n);return m.reduce(function(x,b){var y=n[b],w=y.domain,j=y.reversed,S;if(gt(y.range))i==="angleAxis"?S=[c,u]:i==="radiusAxis"&&(S=[p,g]),j&&(S=[S[1],S[0]]);else{S=y.range;var N=S,P=Sbe(N,2);c=P[0],u=P[1]}var _=mB(y,s),A=_.realScaleType,O=_.scale;O.domain(w).range(S),gB(O);var $=vB(O,Vs(Vs({},y),{},{realScaleType:A})),T=Vs(Vs(Vs({},y),$),{},{range:S,radius:g,realScaleType:A,scale:O,cx:d,cy:f,innerRadius:p,outerRadius:g,startAngle:c,endAngle:u});return Vs(Vs({},x),{},bB({},b,T))},{})},Ebe=function(t,n){var r=t.x,i=t.y,s=n.x,o=n.y;return Math.sqrt(Math.pow(r-s,2)+Math.pow(i-o,2))},Obe=function(t,n){var r=t.x,i=t.y,s=n.cx,o=n.cy,l=Ebe({x:r,y:i},{x:s,y:o});if(l<=0)return{radius:l};var c=(r-s)/l,u=Math.acos(c);return i>o&&(u=2*Math.PI-u),{radius:l,angle:Abe(u),angleInRadian:u}},kbe=function(t){var n=t.startAngle,r=t.endAngle,i=Math.floor(n/360),s=Math.floor(r/360),o=Math.min(i,s);return{startAngle:n-o*360,endAngle:r-o*360}},Tbe=function(t,n){var r=n.startAngle,i=n.endAngle,s=Math.floor(r/360),o=Math.floor(i/360),l=Math.min(s,o);return t+l*360},fk=function(t,n){var r=t.x,i=t.y,s=Obe({x:r,y:i},n),o=s.radius,l=s.angle,c=n.innerRadius,u=n.outerRadius;if(ou)return!1;if(o===0)return!0;var d=kbe(n),f=d.startAngle,h=d.endAngle,p=l,g;if(f<=h){for(;p>h;)p-=360;for(;p=f&&p<=h}else{for(;p>f;)p-=360;for(;p=h&&p<=f}return g?Vs(Vs({},n),{},{radius:o,angle:Tbe(p,n)}):null},SB=function(t){return!v.isValidElement(t)&&!ot(t)&&typeof t!="boolean"?t.className:""};function Dh(e){"@babel/helpers - typeof";return Dh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Dh(e)}var $be=["offset"];function Ibe(e){return Lbe(e)||Dbe(e)||Rbe(e)||Mbe()}function Mbe(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Rbe(e,t){if(e){if(typeof e=="string")return yj(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return yj(e,t)}}function Dbe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Lbe(e){if(Array.isArray(e))return yj(e)}function yj(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Bbe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function hk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function An(e){for(var t=1;t=0?1:-1,w,j;i==="insideStart"?(w=p+y*o,j=m):i==="insideEnd"?(w=g-y*o,j=!m):i==="end"&&(w=g+y*o,j=m),j=b<=0?j:!j;var S=Mt(u,d,x,w),N=Mt(u,d,x,w+(j?1:-1)*359),P="M".concat(S.x,",").concat(S.y,` - A`).concat(x,",").concat(x,",0,1,").concat(j?0:1,`, - `).concat(N.x,",").concat(N.y),_=gt(t.id)?ud("recharts-radial-line-"):t.id;return C.createElement("text",Lh({},r,{dominantBaseline:"central",className:ht("recharts-radial-bar-label",l)}),C.createElement("defs",null,C.createElement("path",{id:_,d:P})),C.createElement("textPath",{xlinkHref:"#".concat(_)},n))},qbe=function(t){var n=t.viewBox,r=t.offset,i=t.position,s=n,o=s.cx,l=s.cy,c=s.innerRadius,u=s.outerRadius,d=s.startAngle,f=s.endAngle,h=(d+f)/2;if(i==="outside"){var p=Mt(o,l,u+r,h),g=p.x,m=p.y;return{x:g,y:m,textAnchor:g>=o?"start":"end",verticalAnchor:"middle"}}if(i==="center")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"middle"};if(i==="centerTop")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"start"};if(i==="centerBottom")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"end"};var x=(c+u)/2,b=Mt(o,l,x,h),y=b.x,w=b.y;return{x:y,y:w,textAnchor:"middle",verticalAnchor:"middle"}},Kbe=function(t){var n=t.viewBox,r=t.parentViewBox,i=t.offset,s=t.position,o=n,l=o.x,c=o.y,u=o.width,d=o.height,f=d>=0?1:-1,h=f*i,p=f>0?"end":"start",g=f>0?"start":"end",m=u>=0?1:-1,x=m*i,b=m>0?"end":"start",y=m>0?"start":"end";if(s==="top"){var w={x:l+u/2,y:c-f*i,textAnchor:"middle",verticalAnchor:p};return An(An({},w),r?{height:Math.max(c-r.y,0),width:u}:{})}if(s==="bottom"){var j={x:l+u/2,y:c+d+h,textAnchor:"middle",verticalAnchor:g};return An(An({},j),r?{height:Math.max(r.y+r.height-(c+d),0),width:u}:{})}if(s==="left"){var S={x:l-x,y:c+d/2,textAnchor:b,verticalAnchor:"middle"};return An(An({},S),r?{width:Math.max(S.x-r.x,0),height:d}:{})}if(s==="right"){var N={x:l+u+x,y:c+d/2,textAnchor:y,verticalAnchor:"middle"};return An(An({},N),r?{width:Math.max(r.x+r.width-N.x,0),height:d}:{})}var P=r?{width:u,height:d}:{};return s==="insideLeft"?An({x:l+x,y:c+d/2,textAnchor:y,verticalAnchor:"middle"},P):s==="insideRight"?An({x:l+u-x,y:c+d/2,textAnchor:b,verticalAnchor:"middle"},P):s==="insideTop"?An({x:l+u/2,y:c+h,textAnchor:"middle",verticalAnchor:g},P):s==="insideBottom"?An({x:l+u/2,y:c+d-h,textAnchor:"middle",verticalAnchor:p},P):s==="insideTopLeft"?An({x:l+x,y:c+h,textAnchor:y,verticalAnchor:g},P):s==="insideTopRight"?An({x:l+u-x,y:c+h,textAnchor:b,verticalAnchor:g},P):s==="insideBottomLeft"?An({x:l+x,y:c+d-h,textAnchor:y,verticalAnchor:p},P):s==="insideBottomRight"?An({x:l+u-x,y:c+d-h,textAnchor:b,verticalAnchor:p},P):sd(s)&&(Oe(s.x)||rl(s.x))&&(Oe(s.y)||rl(s.y))?An({x:l+Sr(s.x,u),y:c+Sr(s.y,d),textAnchor:"end",verticalAnchor:"end"},P):An({x:l+u/2,y:c+d/2,textAnchor:"middle",verticalAnchor:"middle"},P)},Xbe=function(t){return"cx"in t&&Oe(t.cx)};function Vn(e){var t=e.offset,n=t===void 0?5:t,r=Fbe(e,$be),i=An({offset:n},r),s=i.viewBox,o=i.position,l=i.value,c=i.children,u=i.content,d=i.className,f=d===void 0?"":d,h=i.textBreakAll;if(!s||gt(l)&>(c)&&!v.isValidElement(u)&&!ot(u))return null;if(v.isValidElement(u))return v.cloneElement(u,i);var p;if(ot(u)){if(p=v.createElement(u,i),v.isValidElement(p))return p}else p=Wbe(i);var g=Xbe(s),m=Ke(i,!0);if(g&&(o==="insideStart"||o==="insideEnd"||o==="end"))return Gbe(i,p,m);var x=g?qbe(i):Kbe(i);return C.createElement(Ml,Lh({className:ht("recharts-label",f)},m,x,{breakAll:h}),p)}Vn.displayName="Label";var NB=function(t){var n=t.cx,r=t.cy,i=t.angle,s=t.startAngle,o=t.endAngle,l=t.r,c=t.radius,u=t.innerRadius,d=t.outerRadius,f=t.x,h=t.y,p=t.top,g=t.left,m=t.width,x=t.height,b=t.clockWise,y=t.labelViewBox;if(y)return y;if(Oe(m)&&Oe(x)){if(Oe(f)&&Oe(h))return{x:f,y:h,width:m,height:x};if(Oe(p)&&Oe(g))return{x:p,y:g,width:m,height:x}}return Oe(f)&&Oe(h)?{x:f,y:h,width:0,height:0}:Oe(n)&&Oe(r)?{cx:n,cy:r,startAngle:s||i||0,endAngle:o||i||0,innerRadius:u||0,outerRadius:d||c||l||0,clockWise:b}:t.viewBox?t.viewBox:{}},Ybe=function(t,n){return t?t===!0?C.createElement(Vn,{key:"label-implicit",viewBox:n}):Mn(t)?C.createElement(Vn,{key:"label-implicit",viewBox:n,value:t}):v.isValidElement(t)?t.type===Vn?v.cloneElement(t,{key:"label-implicit",viewBox:n}):C.createElement(Vn,{key:"label-implicit",content:t,viewBox:n}):ot(t)?C.createElement(Vn,{key:"label-implicit",content:t,viewBox:n}):sd(t)?C.createElement(Vn,Lh({viewBox:n},t,{key:"label-implicit"})):null:null},Zbe=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&r&&!t.label)return null;var i=t.children,s=NB(t),o=Si(i,Vn).map(function(c,u){return v.cloneElement(c,{viewBox:n||s,key:"label-".concat(u)})});if(!r)return o;var l=Ybe(t.label,n||s);return[l].concat(Ibe(o))};Vn.parseViewBox=NB;Vn.renderCallByParent=Zbe;function Qbe(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var Jbe=Qbe;const _B=Rt(Jbe);function Fh(e){"@babel/helpers - typeof";return Fh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fh(e)}var ewe=["valueAccessor"],twe=["data","dataKey","clockWise","id","textBreakAll"];function nwe(e){return awe(e)||swe(e)||iwe(e)||rwe()}function rwe(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function iwe(e,t){if(e){if(typeof e=="string")return xj(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return xj(e,t)}}function swe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function awe(e){if(Array.isArray(e))return xj(e)}function xj(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function uwe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var dwe=function(t){return Array.isArray(t.value)?_B(t.value):t.value};function _s(e){var t=e.valueAccessor,n=t===void 0?dwe:t,r=gk(e,ewe),i=r.data,s=r.dataKey,o=r.clockWise,l=r.id,c=r.textBreakAll,u=gk(r,twe);return!i||!i.length?null:C.createElement(Et,{className:"recharts-label-list"},i.map(function(d,f){var h=gt(s)?n(d,f):yn(d&&d.payload,s),p=gt(l)?{}:{id:"".concat(l,"-").concat(f)};return C.createElement(Vn,Fv({},Ke(d,!0),u,p,{parentViewBox:d.parentViewBox,value:h,textBreakAll:c,viewBox:Vn.parseViewBox(gt(o)?d:mk(mk({},d),{},{clockWise:o})),key:"label-".concat(f),index:f}))}))}_s.displayName="LabelList";function fwe(e,t){return e?e===!0?C.createElement(_s,{key:"labelList-implicit",data:t}):C.isValidElement(e)||ot(e)?C.createElement(_s,{key:"labelList-implicit",data:t,content:e}):sd(e)?C.createElement(_s,Fv({data:t},e,{key:"labelList-implicit"})):null:null}function hwe(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var r=e.children,i=Si(r,_s).map(function(o,l){return v.cloneElement(o,{data:t,key:"labelList-".concat(l)})});if(!n)return i;var s=fwe(e.label,t);return[s].concat(nwe(i))}_s.renderCallByParent=hwe;function Bh(e){"@babel/helpers - typeof";return Bh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bh(e)}function bj(){return bj=Object.assign?Object.assign.bind():function(e){for(var t=1;t180),",").concat(+(o>u),`, - `).concat(f.x,",").concat(f.y,` - `);if(i>0){var p=Mt(n,r,i,o),g=Mt(n,r,i,u);h+="L ".concat(g.x,",").concat(g.y,` - A `).concat(i,",").concat(i,`,0, - `).concat(+(Math.abs(c)>180),",").concat(+(o<=u),`, - `).concat(p.x,",").concat(p.y," Z")}else h+="L ".concat(n,",").concat(r," Z");return h},ywe=function(t){var n=t.cx,r=t.cy,i=t.innerRadius,s=t.outerRadius,o=t.cornerRadius,l=t.forceCornerRadius,c=t.cornerIsExternal,u=t.startAngle,d=t.endAngle,f=jr(d-u),h=Nm({cx:n,cy:r,radius:s,angle:u,sign:f,cornerRadius:o,cornerIsExternal:c}),p=h.circleTangency,g=h.lineTangency,m=h.theta,x=Nm({cx:n,cy:r,radius:s,angle:d,sign:-f,cornerRadius:o,cornerIsExternal:c}),b=x.circleTangency,y=x.lineTangency,w=x.theta,j=c?Math.abs(u-d):Math.abs(u-d)-m-w;if(j<0)return l?"M ".concat(g.x,",").concat(g.y,` - a`).concat(o,",").concat(o,",0,0,1,").concat(o*2,`,0 - a`).concat(o,",").concat(o,",0,0,1,").concat(-o*2,`,0 - `):PB({cx:n,cy:r,innerRadius:i,outerRadius:s,startAngle:u,endAngle:d});var S="M ".concat(g.x,",").concat(g.y,` - A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(p.x,",").concat(p.y,` - A`).concat(s,",").concat(s,",0,").concat(+(j>180),",").concat(+(f<0),",").concat(b.x,",").concat(b.y,` - A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(y.x,",").concat(y.y,` - `);if(i>0){var N=Nm({cx:n,cy:r,radius:i,angle:u,sign:f,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),P=N.circleTangency,_=N.lineTangency,A=N.theta,O=Nm({cx:n,cy:r,radius:i,angle:d,sign:-f,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),$=O.circleTangency,T=O.lineTangency,M=O.theta,R=c?Math.abs(u-d):Math.abs(u-d)-A-M;if(R<0&&o===0)return"".concat(S,"L").concat(n,",").concat(r,"Z");S+="L".concat(T.x,",").concat(T.y,` - A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat($.x,",").concat($.y,` - A`).concat(i,",").concat(i,",0,").concat(+(R>180),",").concat(+(f>0),",").concat(P.x,",").concat(P.y,` - A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(_.x,",").concat(_.y,"Z")}else S+="L".concat(n,",").concat(r,"Z");return S},xwe={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},CB=function(t){var n=yk(yk({},xwe),t),r=n.cx,i=n.cy,s=n.innerRadius,o=n.outerRadius,l=n.cornerRadius,c=n.forceCornerRadius,u=n.cornerIsExternal,d=n.startAngle,f=n.endAngle,h=n.className;if(o0&&Math.abs(d-f)<360?x=ywe({cx:r,cy:i,innerRadius:s,outerRadius:o,cornerRadius:Math.min(m,g/2),forceCornerRadius:c,cornerIsExternal:u,startAngle:d,endAngle:f}):x=PB({cx:r,cy:i,innerRadius:s,outerRadius:o,startAngle:d,endAngle:f}),C.createElement("path",bj({},Ke(n,!0),{className:p,d:x,role:"img"}))};function zh(e){"@babel/helpers - typeof";return zh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zh(e)}function wj(){return wj=Object.assign?Object.assign.bind():function(e){for(var t=1;t0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function Iwe(e,t){return vd(e.getTime(),t.getTime())}function Pk(e,t,n){if(e.size!==t.size)return!1;for(var r={},i=e.entries(),s=0,o,l;(o=i.next())&&!o.done;){for(var c=t.entries(),u=!1,d=0;(l=c.next())&&!l.done;){var f=o.value,h=f[0],p=f[1],g=l.value,m=g[0],x=g[1];!u&&!r[d]&&(u=n.equals(h,m,s,d,e,t,n)&&n.equals(p,x,h,m,e,t,n))&&(r[d]=!0),d++}if(!u)return!1;s++}return!0}function Mwe(e,t,n){var r=_k(e),i=r.length;if(_k(t).length!==i)return!1;for(var s;i-- >0;)if(s=r[i],s===TB&&(e.$$typeof||t.$$typeof)&&e.$$typeof!==t.$$typeof||!kB(t,s)||!n.equals(e[s],t[s],s,s,e,t,n))return!1;return!0}function Vd(e,t,n){var r=Sk(e),i=r.length;if(Sk(t).length!==i)return!1;for(var s,o,l;i-- >0;)if(s=r[i],s===TB&&(e.$$typeof||t.$$typeof)&&e.$$typeof!==t.$$typeof||!kB(t,s)||!n.equals(e[s],t[s],s,s,e,t,n)||(o=Nk(e,s),l=Nk(t,s),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function Rwe(e,t){return vd(e.valueOf(),t.valueOf())}function Dwe(e,t){return e.source===t.source&&e.flags===t.flags}function Ck(e,t,n){if(e.size!==t.size)return!1;for(var r={},i=e.values(),s,o;(s=i.next())&&!s.done;){for(var l=t.values(),c=!1,u=0;(o=l.next())&&!o.done;)!c&&!r[u]&&(c=n.equals(s.value,o.value,s.value,o.value,e,t,n))&&(r[u]=!0),u++;if(!c)return!1}return!0}function Lwe(e,t){var n=e.length;if(t.length!==n)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}var Fwe="[object Arguments]",Bwe="[object Boolean]",zwe="[object Date]",Uwe="[object Map]",Vwe="[object Number]",Wwe="[object Object]",Hwe="[object RegExp]",Gwe="[object Set]",qwe="[object String]",Kwe=Array.isArray,Ak=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,Ek=Object.assign,Xwe=Object.prototype.toString.call.bind(Object.prototype.toString);function Ywe(e){var t=e.areArraysEqual,n=e.areDatesEqual,r=e.areMapsEqual,i=e.areObjectsEqual,s=e.arePrimitiveWrappersEqual,o=e.areRegExpsEqual,l=e.areSetsEqual,c=e.areTypedArraysEqual;return function(d,f,h){if(d===f)return!0;if(d==null||f==null||typeof d!="object"||typeof f!="object")return d!==d&&f!==f;var p=d.constructor;if(p!==f.constructor)return!1;if(p===Object)return i(d,f,h);if(Kwe(d))return t(d,f,h);if(Ak!=null&&Ak(d))return c(d,f,h);if(p===Date)return n(d,f,h);if(p===RegExp)return o(d,f,h);if(p===Map)return r(d,f,h);if(p===Set)return l(d,f,h);var g=Xwe(d);return g===zwe?n(d,f,h):g===Hwe?o(d,f,h):g===Uwe?r(d,f,h):g===Gwe?l(d,f,h):g===Wwe?typeof d.then!="function"&&typeof f.then!="function"&&i(d,f,h):g===Fwe?i(d,f,h):g===Bwe||g===Vwe||g===qwe?s(d,f,h):!1}}function Zwe(e){var t=e.circular,n=e.createCustomConfig,r=e.strict,i={areArraysEqual:r?Vd:$we,areDatesEqual:Iwe,areMapsEqual:r?jk(Pk,Vd):Pk,areObjectsEqual:r?Vd:Mwe,arePrimitiveWrappersEqual:Rwe,areRegExpsEqual:Dwe,areSetsEqual:r?jk(Ck,Vd):Ck,areTypedArraysEqual:r?Vd:Lwe};if(n&&(i=Ek({},i,n(i))),t){var s=Pm(i.areArraysEqual),o=Pm(i.areMapsEqual),l=Pm(i.areObjectsEqual),c=Pm(i.areSetsEqual);i=Ek({},i,{areArraysEqual:s,areMapsEqual:o,areObjectsEqual:l,areSetsEqual:c})}return i}function Qwe(e){return function(t,n,r,i,s,o,l){return e(t,n,l)}}function Jwe(e){var t=e.circular,n=e.comparator,r=e.createState,i=e.equals,s=e.strict;if(r)return function(c,u){var d=r(),f=d.cache,h=f===void 0?t?new WeakMap:void 0:f,p=d.meta;return n(c,u,{cache:h,equals:i,meta:p,strict:s})};if(t)return function(c,u){return n(c,u,{cache:new WeakMap,equals:i,meta:void 0,strict:s})};var o={cache:void 0,equals:i,meta:void 0,strict:s};return function(c,u){return n(c,u,o)}}var e1e=Lo();Lo({strict:!0});Lo({circular:!0});Lo({circular:!0,strict:!0});Lo({createInternalComparator:function(){return vd}});Lo({strict:!0,createInternalComparator:function(){return vd}});Lo({circular:!0,createInternalComparator:function(){return vd}});Lo({circular:!0,createInternalComparator:function(){return vd},strict:!0});function Lo(e){e===void 0&&(e={});var t=e.circular,n=t===void 0?!1:t,r=e.createInternalComparator,i=e.createState,s=e.strict,o=s===void 0?!1:s,l=Zwe(e),c=Ywe(l),u=r?r(c):Qwe(c);return Jwe({circular:n,comparator:c,createState:i,equals:u,strict:o})}function t1e(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function Ok(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,r=function i(s){n<0&&(n=s),s-n>t?(e(s),n=-1):t1e(i)};requestAnimationFrame(r)}function jj(e){"@babel/helpers - typeof";return jj=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jj(e)}function n1e(e){return a1e(e)||s1e(e)||i1e(e)||r1e()}function r1e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function i1e(e,t){if(e){if(typeof e=="string")return kk(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return kk(e,t)}}function kk(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n1?1:b<0?0:b},m=function(b){for(var y=b>1?1:b,w=y,j=0;j<8;++j){var S=f(w)-y,N=p(w);if(Math.abs(S-y)0&&arguments[0]!==void 0?arguments[0]:{},n=t.stiff,r=n===void 0?100:n,i=t.damping,s=i===void 0?8:i,o=t.dt,l=o===void 0?17:o,c=function(d,f,h){var p=-(d-f)*r,g=h*s,m=h+(p-g)*l/1e3,x=h*l/1e3+d;return Math.abs(x-f)e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function D1e(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,s;for(s=0;s=0)&&(n[i]=e[i]);return n}function Ab(e){return z1e(e)||B1e(e)||F1e(e)||L1e()}function L1e(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function F1e(e,t){if(e){if(typeof e=="string")return Cj(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Cj(e,t)}}function B1e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function z1e(e){if(Array.isArray(e))return Cj(e)}function Cj(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Uv(e){return Uv=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Uv(e)}var ns=function(e){G1e(n,e);var t=q1e(n);function n(r,i){var s;U1e(this,n),s=t.call(this,r,i);var o=s.props,l=o.isActive,c=o.attributeName,u=o.from,d=o.to,f=o.steps,h=o.children,p=o.duration;if(s.handleStyleChange=s.handleStyleChange.bind(Oj(s)),s.changeStyle=s.changeStyle.bind(Oj(s)),!l||p<=0)return s.state={style:{}},typeof h=="function"&&(s.state={style:d}),Ej(s);if(f&&f.length)s.state={style:f[0].style};else if(u){if(typeof h=="function")return s.state={style:u},Ej(s);s.state={style:c?tf({},c,u):u}}else s.state={style:{}};return s}return W1e(n,[{key:"componentDidMount",value:function(){var i=this.props,s=i.isActive,o=i.canBegin;this.mounted=!0,!(!s||!o)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(i){var s=this.props,o=s.isActive,l=s.canBegin,c=s.attributeName,u=s.shouldReAnimate,d=s.to,f=s.from,h=this.state.style;if(l){if(!o){var p={style:c?tf({},c,d):d};this.state&&h&&(c&&h[c]!==d||!c&&h!==d)&&this.setState(p);return}if(!(e1e(i.to,d)&&i.canBegin&&i.isActive)){var g=!i.canBegin||!i.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var m=g||u?f:i.to;if(this.state&&h){var x={style:c?tf({},c,m):m};(c&&h[c]!==m||!c&&h!==m)&&this.setState(x)}this.runAnimation(ki(ki({},this.props),{},{from:m,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var i=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),i&&i()}},{key:"handleStyleChange",value:function(i){this.changeStyle(i)}},{key:"changeStyle",value:function(i){this.mounted&&this.setState({style:i})}},{key:"runJSAnimation",value:function(i){var s=this,o=i.from,l=i.to,c=i.duration,u=i.easing,d=i.begin,f=i.onAnimationEnd,h=i.onAnimationStart,p=I1e(o,l,S1e(u),c,this.changeStyle),g=function(){s.stopJSAnimation=p()};this.manager.start([h,d,g,c,f])}},{key:"runStepAnimation",value:function(i){var s=this,o=i.steps,l=i.begin,c=i.onAnimationStart,u=o[0],d=u.style,f=u.duration,h=f===void 0?0:f,p=function(m,x,b){if(b===0)return m;var y=x.duration,w=x.easing,j=w===void 0?"ease":w,S=x.style,N=x.properties,P=x.onAnimationEnd,_=b>0?o[b-1]:x,A=N||Object.keys(S);if(typeof j=="function"||j==="spring")return[].concat(Ab(m),[s.runJSAnimation.bind(s,{from:_.style,to:S,duration:y,easing:j}),y]);var O=Ik(A,y,j),$=ki(ki(ki({},_.style),S),{},{transition:O});return[].concat(Ab(m),[$,y,P]).filter(d1e)};return this.manager.start([c].concat(Ab(o.reduce(p,[d,Math.max(h,l)])),[i.onAnimationEnd]))}},{key:"runAnimation",value:function(i){this.manager||(this.manager=o1e());var s=i.begin,o=i.duration,l=i.attributeName,c=i.to,u=i.easing,d=i.onAnimationStart,f=i.onAnimationEnd,h=i.steps,p=i.children,g=this.manager;if(this.unSubscribe=g.subscribe(this.handleStyleChange),typeof u=="function"||typeof p=="function"||u==="spring"){this.runJSAnimation(i);return}if(h.length>1){this.runStepAnimation(i);return}var m=l?tf({},l,c):c,x=Ik(Object.keys(m),o,u);g.start([d,s,ki(ki({},m),{},{transition:x}),o,f])}},{key:"render",value:function(){var i=this.props,s=i.children;i.begin;var o=i.duration;i.attributeName,i.easing;var l=i.isActive;i.steps,i.from,i.to,i.canBegin,i.onAnimationEnd,i.shouldReAnimate,i.onAnimationReStart;var c=R1e(i,M1e),u=v.Children.count(s),d=this.state.style;if(typeof s=="function")return s(d);if(!l||u===0||o<=0)return s;var f=function(p){var g=p.props,m=g.style,x=m===void 0?{}:m,b=g.className,y=v.cloneElement(p,ki(ki({},c),{},{style:ki(ki({},x),d),className:b}));return y};return u===1?f(v.Children.only(s)):C.createElement("div",null,v.Children.map(s,function(h){return f(h)}))}}]),n}(v.PureComponent);ns.displayName="Animate";ns.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};ns.propTypes={from:wt.oneOfType([wt.object,wt.string]),to:wt.oneOfType([wt.object,wt.string]),attributeName:wt.string,duration:wt.number,begin:wt.number,easing:wt.oneOfType([wt.string,wt.func]),steps:wt.arrayOf(wt.shape({duration:wt.number.isRequired,style:wt.object.isRequired,easing:wt.oneOfType([wt.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),wt.func]),properties:wt.arrayOf("string"),onAnimationEnd:wt.func})),children:wt.oneOfType([wt.node,wt.func]),isActive:wt.bool,canBegin:wt.bool,onAnimationEnd:wt.func,shouldReAnimate:wt.bool,onAnimationStart:wt.func,onAnimationReStart:wt.func};wt.object,wt.object,wt.object,wt.element;wt.object,wt.object,wt.object,wt.oneOfType([wt.array,wt.element]),wt.any;function Wh(e){"@babel/helpers - typeof";return Wh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wh(e)}function Vv(){return Vv=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0?1:-1,c=r>=0?1:-1,u=i>=0&&r>=0||i<0&&r<0?1:0,d;if(o>0&&s instanceof Array){for(var f=[0,0,0,0],h=0,p=4;ho?o:s[h];d="M".concat(t,",").concat(n+l*f[0]),f[0]>0&&(d+="A ".concat(f[0],",").concat(f[0],",0,0,").concat(u,",").concat(t+c*f[0],",").concat(n)),d+="L ".concat(t+r-c*f[1],",").concat(n),f[1]>0&&(d+="A ".concat(f[1],",").concat(f[1],",0,0,").concat(u,`, - `).concat(t+r,",").concat(n+l*f[1])),d+="L ".concat(t+r,",").concat(n+i-l*f[2]),f[2]>0&&(d+="A ".concat(f[2],",").concat(f[2],",0,0,").concat(u,`, - `).concat(t+r-c*f[2],",").concat(n+i)),d+="L ".concat(t+c*f[3],",").concat(n+i),f[3]>0&&(d+="A ".concat(f[3],",").concat(f[3],",0,0,").concat(u,`, - `).concat(t,",").concat(n+i-l*f[3])),d+="Z"}else if(o>0&&s===+s&&s>0){var g=Math.min(o,s);d="M ".concat(t,",").concat(n+l*g,` - A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(t+c*g,",").concat(n,` - L `).concat(t+r-c*g,",").concat(n,` - A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(t+r,",").concat(n+l*g,` - L `).concat(t+r,",").concat(n+i-l*g,` - A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(t+r-c*g,",").concat(n+i,` - L `).concat(t+c*g,",").concat(n+i,` - A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(t,",").concat(n+i-l*g," Z")}else d="M ".concat(t,",").concat(n," h ").concat(r," v ").concat(i," h ").concat(-r," Z");return d},rje=function(t,n){if(!t||!n)return!1;var r=t.x,i=t.y,s=n.x,o=n.y,l=n.width,c=n.height;if(Math.abs(l)>0&&Math.abs(c)>0){var u=Math.min(s,s+l),d=Math.max(s,s+l),f=Math.min(o,o+c),h=Math.max(o,o+c);return r>=u&&r<=d&&i>=f&&i<=h}return!1},ije={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},kP=function(t){var n=Uk(Uk({},ije),t),r=v.useRef(),i=v.useState(-1),s=X1e(i,2),o=s[0],l=s[1];v.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var j=r.current.getTotalLength();j&&l(j)}catch{}},[]);var c=n.x,u=n.y,d=n.width,f=n.height,h=n.radius,p=n.className,g=n.animationEasing,m=n.animationDuration,x=n.animationBegin,b=n.isAnimationActive,y=n.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||f!==+f||d===0||f===0)return null;var w=ht("recharts-rectangle",p);return y?C.createElement(ns,{canBegin:o>0,from:{width:d,height:f,x:c,y:u},to:{width:d,height:f,x:c,y:u},duration:m,animationEasing:g,isActive:y},function(j){var S=j.width,N=j.height,P=j.x,_=j.y;return C.createElement(ns,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:x,duration:m,isActive:b,easing:g},C.createElement("path",Vv({},Ke(n,!0),{className:w,d:Vk(P,_,S,N,h),ref:r})))}):C.createElement("path",Vv({},Ke(n,!0),{className:w,d:Vk(c,u,d,f,h)}))},sje=["points","className","baseLinePoints","connectNulls"];function wc(){return wc=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function oje(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Wk(e){return dje(e)||uje(e)||cje(e)||lje()}function lje(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cje(e,t){if(e){if(typeof e=="string")return kj(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return kj(e,t)}}function uje(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function dje(e){if(Array.isArray(e))return kj(e)}function kj(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return t.forEach(function(r){Hk(r)?n[n.length-1].push(r):n[n.length-1].length>0&&n.push([])}),Hk(t[0])&&n[n.length-1].push(t[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},jf=function(t,n){var r=fje(t);n&&(r=[r.reduce(function(s,o){return[].concat(Wk(s),Wk(o))},[])]);var i=r.map(function(s){return s.reduce(function(o,l,c){return"".concat(o).concat(c===0?"M":"L").concat(l.x,",").concat(l.y)},"")}).join("");return r.length===1?"".concat(i,"Z"):i},hje=function(t,n,r){var i=jf(t,r);return"".concat(i.slice(-1)==="Z"?i.slice(0,-1):i,"L").concat(jf(n.reverse(),r).slice(1))},FB=function(t){var n=t.points,r=t.className,i=t.baseLinePoints,s=t.connectNulls,o=aje(t,sje);if(!n||!n.length)return null;var l=ht("recharts-polygon",r);if(i&&i.length){var c=o.stroke&&o.stroke!=="none",u=hje(n,i,s);return C.createElement("g",{className:l},C.createElement("path",wc({},Ke(o,!0),{fill:u.slice(-1)==="Z"?o.fill:"none",stroke:"none",d:u})),c?C.createElement("path",wc({},Ke(o,!0),{fill:"none",d:jf(n,s)})):null,c?C.createElement("path",wc({},Ke(o,!0),{fill:"none",d:jf(i,s)})):null)}var d=jf(n,s);return C.createElement("path",wc({},Ke(o,!0),{fill:d.slice(-1)==="Z"?o.fill:"none",className:l,d}))};function Tj(){return Tj=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function bje(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var wje=function(t,n,r,i,s,o){return"M".concat(t,",").concat(s,"v").concat(i,"M").concat(o,",").concat(n,"h").concat(r)},jje=function(t){var n=t.x,r=n===void 0?0:n,i=t.y,s=i===void 0?0:i,o=t.top,l=o===void 0?0:o,c=t.left,u=c===void 0?0:c,d=t.width,f=d===void 0?0:d,h=t.height,p=h===void 0?0:h,g=t.className,m=xje(t,pje),x=mje({x:r,y:s,top:l,left:u,width:f,height:p},m);return!Oe(r)||!Oe(s)||!Oe(f)||!Oe(p)||!Oe(l)||!Oe(u)?null:C.createElement("path",$j({},Ke(x,!0),{className:ht("recharts-cross",g),d:wje(r,s,f,p,l,u)}))},Sje=["cx","cy","innerRadius","outerRadius","gridType","radialLines"];function Gh(e){"@babel/helpers - typeof";return Gh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gh(e)}function Nje(e,t){if(e==null)return{};var n=_je(e,t),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function _je(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function xa(){return xa=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Kje(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Xje(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Yk(e,t){for(var n=0;nJk?o=i==="outer"?"start":"end":s<-Jk?o=i==="outer"?"end":"start":o="middle",o}},{key:"renderAxisLine",value:function(){var r=this.props,i=r.cx,s=r.cy,o=r.radius,l=r.axisLine,c=r.axisLineType,u=Uo(Uo({},Ke(this.props,!1)),{},{fill:"none"},Ke(l,!1));if(c==="circle")return C.createElement(Lp,Yo({className:"recharts-polar-angle-axis-line"},u,{cx:i,cy:s,r:o}));var d=this.props.ticks,f=d.map(function(h){return Mt(i,s,o,h.coordinate)});return C.createElement(FB,Yo({className:"recharts-polar-angle-axis-line"},u,{points:f}))}},{key:"renderTicks",value:function(){var r=this,i=this.props,s=i.ticks,o=i.tick,l=i.tickLine,c=i.tickFormatter,u=i.stroke,d=Ke(this.props,!1),f=Ke(o,!1),h=Uo(Uo({},d),{},{fill:"none"},Ke(l,!1)),p=s.map(function(g,m){var x=r.getTickLineCoord(g),b=r.getTickTextAnchor(g),y=Uo(Uo(Uo({textAnchor:b},d),{},{stroke:"none",fill:u},f),{},{index:m,payload:g,x:x.x2,y:x.y2});return C.createElement(Et,Yo({className:ht("recharts-polar-angle-axis-tick",SB(o)),key:"tick-".concat(g.coordinate)},Il(r.props,g,m)),l&&C.createElement("line",Yo({className:"recharts-polar-angle-axis-tick-line"},h,x)),o&&t.renderTickItem(o,y,c?c(g.value,m):g.value))});return C.createElement(Et,{className:"recharts-polar-angle-axis-ticks"},p)}},{key:"render",value:function(){var r=this.props,i=r.ticks,s=r.radius,o=r.axisLine;return s<=0||!i||!i.length?null:C.createElement(Et,{className:ht("recharts-polar-angle-axis",this.props.className)},o&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(r,i,s){var o;return C.isValidElement(r)?o=C.cloneElement(r,i):ot(r)?o=r(i):o=C.createElement(Ml,Yo({},i,{className:"recharts-polar-angle-axis-tick-value"}),s),o}}])}(v.PureComponent);Xx(Xl,"displayName","PolarAngleAxis");Xx(Xl,"axisType","angleAxis");Xx(Xl,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var uSe=VF,dSe=uSe(Object.getPrototypeOf,Object),fSe=dSe,hSe=Pa,pSe=fSe,mSe=Ca,gSe="[object Object]",vSe=Function.prototype,ySe=Object.prototype,WB=vSe.toString,xSe=ySe.hasOwnProperty,bSe=WB.call(Object);function wSe(e){if(!mSe(e)||hSe(e)!=gSe)return!1;var t=pSe(e);if(t===null)return!0;var n=xSe.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&WB.call(n)==bSe}var jSe=wSe;const SSe=Rt(jSe);var NSe=Pa,_Se=Ca,PSe="[object Boolean]";function CSe(e){return e===!0||e===!1||_Se(e)&&NSe(e)==PSe}var ASe=CSe;const ESe=Rt(ASe);function Kh(e){"@babel/helpers - typeof";return Kh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Kh(e)}function Gv(){return Gv=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n0,from:{upperWidth:0,lowerWidth:0,height:h,x:c,y:u},to:{upperWidth:d,lowerWidth:f,height:h,x:c,y:u},duration:m,animationEasing:g,isActive:b},function(w){var j=w.upperWidth,S=w.lowerWidth,N=w.height,P=w.x,_=w.y;return C.createElement(ns,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:x,duration:m,easing:g},C.createElement("path",Gv({},Ke(n,!0),{className:y,d:rT(P,_,j,S,N),ref:r})))}):C.createElement("g",null,C.createElement("path",Gv({},Ke(n,!0),{className:y,d:rT(c,u,d,f,h)})))},BSe=["option","shapeType","propTransformer","activeClassName","isActive"];function Xh(e){"@babel/helpers - typeof";return Xh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xh(e)}function zSe(e,t){if(e==null)return{};var n=USe(e,t),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function USe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function iT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function qv(e){for(var t=1;t0?ni(w,"paddingAngle",0):0;if(S){var P=Un(S.endAngle-S.startAngle,w.endAngle-w.startAngle),_=Kt(Kt({},w),{},{startAngle:y+N,endAngle:y+P(m)+N});x.push(_),y=_.endAngle}else{var A=w.endAngle,O=w.startAngle,$=Un(0,A-O),T=$(m),M=Kt(Kt({},w),{},{startAngle:y+N,endAngle:y+T+N});x.push(M),y=M.endAngle}}),C.createElement(Et,null,r.renderSectorsStatically(x))})}},{key:"attachKeyboardHandlers",value:function(r){var i=this;r.onkeydown=function(s){if(!s.altKey)switch(s.key){case"ArrowLeft":{var o=++i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[o].focus(),i.setState({sectorToFocus:o});break}case"ArrowRight":{var l=--i.state.sectorToFocus<0?i.sectorRefs.length-1:i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[l].focus(),i.setState({sectorToFocus:l});break}case"Escape":{i.sectorRefs[i.state.sectorToFocus].blur(),i.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var r=this.props,i=r.sectors,s=r.isAnimationActive,o=this.state.prevSectors;return s&&i&&i.length&&(!o||!Rl(o,i))?this.renderSectorsWithAnimation():this.renderSectorsStatically(i)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var r=this,i=this.props,s=i.hide,o=i.sectors,l=i.className,c=i.label,u=i.cx,d=i.cy,f=i.innerRadius,h=i.outerRadius,p=i.isAnimationActive,g=this.state.isAnimationFinished;if(s||!o||!o.length||!Oe(u)||!Oe(d)||!Oe(f)||!Oe(h))return null;var m=ht("recharts-pie",l);return C.createElement(Et,{tabIndex:this.props.rootTabIndex,className:m,ref:function(b){r.pieRef=b}},this.renderSectors(),c&&this.renderLabels(o),Vn.renderCallByParent(this.props,null,!1),(!p||g)&&_s.renderCallByParent(this.props,o,!1))}}],[{key:"getDerivedStateFromProps",value:function(r,i){return i.prevIsAnimationActive!==r.isAnimationActive?{prevIsAnimationActive:r.isAnimationActive,prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:[],isAnimationFinished:!0}:r.isAnimationActive&&r.animationId!==i.prevAnimationId?{prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:i.curSectors,isAnimationFinished:!0}:r.sectors!==i.curSectors?{curSectors:r.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(r,i){return r>i?"start":r=360?y:y-1)*c,j=x-y*p-w,S=i.reduce(function(_,A){var O=yn(A,b,0);return _+(Oe(O)?O:0)},0),N;if(S>0){var P;N=i.map(function(_,A){var O=yn(_,b,0),$=yn(_,d,A),T=(Oe(O)?O:0)/S,M;A?M=P.endAngle+jr(m)*c*(O!==0?1:0):M=o;var R=M+jr(m)*((O!==0?p:0)+T*j),H=(M+R)/2,F=(g.innerRadius+g.outerRadius)/2,V=[{name:$,value:O,payload:_,dataKey:b,type:h}],I=Mt(g.cx,g.cy,F,H);return P=Kt(Kt(Kt({percent:T,cornerRadius:s,name:$,tooltipPayload:V,midAngle:H,middleRadius:F,tooltipPosition:I},_),g),{},{value:yn(_,b),startAngle:M,endAngle:R,payload:_,paddingAngle:jr(m)*c}),P})}return Kt(Kt({},g),{},{sectors:N,data:i})});function cNe(e){return e&&e.length?e[0]:void 0}var uNe=cNe,dNe=uNe;const fNe=Rt(dNe);var hNe=["key"];function _u(e){"@babel/helpers - typeof";return _u=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_u(e)}function pNe(e,t){if(e==null)return{};var n=mNe(e,t),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function mNe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Xv(){return Xv=Object.assign?Object.assign.bind():function(e){for(var t=1;t=2&&(c=!0),u.push(yr(yr({},Mt(o,l,y,x)),{},{name:g,value:m,cx:o,cy:l,radius:y,angle:x,payload:h}))});var f=[];return c&&u.forEach(function(h){if(Array.isArray(h.value)){var p=fNe(h.value),g=gt(p)?void 0:t.scale(p);f.push(yr(yr({},h),{},{radius:g},Mt(o,l,g,h.angle)))}else f.push(h)}),{points:u,isRange:c,baseLinePoints:f}});var SNe=Math.ceil,NNe=Math.max;function _Ne(e,t,n,r){for(var i=-1,s=NNe(SNe((t-e)/(n||1)),0),o=Array(s);s--;)o[r?s:++i]=e,e+=n;return o}var PNe=_Ne,CNe=l6,uT=1/0,ANe=17976931348623157e292;function ENe(e){if(!e)return e===0?e:0;if(e=CNe(e),e===uT||e===-uT){var t=e<0?-1:1;return t*ANe}return e===e?e:0}var YB=ENe,ONe=PNe,kNe=Rx,Eb=YB;function TNe(e){return function(t,n,r){return r&&typeof r!="number"&&kNe(t,n,r)&&(n=r=void 0),t=Eb(t),n===void 0?(n=t,t=0):n=Eb(n),r=r===void 0?t0&&r.handleDrag(i.changedTouches[0])}),Wr(r,"handleDragEnd",function(){r.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var i=r.props,s=i.endIndex,o=i.onDragEnd,l=i.startIndex;o==null||o({endIndex:s,startIndex:l})}),r.detachDragEndListener()}),Wr(r,"handleLeaveWrapper",function(){(r.state.isTravellerMoving||r.state.isSlideMoving)&&(r.leaveTimer=window.setTimeout(r.handleDragEnd,r.props.leaveTimeOut))}),Wr(r,"handleEnterSlideOrTraveller",function(){r.setState({isTextActive:!0})}),Wr(r,"handleLeaveSlideOrTraveller",function(){r.setState({isTextActive:!1})}),Wr(r,"handleSlideDragStart",function(i){var s=mT(i)?i.changedTouches[0]:i;r.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:s.pageX}),r.attachDragEndListener()}),r.travellerDragStartHandlers={startX:r.handleTravellerDragStart.bind(r,"startX"),endX:r.handleTravellerDragStart.bind(r,"endX")},r.state={},r}return GNe(t,e),UNe(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(r){var i=r.startX,s=r.endX,o=this.state.scaleValues,l=this.props,c=l.gap,u=l.data,d=u.length-1,f=Math.min(i,s),h=Math.max(i,s),p=t.getIndexInRange(o,f),g=t.getIndexInRange(o,h);return{startIndex:p-p%c,endIndex:g===d?d:g-g%c}}},{key:"getTextOfTick",value:function(r){var i=this.props,s=i.data,o=i.tickFormatter,l=i.dataKey,c=yn(s[r],l,r);return ot(o)?o(c,r):c}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(r){var i=this.state,s=i.slideMoveStartX,o=i.startX,l=i.endX,c=this.props,u=c.x,d=c.width,f=c.travellerWidth,h=c.startIndex,p=c.endIndex,g=c.onChange,m=r.pageX-s;m>0?m=Math.min(m,u+d-f-l,u+d-f-o):m<0&&(m=Math.max(m,u-o,u-l));var x=this.getIndex({startX:o+m,endX:l+m});(x.startIndex!==h||x.endIndex!==p)&&g&&g(x),this.setState({startX:o+m,endX:l+m,slideMoveStartX:r.pageX})}},{key:"handleTravellerDragStart",value:function(r,i){var s=mT(i)?i.changedTouches[0]:i;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:r,brushMoveStartX:s.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(r){var i=this.state,s=i.brushMoveStartX,o=i.movingTravellerId,l=i.endX,c=i.startX,u=this.state[o],d=this.props,f=d.x,h=d.width,p=d.travellerWidth,g=d.onChange,m=d.gap,x=d.data,b={startX:this.state.startX,endX:this.state.endX},y=r.pageX-s;y>0?y=Math.min(y,f+h-p-u):y<0&&(y=Math.max(y,f-u)),b[o]=u+y;var w=this.getIndex(b),j=w.startIndex,S=w.endIndex,N=function(){var _=x.length-1;return o==="startX"&&(l>c?j%m===0:S%m===0)||lc?S%m===0:j%m===0)||l>c&&S===_};this.setState(Wr(Wr({},o,u+y),"brushMoveStartX",r.pageX),function(){g&&N()&&g(w)})}},{key:"handleTravellerMoveKeyboard",value:function(r,i){var s=this,o=this.state,l=o.scaleValues,c=o.startX,u=o.endX,d=this.state[i],f=l.indexOf(d);if(f!==-1){var h=f+r;if(!(h===-1||h>=l.length)){var p=l[h];i==="startX"&&p>=u||i==="endX"&&p<=c||this.setState(Wr({},i,p),function(){s.props.onChange(s.getIndex({startX:s.state.startX,endX:s.state.endX}))})}}}},{key:"renderBackground",value:function(){var r=this.props,i=r.x,s=r.y,o=r.width,l=r.height,c=r.fill,u=r.stroke;return C.createElement("rect",{stroke:u,fill:c,x:i,y:s,width:o,height:l})}},{key:"renderPanorama",value:function(){var r=this.props,i=r.x,s=r.y,o=r.width,l=r.height,c=r.data,u=r.children,d=r.padding,f=v.Children.only(u);return f?C.cloneElement(f,{x:i,y:s,width:o,height:l,margin:d,compact:!0,data:c}):null}},{key:"renderTravellerLayer",value:function(r,i){var s,o,l=this,c=this.props,u=c.y,d=c.travellerWidth,f=c.height,h=c.traveller,p=c.ariaLabel,g=c.data,m=c.startIndex,x=c.endIndex,b=Math.max(r,this.props.x),y=Ob(Ob({},Ke(this.props,!1)),{},{x:b,y:u,width:d,height:f}),w=p||"Min value: ".concat((s=g[m])===null||s===void 0?void 0:s.name,", Max value: ").concat((o=g[x])===null||o===void 0?void 0:o.name);return C.createElement(Et,{tabIndex:0,role:"slider","aria-label":w,"aria-valuenow":r,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[i],onTouchStart:this.travellerDragStartHandlers[i],onKeyDown:function(S){["ArrowLeft","ArrowRight"].includes(S.key)&&(S.preventDefault(),S.stopPropagation(),l.handleTravellerMoveKeyboard(S.key==="ArrowRight"?1:-1,i))},onFocus:function(){l.setState({isTravellerFocused:!0})},onBlur:function(){l.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(h,y))}},{key:"renderSlide",value:function(r,i){var s=this.props,o=s.y,l=s.height,c=s.stroke,u=s.travellerWidth,d=Math.min(r,i)+u,f=Math.max(Math.abs(i-r)-u,0);return C.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:c,fillOpacity:.2,x:d,y:o,width:f,height:l})}},{key:"renderText",value:function(){var r=this.props,i=r.startIndex,s=r.endIndex,o=r.y,l=r.height,c=r.travellerWidth,u=r.stroke,d=this.state,f=d.startX,h=d.endX,p=5,g={pointerEvents:"none",fill:u};return C.createElement(Et,{className:"recharts-brush-texts"},C.createElement(Ml,Qv({textAnchor:"end",verticalAnchor:"middle",x:Math.min(f,h)-p,y:o+l/2},g),this.getTextOfTick(i)),C.createElement(Ml,Qv({textAnchor:"start",verticalAnchor:"middle",x:Math.max(f,h)+c+p,y:o+l/2},g),this.getTextOfTick(s)))}},{key:"render",value:function(){var r=this.props,i=r.data,s=r.className,o=r.children,l=r.x,c=r.y,u=r.width,d=r.height,f=r.alwaysShowText,h=this.state,p=h.startX,g=h.endX,m=h.isTextActive,x=h.isSlideMoving,b=h.isTravellerMoving,y=h.isTravellerFocused;if(!i||!i.length||!Oe(l)||!Oe(c)||!Oe(u)||!Oe(d)||u<=0||d<=0)return null;var w=ht("recharts-brush",s),j=C.Children.count(o)===1,S=BNe("userSelect","none");return C.createElement(Et,{className:w,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:S},this.renderBackground(),j&&this.renderPanorama(),this.renderSlide(p,g),this.renderTravellerLayer(p,"startX"),this.renderTravellerLayer(g,"endX"),(m||x||b||y||f)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(r){var i=r.x,s=r.y,o=r.width,l=r.height,c=r.stroke,u=Math.floor(s+l/2)-1;return C.createElement(C.Fragment,null,C.createElement("rect",{x:i,y:s,width:o,height:l,fill:c,stroke:"none"}),C.createElement("line",{x1:i+1,y1:u,x2:i+o-1,y2:u,fill:"none",stroke:"#fff"}),C.createElement("line",{x1:i+1,y1:u+2,x2:i+o-1,y2:u+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(r,i){var s;return C.isValidElement(r)?s=C.cloneElement(r,i):ot(r)?s=r(i):s=t.renderDefaultTraveller(i),s}},{key:"getDerivedStateFromProps",value:function(r,i){var s=r.data,o=r.width,l=r.x,c=r.travellerWidth,u=r.updateId,d=r.startIndex,f=r.endIndex;if(s!==i.prevData||u!==i.prevUpdateId)return Ob({prevData:s,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:o},s&&s.length?KNe({data:s,width:o,x:l,travellerWidth:c,startIndex:d,endIndex:f}):{scale:null,scaleValues:null});if(i.scale&&(o!==i.prevWidth||l!==i.prevX||c!==i.prevTravellerWidth)){i.scale.range([l,l+o-c]);var h=i.scale.domain().map(function(p){return i.scale(p)});return{prevData:s,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:o,startX:i.scale(r.startIndex),endX:i.scale(r.endIndex),scaleValues:h}}return null}},{key:"getIndexInRange",value:function(r,i){for(var s=r.length,o=0,l=s-1;l-o>1;){var c=Math.floor((o+l)/2);r[c]>i?l=c:o=c}return i>=r[l]?l:o}}])}(v.PureComponent);Wr(Cu,"displayName","Brush");Wr(Cu,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var XNe=rP;function YNe(e,t){var n;return XNe(e,function(r,i,s){return n=t(r,i,s),!n}),!!n}var ZNe=YNe,QNe=MF,JNe=Is,e_e=ZNe,t_e=Vr,n_e=Rx;function r_e(e,t,n){var r=t_e(e)?QNe:e_e;return n&&n_e(e,t,n)&&(t=void 0),r(e,JNe(t))}var i_e=r_e;const s_e=Rt(i_e);var Ps=function(t,n){var r=t.alwaysShow,i=t.ifOverflow;return r&&(i="extendDomain"),i===n},gT=r6;function a_e(e,t,n){t=="__proto__"&&gT?gT(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var o_e=a_e,l_e=o_e,c_e=t6,u_e=Is;function d_e(e,t){var n={};return t=u_e(t),c_e(e,function(r,i,s){l_e(n,i,t(r,i,s))}),n}var f_e=d_e;const h_e=Rt(f_e);function p_e(e,t){for(var n=-1,r=e==null?0:e.length;++n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function k_e(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function T_e(e,t){var n=e.x,r=e.y,i=O_e(e,P_e),s="".concat(n),o=parseInt(s,10),l="".concat(r),c=parseInt(l,10),u="".concat(t.height||i.height),d=parseInt(u,10),f="".concat(t.width||i.width),h=parseInt(f,10);return Wd(Wd(Wd(Wd(Wd({},t),i),o?{x:o}:{}),c?{y:c}:{}),{},{height:d,width:h,name:t.name,radius:t.radius})}function yT(e){return C.createElement(HB,Fj({shapeType:"rectangle",propTransformer:T_e,activeClassName:"recharts-active-bar"},e))}var $_e=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(r,i){if(typeof t=="number")return t;var s=typeof r=="number";return s?t(r,i):(s||Ll(),n)}},I_e=["value","background"],tz;function Au(e){"@babel/helpers - typeof";return Au=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Au(e)}function M_e(e,t){if(e==null)return{};var n=R_e(e,t),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function R_e(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function ey(){return ey=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs(H)0&&Math.abs(R)0&&(M=Math.min((z||0)-(R[ae-1]||0),M))}),Number.isFinite(M)){var H=M/T,F=m.layout==="vertical"?r.height:r.width;if(m.padding==="gap"&&(P=H*F/2),m.padding==="no-gap"){var V=Sr(t.barCategoryGap,H*F),I=H*F/2;P=I-V-(I-V)/F*V}}}i==="xAxis"?_=[r.left+(w.left||0)+(P||0),r.left+r.width-(w.right||0)-(P||0)]:i==="yAxis"?_=c==="horizontal"?[r.top+r.height-(w.bottom||0),r.top+(w.top||0)]:[r.top+(w.top||0)+(P||0),r.top+r.height-(w.bottom||0)-(P||0)]:_=m.range,S&&(_=[_[1],_[0]]);var L=mB(m,s,h),Z=L.scale,ee=L.realScaleType;Z.domain(b).range(_),gB(Z);var re=vB(Z,Fi(Fi({},m),{},{realScaleType:ee}));i==="xAxis"?($=x==="top"&&!j||x==="bottom"&&j,A=r.left,O=f[N]-$*m.height):i==="yAxis"&&($=x==="left"&&!j||x==="right"&&j,A=f[N]-$*m.width,O=r.top);var me=Fi(Fi(Fi({},m),re),{},{realScaleType:ee,x:A,y:O,scale:Z,width:i==="xAxis"?r.width:m.width,height:i==="yAxis"?r.height:m.height});return me.bandSize=Dv(me,re),!m.hide&&i==="xAxis"?f[N]+=($?-1:1)*me.height:m.hide||(f[N]+=($?-1:1)*me.width),Fi(Fi({},p),{},Qx({},g,me))},{})},az=function(t,n){var r=t.x,i=t.y,s=n.x,o=n.y;return{x:Math.min(r,s),y:Math.min(i,o),width:Math.abs(s-r),height:Math.abs(o-i)}},q_e=function(t){var n=t.x1,r=t.y1,i=t.x2,s=t.y2;return az({x:n,y:r},{x:i,y:s})},oz=function(){function e(t){W_e(this,e),this.scale=t}return H_e(e,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=r.bandAware,s=r.position;if(n!==void 0){if(s)switch(s){case"start":return this.scale(n);case"middle":{var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+o}case"end":{var l=this.bandwidth?this.bandwidth():0;return this.scale(n)+l}default:return this.scale(n)}if(i){var c=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+c}return this.scale(n)}}},{key:"isInRange",value:function(n){var r=this.range(),i=r[0],s=r[r.length-1];return i<=s?n>=i&&n<=s:n>=s&&n<=i}}],[{key:"create",value:function(n){return new e(n)}}])}();Qx(oz,"EPS",1e-4);var $P=function(t){var n=Object.keys(t).reduce(function(r,i){return Fi(Fi({},r),{},Qx({},i,oz.create(t[i])))},{});return Fi(Fi({},n),{},{apply:function(i){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=s.bandAware,l=s.position;return h_e(i,function(c,u){return n[u].apply(c,{bandAware:o,position:l})})},isInRange:function(i){return ez(i,function(s,o){return n[o].isInRange(s)})}})};function K_e(e){return(e%180+180)%180}var X_e=function(t){var n=t.width,r=t.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=K_e(i),o=s*Math.PI/180,l=Math.atan(r/n),c=o>l&&o-1?i[s?t[o]:o]:void 0}}var ePe=J_e,tPe=YB;function nPe(e){var t=tPe(e),n=t%1;return t===t?n?t-n:t:0}var rPe=nPe,iPe=XF,sPe=Is,aPe=rPe,oPe=Math.max;function lPe(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var i=n==null?0:aPe(n);return i<0&&(i=oPe(r+i,0)),iPe(e,sPe(t),i)}var cPe=lPe,uPe=ePe,dPe=cPe,fPe=uPe(dPe),hPe=fPe;const pPe=Rt(hPe);var mPe=Jie(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return["l",e.left,"t",e.top,"w",e.width,"h",e.height].join("")}),IP=v.createContext(void 0),MP=v.createContext(void 0),lz=v.createContext(void 0),cz=v.createContext({}),uz=v.createContext(void 0),dz=v.createContext(0),fz=v.createContext(0),ST=function(t){var n=t.state,r=n.xAxisMap,i=n.yAxisMap,s=n.offset,o=t.clipPathId,l=t.children,c=t.width,u=t.height,d=mPe(s);return C.createElement(IP.Provider,{value:r},C.createElement(MP.Provider,{value:i},C.createElement(cz.Provider,{value:s},C.createElement(lz.Provider,{value:d},C.createElement(uz.Provider,{value:o},C.createElement(dz.Provider,{value:u},C.createElement(fz.Provider,{value:c},l)))))))},gPe=function(){return v.useContext(uz)},hz=function(t){var n=v.useContext(IP);n==null&&Ll();var r=n[t];return r==null&&Ll(),r},vPe=function(){var t=v.useContext(IP);return Wa(t)},yPe=function(){var t=v.useContext(MP),n=pPe(t,function(r){return ez(r.domain,Number.isFinite)});return n||Wa(t)},pz=function(t){var n=v.useContext(MP);n==null&&Ll();var r=n[t];return r==null&&Ll(),r},xPe=function(){var t=v.useContext(lz);return t},bPe=function(){return v.useContext(cz)},RP=function(){return v.useContext(fz)},DP=function(){return v.useContext(dz)};function Eu(e){"@babel/helpers - typeof";return Eu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Eu(e)}function wPe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jPe(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);ne*i)return!1;var s=n();return e*(t-e*s/2-r)>=0&&e*(t+e*s/2-i)<=0}function rCe(e,t){return wz(e,t+1)}function iCe(e,t,n,r,i){for(var s=(r||[]).slice(),o=t.start,l=t.end,c=0,u=1,d=o,f=function(){var g=r==null?void 0:r[c];if(g===void 0)return{v:wz(r,u)};var m=c,x,b=function(){return x===void 0&&(x=n(g,m)),x},y=g.coordinate,w=c===0||sy(e,y,b,d,l);w||(c=0,d=o,u+=1),w&&(d=y+e*(b()/2+i),c+=u)},h;u<=s.length;)if(h=f(),h)return h.v;return[]}function ep(e){"@babel/helpers - typeof";return ep=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ep(e)}function kT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function ar(e){for(var t=1;t0?p.coordinate-x*e:p.coordinate})}else s[h]=p=ar(ar({},p),{},{tickCoord:p.coordinate});var b=sy(e,p.tickCoord,m,l,c);b&&(c=p.tickCoord-e*(m()/2+i),s[h]=ar(ar({},p),{},{isShow:!0}))},d=o-1;d>=0;d--)u(d);return s}function cCe(e,t,n,r,i,s){var o=(r||[]).slice(),l=o.length,c=t.start,u=t.end;if(s){var d=r[l-1],f=n(d,l-1),h=e*(d.coordinate+e*f/2-u);o[l-1]=d=ar(ar({},d),{},{tickCoord:h>0?d.coordinate-h*e:d.coordinate});var p=sy(e,d.tickCoord,function(){return f},c,u);p&&(u=d.tickCoord-e*(f/2+i),o[l-1]=ar(ar({},d),{},{isShow:!0}))}for(var g=s?l-1:l,m=function(y){var w=o[y],j,S=function(){return j===void 0&&(j=n(w,y)),j};if(y===0){var N=e*(w.coordinate-e*S()/2-c);o[y]=w=ar(ar({},w),{},{tickCoord:N<0?w.coordinate-N*e:w.coordinate})}else o[y]=w=ar(ar({},w),{},{tickCoord:w.coordinate});var P=sy(e,w.tickCoord,S,c,u);P&&(c=w.tickCoord+e*(S()/2+i),o[y]=ar(ar({},w),{},{isShow:!0}))},x=0;x=2?jr(i[1].coordinate-i[0].coordinate):1,b=nCe(s,x,p);return c==="equidistantPreserveStart"?iCe(x,b,m,i,o):(c==="preserveStart"||c==="preserveStartEnd"?h=cCe(x,b,m,i,o,c==="preserveStartEnd"):h=lCe(x,b,m,i,o),h.filter(function(y){return y.isShow}))}var uCe=["viewBox"],dCe=["viewBox"],fCe=["ticks"];function Tu(e){"@babel/helpers - typeof";return Tu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tu(e)}function Sc(){return Sc=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function hCe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function pCe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $T(e,t){for(var n=0;n0?c(this.props):c(p)),o<=0||l<=0||!g||!g.length?null:C.createElement(Et,{className:ht("recharts-cartesian-axis",u),ref:function(x){r.layerReference=x}},s&&this.renderAxisLine(),this.renderTicks(g,this.state.fontSize,this.state.letterSpacing),Vn.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(r,i,s){var o;return C.isValidElement(r)?o=C.cloneElement(r,i):ot(r)?o=r(i):o=C.createElement(Ml,Sc({},i,{className:"recharts-cartesian-axis-tick-value"}),s),o}}])}(v.Component);zP(xd,"displayName","CartesianAxis");zP(xd,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var wCe=["x1","y1","x2","y2","key"],jCe=["offset"];function Fl(e){"@babel/helpers - typeof";return Fl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fl(e)}function IT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function dr(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function PCe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var CCe=function(t){var n=t.fill;if(!n||n==="none")return null;var r=t.fillOpacity,i=t.x,s=t.y,o=t.width,l=t.height,c=t.ry;return C.createElement("rect",{x:i,y:s,ry:c,width:o,height:l,stroke:"none",fill:n,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function Nz(e,t){var n;if(C.isValidElement(e))n=C.cloneElement(e,t);else if(ot(e))n=e(t);else{var r=t.x1,i=t.y1,s=t.x2,o=t.y2,l=t.key,c=MT(t,wCe),u=Ke(c,!1);u.offset;var d=MT(u,jCe);n=C.createElement("line",al({},d,{x1:r,y1:i,x2:s,y2:o,fill:"none",key:l}))}return n}function ACe(e){var t=e.x,n=e.width,r=e.horizontal,i=r===void 0?!0:r,s=e.horizontalPoints;if(!i||!s||!s.length)return null;var o=s.map(function(l,c){var u=dr(dr({},e),{},{x1:t,y1:l,x2:t+n,y2:l,key:"line-".concat(c),index:c});return Nz(i,u)});return C.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function ECe(e){var t=e.y,n=e.height,r=e.vertical,i=r===void 0?!0:r,s=e.verticalPoints;if(!i||!s||!s.length)return null;var o=s.map(function(l,c){var u=dr(dr({},e),{},{x1:l,y1:t,x2:l,y2:t+n,key:"line-".concat(c),index:c});return Nz(i,u)});return C.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function OCe(e){var t=e.horizontalFill,n=e.fillOpacity,r=e.x,i=e.y,s=e.width,o=e.height,l=e.horizontalPoints,c=e.horizontal,u=c===void 0?!0:c;if(!u||!t||!t.length)return null;var d=l.map(function(h){return Math.round(h+i-i)}).sort(function(h,p){return h-p});i!==d[0]&&d.unshift(0);var f=d.map(function(h,p){var g=!d[p+1],m=g?i+o-h:d[p+1]-h;if(m<=0)return null;var x=p%t.length;return C.createElement("rect",{key:"react-".concat(p),y:h,x:r,height:m,width:s,stroke:"none",fill:t[x],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return C.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function kCe(e){var t=e.vertical,n=t===void 0?!0:t,r=e.verticalFill,i=e.fillOpacity,s=e.x,o=e.y,l=e.width,c=e.height,u=e.verticalPoints;if(!n||!r||!r.length)return null;var d=u.map(function(h){return Math.round(h+s-s)}).sort(function(h,p){return h-p});s!==d[0]&&d.unshift(0);var f=d.map(function(h,p){var g=!d[p+1],m=g?s+l-h:d[p+1]-h;if(m<=0)return null;var x=p%r.length;return C.createElement("rect",{key:"react-".concat(p),x:h,y:o,width:m,height:c,stroke:"none",fill:r[x],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return C.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var TCe=function(t,n){var r=t.xAxis,i=t.width,s=t.height,o=t.offset;return pB(BP(dr(dr(dr({},xd.defaultProps),r),{},{ticks:Qs(r,!0),viewBox:{x:0,y:0,width:i,height:s}})),o.left,o.left+o.width,n)},$Ce=function(t,n){var r=t.yAxis,i=t.width,s=t.height,o=t.offset;return pB(BP(dr(dr(dr({},xd.defaultProps),r),{},{ticks:Qs(r,!0),viewBox:{x:0,y:0,width:i,height:s}})),o.top,o.top+o.height,n)},ic={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function tp(e){var t,n,r,i,s,o,l=RP(),c=DP(),u=bPe(),d=dr(dr({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:ic.stroke,fill:(n=e.fill)!==null&&n!==void 0?n:ic.fill,horizontal:(r=e.horizontal)!==null&&r!==void 0?r:ic.horizontal,horizontalFill:(i=e.horizontalFill)!==null&&i!==void 0?i:ic.horizontalFill,vertical:(s=e.vertical)!==null&&s!==void 0?s:ic.vertical,verticalFill:(o=e.verticalFill)!==null&&o!==void 0?o:ic.verticalFill,x:Oe(e.x)?e.x:u.left,y:Oe(e.y)?e.y:u.top,width:Oe(e.width)?e.width:u.width,height:Oe(e.height)?e.height:u.height}),f=d.x,h=d.y,p=d.width,g=d.height,m=d.syncWithTicks,x=d.horizontalValues,b=d.verticalValues,y=vPe(),w=yPe();if(!Oe(p)||p<=0||!Oe(g)||g<=0||!Oe(f)||f!==+f||!Oe(h)||h!==+h)return null;var j=d.verticalCoordinatesGenerator||TCe,S=d.horizontalCoordinatesGenerator||$Ce,N=d.horizontalPoints,P=d.verticalPoints;if((!N||!N.length)&&ot(S)){var _=x&&x.length,A=S({yAxis:w?dr(dr({},w),{},{ticks:_?x:w.ticks}):void 0,width:l,height:c,offset:u},_?!0:m);Ki(Array.isArray(A),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(Fl(A),"]")),Array.isArray(A)&&(N=A)}if((!P||!P.length)&&ot(j)){var O=b&&b.length,$=j({xAxis:y?dr(dr({},y),{},{ticks:O?b:y.ticks}):void 0,width:l,height:c,offset:u},O?!0:m);Ki(Array.isArray($),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(Fl($),"]")),Array.isArray($)&&(P=$)}return C.createElement("g",{className:"recharts-cartesian-grid"},C.createElement(CCe,{fill:d.fill,fillOpacity:d.fillOpacity,x:d.x,y:d.y,width:d.width,height:d.height,ry:d.ry}),C.createElement(ACe,al({},d,{offset:u,horizontalPoints:N,xAxis:y,yAxis:w})),C.createElement(ECe,al({},d,{offset:u,verticalPoints:P,xAxis:y,yAxis:w})),C.createElement(OCe,al({},d,{horizontalPoints:N})),C.createElement(kCe,al({},d,{verticalPoints:P})))}tp.displayName="CartesianGrid";var ICe=["layout","type","stroke","connectNulls","isRange","ref"],MCe=["key"],_z;function $u(e){"@babel/helpers - typeof";return $u=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$u(e)}function Pz(e,t){if(e==null)return{};var n=RCe(e,t),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function RCe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function ol(){return ol=Object.assign?Object.assign.bind():function(e){for(var t=1;t0||!Rl(d,o)||!Rl(f,l))?this.renderAreaWithAnimation(r,i):this.renderAreaStatically(o,l,r,i)}},{key:"render",value:function(){var r,i=this.props,s=i.hide,o=i.dot,l=i.points,c=i.className,u=i.top,d=i.left,f=i.xAxis,h=i.yAxis,p=i.width,g=i.height,m=i.isAnimationActive,x=i.id;if(s||!l||!l.length)return null;var b=this.state.isAnimationFinished,y=l.length===1,w=ht("recharts-area",c),j=f&&f.allowDataOverflow,S=h&&h.allowDataOverflow,N=j||S,P=gt(x)?this.id:x,_=(r=Ke(o,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},A=_.r,O=A===void 0?3:A,$=_.strokeWidth,T=$===void 0?2:$,M=iae(o)?o:{},R=M.clipDot,H=R===void 0?!0:R,F=O*2+T;return C.createElement(Et,{className:w},j||S?C.createElement("defs",null,C.createElement("clipPath",{id:"clipPath-".concat(P)},C.createElement("rect",{x:j?d:d-p/2,y:S?u:u-g/2,width:j?p:p*2,height:S?g:g*2})),!H&&C.createElement("clipPath",{id:"clipPath-dots-".concat(P)},C.createElement("rect",{x:d-F/2,y:u-F/2,width:p+F,height:g+F}))):null,y?null:this.renderArea(N,P),(o||y)&&this.renderDots(N,H,P),(!m||b)&&_s.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(r,i){return r.animationId!==i.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,curBaseLine:r.baseLine,prevPoints:i.curPoints,prevBaseLine:i.curBaseLine}:r.points!==i.curPoints||r.baseLine!==i.curBaseLine?{curPoints:r.points,curBaseLine:r.baseLine}:null}}])}(v.PureComponent);_z=Yi;xs(Yi,"displayName","Area");xs(Yi,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!Xi.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});xs(Yi,"getBaseValue",function(e,t,n,r){var i=e.layout,s=e.baseValue,o=t.props.baseValue,l=o??s;if(Oe(l)&&typeof l=="number")return l;var c=i==="horizontal"?r:n,u=c.scale.domain();if(c.type==="number"){var d=Math.max(u[0],u[1]),f=Math.min(u[0],u[1]);return l==="dataMin"?f:l==="dataMax"||d<0?d:Math.max(Math.min(u[0],u[1]),0)}return l==="dataMin"?u[0]:l==="dataMax"?u[1]:u[0]});xs(Yi,"getComposedData",function(e){var t=e.props,n=e.item,r=e.xAxis,i=e.yAxis,s=e.xAxisTicks,o=e.yAxisTicks,l=e.bandSize,c=e.dataKey,u=e.stackedData,d=e.dataStartIndex,f=e.displayedData,h=e.offset,p=t.layout,g=u&&u.length,m=_z.getBaseValue(t,n,r,i),x=p==="horizontal",b=!1,y=f.map(function(j,S){var N;g?N=u[d+S]:(N=yn(j,c),Array.isArray(N)?b=!0:N=[m,N]);var P=N[1]==null||g&&yn(j,c)==null;return x?{x:sk({axis:r,ticks:s,bandSize:l,entry:j,index:S}),y:P?null:i.scale(N[1]),value:N,payload:j}:{x:P?null:r.scale(N[1]),y:sk({axis:i,ticks:o,bandSize:l,entry:j,index:S}),value:N,payload:j}}),w;return g||b?w=y.map(function(j){var S=Array.isArray(j.value)?j.value[0]:null;return x?{x:j.x,y:S!=null&&j.y!=null?i.scale(S):null}:{x:S!=null?r.scale(S):null,y:j.y}}):w=x?i.scale(m):r.scale(m),Ma({points:y,baseLine:w,layout:p,isRange:b},h)});xs(Yi,"renderDotItem",function(e,t){var n;if(C.isValidElement(e))n=C.cloneElement(e,t);else if(ot(e))n=e(t);else{var r=ht("recharts-area-dot",typeof e!="boolean"?e.className:""),i=t.key,s=Pz(t,MCe);n=C.createElement(Lp,ol({},s,{key:i,className:r}))}return n});function Iu(e){"@babel/helpers - typeof";return Iu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Iu(e)}function WCe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function HCe(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function kAe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function TAe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $Ae(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n0?o:t&&t.length&&Oe(i)&&Oe(s)?t.slice(i,s+1):[]};function Uz(e){return e==="number"?[0,"auto"]:void 0}var rS=function(t,n,r,i){var s=t.graphicalItems,o=t.tooltipAxis,l=r0(n,t);return r<0||!s||!s.length||r>=l.length?null:s.reduce(function(c,u){var d,f=(d=u.props.data)!==null&&d!==void 0?d:n;f&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(f=f.slice(t.dataStartIndex,t.dataEndIndex+1));var h;if(o.dataKey&&!o.allowDuplicatedCategory){var p=f===void 0?l:f;h=cv(p,o.dataKey,i)}else h=f&&f[r]||l[r];return h?[].concat(Du(c),[xB(u,h)]):c},[])},VT=function(t,n,r,i){var s=i||{x:t.chartX,y:t.chartY},o=HAe(s,r),l=t.orderedTooltipTicks,c=t.tooltipAxis,u=t.tooltipTicks,d=sbe(o,l,u,c);if(d>=0&&u){var f=u[d]&&u[d].value,h=rS(t,n,d,f),p=GAe(r,l,d,s);return{activeTooltipIndex:d,activeLabel:f,activePayload:h,activeCoordinate:p}}return null},qAe=function(t,n){var r=n.axes,i=n.graphicalItems,s=n.axisType,o=n.axisIdKey,l=n.stackGroups,c=n.dataStartIndex,u=n.dataEndIndex,d=t.layout,f=t.children,h=t.stackOffset,p=hB(d,s);return r.reduce(function(g,m){var x,b=m.type.defaultProps!==void 0?ge(ge({},m.type.defaultProps),m.props):m.props,y=b.type,w=b.dataKey,j=b.allowDataOverflow,S=b.allowDuplicatedCategory,N=b.scale,P=b.ticks,_=b.includeHidden,A=b[o];if(g[A])return g;var O=r0(t.data,{graphicalItems:i.filter(function(re){var me,z=o in re.props?re.props[o]:(me=re.type.defaultProps)===null||me===void 0?void 0:me[o];return z===A}),dataStartIndex:c,dataEndIndex:u}),$=O.length,T,M,R;xAe(b.domain,j,y)&&(T=vj(b.domain,null,j),p&&(y==="number"||N!=="auto")&&(R=bf(O,w,"category")));var H=Uz(y);if(!T||T.length===0){var F,V=(F=b.domain)!==null&&F!==void 0?F:H;if(w){if(T=bf(O,w,y),y==="category"&&p){var I=Xse(T);S&&I?(M=T,T=Zv(0,$)):S||(T=ck(V,T,m).reduce(function(re,me){return re.indexOf(me)>=0?re:[].concat(Du(re),[me])},[]))}else if(y==="category")S?T=T.filter(function(re){return re!==""&&!gt(re)}):T=ck(V,T,m).reduce(function(re,me){return re.indexOf(me)>=0||me===""||gt(me)?re:[].concat(Du(re),[me])},[]);else if(y==="number"){var L=ube(O,i.filter(function(re){var me,z,ae=o in re.props?re.props[o]:(me=re.type.defaultProps)===null||me===void 0?void 0:me[o],de="hide"in re.props?re.props.hide:(z=re.type.defaultProps)===null||z===void 0?void 0:z.hide;return ae===A&&(_||!de)}),w,s,d);L&&(T=L)}p&&(y==="number"||N!=="auto")&&(R=bf(O,w,"category"))}else p?T=Zv(0,$):l&&l[A]&&l[A].hasStack&&y==="number"?T=h==="expand"?[0,1]:yB(l[A].stackGroups,c,u):T=fB(O,i.filter(function(re){var me=o in re.props?re.props[o]:re.type.defaultProps[o],z="hide"in re.props?re.props.hide:re.type.defaultProps.hide;return me===A&&(_||!z)}),y,d,!0);if(y==="number")T=eS(f,T,A,s,P),V&&(T=vj(V,T,j));else if(y==="category"&&V){var Z=V,ee=T.every(function(re){return Z.indexOf(re)>=0});ee&&(T=Z)}}return ge(ge({},g),{},ct({},A,ge(ge({},b),{},{axisType:s,domain:T,categoricalDomain:R,duplicateDomain:M,originalDomain:(x=b.domain)!==null&&x!==void 0?x:H,isCategorical:p,layout:d})))},{})},KAe=function(t,n){var r=n.graphicalItems,i=n.Axis,s=n.axisType,o=n.axisIdKey,l=n.stackGroups,c=n.dataStartIndex,u=n.dataEndIndex,d=t.layout,f=t.children,h=r0(t.data,{graphicalItems:r,dataStartIndex:c,dataEndIndex:u}),p=h.length,g=hB(d,s),m=-1;return r.reduce(function(x,b){var y=b.type.defaultProps!==void 0?ge(ge({},b.type.defaultProps),b.props):b.props,w=y[o],j=Uz("number");if(!x[w]){m++;var S;return g?S=Zv(0,p):l&&l[w]&&l[w].hasStack?(S=yB(l[w].stackGroups,c,u),S=eS(f,S,w,s)):(S=vj(j,fB(h,r.filter(function(N){var P,_,A=o in N.props?N.props[o]:(P=N.type.defaultProps)===null||P===void 0?void 0:P[o],O="hide"in N.props?N.props.hide:(_=N.type.defaultProps)===null||_===void 0?void 0:_.hide;return A===w&&!O}),"number",d),i.defaultProps.allowDataOverflow),S=eS(f,S,w,s)),ge(ge({},x),{},ct({},w,ge(ge({axisType:s},i.defaultProps),{},{hide:!0,orientation:ni(VAe,"".concat(s,".").concat(m%2),null),domain:S,originalDomain:j,isCategorical:g,layout:d})))}return x},{})},XAe=function(t,n){var r=n.axisType,i=r===void 0?"xAxis":r,s=n.AxisComp,o=n.graphicalItems,l=n.stackGroups,c=n.dataStartIndex,u=n.dataEndIndex,d=t.children,f="".concat(i,"Id"),h=Si(d,s),p={};return h&&h.length?p=qAe(t,{axes:h,graphicalItems:o,axisType:i,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u}):o&&o.length&&(p=KAe(t,{Axis:s,graphicalItems:o,axisType:i,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u})),p},YAe=function(t){var n=Wa(t),r=Qs(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:iP(r,function(i){return i.coordinate}),tooltipAxis:n,tooltipAxisBandSize:Dv(n,r)}},WT=function(t){var n=t.children,r=t.defaultShowTooltip,i=Kr(n,Cu),s=0,o=0;return t.data&&t.data.length!==0&&(o=t.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(s=i.props.startIndex),i.props.endIndex>=0&&(o=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:s,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!r}},ZAe=function(t){return!t||!t.length?!1:t.some(function(n){var r=ta(n&&n.type);return r&&r.indexOf("Bar")>=0})},HT=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},QAe=function(t,n){var r=t.props,i=t.graphicalItems,s=t.xAxisMap,o=s===void 0?{}:s,l=t.yAxisMap,c=l===void 0?{}:l,u=r.width,d=r.height,f=r.children,h=r.margin||{},p=Kr(f,Cu),g=Kr(f,na),m=Object.keys(c).reduce(function(S,N){var P=c[N],_=P.orientation;return!P.mirror&&!P.hide?ge(ge({},S),{},ct({},_,S[_]+P.width)):S},{left:h.left||0,right:h.right||0}),x=Object.keys(o).reduce(function(S,N){var P=o[N],_=P.orientation;return!P.mirror&&!P.hide?ge(ge({},S),{},ct({},_,ni(S,"".concat(_))+P.height)):S},{top:h.top||0,bottom:h.bottom||0}),b=ge(ge({},x),m),y=b.bottom;p&&(b.bottom+=p.props.height||Cu.defaultProps.height),g&&n&&(b=lbe(b,i,r,n));var w=u-b.left-b.right,j=d-b.top-b.bottom;return ge(ge({brushBottom:y},b),{},{width:Math.max(w,0),height:Math.max(j,0)})},JAe=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},i0=function(t){var n=t.chartName,r=t.GraphicalChild,i=t.defaultTooltipEventType,s=i===void 0?"axis":i,o=t.validateTooltipEventTypes,l=o===void 0?["axis"]:o,c=t.axisComponents,u=t.legendContent,d=t.formatAxisMap,f=t.defaultProps,h=function(x,b){var y=b.graphicalItems,w=b.stackGroups,j=b.offset,S=b.updateId,N=b.dataStartIndex,P=b.dataEndIndex,_=x.barSize,A=x.layout,O=x.barGap,$=x.barCategoryGap,T=x.maxBarSize,M=HT(A),R=M.numericAxisName,H=M.cateAxisName,F=ZAe(y),V=[];return y.forEach(function(I,L){var Z=r0(x.data,{graphicalItems:[I],dataStartIndex:N,dataEndIndex:P}),ee=I.type.defaultProps!==void 0?ge(ge({},I.type.defaultProps),I.props):I.props,re=ee.dataKey,me=ee.maxBarSize,z=ee["".concat(R,"Id")],ae=ee["".concat(H,"Id")],de={},fe=c.reduce(function(U,Q){var te=b["".concat(Q.axisType,"Map")],Y=ee["".concat(Q.axisType,"Id")];te&&te[Y]||Q.axisType==="zAxis"||Ll();var xe=te[Y];return ge(ge({},U),{},ct(ct({},Q.axisType,xe),"".concat(Q.axisType,"Ticks"),Qs(xe)))},de),Ne=fe[H],he=fe["".concat(H,"Ticks")],ue=w&&w[z]&&w[z].hasStack&&xbe(I,w[z].stackGroups),Ee=ta(I.type).indexOf("Bar")>=0,ie=Dv(Ne,he),Xe=[],K=F&&abe({barSize:_,stackGroups:w,totalSize:JAe(fe,H)});if(Ee){var ve,Se,$e=gt(me)?T:me,E=(ve=(Se=Dv(Ne,he,!0))!==null&&Se!==void 0?Se:$e)!==null&&ve!==void 0?ve:0;Xe=obe({barGap:O,barCategoryGap:$,bandSize:E!==ie?E:ie,sizeList:K[ae],maxBarSize:$e}),E!==ie&&(Xe=Xe.map(function(U){return ge(ge({},U),{},{position:ge(ge({},U.position),{},{offset:U.position.offset-E/2})})}))}var D=I&&I.type&&I.type.getComposedData;D&&V.push({props:ge(ge({},D(ge(ge({},fe),{},{displayedData:Z,props:x,dataKey:re,item:I,bandSize:ie,barPosition:Xe,offset:j,stackedData:ue,layout:A,dataStartIndex:N,dataEndIndex:P}))),{},ct(ct(ct({key:I.key||"item-".concat(L)},R,fe[R]),H,fe[H]),"animationId",S)),childIndex:oae(I,x.children),item:I})}),V},p=function(x,b){var y=x.props,w=x.dataStartIndex,j=x.dataEndIndex,S=x.updateId;if(!nO({props:y}))return null;var N=y.children,P=y.layout,_=y.stackOffset,A=y.data,O=y.reverseStackOrder,$=HT(P),T=$.numericAxisName,M=$.cateAxisName,R=Si(N,r),H=vbe(A,R,"".concat(T,"Id"),"".concat(M,"Id"),_,O),F=c.reduce(function(ee,re){var me="".concat(re.axisType,"Map");return ge(ge({},ee),{},ct({},me,XAe(y,ge(ge({},re),{},{graphicalItems:R,stackGroups:re.axisType===T&&H,dataStartIndex:w,dataEndIndex:j}))))},{}),V=QAe(ge(ge({},F),{},{props:y,graphicalItems:R}),b==null?void 0:b.legendBBox);Object.keys(F).forEach(function(ee){F[ee]=d(y,F[ee],V,ee.replace("Map",""),n)});var I=F["".concat(M,"Map")],L=YAe(I),Z=h(y,ge(ge({},F),{},{dataStartIndex:w,dataEndIndex:j,updateId:S,graphicalItems:R,stackGroups:H,offset:V}));return ge(ge({formattedGraphicalItems:Z,graphicalItems:R,offset:V,stackGroups:H},L),F)},g=function(m){function x(b){var y,w,j;return TAe(this,x),j=MAe(this,x,[b]),ct(j,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),ct(j,"accessibilityManager",new yAe),ct(j,"handleLegendBBoxUpdate",function(S){if(S){var N=j.state,P=N.dataStartIndex,_=N.dataEndIndex,A=N.updateId;j.setState(ge({legendBBox:S},p({props:j.props,dataStartIndex:P,dataEndIndex:_,updateId:A},ge(ge({},j.state),{},{legendBBox:S}))))}}),ct(j,"handleReceiveSyncEvent",function(S,N,P){if(j.props.syncId===S){if(P===j.eventEmitterSymbol&&typeof j.props.syncMethod!="function")return;j.applySyncEvent(N)}}),ct(j,"handleBrushChange",function(S){var N=S.startIndex,P=S.endIndex;if(N!==j.state.dataStartIndex||P!==j.state.dataEndIndex){var _=j.state.updateId;j.setState(function(){return ge({dataStartIndex:N,dataEndIndex:P},p({props:j.props,dataStartIndex:N,dataEndIndex:P,updateId:_},j.state))}),j.triggerSyncEvent({dataStartIndex:N,dataEndIndex:P})}}),ct(j,"handleMouseEnter",function(S){var N=j.getMouseInfo(S);if(N){var P=ge(ge({},N),{},{isTooltipActive:!0});j.setState(P),j.triggerSyncEvent(P);var _=j.props.onMouseEnter;ot(_)&&_(P,S)}}),ct(j,"triggeredAfterMouseMove",function(S){var N=j.getMouseInfo(S),P=N?ge(ge({},N),{},{isTooltipActive:!0}):{isTooltipActive:!1};j.setState(P),j.triggerSyncEvent(P);var _=j.props.onMouseMove;ot(_)&&_(P,S)}),ct(j,"handleItemMouseEnter",function(S){j.setState(function(){return{isTooltipActive:!0,activeItem:S,activePayload:S.tooltipPayload,activeCoordinate:S.tooltipPosition||{x:S.cx,y:S.cy}}})}),ct(j,"handleItemMouseLeave",function(){j.setState(function(){return{isTooltipActive:!1}})}),ct(j,"handleMouseMove",function(S){S.persist(),j.throttleTriggeredAfterMouseMove(S)}),ct(j,"handleMouseLeave",function(S){j.throttleTriggeredAfterMouseMove.cancel();var N={isTooltipActive:!1};j.setState(N),j.triggerSyncEvent(N);var P=j.props.onMouseLeave;ot(P)&&P(N,S)}),ct(j,"handleOuterEvent",function(S){var N=aae(S),P=ni(j.props,"".concat(N));if(N&&ot(P)){var _,A;/.*touch.*/i.test(N)?A=j.getMouseInfo(S.changedTouches[0]):A=j.getMouseInfo(S),P((_=A)!==null&&_!==void 0?_:{},S)}}),ct(j,"handleClick",function(S){var N=j.getMouseInfo(S);if(N){var P=ge(ge({},N),{},{isTooltipActive:!0});j.setState(P),j.triggerSyncEvent(P);var _=j.props.onClick;ot(_)&&_(P,S)}}),ct(j,"handleMouseDown",function(S){var N=j.props.onMouseDown;if(ot(N)){var P=j.getMouseInfo(S);N(P,S)}}),ct(j,"handleMouseUp",function(S){var N=j.props.onMouseUp;if(ot(N)){var P=j.getMouseInfo(S);N(P,S)}}),ct(j,"handleTouchMove",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&j.throttleTriggeredAfterMouseMove(S.changedTouches[0])}),ct(j,"handleTouchStart",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&j.handleMouseDown(S.changedTouches[0])}),ct(j,"handleTouchEnd",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&j.handleMouseUp(S.changedTouches[0])}),ct(j,"triggerSyncEvent",function(S){j.props.syncId!==void 0&&Tb.emit($b,j.props.syncId,S,j.eventEmitterSymbol)}),ct(j,"applySyncEvent",function(S){var N=j.props,P=N.layout,_=N.syncMethod,A=j.state.updateId,O=S.dataStartIndex,$=S.dataEndIndex;if(S.dataStartIndex!==void 0||S.dataEndIndex!==void 0)j.setState(ge({dataStartIndex:O,dataEndIndex:$},p({props:j.props,dataStartIndex:O,dataEndIndex:$,updateId:A},j.state)));else if(S.activeTooltipIndex!==void 0){var T=S.chartX,M=S.chartY,R=S.activeTooltipIndex,H=j.state,F=H.offset,V=H.tooltipTicks;if(!F)return;if(typeof _=="function")R=_(V,S);else if(_==="value"){R=-1;for(var I=0;I=0){var ue,Ee;if(T.dataKey&&!T.allowDuplicatedCategory){var ie=typeof T.dataKey=="function"?he:"payload.".concat(T.dataKey.toString());ue=cv(I,ie,R),Ee=L&&Z&&cv(Z,ie,R)}else ue=I==null?void 0:I[M],Ee=L&&Z&&Z[M];if(ae||z){var Xe=S.props.activeIndex!==void 0?S.props.activeIndex:M;return[v.cloneElement(S,ge(ge(ge({},_.props),fe),{},{activeIndex:Xe})),null,null]}if(!gt(ue))return[Ne].concat(Du(j.renderActivePoints({item:_,activePoint:ue,basePoint:Ee,childIndex:M,isRange:L})))}else{var K,ve=(K=j.getItemByXY(j.state.activeCoordinate))!==null&&K!==void 0?K:{graphicalItem:Ne},Se=ve.graphicalItem,$e=Se.item,E=$e===void 0?S:$e,D=Se.childIndex,U=ge(ge(ge({},_.props),fe),{},{activeIndex:D});return[v.cloneElement(E,U),null,null]}return L?[Ne,null,null]:[Ne,null]}),ct(j,"renderCustomized",function(S,N,P){return v.cloneElement(S,ge(ge({key:"recharts-customized-".concat(P)},j.props),j.state))}),ct(j,"renderMap",{CartesianGrid:{handler:Am,once:!0},ReferenceArea:{handler:j.renderReferenceElement},ReferenceLine:{handler:Am},ReferenceDot:{handler:j.renderReferenceElement},XAxis:{handler:Am},YAxis:{handler:Am},Brush:{handler:j.renderBrush,once:!0},Bar:{handler:j.renderGraphicChild},Line:{handler:j.renderGraphicChild},Area:{handler:j.renderGraphicChild},Radar:{handler:j.renderGraphicChild},RadialBar:{handler:j.renderGraphicChild},Scatter:{handler:j.renderGraphicChild},Pie:{handler:j.renderGraphicChild},Funnel:{handler:j.renderGraphicChild},Tooltip:{handler:j.renderCursor,once:!0},PolarGrid:{handler:j.renderPolarGrid,once:!0},PolarAngleAxis:{handler:j.renderPolarAxis},PolarRadiusAxis:{handler:j.renderPolarAxis},Customized:{handler:j.renderCustomized}}),j.clipPathId="".concat((y=b.id)!==null&&y!==void 0?y:ud("recharts"),"-clip"),j.throttleTriggeredAfterMouseMove=c6(j.triggeredAfterMouseMove,(w=b.throttleDelay)!==null&&w!==void 0?w:1e3/60),j.state={},j}return LAe(x,m),IAe(x,[{key:"componentDidMount",value:function(){var y,w;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(y=this.props.margin.left)!==null&&y!==void 0?y:0,top:(w=this.props.margin.top)!==null&&w!==void 0?w:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var y=this.props,w=y.children,j=y.data,S=y.height,N=y.layout,P=Kr(w,cr);if(P){var _=P.props.defaultIndex;if(!(typeof _!="number"||_<0||_>this.state.tooltipTicks.length-1)){var A=this.state.tooltipTicks[_]&&this.state.tooltipTicks[_].value,O=rS(this.state,j,_,A),$=this.state.tooltipTicks[_].coordinate,T=(this.state.offset.top+S)/2,M=N==="horizontal",R=M?{x:$,y:T}:{y:$,x:T},H=this.state.formattedGraphicalItems.find(function(V){var I=V.item;return I.type.name==="Scatter"});H&&(R=ge(ge({},R),H.props.points[_].tooltipPosition),O=H.props.points[_].tooltipPayload);var F={activeTooltipIndex:_,isTooltipActive:!0,activeLabel:A,activePayload:O,activeCoordinate:R};this.setState(F),this.renderCursor(P),this.accessibilityManager.setIndex(_)}}}},{key:"getSnapshotBeforeUpdate",value:function(y,w){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==w.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==y.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==y.margin){var j,S;this.accessibilityManager.setDetails({offset:{left:(j=this.props.margin.left)!==null&&j!==void 0?j:0,top:(S=this.props.margin.top)!==null&&S!==void 0?S:0}})}return null}},{key:"componentDidUpdate",value:function(y){T1([Kr(y.children,cr)],[Kr(this.props.children,cr)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var y=Kr(this.props.children,cr);if(y&&typeof y.props.shared=="boolean"){var w=y.props.shared?"axis":"item";return l.indexOf(w)>=0?w:s}return s}},{key:"getMouseInfo",value:function(y){if(!this.container)return null;var w=this.container,j=w.getBoundingClientRect(),S=$ge(j),N={chartX:Math.round(y.pageX-S.left),chartY:Math.round(y.pageY-S.top)},P=j.width/w.offsetWidth||1,_=this.inRange(N.chartX,N.chartY,P);if(!_)return null;var A=this.state,O=A.xAxisMap,$=A.yAxisMap,T=this.getTooltipEventType();if(T!=="axis"&&O&&$){var M=Wa(O).scale,R=Wa($).scale,H=M&&M.invert?M.invert(N.chartX):null,F=R&&R.invert?R.invert(N.chartY):null;return ge(ge({},N),{},{xValue:H,yValue:F})}var V=VT(this.state,this.props.data,this.props.layout,_);return V?ge(ge({},N),V):null}},{key:"inRange",value:function(y,w){var j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,S=this.props.layout,N=y/j,P=w/j;if(S==="horizontal"||S==="vertical"){var _=this.state.offset,A=N>=_.left&&N<=_.left+_.width&&P>=_.top&&P<=_.top+_.height;return A?{x:N,y:P}:null}var O=this.state,$=O.angleAxisMap,T=O.radiusAxisMap;if($&&T){var M=Wa($);return fk({x:N,y:P},M)}return null}},{key:"parseEventsOfWrapper",value:function(){var y=this.props.children,w=this.getTooltipEventType(),j=Kr(y,cr),S={};j&&w==="axis"&&(j.props.trigger==="click"?S={onClick:this.handleClick}:S={onMouseEnter:this.handleMouseEnter,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd});var N=uv(this.props,this.handleOuterEvent);return ge(ge({},N),S)}},{key:"addListener",value:function(){Tb.on($b,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){Tb.removeListener($b,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(y,w,j){for(var S=this.state.formattedGraphicalItems,N=0,P=S.length;Ns<30?"Low":s<70?"Medium":"High";return a.jsx(cu,{open:t,onOpenChange:n,children:a.jsxs(kl,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[a.jsx(Tl,{children:a.jsxs($l,{className:"flex items-center gap-3",children:[a.jsx("img",{src:Zu(e),alt:`${e.name} avatar`,className:"h-10 w-10 rounded-full object-cover"}),e.name]})}),a.jsxs("div",{className:"space-y-6",children:[a.jsx(Ge,{children:a.jsxs(tt,{className:"p-4",children:[a.jsxs("h3",{className:"font-medium mb-3 flex items-center gap-2",children:[a.jsx(Hn,{className:"h-4 w-4"}),"Demographics"]}),a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Age:"}),a.jsx("p",{className:"font-medium",children:e.age})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Gender:"}),a.jsx("p",{className:"font-medium",children:e.gender})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Occupation:"}),a.jsx("p",{className:"font-medium",children:e.occupation})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Location:"}),a.jsxs("p",{className:"font-medium flex items-center gap-1",children:[a.jsx(jR,{className:"h-3 w-3"}),e.location]})]})]})]})}),e.aiSynthesizedBio&&a.jsx(Ge,{children:a.jsxs(tt,{className:"p-4",children:[a.jsxs("h3",{className:"font-medium mb-3 flex items-center gap-2",children:[a.jsx(fa,{className:"h-4 w-4"}),"AI-Synthesized Bio"]}),a.jsx("p",{className:"text-sm leading-relaxed",children:e.aiSynthesizedBio})]})}),e.personality&&a.jsx(Ge,{children:a.jsxs(tt,{className:"p-4",children:[a.jsxs("h3",{className:"font-medium mb-3 flex items-center gap-2",children:[a.jsx(Ag,{className:"h-4 w-4"}),"Personality Overview"]}),a.jsxs("p",{className:"text-sm leading-relaxed italic",children:['"',e.personality,'"']})]})}),e.techSavviness!==void 0&&a.jsx(Ge,{children:a.jsxs(tt,{className:"p-4",children:[a.jsxs("h3",{className:"font-medium mb-3 flex items-center gap-2",children:[a.jsx(NN,{className:"h-4 w-4"}),"Tech Savviness"]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"flex-1 bg-slate-200 rounded-full h-2",children:a.jsx("div",{className:"bg-primary h-2 rounded-full transition-all duration-300",style:{width:`${e.techSavviness}%`}})}),a.jsxs("span",{className:"text-sm font-medium min-w-0",children:[i(e.techSavviness)," (",e.techSavviness,"/100)"]})]})]})}),e.qualitativeAttributes&&e.qualitativeAttributes.length>0&&a.jsx(Ge,{children:a.jsxs(tt,{className:"p-4",children:[a.jsxs("h3",{className:"font-medium mb-3 flex items-center gap-2",children:[a.jsx(SN,{className:"h-4 w-4"}),"Key Attributes"]}),a.jsx("div",{className:"flex flex-wrap gap-2",children:e.qualitativeAttributes.map((s,o)=>a.jsxs("span",{className:"inline-flex items-center gap-1 px-3 py-1 bg-blue-50 text-blue-700 text-sm rounded-full",children:["๐Ÿท๏ธ ",s]},o))})]})}),e.topPersonalityTraits&&e.topPersonalityTraits.length>0&&a.jsx(Ge,{children:a.jsxs(tt,{className:"p-4",children:[a.jsxs("h3",{className:"font-medium mb-3 flex items-center gap-2",children:[a.jsx(fa,{className:"h-4 w-4"}),"Top Personality Traits"]}),a.jsx("div",{className:"flex flex-wrap gap-2",children:e.topPersonalityTraits.map((s,o)=>a.jsxs("span",{className:"inline-flex items-center gap-1 px-3 py-1 bg-purple-50 text-purple-700 text-sm rounded-full",children:["๐Ÿง  ",s]},o))})]})}),r.length>0&&a.jsx(Ge,{children:a.jsxs(tt,{className:"p-4",children:[a.jsxs("h3",{className:"font-medium mb-3 flex items-center gap-2",children:[a.jsx(Hs,{className:"h-4 w-4"}),"OCEAN Personality Traits"]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsx("div",{className:"h-64",children:a.jsx(ra,{width:"100%",height:"100%",children:a.jsxs(Wz,{data:r,children:[a.jsx(TP,{stroke:"#e2e8f0"}),a.jsx(Xl,{dataKey:"trait",tick:{fill:"#64748b",fontSize:12}}),a.jsx(Kl,{angle:90,domain:[0,100],tick:{fill:"#64748b",fontSize:10}}),a.jsx(yd,{name:"OCEAN Traits",dataKey:"value",stroke:"#3b82f6",fill:"#3b82f6",fillOpacity:.1,strokeWidth:2})]})})}),a.jsx("div",{className:"space-y-4",children:r.map(s=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between items-center mb-1",children:[a.jsx("span",{className:"text-sm font-medium",children:s.trait}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[s.value,"/100"]})]}),a.jsx("div",{className:"w-full bg-slate-200 rounded-full h-2",children:a.jsx("div",{className:"bg-primary h-2 rounded-full transition-all duration-300",style:{width:`${s.value}%`}})})]},s.trait))})]})]})}),(e.ethnicity||e.additionalNotes)&&a.jsxs(gne,{type:"single",collapsible:!0,className:"w-full",children:[e.ethnicity&&a.jsxs(C1,{value:"demographics",children:[a.jsx(A1,{children:"Additional Demographics"}),a.jsx(E1,{children:a.jsx("div",{className:"space-y-2",children:a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Ethnicity:"}),a.jsx("p",{className:"font-medium",children:e.ethnicity})]})})})]}),e.additionalNotes&&a.jsxs(C1,{value:"notes",children:[a.jsx(A1,{children:"Additional Notes"}),a.jsx(E1,{children:a.jsx("p",{className:"text-sm leading-relaxed",children:e.additionalNotes})})]})]})]})]})})}const Vo="all",tEe=Le.object({researchBrief:Le.string().min(10,{message:"Research brief must be at least 10 characters."}),focusGroupName:Le.string().min(3,{message:"Focus group name must be at least 3 characters."}),discussionTopics:Le.string().min(10,{message:"Discussion topics are required."}),creativeAssets:Le.instanceof(FileList).optional(),duration:Le.string().min(1,{message:"Duration is required."})}),Hd={introduction:"Welcome to our focus group discussion. Today we'll be exploring your experiences and opinions on [product/service]. There are no right or wrong answers, we're just interested in your honest thoughts.",warmup:"Let's start by introducing ourselves and sharing a bit about your background and daily routines relevant to this topic.",exploration:"Now, let's dive deeper into your experiences with similar products. What features do you find most valuable? What frustrations have you encountered?",creative:"We'll now show you some concepts and get your feedback. Please be honest and specific in your reactions.",conclusion:"To wrap up, I'd like to hear your final thoughts on what we've discussed today and any additional insights you'd like to share."};function nEe({draftToEdit:e,onDraftSaved:t}={}){console.log("FocusGroupModerator component rendering, draftToEdit:",e);const n=Cn(),[r,i]=v.useState("setup"),[s,o]=v.useState(!1),[l,c]=v.useState(!1),[u,d]=v.useState(!1),[f,h]=v.useState(null),[p,g]=v.useState(null),m=v.useRef(f);m.current=f;const x=v.useRef(!1),b=k=>k&&typeof k=="object"&&k.title&&k.sections,[y,w]=v.useState([]),[j,S]=v.useState([]),[N,P]=v.useState([]),[_,A]=v.useState(!1),[O,$]=v.useState(!1),[T,M]=v.useState([]),[R,H]=v.useState(Vo),[F,V]=v.useState(!1),[I,L]=v.useState(""),[Z,ee]=v.useState(null),[re,me]=v.useState(""),[z,ae]=v.useState(""),[de,fe]=v.useState(!1),[Ne,he]=v.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]}),[ue,Ee]=v.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]}),[ie,Xe]=v.useState(!1),[K,ve]=v.useState(null),Se=k=>{ve(k),Xe(!0)},$e=()=>{Xe(!1),ve(null)},E=k=>{const B={age:new Set,gender:new Set,occupation:new Set,location:new Set,techSavviness:new Set,ethnicity:new Set};return k.forEach(W=>{if(W.age&&B.age.add(W.age),W.gender&&B.gender.add(W.gender),W.occupation&&B.occupation.add(W.occupation),W.location&&B.location.add(W.location),W.techSavviness!==void 0){const ne=W.techSavviness<30?"Low (0-30)":W.techSavviness<70?"Medium (31-70)":"High (71-100)";B.techSavviness.add(ne)}W.ethnicity&&B.ethnicity.add(W.ethnicity)}),{age:Array.from(B.age).sort(),gender:Array.from(B.gender).sort(),occupation:Array.from(B.occupation).sort(),location:Array.from(B.location).sort(),techSavviness:Array.from(B.techSavviness).sort((W,ne)=>{const J=["Low (0-30)","Medium (31-70)","High (71-100)"];return J.indexOf(W)-J.indexOf(ne)}),ethnicity:Array.from(B.ethnicity).sort()}},D=k=>{const B={...ue};B[k]=[];const W=N.filter(ne=>{let J=!0;if(R!==Vo)if(J=!1,ne.folderId===R)J=!0;else{const ye=T.find(se=>se.id===R);ye&&ye.personaIds.includes(ne.id)&&(J=!0)}return J?Object.entries(B).every(([ye,se])=>{if(se.length===0)return!0;const Pe=ye;if(Pe==="techSavviness"&&ne.techSavviness!==void 0){const _e=ne.techSavviness<30?"Low (0-30)":ne.techSavviness<70?"Medium (31-70)":"High (71-100)";return se.includes(_e)}else{if(Pe==="age"&&ne.age)return se.includes(ne.age);if(Pe==="gender"&&ne.gender)return se.includes(ne.gender);if(Pe==="occupation"&&ne.occupation)return se.includes(ne.occupation);if(Pe==="location"&&ne.location)return se.includes(ne.location);if(Pe==="ethnicity"&&ne.ethnicity)return se.includes(ne.ethnicity)}return!0}):!1});return E(W)},U=()=>{fe(!1),setTimeout(()=>{he({...ue})},0)},Q=()=>{Ee({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]})},te=(k,B)=>{Ee(W=>{const ne={...W};return ne[k].includes(B)?ne[k]=ne[k].filter(J=>J!==B):ne[k]=[...ne[k],B],ne})},Y=()=>{if(!I.trim()){pe.error("Please enter a folder name");return}const k={id:`folder-${Date.now()}`,name:I.trim(),personaIds:[]};M([...T,k]),L(""),V(!1),pe.success(`Folder "${I}" created`)},xe=()=>{L(""),V(!1)},je=k=>{ee(k),me(k.name)},Fe=()=>{if(!Z||!re.trim()){ee(null);return}const k=T.map(B=>B.id===Z.id?{...B,name:re.trim()}:B);M(k),ee(null),pe.success(`Folder renamed to "${re}"`)},ce=()=>{ee(null),me("")},ke=(k,B)=>(k.forEach(W=>{if(W.folderId){const ne=B.find(J=>J.id===W.folderId);ne&&!ne.personaIds.includes(W.id)&&ne.personaIds.push(W.id)}}),B.forEach(W=>{W.personaIds=W.personaIds.filter(ne=>{if(!ne)return console.log(`Removing invalid personaId (${ne}) from folder ${W.name}`),!1;const J=k.find(ye=>ye.id===ne||ye._id===ne);return J||console.log(`Removing non-existent personaId ${ne} from folder ${W.name}`),!!J})}),B);v.useEffect(()=>{const k=async()=>{A(!0);try{const ne=await Nn.getAll();console.log("Fetched personas for FocusGroupModerator:",ne.data),Array.isArray(ne.data)&&ne.data.length>0?P(ne.data):(console.warn("No personas returned from API or invalid format",ne.data),pe.warning("No participants available"))}catch(ne){console.error("Error fetching personas:",ne),pe.error("Failed to load participants")}finally{A(!1)}},B=localStorage.getItem("persona-folders");let W=[];if(B)try{W=JSON.parse(B),M(W)}catch(ne){console.error("Failed to parse stored folders:",ne)}k()},[]),v.useEffect(()=>{T.length>0&&(console.log("Saving folders to localStorage:",T),localStorage.setItem("persona-folders",JSON.stringify(T)))},[T]),v.useEffect(()=>{if(N.length>0&&T.length>0){console.log("Running folder sync with personas:",N.length,"and folders:",T.length);const k=ke(N,[...T]);JSON.stringify(k)!==JSON.stringify(T)?(console.log("Updating folders after sync"),M(k)):console.log("No folder changes after sync")}},[N,T.length]),console.log("About to initialize form with useForm hook");const Be=Ky({resolver:Xy(tEe),defaultValues:{researchBrief:"",focusGroupName:"",discussionTopics:"",duration:"60"}});console.log("Form initialized successfully"),v.useEffect(()=>{e&&!x.current&&(console.log("Loading draft focus group:",e),x.current=!0,g(e.id||e._id),e.name&&Be.setValue("focusGroupName",e.name),(e.description||e.objective)&&Be.setValue("researchBrief",e.description||e.objective||""),e.topic&&Be.setValue("discussionTopics",e.topic),e.duration&&Be.setValue("duration",e.duration.toString()),e.discussionGuide&&(h(e.discussionGuide),i("review")),e.participants&&Array.isArray(e.participants)&&w(e.participants),pe.success("Draft focus group loaded",{description:"Continue editing your focus group setup"}))},[e,Be]);const mt=async(k,B)=>{var W,ne;o(!0),c(!1),d(!1);try{const J={name:k.focusGroupName,description:k.researchBrief,objective:k.researchBrief,topic:k.discussionTopics,duration:parseInt(k.duration)},ye=B?await At.generateDiscussionGuideForGroup(B,J):await At.generateDiscussionGuide(J);if(ye.data&&ye.data.discussionGuide)return c(!0),ye.data.discussionGuide;throw new Error("Failed to generate discussion guide")}catch(J){console.error("Error generating discussion guide:",J),d(!0);let ye="Unknown error occurred";return(ne=(W=J==null?void 0:J.response)==null?void 0:W.data)!=null&&ne.error?ye=J.response.data.error:J!=null&&J.message&&(ye=J.message),ye.includes("500")||ye.includes("internal error")||ye.includes("Internal Server Error")?pe.error("AI service temporarily unavailable",{description:"The discussion guide generator is experiencing issues. Please try again in a few minutes.",action:{label:"Retry",onClick:()=>mt(k)}}):pe.error("Failed to generate discussion guide",{description:ye,action:{label:"Retry",onClick:()=>mt(k)}}),` -# Discussion Guide: ${k.focusGroupName} - -## Introduction (5 minutes) -${Hd.introduction} - -## Warm-up Questions (10 minutes) -${Hd.warmup} - -## ${k.discussionTopics.split(",")[0]} Exploration (15 minutes) -${Hd.exploration} - -## Creative Testing (20 minutes) -${Hd.creative} -${k.creativeAssets&&k.creativeAssets.length>0?`We'll be reviewing ${k.creativeAssets.length} creative assets.`:""} - -## Conclusion (10 minutes) -${Hd.conclusion} - -## Research Brief Context -${k.researchBrief} - `}},_t=()=>{o(!1),c(!1),d(!1)};async function Pt(k){var B;try{let W=p;if(!W){const J={name:k.focusGroupName,status:"draft",participants:y,participants_count:y.length,date:new Date().toISOString(),duration:parseInt(k.duration),topic:k.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:k.researchBrief,objective:k.researchBrief},ye=await At.create(J);W=ye.data.focus_group_id||ye.data.id||ye.data._id,g(W),console.log("Draft focus group created for asset upload:",ye,"with ID:",W)}if(k.creativeAssets&&k.creativeAssets.length>0&&W)try{const J=new FormData;Array.from(k.creativeAssets).forEach(_e=>{J.append("assets",_e)});const se=(await At.uploadAssets(W,J)).data;console.log("Assets uploaded successfully:",se),pe.success(`${se.uploaded_assets} asset(s) uploaded successfully`,{description:"Assets will be included in the discussion guide"});const Pe=Array.from(k.creativeAssets);S(Pe)}catch(J){console.error("Asset upload failed:",J);const ye=(B=J.response)==null?void 0:B.data;let se="Asset upload failed",Pe="Some assets could not be uploaded";(ye==null?void 0:ye.code)==="TEMP_DIR_ERROR"?(se="Upload temporarily unavailable",Pe="Server storage issue. Please try again in a moment."):(ye==null?void 0:ye.code)==="UPLOAD_SYSTEM_FAILURE"?(se="Upload system unavailable",Pe="Critical server issue. Please contact support."):ye!=null&&ye.can_retry&&(se="Upload failed - can retry",Pe=(ye==null?void 0:ye.details)||"Please try uploading again."),pe.error(se,{description:Pe}),console.log("Continuing without assets due to upload failure")}const ne=await mt(k,W);h(ne);try{const J={name:k.focusGroupName,status:"draft",participants:y,participants_count:y.length,date:new Date().toISOString(),duration:parseInt(k.duration),topic:k.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:k.researchBrief,objective:k.researchBrief,discussionGuide:ne};await At.update(W,J),console.log("Focus group updated with discussion guide"),pe.success("Progress saved as draft",{description:"Your focus group setup has been automatically saved"})}catch(J){console.error("Failed to update focus group with discussion guide:",J),pe.error("Failed to save draft",{description:"Discussion guide generated, but draft save failed"})}i("review"),pe.success("Discussion guide generated",{description:"Review and edit before proceeding"})}catch(W){console.error("Error in focus group creation flow:",W),pe.error("Focus group creation failed",{description:W.message||"An unexpected error occurred"})}}const qt=(()=>{var B;const k=N.filter(W=>{const ne=W.name.toLowerCase().includes(z.toLowerCase())||W.occupation&&W.occupation.toLowerCase().includes(z.toLowerCase())||W.location&&W.location.toLowerCase().includes(z.toLowerCase()),J=(Ne.age.length===0||Ne.age.includes(W.age))&&(Ne.gender.length===0||Ne.gender.includes(W.gender))&&(Ne.occupation.length===0||Ne.occupation.includes(W.occupation))&&(Ne.location.length===0||Ne.location.includes(W.location))&&(Ne.ethnicity.length===0||W.ethnicity&&Ne.ethnicity.includes(W.ethnicity))&&(Ne.techSavviness.length===0||W.techSavviness!==void 0&&Ne.techSavviness.includes(W.techSavviness<30?"Low (0-30)":W.techSavviness<70?"Medium (31-70)":"High (71-100)"))&&!0;let ye=!0;if(R!==Vo)if(ye=!1,W.folderId===R)ye=!0;else{const se=T.find(Pe=>Pe.id===R);if(se){const Pe=se.personaIds.filter(et=>!!et),_e=W.id||W._id;Pe.includes(_e)&&(ye=!0)}}return ne&&J&&ye});if(console.log(`Filtered personas: ${k.length}/${N.length}`),console.log(`Selected folder: ${R===Vo?"All Personas":((B=T.find(W=>W.id===R))==null?void 0:B.name)||R}`),R!==Vo){const W=T.find(ne=>ne.id===R);if(W){const ne=W.personaIds.filter(se=>!!se);console.log(`Folder details: ${W.name}, ID: ${W.id}, Contains: ${ne.length} valid personas`),console.log("Folder personaIds (valid only):",ne);const J=N.filter(se=>se.folderId===R);console.log(`Personas with folderId matching this folder: ${J.length}`);const ye=N.filter(se=>{const Pe=se.id||se._id;return W.personaIds.includes(Pe)});console.log(`Personas in folder's personaIds array: ${ye.length}`)}}return k})(),mn=k=>{console.log("Toggling selection for participant ID:",k),w(B=>{const W=B.includes(k);console.log("Current selection:",{id:k,isCurrentlySelected:W,currentSelections:[...B]});const ne=W?B.filter(J=>J!==k):[...B,k];return console.log("New selection:",ne),p&&f&&Wt(ne),ne})},Wt=async k=>{if(p)try{const B=Be.getValues(),W={name:B.focusGroupName,status:"draft",participants:k,participants_count:k.length,date:new Date().toISOString(),duration:parseInt(B.duration),topic:B.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:B.researchBrief,objective:B.researchBrief,discussionGuide:f};await At.update(p,W),console.log("Participant selection auto-saved to draft")}catch(B){console.error("Failed to auto-save participant selection:",B)}},zt=async()=>{try{const k=Be.getValues(),B={name:k.focusGroupName,status:"in-progress",participants:y,participants_count:y.length,date:new Date().toISOString(),duration:parseInt(k.duration),topic:k.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),discussionGuide:f},ne=(await At.create(B)).data;return console.log("Focus group created successfully:",ne),ne.focus_group_id}catch(k){throw console.error("Error saving focus group:",k),k}},mr=v.useCallback(async()=>{if(!m.current){pe.error("No discussion guide available",{description:"Please generate a discussion guide first"});return}$(!0);try{const{downloadDiscussionGuideAsMarkdown:k}=await yee(async()=>{const{downloadDiscussionGuideAsMarkdown:W}=await import("./discussionGuideMarkdown-eMXneipz.js");return{downloadDiscussionGuideAsMarkdown:W}},[]),B=Be.getValues();k(m.current,B.focusGroupName),pe.success("Discussion guide downloaded",{description:"The guide has been saved to your downloads folder"})}catch(k){console.error("Error downloading discussion guide:",k),pe.error("Download failed",{description:"Unable to download the discussion guide. Please try again."})}finally{$(!1)}},[Be]),Je=v.useCallback(async k=>{console.log("๐Ÿ“ handleSaveDiscussionGuide called with:",k),h(k),pe.success("Discussion guide updated",{description:"Your changes have been saved."})},[]),X=v.useCallback(()=>{},[]),G=v.useCallback(()=>{},[]),q=async()=>{if(!Be.getValues().focusGroupName){pe.error("Missing focus group name",{description:"Please provide a name for the focus group"});return}if(!f){pe.error("Missing discussion guide",{description:"Please generate a discussion guide first"});return}if(y.length<1){pe.error("Not enough participants",{description:"Please select at least one participant for the focus group"});return}console.log("Starting focus group with participants:",y);try{pe.loading("Creating focus group...");let k;if(p){const B=Be.getValues(),W={name:B.focusGroupName,status:"in-progress",participants:y,participants_count:y.length,date:new Date().toISOString(),duration:parseInt(B.duration),topic:B.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:B.researchBrief,objective:B.researchBrief,discussionGuide:f},ne=await At.update(p,W);k=p,console.log("Draft focus group updated to in-progress:",ne),t&&t()}else k=await zt();pe.dismiss(),pe.success("Focus group created successfully",{description:"The AI moderator is now running the session"}),n(`/focus-groups/${k}`)}catch(k){pe.dismiss(),k!=null&&k.message,console.error("Failed to start focus group:",k),pe.error("Failed to create focus group",{description:"Please try again or check your connection"})}};return a.jsxs("div",{className:"glass-panel rounded-xl p-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[a.jsx(pa,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"AI Focus Group Moderator"})]}),s&&a.jsx("div",{className:"mb-6",children:a.jsx(S_,{isActive:s,isComplete:l,hasError:u,label:"Generating discussion guide",onComplete:_t})}),a.jsxs(Io,{value:r,onValueChange:i,children:[a.jsxs(Sa,{className:"grid w-full grid-cols-3 mb-6",children:[a.jsx(Ft,{value:"setup",children:"Setup"}),a.jsx(Ft,{value:"review",children:"Review & Edit"}),a.jsx(Ft,{value:"participants",children:"Participants"})]}),a.jsx(Bt,{value:"setup",children:a.jsx(Zy,{...Be,children:a.jsxs("form",{onSubmit:Be.handleSubmit(Pt),className:"space-y-6",children:[a.jsx(at,{control:Be.control,name:"focusGroupName",render:({field:k})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Focus Group Name"}),a.jsx(it,{children:a.jsx(St,{placeholder:"e.g., Mobile App UX Evaluation",...k})}),a.jsx(un,{children:"Give your focus group a descriptive name"}),a.jsx(st,{})]})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx(at,{control:Be.control,name:"researchBrief",render:({field:k})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Research Brief"}),a.jsx(it,{children:a.jsx(Qe,{placeholder:"Describe your research objectives...",className:"h-36",...k})}),a.jsx(un,{children:"Provide context about what you want to learn"}),a.jsx(st,{})]})}),a.jsxs("div",{className:"space-y-6",children:[a.jsx(at,{control:Be.control,name:"discussionTopics",render:({field:k})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Discussion Topics"}),a.jsx(it,{children:a.jsx(Qe,{placeholder:"List main topics to cover, separated by commas",className:"h-24",...k})}),a.jsx(un,{children:"E.g., User experience, feature preferences, pain points"}),a.jsx(st,{})]})}),a.jsx(at,{control:Be.control,name:"duration",render:({field:k})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Duration (minutes)"}),a.jsxs(Xn,{onValueChange:k.onChange,defaultValue:k.value,children:[a.jsx(it,{children:a.jsx(Fn,{children:a.jsx(Yn,{placeholder:"Select duration"})})}),a.jsxs(Bn,{children:[a.jsx(be,{value:"30",children:"30 minutes"}),a.jsx(be,{value:"45",children:"45 minutes"}),a.jsx(be,{value:"60",children:"60 minutes"}),a.jsx(be,{value:"90",children:"90 minutes"}),a.jsx(be,{value:"120",children:"120 minutes"})]})]}),a.jsx(un,{children:"How long should the focus group session last?"}),a.jsx(st,{})]})})]})]}),a.jsx(at,{control:Be.control,name:"creativeAssets",render:({field:{value:k,onChange:B,...W}})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Creative Assets (Optional)"}),a.jsx(it,{children:a.jsxs("div",{className:"border-2 border-dashed border-slate-200 rounded-lg p-6 flex flex-col items-center justify-center bg-slate-50 hover:bg-slate-100 transition cursor-pointer",children:[a.jsx(xR,{className:"h-10 w-10 text-slate-400 mb-2"}),a.jsx("p",{className:"text-sm text-slate-600 mb-1",children:"Upload creative assets for testing"}),a.jsx("p",{className:"text-xs text-slate-500 mb-3",children:"Images, mockups, or product designs"}),a.jsx(St,{...W,type:"file",accept:"image/*,.pdf",multiple:!0,onChange:ne=>{B(ne.target.files)},className:"hidden",id:"assets-file-input"}),a.jsxs(oe,{type:"button",variant:"outline",size:"sm",onClick:()=>{var ne;return(ne=document.getElementById("assets-file-input"))==null?void 0:ne.click()},children:[a.jsx(NR,{className:"mr-2 h-4 w-4"}),"Select Files"]}),k&&k.length>0&&a.jsxs("p",{className:"text-xs text-primary mt-2",children:[k.length," file(s) selected"]})]})}),a.jsx(un,{children:"Upload visuals that you want feedback on during the session"}),a.jsx(st,{})]})}),a.jsx("div",{className:"space-y-3",children:a.jsx("div",{className:"flex justify-end",children:a.jsxs(oe,{type:"submit",disabled:s,className:"min-w-32",children:[a.jsx(pa,{className:"mr-2 h-4 w-4"}),s?"Generating...":"Generate Discussion Guide"]})})})]})})}),a.jsx(Bt,{value:"review",children:a.jsxs("div",{className:"space-y-6",children:[a.jsx(Ge,{children:a.jsxs(tt,{className:"p-6",children:[a.jsx("div",{className:"flex items-center justify-between mb-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("h3",{className:"font-sf text-lg font-medium",children:"AI-Generated Discussion Guide"}),f&&a.jsx(lr,{variant:"outline",className:"text-xs",children:b(f)?"Structured JSON":"Legacy Text"})]})}),a.jsx("div",{className:"prose max-w-none",children:f?a.jsx(I5,{discussionGuide:f,showProgress:!1,collapsible:!0,defaultExpanded:!0,className:"border-0",onSave:Je,onDownload:mr,onSectionSelect:X,onSetPosition:G,isDownloading:O,focusGroupId:p}):a.jsx("div",{className:"bg-slate-50 p-4 rounded border text-center text-slate-600",children:'No discussion guide generated yet. Complete the setup and click "Generate Discussion Guide" to create one.'})})]})}),j.length>0&&a.jsx(Ge,{children:a.jsxs(tt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-medium mb-4",children:"Uploaded Creative Assets"}),a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-4",children:j.map((k,B)=>a.jsxs("div",{className:"border rounded-md p-2",children:[a.jsx("div",{className:"aspect-square bg-slate-100 rounded flex items-center justify-center mb-2",children:k.type.startsWith("image/")?a.jsx("img",{src:URL.createObjectURL(k),alt:`Asset ${B+1}`,className:"max-h-full max-w-full object-contain"}):a.jsx(Ww,{className:"h-10 w-10 text-slate-400"})}),a.jsx("p",{className:"text-xs truncate",children:k.name})]},B))})]})}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx(oe,{variant:"outline",onClick:()=>i("setup"),children:"Back to Setup"}),a.jsxs(oe,{onClick:()=>i("participants"),children:["Select Participants",a.jsx(Hn,{className:"ml-2 h-4 w-4"})]})]})]})}),a.jsxs(Bt,{value:"participants",children:[a.jsxs("div",{className:"flex flex-col md:flex-row gap-6",children:[a.jsxs("div",{className:"w-full md:w-64 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"text-sm font-medium",children:"Folders"}),a.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>{console.log("Clicked 'Create new folder' button"),V(!0)},className:"h-7 w-7 p-0",children:a.jsx(bR,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("button",{onClick:()=>{console.log("Clicked 'All Personas' folder"),console.log("All personas count:",N.length),H(Vo),setTimeout(()=>{console.log(`Will show all ${N.length} personas`)},0)},className:`w-full flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${R===Vo?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(Li,{className:"h-4 w-4"}),a.jsx("span",{children:"All Personas"})]}),T.map(k=>a.jsx("div",{className:"flex items-center justify-between group",children:Z&&Z.id===k.id?a.jsxs("div",{className:"flex-1 flex items-center px-3 py-2 space-x-2",children:[a.jsx(Li,{className:"h-4 w-4"}),a.jsx(St,{value:re,onChange:B=>me(B.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:B=>{B.key==="Enter"?Fe():B.key==="Escape"&&ce()}}),a.jsx(oe,{size:"sm",variant:"ghost",onClick:()=>{console.log(`Confirming folder rename: "${Z==null?void 0:Z.name}" to "${re}"`),Fe()},className:"h-7 w-7 p-0",children:a.jsx(ha,{className:"h-4 w-4"})}),a.jsx(oe,{size:"sm",variant:"ghost",onClick:()=>{console.log(`Cancelling rename of folder: "${Z==null?void 0:Z.name}"`),ce()},className:"h-7 w-7 p-0",children:a.jsx(js,{className:"h-4 w-4"})})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>{console.log(`Clicked folder: ${k.name} (ID: ${k.id})`);const B=k.personaIds.filter(W=>!!W);console.log(`Current persona count in folder: ${B.length}`),console.log("Folder personaIds:",B),console.log("All personas count:",N.length),H(k.id),setTimeout(()=>{const W=N.filter(ne=>{if(ne.folderId===k.id)return!0;const J=ne.id||ne._id;return B.includes(J)});console.log(`Will show ${W.length} personas after filtering`),console.log("Filtered personas:",W.map(ne=>ne.name))},0)},className:`flex-1 flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${R===k.id?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(Li,{className:"h-4 w-4"}),a.jsx("span",{children:k.name}),a.jsx("span",{className:"text-muted-foreground text-xs ml-auto",children:k.personaIds.filter(B=>!!B).length})]}),a.jsxs(v1,{children:[a.jsx(y1,{asChild:!0,children:a.jsx(oe,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100",children:a.jsx(Vw,{className:"h-4 w-4"})})}),a.jsx(Kg,{align:"end",children:a.jsx(Xo,{onClick:()=>{console.log(`Initiating rename for folder: ${k.name} (ID: ${k.id})`),je(k)},children:"Rename"})})]})]})},k.id)),F&&a.jsxs("div",{className:"flex items-center px-3 py-2 space-x-2",children:[a.jsxs("div",{className:"flex-1 flex items-center space-x-2",children:[a.jsx(Li,{className:"h-4 w-4"}),a.jsx(St,{value:I,onChange:k=>L(k.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:k=>{k.key==="Enter"?Y():k.key==="Escape"&&xe()}})]}),a.jsx(oe,{size:"sm",variant:"ghost",onClick:()=>{console.log(`Confirming creation of new folder: "${I}"`),Y()},className:"h-7 w-7 p-0",children:a.jsx(ha,{className:"h-4 w-4"})}),a.jsx(oe,{size:"sm",variant:"ghost",onClick:()=>{console.log("Cancelling folder creation"),xe()},className:"h-7 w-7 p-0",children:a.jsx(js,{className:"h-4 w-4"})})]})]})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Ge,{className:"mb-4",children:a.jsx(tt,{className:"p-6",children:a.jsxs("div",{className:"flex flex-col space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"font-sf text-lg font-medium",children:"Select Participants"}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(Hn,{className:"h-5 w-5 mr-2 text-muted-foreground"}),a.jsxs("span",{className:"text-sm font-medium",children:[y.length," of ",qt.length," selected"]})]})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx(jN,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(St,{placeholder:"Search personas by name, occupation, or location...",className:"pl-10 bg-white",value:z,onChange:k=>ae(k.target.value)})]}),a.jsxs(oe,{variant:"outline",className:"flex items-center gap-2",onClick:()=>fe(!0),children:[a.jsx(bN,{className:"h-4 w-4"}),a.jsxs("span",{children:["Filter",Object.values(Ne).some(k=>k.length>0)?` (${Object.values(Ne).reduce((k,B)=>k+B.length,0)})`:""]})]})]}),_?a.jsx("div",{className:"flex justify-center items-center py-12",children:a.jsx(_l,{className:"h-8 w-8 animate-spin text-primary"})}):qt.length>0?a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:qt.map(k=>{const B=k._id||k.id;return a.jsx(zN,{user:{id:B,_id:k._id,name:k.name,age:k.age,gender:k.gender,occupation:k.occupation,location:k.location||"Unknown",techSavviness:k.techSavviness||50,personality:k.personality||"No description available",oceanTraits:k.oceanTraits,qualitativeAttributes:k.qualitativeAttributes,topPersonalityTraits:k.topPersonalityTraits,aiSynthesizedBio:k.aiSynthesizedBio},selected:y.includes(B),onSelectionToggle:()=>mn(B),showModalInsteadOfNavigate:!0,onOpenPersonaModal:Se},B)})}):a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-muted-foreground",children:"No personas available matching your criteria."})})]})})}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx(oe,{variant:"outline",onClick:()=>i("review"),children:"Back to Review"}),a.jsxs(oe,{onClick:q,disabled:y.length<1||!f,children:[a.jsx(jG,{className:"mr-2 h-4 w-4"}),"Start Focus Group Session"]})]})]})]}),a.jsx(cu,{open:de,onOpenChange:k=>{k?(fe(k),Ee({...Ne})):fe(!1)},children:a.jsxs(kl,{className:"max-w-4xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Tl,{children:[a.jsx($l,{children:"Filter Personas"}),a.jsx(mh,{children:"Select attributes to filter personas by. Multiple selections within a category use OR logic, different categories use AND logic."})]}),a.jsxs("div",{className:"py-4 space-y-6",children:[Object.values(ue).some(k=>k.length>0)&&a.jsx("div",{className:"bg-muted/30 p-3 rounded-md",children:a.jsxs("p",{className:"text-sm text-muted-foreground",children:[Object.values(ue).reduce((k,B)=>k+B.length,0)," active filters"]})}),(()=>{const k=E(N),B=Object.values(ue).every(ne=>ne.length===0),W=(ne,J,ye=1)=>{const se=B?k[J]:D(J)[J],Pe=ue[J],_e=[...new Set([...se,...Pe])].sort();return _e.length===0?null:a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium mb-3",children:ne}),a.jsx("div",{className:`grid grid-cols-1 ${ye===2?"sm:grid-cols-2":ye===3?"sm:grid-cols-2 md:grid-cols-3":""} gap-2`,children:_e.map(et=>{const Ie=ue[J].includes(et),ft=se.includes(et);return a.jsxs("div",{className:`flex items-center space-x-2 ${!ft&&!Ie?"opacity-50":""}`,children:[a.jsx(gh,{id:`${J}-${et}`,checked:Ie,onCheckedChange:()=>te(J,et),disabled:!ft&&!Ie}),a.jsxs(uo,{htmlFor:`${J}-${et}`,className:"truncate overflow-hidden",children:[et,Ie&&!ft&&a.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:"(no matches)"})]})]},et)})})]})};return a.jsxs(a.Fragment,{children:[W("Gender","gender",3),W("Age","age",3),W("Ethnicity","ethnicity",2),W("Location","location",2),W("Occupation","occupation",2),W("Tech Savviness","techSavviness",3),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-6"})]})})()]}),a.jsxs(uu,{children:[a.jsx(oe,{variant:"outline",onClick:Q,children:"Reset"}),a.jsx(oe,{onClick:U,children:"Apply Filters"})]})]})})]})]}),a.jsx(eEe,{persona:K,isOpen:ie,onClose:$e})]})}const rEe=[{id:"1",name:"Mobile App UX Evaluation",status:"completed",participants:6,date:"2023-06-10T14:00:00Z",duration:60,topic:"user-experience"},{id:"2",name:"Product Feature Feedback",status:"scheduled",participants:8,date:"2023-06-15T10:00:00Z",duration:90,topic:"product-feedback"},{id:"3",name:"Marketing Campaign Testing",status:"in-progress",participants:5,date:"2023-06-12T15:30:00Z",duration:45,topic:"creative-testing"},{id:"4",name:"Website Navigation Study",status:"scheduled",participants:7,date:"2023-06-18T13:00:00Z",duration:60,topic:"user-experience"}],iEe={completed:"bg-green-100 text-green-800 border-green-200",scheduled:"bg-blue-100 text-blue-800 border-blue-200","in-progress":"bg-amber-100 text-amber-800 border-amber-200",active:"bg-amber-100 text-amber-800 border-amber-200",paused:"bg-purple-100 text-purple-800 border-purple-200",new:"bg-slate-100 text-slate-800 border-slate-200",ai_mode:"bg-amber-100 text-amber-800 border-amber-200",draft:"bg-gray-100 text-gray-800 border-gray-200"},sEe=()=>{console.log("FocusGroups component rendering");const[e,t]=v.useState("view"),[n,r]=v.useState(""),[i,s]=v.useState([]),[o,l]=v.useState(!0),[c,u]=v.useState([]),[d,f]=v.useState(!1),[h,p]=v.useState(!1),[g,m]=v.useState(null),x=Cn(),b=v.useRef(!0),y=async(_=!0)=>{if(console.log("fetchFocusGroups called with isMountedCheck:",_),console.log("isMounted.current:",b.current),_&&!b.current){console.log("Exiting early: component not mounted");return}console.log("Setting loading to true and making API call"),l(!0);try{console.log("Calling focusGroupsApi.getAll()");const A=await At.getAll();if(console.log("API response received:",A),!_||b.current){const O=A.data.map($=>({...$,id:$.id||$._id,participants_count:Array.isArray($.participants)?$.participants.length:typeof $.participants=="number"?$.participants:0}));s(O)}}catch(A){console.error("Error fetching focus groups:",A),(!_||b.current)&&(Ze.error("Failed to load focus groups"),s(rEe))}finally{(!_||b.current)&&l(!1)}};v.useEffect(()=>(console.log("useEffect running - about to fetch focus groups"),y(),()=>{console.log("useEffect cleanup - setting isMounted to false"),b.current=!1}),[]),v.useEffect(()=>{console.log("Mode change useEffect running, mode:",e),e==="view"&&(console.log("Mode is view, calling fetchFocusGroups"),y())},[e]);const w=i.filter(_=>_.name.toLowerCase().includes(n.toLowerCase())||_.topic.toLowerCase().includes(n.toLowerCase())),j=_=>new Date(_).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),S=_=>new Date(_).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}),N=_=>{u(A=>A.includes(_)?A.filter(O=>O!==_):[...A,_])},P=async()=>{if(c.length!==0){p(!0);try{const _=c.map(A=>At.delete(A));await Promise.all(_),s(A=>A.filter(O=>!c.includes(O.id||O._id||""))),u([]),Ze.success(`${c.length} focus group${c.length>1?"s":""} deleted successfully`)}catch(_){console.error("Error deleting focus groups:",_),Ze.error("Failed to delete focus groups")}finally{p(!1),f(!1)}}};return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(ea,{}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center mb-8",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"font-sf text-3xl font-bold text-slate-900",children:"Focus Groups"}),a.jsx("p",{className:"text-slate-600 mt-1",children:"Set up and manage AI-moderated research sessions"})]}),a.jsx("div",{className:"mt-4 sm:mt-0",children:a.jsx(oe,{onClick:()=>{console.log("Create New Focus Group button clicked, current mode:",e);try{e==="view"?(console.log("Setting draft to null and switching to create mode"),m(null),t("create")):(console.log("Switching back to view mode"),t("view"))}catch(_){console.error("Error in Create New Focus Group onClick:",_)}},className:"hover-transition",children:e==="view"?"Create New Focus Group":"View All Focus Groups"})})]}),e==="view"?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-6",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx(jN,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(St,{placeholder:"Search focus groups by name or topic...",className:"pl-10 bg-white",value:n,onChange:_=>r(_.target.value)})]}),a.jsxs(oe,{variant:"outline",className:"flex items-center gap-2",children:[a.jsx(bN,{className:"h-4 w-4"}),a.jsx("span",{children:"Filter"})]})]}),a.jsxs("div",{className:"glass-panel rounded-xl p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(pa,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"Your Focus Groups"})]}),c.length>0&&a.jsxs(oe,{variant:"destructive",size:"sm",onClick:()=>f(!0),disabled:h,className:"flex items-center gap-2",children:[a.jsx(gn,{className:"h-4 w-4"}),"Delete Selected (",c.length,")"]})]}),o?a.jsx("div",{className:"flex justify-center items-center py-12",children:a.jsx(_l,{className:"h-8 w-8 animate-spin text-primary"})}):w.length>0?a.jsx("div",{className:"space-y-4",children:w.map(_=>a.jsx("div",{className:"glass-card rounded-xl overflow-hidden hover:shadow-md button-transition",children:a.jsxs("div",{className:"flex flex-col md:flex-row",children:[a.jsxs("div",{className:"flex-1 p-6",children:[a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(gh,{id:`select-${_.id||_._id}`,checked:c.includes(_.id||_._id||""),onCheckedChange:()=>N(_.id||_._id||""),className:"mt-1"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-sf text-lg font-semibold mb-2",children:_.name}),a.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(aG,{className:"h-4 w-4 mr-1"}),j(_.date)]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(Xf,{className:"h-4 w-4 mr-1"}),S(_.date)]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(Hn,{className:"h-4 w-4 mr-1"}),_.participants_count||(Array.isArray(_.participants)?_.participants.length:0)," participant",_.participants_count>1||Array.isArray(_.participants)&&_.participants.length>1?"s":""]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(Xf,{className:"h-4 w-4 mr-1"}),_.duration," min"]})]})]})]}),a.jsxs("div",{className:Me("px-3 py-1 rounded-full text-xs font-medium border",iEe[_.status]||"bg-gray-100 text-gray-800 border-gray-200"),children:[_.status==="completed"&&"Completed",_.status==="scheduled"&&"Scheduled",_.status==="in-progress"&&"In Progress",_.status==="active"&&"In Progress",_.status==="ai_mode"&&"In Progress",_.status==="paused"&&"Paused",_.status==="new"&&"Not Started",_.status==="draft"&&"Draft",!["completed","scheduled","in-progress","active","ai_mode","paused","new","draft"].includes(_.status)&&_.status]})]}),a.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[a.jsxs("div",{className:"px-3 py-1 bg-slate-100 rounded-full text-xs font-medium text-slate-800",children:[_.topic==="user-experience"&&"User Experience",_.topic==="product-feedback"&&"Product Feedback",_.topic==="creative-testing"&&"Creative Testing",_.topic==="messaging-evaluation"&&"Messaging Evaluation",_.topic&&!["user-experience","product-feedback","creative-testing","messaging-evaluation"].includes(_.topic)&&_.topic.charAt(0).toUpperCase()+_.topic.slice(1).replace(/-/g," ")]}),a.jsx("div",{className:"px-3 py-1 bg-slate-100 rounded-full text-xs font-medium text-slate-800",children:"AI Moderated"})]})]}),a.jsx("div",{className:"bg-slate-50 p-6 flex flex-col justify-center items-center md:border-l border-slate-100",children:a.jsx(oe,{variant:_.status==="in-progress"||_.status==="active"||_.status==="ai_mode"?"default":_.status==="new"||_.status==="draft"?"outline":"default",className:Me("w-full hover-transition",_.status==="new"?"bg-slate-200 text-slate-700 hover:bg-slate-300 border-slate-300":"",_.status==="draft"?"bg-gray-200 text-gray-700 hover:bg-gray-300 border-gray-300":""),onClick:()=>{if(_.status==="draft")m(_),t("create");else{const A=_.id||_._id;console.log("Navigating to focus group:",A),x(`/focus-groups/${A}`)}},children:_.status==="completed"?a.jsxs(a.Fragment,{children:["View Session",a.jsx(ds,{className:"ml-2 h-4 w-4"})]}):_.status==="in-progress"||_.status==="active"||_.status==="ai_mode"?a.jsxs(a.Fragment,{children:["Join Session",a.jsx(ds,{className:"ml-2 h-4 w-4"})]}):_.status==="paused"?a.jsxs(a.Fragment,{children:["Session Details",a.jsx(ds,{className:"ml-2 h-4 w-4"})]}):_.status==="scheduled"?a.jsxs(a.Fragment,{children:["View Details",a.jsx(ds,{className:"ml-2 h-4 w-4"})]}):_.status==="new"?a.jsxs(a.Fragment,{children:["View Session",a.jsx(ds,{className:"ml-2 h-4 w-4"})]}):_.status==="draft"?a.jsxs(a.Fragment,{children:["Edit",a.jsx(ds,{className:"ml-2 h-4 w-4"})]}):a.jsxs(a.Fragment,{children:["View Session",a.jsx(ds,{className:"ml-2 h-4 w-4"})]})})})]})},_.id))}):a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-muted-foreground",children:"No focus groups found matching your search criteria."})})]})]}):a.jsx(nEe,{draftToEdit:g,onDraftSaved:()=>{m(null),t("view"),y()}})]}),a.jsx(x1,{open:d,onOpenChange:f,children:a.jsxs(Yg,{children:[a.jsxs(Zg,{children:[a.jsxs(Jg,{children:["Delete ",c.length," Focus Group",c.length!==1?"s":"","?"]}),a.jsxs(ev,{children:["This action cannot be undone. This will permanently delete the selected focus group",c.length!==1?"s":""," and remove all data associated with ",c.length!==1?"them":"it","."]})]}),a.jsxs(Qg,{children:[a.jsx(nv,{disabled:h,children:"Cancel"}),a.jsx(tv,{onClick:_=>{_.preventDefault(),P()},disabled:h,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:h?a.jsxs(a.Fragment,{children:[a.jsx(_l,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):a.jsx(a.Fragment,{children:"Delete"})})]})]})})]})},aEe=({participants:e,selectedParticipantIds:t,onToggleParticipantFilter:n})=>{const r=Cn(),i=o=>{const l=o.id||o._id;l&&r(`/personas/${l}`)},s=o=>{const l=o.id||o._id;l&&n(l)};return a.jsx("div",{className:"w-full lg:w-64 shrink-0",children:a.jsxs("div",{className:"glass-panel rounded-xl p-4",children:[a.jsxs("h2",{className:"font-sf text-lg font-semibold flex items-center mb-3",children:[a.jsx(Hn,{className:"h-5 w-5 text-primary mr-2"})," Participants"]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center p-2 bg-primary/5 rounded-lg",children:[a.jsx(Tc,{className:"h-8 w-8 text-primary mr-3"}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-primary",children:"AI Moderator"}),a.jsx("p",{className:"text-xs text-slate-500",children:"Session facilitator"})]})]}),e.map(o=>{const l=o.id||o._id,c=t.includes(l);return a.jsxs("div",{className:`flex items-center p-2 rounded-lg transition-colors ${c?"bg-blue-50 border border-blue-200":"hover:bg-slate-100"}`,children:[a.jsx("div",{className:"cursor-pointer mr-3",onClick:()=>i(o),title:`View ${o.name}'s profile`,children:a.jsx("img",{src:Zu(o),alt:o.name,className:"h-8 w-8 rounded-full object-cover"})}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx("p",{className:"font-medium cursor-pointer hover:text-blue-600 transition-colors",onClick:()=>s(o),title:`Filter to show only ${o.name}'s messages`,children:o.name}),c&&a.jsx(ha,{className:"h-4 w-4 text-blue-600 ml-2"})]}),a.jsx("p",{className:"text-xs text-slate-500",children:o.occupation})]})]},o.id)})]})]})})};function oEe(e,t){return v.useReducer((n,r)=>t[n][r]??n,e)}var VP="ScrollArea",[Gz,EOe]=Er(VP),[lEe,Ei]=Gz(VP),qz=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:i,scrollHideDelay:s=600,...o}=e,[l,c]=v.useState(null),[u,d]=v.useState(null),[f,h]=v.useState(null),[p,g]=v.useState(null),[m,x]=v.useState(null),[b,y]=v.useState(0),[w,j]=v.useState(0),[S,N]=v.useState(!1),[P,_]=v.useState(!1),A=dt(t,$=>c($)),O=ko(i);return a.jsx(lEe,{scope:n,type:r,dir:O,scrollHideDelay:s,scrollArea:l,viewport:u,onViewportChange:d,content:f,onContentChange:h,scrollbarX:p,onScrollbarXChange:g,scrollbarXEnabled:S,onScrollbarXEnabledChange:N,scrollbarY:m,onScrollbarYChange:x,scrollbarYEnabled:P,onScrollbarYEnabledChange:_,onCornerWidthChange:y,onCornerHeightChange:j,children:a.jsx(qe.div,{dir:O,...o,ref:A,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":w+"px",...e.style}})})});qz.displayName=VP;var Kz="ScrollAreaViewport",Xz=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,asChild:i,nonce:s,...o}=e,l=Ei(Kz,n),c=v.useRef(null),u=dt(t,c,l.onViewportChange);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:` -[data-radix-scroll-area-viewport] { - scrollbar-width: none; - -ms-overflow-style: none; - -webkit-overflow-scrolling: touch; -} -[data-radix-scroll-area-viewport]::-webkit-scrollbar { - display: none; -} -:where([data-radix-scroll-area-viewport]) { - display: flex; - flex-direction: column; - align-items: stretch; -} -:where([data-radix-scroll-area-content]) { - flex-grow: 1; -} -`},nonce:s}),a.jsx(qe.div,{"data-radix-scroll-area-viewport":"",...o,asChild:i,ref:u,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...e.style},children:yEe({asChild:i,children:r},d=>a.jsx("div",{"data-radix-scroll-area-content":"",ref:l.onContentChange,style:{minWidth:l.scrollbarXEnabled?"fit-content":void 0},children:d}))})]})});Xz.displayName=Kz;var Ms="ScrollAreaScrollbar",WP=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=Ei(Ms,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:o}=i,l=e.orientation==="horizontal";return v.useEffect(()=>(l?s(!0):o(!0),()=>{l?s(!1):o(!1)}),[l,s,o]),i.type==="hover"?a.jsx(cEe,{...r,ref:t,forceMount:n}):i.type==="scroll"?a.jsx(uEe,{...r,ref:t,forceMount:n}):i.type==="auto"?a.jsx(Yz,{...r,ref:t,forceMount:n}):i.type==="always"?a.jsx(HP,{...r,ref:t}):null});WP.displayName=Ms;var cEe=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=Ei(Ms,e.__scopeScrollArea),[s,o]=v.useState(!1);return v.useEffect(()=>{const l=i.scrollArea;let c=0;if(l){const u=()=>{window.clearTimeout(c),o(!0)},d=()=>{c=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return l.addEventListener("pointerenter",u),l.addEventListener("pointerleave",d),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",u),l.removeEventListener("pointerleave",d)}}},[i.scrollArea,i.scrollHideDelay]),a.jsx(er,{present:n||s,children:a.jsx(Yz,{"data-state":s?"visible":"hidden",...r,ref:t})})}),uEe=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=Ei(Ms,e.__scopeScrollArea),s=e.orientation==="horizontal",o=a0(()=>c("SCROLL_END"),100),[l,c]=oEe("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return v.useEffect(()=>{if(l==="idle"){const u=window.setTimeout(()=>c("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(u)}},[l,i.scrollHideDelay,c]),v.useEffect(()=>{const u=i.viewport,d=s?"scrollLeft":"scrollTop";if(u){let f=u[d];const h=()=>{const p=u[d];f!==p&&(c("SCROLL"),o()),f=p};return u.addEventListener("scroll",h),()=>u.removeEventListener("scroll",h)}},[i.viewport,s,c,o]),a.jsx(er,{present:n||l!=="hidden",children:a.jsx(HP,{"data-state":l==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:Te(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:Te(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Yz=v.forwardRef((e,t)=>{const n=Ei(Ms,e.__scopeScrollArea),{forceMount:r,...i}=e,[s,o]=v.useState(!1),l=e.orientation==="horizontal",c=a0(()=>{if(n.viewport){const u=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=e,i=Ei(Ms,e.__scopeScrollArea),s=v.useRef(null),o=v.useRef(0),[l,c]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=t8(l.viewport,l.content),d={...r,sizes:l,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:h=>s.current=h,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:h=>o.current=h};function f(h,p){return gEe(h,o.current,l,p)}return n==="horizontal"?a.jsx(dEe,{...d,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const h=i.viewport.scrollLeft,p=GT(h,l,i.dir);s.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:h=>{i.viewport&&(i.viewport.scrollLeft=h)},onDragScroll:h=>{i.viewport&&(i.viewport.scrollLeft=f(h,i.dir))}}):n==="vertical"?a.jsx(fEe,{...d,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const h=i.viewport.scrollTop,p=GT(h,l);s.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:h=>{i.viewport&&(i.viewport.scrollTop=h)},onDragScroll:h=>{i.viewport&&(i.viewport.scrollTop=f(h))}}):null}),dEe=v.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...i}=e,s=Ei(Ms,e.__scopeScrollArea),[o,l]=v.useState(),c=v.useRef(null),u=dt(t,c,s.onScrollbarXChange);return v.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),a.jsx(Qz,{"data-orientation":"horizontal",...i,ref:u,sizes:n,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":s0(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(s.viewport){const h=s.viewport.scrollLeft+d.deltaX;e.onWheelScroll(h),r8(h,f)&&d.preventDefault()}},onResize:()=>{c.current&&s.viewport&&o&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:fy(o.paddingLeft),paddingEnd:fy(o.paddingRight)}})}})}),fEe=v.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...i}=e,s=Ei(Ms,e.__scopeScrollArea),[o,l]=v.useState(),c=v.useRef(null),u=dt(t,c,s.onScrollbarYChange);return v.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),a.jsx(Qz,{"data-orientation":"vertical",...i,ref:u,sizes:n,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":s0(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(s.viewport){const h=s.viewport.scrollTop+d.deltaY;e.onWheelScroll(h),r8(h,f)&&d.preventDefault()}},onResize:()=>{c.current&&s.viewport&&o&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:fy(o.paddingTop),paddingEnd:fy(o.paddingBottom)}})}})}),[hEe,Zz]=Gz(Ms),Qz=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:s,onThumbPointerUp:o,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:f,...h}=e,p=Ei(Ms,n),[g,m]=v.useState(null),x=dt(t,A=>m(A)),b=v.useRef(null),y=v.useRef(""),w=p.viewport,j=r.content-r.viewport,S=$n(d),N=$n(c),P=a0(f,10);function _(A){if(b.current){const O=A.clientX-b.current.left,$=A.clientY-b.current.top;u({x:O,y:$})}}return v.useEffect(()=>{const A=O=>{const $=O.target;(g==null?void 0:g.contains($))&&S(O,j)};return document.addEventListener("wheel",A,{passive:!1}),()=>document.removeEventListener("wheel",A,{passive:!1})},[w,g,j,S]),v.useEffect(N,[r,N]),Lu(g,P),Lu(p.content,P),a.jsx(hEe,{scope:n,scrollbar:g,hasThumb:i,onThumbChange:$n(s),onThumbPointerUp:$n(o),onThumbPositionChange:N,onThumbPointerDown:$n(l),children:a.jsx(qe.div,{...h,ref:x,style:{position:"absolute",...h.style},onPointerDown:Te(e.onPointerDown,A=>{A.button===0&&(A.target.setPointerCapture(A.pointerId),b.current=g.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),_(A))}),onPointerMove:Te(e.onPointerMove,_),onPointerUp:Te(e.onPointerUp,A=>{const O=A.target;O.hasPointerCapture(A.pointerId)&&O.releasePointerCapture(A.pointerId),document.body.style.webkitUserSelect=y.current,p.viewport&&(p.viewport.style.scrollBehavior=""),b.current=null})})})}),dy="ScrollAreaThumb",Jz=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=Zz(dy,e.__scopeScrollArea);return a.jsx(er,{present:n||i.hasThumb,children:a.jsx(pEe,{ref:t,...r})})}),pEe=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...i}=e,s=Ei(dy,n),o=Zz(dy,n),{onThumbPositionChange:l}=o,c=dt(t,f=>o.onThumbChange(f)),u=v.useRef(),d=a0(()=>{u.current&&(u.current(),u.current=void 0)},100);return v.useEffect(()=>{const f=s.viewport;if(f){const h=()=>{if(d(),!u.current){const p=vEe(f,l);u.current=p,l()}};return l(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[s.viewport,d,l]),a.jsx(qe.div,{"data-state":o.hasThumb?"visible":"hidden",...i,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Te(e.onPointerDownCapture,f=>{const p=f.target.getBoundingClientRect(),g=f.clientX-p.left,m=f.clientY-p.top;o.onThumbPointerDown({x:g,y:m})}),onPointerUp:Te(e.onPointerUp,o.onThumbPointerUp)})});Jz.displayName=dy;var GP="ScrollAreaCorner",e8=v.forwardRef((e,t)=>{const n=Ei(GP,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?a.jsx(mEe,{...e,ref:t}):null});e8.displayName=GP;var mEe=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,i=Ei(GP,n),[s,o]=v.useState(0),[l,c]=v.useState(0),u=!!(s&&l);return Lu(i.scrollbarX,()=>{var f;const d=((f=i.scrollbarX)==null?void 0:f.offsetHeight)||0;i.onCornerHeightChange(d),c(d)}),Lu(i.scrollbarY,()=>{var f;const d=((f=i.scrollbarY)==null?void 0:f.offsetWidth)||0;i.onCornerWidthChange(d),o(d)}),u?a.jsx(qe.div,{...r,ref:t,style:{width:s,height:l,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function fy(e){return e?parseInt(e,10):0}function t8(e,t){const n=e/t;return isNaN(n)?0:n}function s0(e){const t=t8(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function gEe(e,t,n,r="ltr"){const i=s0(n),s=i/2,o=t||s,l=i-o,c=n.scrollbar.paddingStart+o,u=n.scrollbar.size-n.scrollbar.paddingEnd-l,d=n.content-n.viewport,f=r==="ltr"?[0,d]:[d*-1,0];return n8([c,u],f)(e)}function GT(e,t,n="ltr"){const r=s0(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-i,o=t.content-t.viewport,l=s-r,c=n==="ltr"?[0,o]:[o*-1,0],u=dh(e,c);return n8([0,o],[0,l])(u)}function n8(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function r8(e,t){return e>0&&e{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function i(){const s={left:e.scrollLeft,top:e.scrollTop},o=n.left!==s.left,l=n.top!==s.top;(o||l)&&t(),n=s,r=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(r)};function a0(e,t){const n=$n(e),r=v.useRef(0);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),v.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Lu(e,t){const n=$n(t);Jn(()=>{let r=0;if(e){const i=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return i.observe(e),()=>{window.cancelAnimationFrame(r),i.unobserve(e)}}},[e,n])}function yEe(e,t){const{asChild:n,children:r}=e;if(!n)return typeof t=="function"?t(r):t;const i=v.Children.only(r);return v.cloneElement(i,{children:typeof t=="function"?t(i.props.children):t})}var i8=qz,xEe=Xz,bEe=e8;const o0=v.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(i8,{ref:r,className:Me("relative overflow-hidden",e),...n,children:[a.jsx(xEe,{className:"h-full w-full rounded-[inherit]",children:t}),a.jsx(s8,{}),a.jsx(bEe,{})]}));o0.displayName=i8.displayName;const s8=v.forwardRef(({className:e,orientation:t="vertical",...n},r)=>a.jsx(WP,{ref:r,orientation:t,className:Me("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:a.jsx(Jz,{className:"relative flex-1 rounded-full bg-border"})}));s8.displayName=WP.displayName;const wEe=({participants:e,isVisible:t,selectedIndex:n,onSelect:r,onClose:i,position:s})=>{const o=v.useRef(null);return v.useEffect(()=>{const l=c=>{o.current&&!o.current.contains(c.target)&&i()};if(t)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[t,i]),v.useEffect(()=>{if(t&&n>=0&&o.current){const l=o.current.children[n];l&&l.scrollIntoView({block:"nearest",behavior:"smooth"})}},[n,t]),!t||e.length===0?null:a.jsxs("div",{ref:o,className:"absolute z-50 w-64 max-h-48 overflow-y-auto bg-white border border-slate-200 rounded-lg shadow-lg",style:{top:s.top,left:s.left},children:[e.map((l,c)=>{const u=l.id||l._id,d=c===n;return a.jsxs("div",{className:`flex items-center p-3 cursor-pointer transition-colors ${d?"bg-blue-50 border-l-4 border-blue-500":"hover:bg-slate-50"}`,onClick:()=>r(l),children:[a.jsx("img",{src:Zu(l),alt:l.name,className:"h-8 w-8 rounded-full object-cover mr-3 flex-shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:`font-medium truncate ${d?"text-blue-900":"text-slate-900"}`,children:l.name}),a.jsx("p",{className:`text-sm truncate ${d?"text-blue-600":"text-slate-500"}`,children:l.occupation})]})]},u)}),e.length===0&&a.jsx("div",{className:"p-3 text-center text-slate-500 text-sm",children:"No participants found"})]})};function iS(e,t){const n=[],r=[],i=/@(\w+(?:\s+\w+)*)/g;let s;for(;(s=i.exec(e))!==null;){const o=s[1],l=s.index,c=s.index+s[0].length,u=t.find(d=>d.name.toLowerCase()===o.toLowerCase());if(u){const d=u.id||u._id;d&&(n.push({id:d,name:u.name,startIndex:l,endIndex:c}),r.includes(d)||r.push(d))}}return{text:e,mentions:n,mentionedParticipantIds:r}}function jEe(e,t){if(t.length===0)return[e];const n=[];let r=0;return[...t].sort((s,o)=>s.startIndex-o.startIndex).forEach((s,o)=>{s.startIndex>r&&n.push(e.slice(r,s.startIndex)),n.push(C.createElement("span",{key:`mention-${o}`,className:"text-blue-600 bg-blue-50 px-1 rounded font-medium"},`@${s.name}`)),r=s.endIndex}),r=0;n--){const r=e[n];if(r==="@"){if(n===0||/\s/.test(e[n-1]))return n}else if(/\s/.test(r))break}return null}function _Ee(e,t,n){return e.slice(t+1,n).toLowerCase()}function PEe(e,t){return t?e.filter(n=>n.name.toLowerCase().includes(t)):e}const a8=v.forwardRef(({value:e,onChange:t,participants:n,placeholder:r="Ask a question or provide guidance...",className:i="",disabled:s=!1},o)=>{const[l,c]=v.useState(!1),[u,d]=v.useState(0),[f,h]=v.useState({top:0,left:0}),[p,g]=v.useState(null),[m,x]=v.useState([]),b=v.useRef(null),y=v.useRef(null);v.useEffect(()=>{o&&b.current&&(typeof o=="function"?o(b.current):o.current=b.current)},[o]);const w=()=>{if(b.current&&y.current&&p!==null){const _=b.current,A=y.current,O=document.createElement("div");O.style.position="absolute",O.style.visibility="hidden",O.style.whiteSpace="pre",O.style.font=window.getComputedStyle(_).font,O.textContent=e.slice(0,p),document.body.appendChild(O);const $=O.offsetWidth;document.body.removeChild(O);const T=A.getBoundingClientRect(),M=_.getBoundingClientRect();h({top:M.height+4,left:Math.min($,T.width-280)})}},j=_=>{const A=_.target.value,O=_.target.selectionStart||0,$=NEe(A,O);if($!==null&&n.length>0){const M=_Ee(A,$,O),R=PEe(n,M);g($),x(R),d(0),c(!0)}else c(!1),g(null);const T=iS(A,n);t(A,T)},S=_=>{if(l&&m.length>0)switch(_.key){case"ArrowDown":_.preventDefault(),d(A=>AA>0?A-1:m.length-1);break;case"Enter":case"Tab":_.preventDefault(),m[u]&&N(m[u]);break;case"Escape":_.preventDefault(),c(!1);break}},N=_=>{if(p!==null&&b.current){const A=b.current.selectionStart||0,{newText:O,newCursorPosition:$}=SEe(e,A,_,p),T=iS(O,n);t(O,T),setTimeout(()=>{b.current&&(b.current.focus(),b.current.setSelectionRange($,$))},0),c(!1),g(null)}},P=()=>{c(!1),g(null)};return v.useEffect(()=>{l&&p!==null&&w()},[l,p,e]),a.jsxs("div",{ref:y,className:`relative ${i}`,children:[a.jsx("input",{ref:b,type:"text",value:e,onChange:j,onKeyDown:S,placeholder:r,disabled:s,className:"flex h-10 w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-sm ring-offset-white file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-slate-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-950 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"}),a.jsx(wEe,{participants:m,isVisible:l,selectedIndex:u,onSelect:N,onClose:P,position:f})]})});a8.displayName="MentionInput";const CEe=({message:e,persona:t,toggleHighlight:n,participants:r=[],focusGroupId:i})=>{const[s,o]=v.useState(!1),l=e.senderId==="moderator",c=e.senderId==="facilitator",u=iS(e.text,r),d=jEe(e.text,u.mentions),h=(m=>{const x=[/titled\s+['"]([^'"]+\.(jpg|jpeg|png))['\"]/i,/asset\s+['"]([^'"]+\.(jpg|jpeg|png))['\"]/i,/image\s+['"]([^'"]+\.(jpg|jpeg|png))['\"]/i,/['"]([a-zA-Z0-9_\-]+\.(jpg|jpeg|png))['\"]/i,/(fg-[a-f0-9]+-[a-f0-9]{32}\.(jpg|jpeg|png))/i];for(const b of x){const y=m.match(b);if(y)return y[1]}return null})(e.text),p=(l||c)&&h&&i,g=()=>{n()};return a.jsxs("div",{id:`message-${e.id}`,className:Me("flex items-start p-3 rounded-lg transition-colors",e.highlighted?"bg-amber-50 border border-amber-200":"hover:bg-slate-50",l?"border-l-4 border-l-primary pl-4":"",c?"border-l-4 border-l-green-500 pl-4":""),onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),"data-highlighted":e.highlighted?"true":"false",children:[a.jsx("div",{className:"flex-shrink-0 mr-3",children:l?a.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:a.jsx(Tc,{className:"h-6 w-6 text-primary"})}):c?a.jsx("div",{className:"bg-green-100 p-2 rounded-full",children:a.jsx(Og,{className:"h-6 w-6 text-green-600"})}):t?a.jsx("div",{className:"bg-slate-100 p-2 rounded-full",children:a.jsx("img",{src:Zu(t),alt:`${t.name} avatar`,className:"h-6 w-6 rounded-full object-cover"})}):a.jsx("div",{className:"bg-slate-100 p-2 rounded-full",children:a.jsx(uG,{className:"h-6 w-6 text-slate-600"})})}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center mb-1",children:[a.jsx("span",{className:"font-medium mr-2",children:l?"AI Moderator":c?"Human Facilitator":(t==null?void 0:t.name)||"Unknown"}),!l&&!c&&t&&a.jsx(lr,{variant:"outline",className:"text-xs font-normal",children:t.occupation}),a.jsx("span",{className:"text-xs text-slate-500 ml-auto",children:e.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),a.jsx("p",{className:"text-slate-700",children:d}),p&&a.jsxs("div",{className:"mt-3 p-3 border rounded-lg bg-slate-50",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(wR,{className:"h-4 w-4 text-slate-600"}),a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Creative Asset"})]}),a.jsx("img",{src:At.getAssetUrl(i,h),alt:"Creative asset for review",className:"max-w-full h-auto rounded border shadow-sm",style:{maxHeight:"300px"},onError:m=>{var b;console.error("Failed to load creative asset:",At.getAssetUrl(i,h)),m.currentTarget.style.display="none";const x=document.createElement("div");x.className="text-xs text-slate-500 italic p-2 border rounded bg-slate-100",x.textContent=`Creative asset not found: ${h}`,(b=m.currentTarget.parentNode)==null||b.appendChild(x)}})]}),a.jsx("div",{className:Me("flex mt-2 space-x-2",!s&&!e.highlighted&&"hidden"),children:a.jsxs(oe,{variant:"ghost",size:"sm",onClick:g,className:"h-8 px-2 text-xs",children:[a.jsx(AG,{className:Me("h-3 w-3 mr-1",e.highlighted?"fill-amber-400 text-amber-400":"text-slate-400")}),e.highlighted?"Highlighted":"Highlight"]})})]})]})},AEe=({action:e})=>{switch(e){case"moderator_speak":return a.jsx(pa,{className:"h-4 w-4 text-blue-500"});case"participant_respond":return a.jsx(Hn,{className:"h-4 w-4 text-green-500"});case"participant_interaction":return a.jsx(Hn,{className:"h-4 w-4 text-purple-500"});case"probe_trigger":return a.jsx(NN,{className:"h-4 w-4 text-orange-500"});case"end_session":return a.jsx(kG,{className:"h-4 w-4 text-red-500"});default:return a.jsx(fa,{className:"h-4 w-4 text-gray-500"})}},EEe=({status:e})=>{switch(e){case"success":return a.jsx(Cg,{className:"h-3 w-3 text-green-500"});case"error":return a.jsx(dG,{className:"h-3 w-3 text-red-500"});case"pending":return a.jsx(Xf,{className:"h-3 w-3 text-yellow-500 animate-pulse"});default:return null}},OEe=({action:e})=>({moderator_speak:"Moderator",participant_respond:"Participant Response",participant_interaction:"Participant Interaction",probe_trigger:"Probe Question",end_session:"End Session"})[e]||e,kEe=e=>{try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return e}},TEe=({entry:e,isLatest:t})=>{const[n,r]=v.useState(t);return a.jsx(Ge,{className:`mb-2 ${t?"ring-2 ring-blue-200 bg-blue-50/50":""}`,children:a.jsxs(xp,{open:n,onOpenChange:r,children:[a.jsx(bp,{asChild:!0,children:a.jsx($r,{className:"pb-2 cursor-pointer hover:bg-gray-50/50 transition-colors",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(AEe,{action:e.action}),a.jsxs("div",{className:"flex flex-col",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-medium text-sm",children:a.jsx(OEe,{action:e.action})}),a.jsx(EEe,{status:e.execution_status})]}),a.jsx("span",{className:"text-xs text-gray-500",children:kEe(e.timestamp)})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[t&&a.jsx(lr,{variant:"secondary",className:"text-xs",children:"Latest"}),n?a.jsx(pp,{className:"h-4 w-4 text-gray-400"}):a.jsx(ja,{className:"h-4 w-4 text-gray-400"})]})]})})}),a.jsx(wp,{children:a.jsx(tt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-1",children:"AI Reasoning:"}),a.jsxs("p",{className:"text-sm text-gray-600 bg-gray-50 p-2 rounded italic",children:['"',e.reasoning,'"']})]}),e.details&&Object.keys(e.details).length>0&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-1",children:"Details:"}),a.jsx("div",{className:"text-xs text-gray-600 bg-gray-50 p-2 rounded font-mono",children:JSON.stringify(e.details,null,2)})]}),e.execution_result&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-1",children:"Execution Result:"}),a.jsx("div",{className:"text-xs text-gray-600 bg-gray-50 p-2 rounded",children:e.execution_result.error?a.jsxs("span",{className:"text-red-600",children:["Error: ",e.execution_result.error]}):a.jsx("span",{className:"text-green-600",children:e.execution_result.message||"Success"})})]})]})})})]})})},$Ee=({reasoningHistory:e,isVisible:t,onToggle:n,isAiMode:r=!1})=>{const[i,s]=v.useState(!0);return v.useEffect(()=>{if(i&&e.length>0){const o=document.getElementById("reasoning-panel-content");o&&(o.scrollTop=0)}},[e.length,i]),a.jsx("div",{className:"border-t border-gray-200 bg-white",children:a.jsxs(xp,{open:t,onOpenChange:n,children:[a.jsx(bp,{asChild:!0,children:a.jsxs("div",{className:"flex items-center justify-between p-3 cursor-pointer hover:bg-gray-50 transition-colors",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(fa,{className:"h-4 w-4 text-purple-600"}),a.jsx("span",{className:"font-medium text-sm",children:r?"AI Decision Reasoning":"AI Moderator Logic"}),r&&e.length>0&&a.jsx(lr,{variant:"outline",className:"text-xs",children:e.length}),!r&&a.jsx(lr,{variant:"secondary",className:"text-xs",children:"Manual Mode"})]}),t?a.jsx(pp,{className:"h-4 w-4 text-gray-400"}):a.jsx(ja,{className:"h-4 w-4 text-gray-400"})]})}),a.jsx(wp,{children:a.jsx("div",{className:"border-t border-gray-100",children:r?e.length===0?a.jsxs("div",{className:"p-4 text-center text-gray-500",children:[a.jsx(fa,{className:"h-8 w-8 mx-auto mb-2 text-gray-300"}),a.jsx("p",{className:"text-sm",children:"No AI decisions yet"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Reasoning will appear here when the AI makes decisions"})]}):a.jsx(o0,{id:"reasoning-panel-content",className:"h-[25vh] p-3",children:a.jsx("div",{className:"space-y-2",children:e.map((o,l)=>a.jsx(TEe,{entry:o,isLatest:l===0},`${o.timestamp}-${l}`))})}):a.jsxs("div",{className:"p-4 text-center text-gray-500",children:[a.jsx(SR,{className:"h-8 w-8 mx-auto mb-2 text-gray-400"}),a.jsx("p",{className:"text-sm font-medium text-gray-700",children:"Manual Moderation Mode"}),a.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"You are currently moderating the discussion manually."}),a.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"Switch to AI Mode to see automated reasoning and decisions."})]})})})]})})},IEe=({modeEvent:e})=>{const t=i=>i.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),n=i=>{switch(i){case"ai_mode_started":return"AI Mode Started";case"manual_mode_started":return"Manual Moderation Enabled";default:return"Mode Changed"}},r=i=>{switch(i){case"ai_mode_started":return"text-blue-600";case"manual_mode_started":return"text-slate-600";default:return"text-gray-600"}};return a.jsxs("div",{className:"flex items-center my-6 px-4",children:[a.jsx("div",{className:"flex-1 border-t border-gray-200"}),a.jsx("div",{className:`mx-4 px-3 py-1 bg-white border border-gray-200 rounded-full ${r(e.event_type)}`,children:a.jsxs("div",{className:"flex items-center space-x-2 text-xs font-medium",children:[a.jsx("span",{children:n(e.event_type)}),a.jsx("span",{className:"text-gray-400",children:"at"}),a.jsx("span",{children:t(e.timestamp)})]})}),a.jsx("div",{className:"flex-1 border-t border-gray-200"})]})},MEe=({messages:e,modeEvents:t,personas:n,isSpeaking:r,focusGroupId:i,isAiModeActive:s=!1,selectedParticipantIds:o,onToggleHighlight:l,onAdvanceDiscussion:c,onNewMessage:u,onStatusChange:d,isEditingDiscussionGuide:f=!1})=>{const[h,p]=v.useState(""),[g,m]=v.useState(null),[x,b]=v.useState(!1),[y,w]=v.useState(null),j=v.useRef(null),[S,N]=v.useState(-1),P=v.useRef(null),[_,A]=v.useState(!1),[O,$]=v.useState(!1),[T,M]=v.useState(!1),[R,H]=v.useState(null),F=R!==null?R:s,[V,I]=v.useState([]),[L,Z]=v.useState(!1),ee=L;v.useEffect(()=>{s&&i&&re()},[s,i]);const re=async()=>{if(i)try{s&&me()}catch(E){console.error("Error checking autonomous status:",E)}},me=async()=>{if(i)try{const E=await fn.getReasoningHistory(i);I(E.data.reasoning_history||[])}catch(E){console.error("Error fetching reasoning history:",E)}};v.useEffect(()=>{_&&fe()},[e,_]),v.useEffect(()=>{let E;return s&&i&&(E=setInterval(()=>{me(),re()},5e3)),()=>{E&&clearInterval(E)}},[s,i]);const z=E=>n.find(D=>D.id===E||D._id===E),ae=o.length===0?e:e.filter(E=>E.senderId==="moderator"||E.senderId==="facilitator"||o.includes(E.senderId)),de=()=>{const E=[];return ae.forEach(D=>{E.push({type:"message",data:D,timestamp:D.timestamp})}),t.forEach(D=>{E.push({type:"mode_event",data:D,timestamp:D.timestamp})}),E.sort((D,U)=>D.timestamp.getTime()-U.timestamp.getTime())},fe=()=>{if(!f&&P.current){const E=P.current.closest("[data-radix-scroll-area-viewport]");if(E){const D=P.current.offsetTop-E.clientHeight+50,U=E.scrollTop,Q=D-U,te=300;let Y=null;const xe=je=>{Y||(Y=je);const Fe=je-Y,ce=Math.min(Fe/te,1),ke=1-Math.pow(1-ce,3);E.scrollTop=U+Q*ke,ce<1&&window.requestAnimationFrame(xe)};window.requestAnimationFrame(xe)}else P.current.scrollIntoView({behavior:"smooth",block:"end"})}},Ne=async E=>{var te,Y;if(E.preventDefault(),!h.trim())return;let D=h,U=null;const Q=g;p(""),m(null),b(!0);try{if(y){try{pe.info("Uploading creative asset...",{description:"Please wait while we upload your image."});const Fe=new FormData;Fe.append("assets",y);const ce=await At.uploadAssets(i,Fe);console.log("Upload response:",ce==null?void 0:ce.data);const ke=ce==null?void 0:ce.data;ke&&ke.assets&&ke.assets.length>0?(U=ke.assets[0].filename,console.log("Successfully got filename from upload response:",U)):console.error("Invalid upload response structure:",ke),U&&(D=`Please review this creative asset titled '${U}'. ${h}`,pe.success("Creative asset uploaded successfully",{description:"The image has been attached to your message."}))}catch(Fe){console.error("Error uploading file:",Fe),console.error("Upload error details:",(te=Fe.response)==null?void 0:te.data),pe.error("Failed to upload creative asset",{description:"Your message will be sent without the attachment."})}ve()}const xe={id:`msg-${Date.now()}`,senderId:"facilitator",text:D,timestamp:new Date,type:"question"},je=await At.sendMessage(i,{text:D,type:"question",senderId:"facilitator"});console.log("Message sent to API:",je),(Y=je==null?void 0:je.data)!=null&&Y.message_id&&(xe.id=je.data.message_id),u(xe),setTimeout(()=>{fe()},100),Q&&Q.mentionedParticipantIds.length>0?setTimeout(()=>{Se(Q.mentionedParticipantIds,xe.text)},500):setTimeout(()=>{b(!1)},1e3)}catch(xe){console.error("Error sending message:",xe),b(!1);const je={id:`msg-${Date.now()}`,senderId:"facilitator",text:h,timestamp:new Date,type:"question"};u(je),setTimeout(()=>{fe()},100),pe.error("Failed to send message to server",{description:"Message will be shown locally but not saved."})}},he=()=>{for(let E=e.length-1;E>=0;E--)if(e[E].senderId==="moderator"&&e[E].type==="question")return e[E].text;for(let E=e.length-1;E>=0;E--)if(e[E].senderId==="moderator")return e[E].text;return"What are your thoughts on this topic?"},ue=(E,D)=>{if(!E||!E.sections||!D)return null;const{section_index:U,subsection_index:Q,item_index:te,item_type:Y}=D,xe=E.sections,je=ce=>{const ke=[];return ce.questions&&ce.questions.forEach((Be,mt)=>{ke.push({...Be,type:"question",index:mt})}),ce.activities&&ce.activities.forEach((Be,mt)=>{ke.push({...Be,type:"activity",index:mt})}),ke.sort((Be,mt)=>Be.type!==mt.type?Be.type==="question"?-1:1:Be.index-mt.index)};if(U>=xe.length)return{completed:!0};const Fe=xe[U];if(Q!==void 0&&Fe.subsections){if(Q>=Fe.subsections.length)return ue(E,{section_index:U+1,subsection_index:void 0,item_index:0,item_type:"question"});const ce=Fe.subsections[Q],ke=je(ce),Be=ke.findIndex(mt=>mt.type===Y&&mt.index===te);if(Be0){const ke=ce.findIndex(Be=>Be.type===Y&&Be.index===te);if(ke0?ue(E,{section_index:U,subsection_index:0,item_index:0,item_type:"question"}):ue(E,{section_index:U+1,subsection_index:void 0,item_index:0,item_type:"question"})}},Ee=async()=>{var E,D,U;if(i)try{b(!0),pe.info("Advancing discussion...",{description:"Moving to the next question in the discussion guide."});const[Q,te]=await Promise.all([fn.getModeratorStatus(i),At.getById(i)]);if(!((E=Q==null?void 0:Q.data)!=null&&E.status)||!((D=te==null?void 0:te.data)!=null&&D.discussionGuide))throw new Error("Could not fetch moderator status or discussion guide");const Y=Q.data.status,xe=te.data.discussionGuide;if(!xe.sections)throw new Error("Discussion guide does not have a structured format");const je=ue(xe,Y.moderator_position);if(!je)throw new Error("Could not determine next discussion item");if(je.completed){pe.success("Discussion guide completed",{description:"All sections of the discussion guide have been covered."});const ce={id:`msg-${Date.now()}`,senderId:"moderator",text:"We have covered all the questions in our discussion guide. Thank you all for your valuable insights and participation in this focus group session.",timestamp:new Date,type:"system"};u(ce);return}await fn.setModeratorPosition(i,je.sectionId,je.itemId);const Fe={id:`msg-${Date.now()}`,senderId:"moderator",text:je.content,timestamp:new Date,type:"question"};try{const ce=await At.sendMessage(i,{senderId:"moderator",text:Fe.text,type:"question"});(U=ce==null?void 0:ce.data)!=null&&U.message_id&&(Fe.id=ce.data.message_id)}catch(ce){console.warn("Failed to save message to API, showing locally:",ce)}u(Fe),setTimeout(()=>{fe()},100),pe.success("Discussion advanced",{description:`Moved to: ${je.section.title}${je.subsection?` > ${je.subsection.title}`:""}`}),d&&setTimeout(()=>d(),500)}catch(Q){console.error("Error advancing discussion:",Q),pe.error("Failed to advance discussion",{description:Q.message||"There was a problem advancing to the next question."})}finally{b(!1)}},ie=async()=>{var E,D,U,Q;if(i){console.log("Starting AI Mode: setting autonomousLoading to true"),M(!0);try{console.log("Starting AI Mode: calling API...");const Y=await Promise.race([fn.startAutonomousConversation(i),new Promise((xe,je)=>setTimeout(()=>je(new Error("API call timeout after 30 seconds")),3e4))]);if(console.log("Starting AI Mode: API response received:",Y),Y.data.error){pe.error("Failed to start autonomous conversation",{description:Y.data.error}),M(!1);return}pe.success("Autonomous conversation started",{description:"The AI is now managing the focus group conversation"}),H(!0);try{console.log("Starting AI Mode: calling onStatusChange..."),d&&(await d(),console.log("Starting AI Mode: onStatusChange completed successfully"))}catch(xe){console.error("Starting AI Mode: onStatusChange failed:",xe)}console.log("Starting AI Mode: resetting autonomousLoading to false"),M(!1),setTimeout(()=>{console.log("Starting AI Mode: clearing local AI mode state"),H(null)},1e3),me()}catch(te){console.error("Error starting autonomous conversation:",te),te.response&&te.response.data&&console.error("Backend error details:",te.response.data);const Y=((D=(E=te.response)==null?void 0:E.data)==null?void 0:D.message)||((Q=(U=te.response)==null?void 0:U.data)==null?void 0:Q.error)||"Please check your connection and try again";pe.error("Failed to start autonomous conversation",{description:Y}),M(!1)}}},Xe=async()=>{if(i){console.log("Stopping AI Mode: setting autonomousLoading to true"),M(!0);try{const E=await fn.stopAutonomousConversation(i,"manual_stop");if(E.data.error){pe.error("Failed to stop autonomous conversation",{description:E.data.error}),M(!1);return}I([]),pe.success("Autonomous conversation stopped",{description:"You can now moderate the discussion manually"}),H(!1);try{console.log("Stopping AI Mode: calling onStatusChange..."),d&&(await d(),console.log("Stopping AI Mode: onStatusChange completed successfully"))}catch(D){console.error("Stopping AI Mode: onStatusChange failed:",D)}console.log("Stopping AI Mode: resetting autonomousLoading to false"),M(!1),setTimeout(()=>{console.log("Stopping AI Mode: clearing local AI mode state"),H(null)},1e3)}catch(E){console.error("Error stopping autonomous conversation:",E),pe.error("Failed to stop autonomous conversation"),M(!1)}}},K=E=>{var U;const D=(U=E.target.files)==null?void 0:U[0];if(D){if(!D.type.startsWith("image/")){pe.error("Please select an image file",{description:"Only image files (JPG, PNG, etc.) are supported for creative review."});return}if(D.size>10*1024*1024){pe.error("File too large",{description:"Please select an image smaller than 10MB."});return}w(D),pe.success(`Image selected: ${D.name}`,{description:"The image will be attached to your next message."})}},ve=()=>{w(null),j.current&&(j.current.value="")},Se=async(E,D)=>{var U;if(!(!i||E.length===0))try{b(!0),pe.info("Generating responses from mentioned participants...",{description:`Generating responses from ${E.length} mentioned participant(s).`});for(const Q of E){const te=n.find(Y=>(Y._id||Y.id)===Q);if(!te){console.warn(`Mentioned participant ${Q} not found in focus group`);continue}try{const Y=await fn.generateResponse(i,Q,D||"Continue the conversation based on the latest moderator message.");if((U=Y==null?void 0:Y.data)!=null&&U.response){console.log("Generated response from mentioned participant:",Y.data);const xe={id:Y.data.message_id||`msg-${Date.now()}-${Q}`,senderId:Q,text:Y.data.response,timestamp:new Date,type:"response"};u(xe),pe.success(`Response generated from ${te.name}`,{description:Y.data.response.substring(0,100)+"..."})}}catch(Y){console.error(`Error generating response from ${te.name}:`,Y),pe.error(`Failed to generate response from ${te.name}`)}}}catch(Q){console.error("Error generating mentioned responses:",Q),pe.error("Failed to generate responses from mentioned participants")}finally{b(!1)}},$e=async()=>{var E,D,U,Q;if(i){if(n.length===0){pe.error("No participants available",{description:"Add participants to the focus group before generating responses."});return}try{b(!0),pe.info("AI is selecting participant...",{description:"Analyzing the conversation to choose the best respondent."});const te=await fn.makeConversationDecision(i,.7,"manual");if(!te||!te.data||!te.data.decision)throw new Error("Empty decision response from AI");const Y=te.data.decision;if(Y.action==="participant_respond"){const xe=Y.details.participant_id,je=Y.details.topic_context,Fe=Y.reasoning,ce=n.find(Be=>(Be._id||Be.id)===xe);if(!ce)throw new Error(`Selected participant ${xe} not found in focus group`);pe.info("Generating response...",{description:`AI selected ${ce.name}: ${Fe.substring(0,100)}${Fe.length>100?"...":""}`});const ke=await fn.generateResponse(i,xe,je);if(!ke||!ke.data)throw new Error("Empty response from API");if((E=ke==null?void 0:ke.data)!=null&&E.message_id&&((D=ke==null?void 0:ke.data)!=null&&D.response)){const Be={id:ke.data.message_id,senderId:xe,text:ke.data.response,timestamp:new Date,type:"response",highlighted:!1};u(Be),setTimeout(()=>{fe()},100)}else throw new Error("Failed to generate or save AI response")}else{if(console.log("AI suggested different action:",Y.action),Y.action==="moderator_speak"){pe.info("AI suggests moderator intervention",{description:`AI reasoning: ${Y.reasoning.substring(0,100)}${Y.reasoning.length>100?"...":""}`});return}pe.warning("Using fallback participant selection",{description:`AI suggested "${Y.action}" but generating participant response anyway.`});const xe=(S+1)%n.length,je=n[xe],Fe=he(),ce=je._id||je.id,ke=await fn.generateResponse(i,ce,Fe);if((U=ke==null?void 0:ke.data)!=null&&U.message_id&&((Q=ke==null?void 0:ke.data)!=null&&Q.response)){const Be={id:ke.data.message_id,senderId:ce,text:ke.data.response,timestamp:new Date,type:"response",highlighted:!1};u(Be),setTimeout(()=>{fe()},100),N(xe)}}}catch(te){console.error("Error generating AI response:",te),pe.error("Failed to generate AI response",{description:"There was a problem connecting to the server."})}finally{b(!1)}}};return a.jsxs("div",{className:"glass-panel rounded-xl p-4 flex flex-col h-full",children:[a.jsx("div",{className:"flex-1 min-h-0 mb-4",children:a.jsxs(o0,{className:"h-full pr-4",children:[a.jsxs("div",{className:"space-y-4",children:[de().map(E=>E.type==="message"?a.jsx(CEe,{message:E.data,persona:E.data.senderId!=="moderator"&&E.data.senderId!=="facilitator"?z(E.data.senderId):null,toggleHighlight:()=>l(E.data.id),participants:n,focusGroupId:i},E.data.id):a.jsx(IEe,{modeEvent:E.data},E.data.id)),x&&a.jsxs("div",{className:"flex items-center space-x-2 text-sm text-slate-500 animate-pulse",children:[a.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:a.jsx(di,{className:"h-4 w-4 text-primary"})}),a.jsx("span",{children:"Generating AI response..."})]}),a.jsx("div",{className:"h-8"}),a.jsx("div",{ref:P,className:"h-1"})]}),!_&&ae.length>6&&a.jsx("div",{className:"sticky bottom-5 ml-auto mr-5 z-10 w-fit",children:a.jsx(oe,{size:"sm",className:"rounded-full shadow-md h-10 w-10 p-0",onClick:fe,title:"Scroll to bottom",children:a.jsx($A,{className:"h-4 w-4"})})})]})}),a.jsx($Ee,{reasoningHistory:V,isVisible:ee,onToggle:()=>Z(!L),isAiMode:s}),a.jsxs("div",{className:"pt-4 border-t border-slate-200 w-full",children:[y&&a.jsxs("div",{className:"mb-2 p-2 bg-blue-50 border border-blue-200 rounded-md flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(FA,{className:"h-4 w-4 text-blue-600"}),a.jsx("span",{className:"text-sm text-blue-700",children:y.name}),a.jsxs("span",{className:"text-xs text-blue-500",children:["(",(y.size/1024/1024).toFixed(1)," MB)"]})]}),a.jsx(oe,{type:"button",variant:"ghost",size:"sm",onClick:ve,className:"h-6 w-6 p-0 text-blue-600 hover:text-blue-800",children:"ร—"})]}),a.jsxs("form",{onSubmit:Ne,className:"flex items-center gap-2 w-full",children:[a.jsx("input",{ref:j,type:"file",accept:"image/*",onChange:K,className:"hidden"}),a.jsx(a8,{value:h,onChange:(E,D)=>{p(E),m(D||null)},participants:n,placeholder:"Ask a question or provide guidance...",className:"flex-1 min-w-0",disabled:!1}),a.jsx(oe,{type:"button",variant:"outline",size:"sm",onClick:()=>{var E;return(E=j.current)==null?void 0:E.click()},className:"hover-transition shrink-0 px-3",disabled:!1,title:"Attach image for creative review",children:a.jsx(FA,{className:"h-4 w-4"})}),a.jsxs(oe,{type:"submit",variant:"default",className:"hover-transition shrink-0",disabled:!1,children:[a.jsx(pa,{className:"mr-2 h-4 w-4"}),"Send"]})]}),a.jsxs("div",{className:"flex justify-between items-center mt-3",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx("p",{className:"text-sm text-slate-500",children:r?"Speaking...":s?"AI mode active":"Manual moderation mode"}),a.jsx(oe,{variant:"outline",size:"sm",onClick:F?Xe:ie,disabled:T,className:`hover-transition ${F?"bg-red-50 text-red-600 hover:bg-red-100":"bg-blue-50 text-blue-600 hover:bg-blue-100"}`,title:F?"Stop AI mode and return to manual":"Start autonomous AI conversation",children:T?a.jsxs(a.Fragment,{children:[a.jsx(Tc,{className:"mr-1 h-3 w-3 animate-spin"}),s?"Stopping...":"Starting..."]}):F?a.jsxs(a.Fragment,{children:[a.jsx(Tc,{className:"mr-1 h-3 w-3"}),"Stop AI Mode"]}):a.jsxs(a.Fragment,{children:[a.jsx(Tc,{className:"mr-1 h-3 w-3"}),"Start AI Mode"]})}),a.jsxs(oe,{variant:"outline",size:"sm",onClick:()=>{A(!_),_||fe()},className:`hover-transition ${_?"bg-blue-50 text-blue-600 hover:bg-blue-100":""}`,title:_?"Disable auto-scroll":"Enable auto-scroll",children:[a.jsx($A,{className:`h-3 w-3 ${_?"mr-1":""}`}),_&&"Auto-scroll"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[!s&&a.jsxs(a.Fragment,{children:[a.jsxs(oe,{variant:"outline",onClick:Ee,className:`hover-transition ${n.length===0?"bg-red-50":""}`,disabled:x,title:n.length===0?"Add participants to the focus group first":"Advance to the next part of the discussion guide",children:[a.jsx(pa,{className:"mr-2 h-4 w-4"}),n.length===0?"No Participants":"Advance Discussion"]}),a.jsxs(oe,{variant:"ghost",size:"sm",onClick:$e,className:`hover-transition ${n.length===0?"bg-red-50":""}`,disabled:x||n.length===0,title:"Generate a participant response to the current topic",children:[a.jsx(di,{className:"mr-1 h-3 w-3"}),"Get Response"]})]}),s&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1 text-sm text-slate-600",children:[a.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full animate-pulse"}),a.jsx("span",{children:"AI Active"})]}),a.jsx(oe,{variant:"outline",size:"sm",onClick:()=>$(!O),className:"hover-transition",title:"Show autonomous conversation controls",children:a.jsx(SR,{className:"h-3 w-3"})})]})]})]})]})]})},REe=({themes:e,messages:t,personas:n=[],onThemeDelete:r,onQuoteClick:i})=>{const s=(d,f)=>{d.stopPropagation(),r&&(r(f),pe.success("Theme deleted successfully"))},o=d=>n.find(f=>f.id===d||f._id===d),l=d=>{let f=d;const h=d.match(/^\[MSG_ID:[^\]]+\]\s*(.*)$/);h&&(f=h[1]);const p=f.match(/^\[([^\]]+)\]:\s*(.*)$/);if(p)return{persona:p[1],text:p[2]};const g=f.match(/^([^:]+):\s*(.*)$/);return g&&g[1].trim()!==f.trim()?{persona:g[1].trim(),text:g[2]}:{persona:null,text:f}},c=e.filter(d=>"source"in d?d.source==="highlight":!0),u=e.filter(d=>"source"in d&&d.source==="generated");return a.jsxs("div",{className:"glass-panel rounded-xl p-6 h-[70vh] flex flex-col overflow-hidden",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(Nl,{className:"h-5 w-5 text-primary mr-2"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"Key Themes"})]}),a.jsxs("div",{className:"overflow-auto",children:[u.length>0&&a.jsxs("div",{className:"mb-8",children:[a.jsxs("div",{className:"flex items-center mb-3",children:[a.jsx(fa,{className:"h-4 w-4 text-primary mr-2"}),a.jsx("h3",{className:"font-medium",children:"AI-Generated Themes"})]}),a.jsx("div",{className:"grid grid-cols-1 gap-4 mb-4",children:u.map(d=>a.jsxs(Ge,{className:"hover:shadow-md transition-shadow relative group",children:[r&&a.jsx("button",{className:"absolute top-2 right-2 p-1 rounded-full bg-slate-200 opacity-0 group-hover:opacity-100 transition-opacity",onClick:f=>s(f,d.id),children:a.jsx(js,{className:"h-3 w-3 text-slate-700"})}),a.jsx($r,{className:"pb-2",children:a.jsx(Xr,{className:"text-base",children:d.title})}),a.jsxs(tt,{children:[a.jsx("p",{className:"text-sm text-slate-600 mb-2",children:d.description}),d.quotes&&d.quotes.length>0&&a.jsxs("div",{className:"mt-3",children:[a.jsx("h4",{className:"text-xs font-medium text-slate-700 mb-2",children:"Supporting Quotes:"}),a.jsx("div",{className:"space-y-2",children:d.quotes.map((f,h)=>{const p=typeof f=="object"&&f!==null,g=p?f.text:f,m=p?f.speaker:l(f).persona,x=p?f.message_id:void 0,b=p?f.original:f;return a.jsxs("div",{className:"bg-slate-50 p-2 rounded text-xs text-slate-600 border-l-2 border-slate-200 cursor-pointer hover:bg-slate-100 transition-colors",onClick:y=>{y.stopPropagation(),i&&i(p?f:b,x)},title:x?`Message ID: ${x}`:"Click to find original message",children:[m&&a.jsxs("span",{className:"font-semibold text-slate-700 mr-1",children:[m,":"]}),'"',g,'"',x&&a.jsx("span",{className:"ml-2 text-xs text-green-600 opacity-70",children:"โœ“"})]},h)})})]})]})]},d.id))})]}),c.length>0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center mb-3",children:[a.jsx(wG,{className:"h-4 w-4 text-primary mr-2"}),a.jsx("h3",{className:"font-medium",children:"Highlighted Comments"})]}),a.jsx("div",{className:"grid grid-cols-1 gap-4 mb-4",children:c.map(d=>{const f=d.messages.length>0?t.find(x=>x.id===d.messages[0]):null,h=(f==null?void 0:f.text)||d.text,p=h.length>200?h.substring(0,200)+"...":h,g=f==null?void 0:f.senderId;let m="";if(g==="moderator")m="AI Moderator";else if(g==="facilitator")m="Human Facilitator";else if(g){const x=o(g);m=(x==null?void 0:x.name)||"Unknown Participant"}return a.jsxs(Ge,{className:"hover:shadow-md hover:bg-slate-50 transition-all cursor-pointer relative group",onClick:x=>{x.stopPropagation(),i&&f&&i(f.text,f.id)},title:"Click to view in discussion",children:[r&&a.jsx("button",{className:"absolute top-2 right-2 p-1 rounded-full bg-slate-200 opacity-0 group-hover:opacity-100 transition-opacity z-10",onClick:x=>s(x,d.id),children:a.jsx(js,{className:"h-3 w-3 text-slate-700"})}),a.jsx($r,{className:"pb-2",children:a.jsx(Xr,{className:"text-sm font-medium text-slate-800 line-clamp-2",children:m&&a.jsx("span",{className:"text-primary font-semibold",children:m})})}),a.jsxs(tt,{className:"pt-0",children:[a.jsxs("p",{className:"text-sm text-slate-600 leading-relaxed",children:['"',p,'"']}),a.jsxs("div",{className:"mt-2 flex items-center text-xs text-slate-400",children:[a.jsx(di,{className:"h-3 w-3 mr-1"}),"Click to view in discussion"]})]})]},d.id)})})]}),e.length===0&&a.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center bg-slate-50 rounded-lg",children:[a.jsx(Nl,{className:"h-8 w-8 text-slate-400 mb-3"}),a.jsx("p",{className:"text-slate-600",children:"No themes have been identified yet."}),a.jsx("p",{className:"text-sm text-slate-500 mt-2",children:"Highlight important messages in the discussion or generate themes automatically."})]})]})]})},DEe=({themes:e,messages:t,personas:n,focusGroupId:r,onThemesGenerated:i,onThemeDelete:s,onQuoteClick:o,onGenerateKeyThemes:l})=>{const c=()=>{if(!e||e.length===0){pe.warning("No themes to export",{description:"Generate some themes first before exporting."});return}let u=`# Key Themes Analysis - -`;const d=e.filter(g=>"source"in g&&g.source==="generated");if(d.length===0){pe.warning("No AI-generated themes to export",{description:"Only AI-generated themes are included in the export."});return}d.forEach((g,m)=>{u+=`## ${m+1}. ${g.title} - -`,u+=`${g.description} - -`,g.quotes&&g.quotes.length>0&&(u+=`**Supporting Quotes:** - -`,g.quotes.forEach(x=>{u+=`> ${x} - -`})),u+=`--- - -`});const f=new Blob([u],{type:"text/markdown"}),h=URL.createObjectURL(f),p=document.createElement("a");p.href=h,p.download=`key-themes-${new Date().toISOString().split("T")[0]}.md`,document.body.appendChild(p),p.click(),document.body.removeChild(p),URL.revokeObjectURL(h),pe.success("Themes exported successfully",{description:`Downloaded ${d.length} themes as markdown file.`})};return a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{className:"mb-4 space-y-2",children:[a.jsxs(oe,{onClick:l,className:"w-full",children:[a.jsx(TG,{className:"mr-2 h-4 w-4"}),"Analyze Discussion for Key Themes"]}),a.jsxs(oe,{onClick:c,disabled:!e||e.length===0,variant:"outline",className:"w-full",children:[a.jsx(Ku,{className:"mr-2 h-4 w-4"}),"Export Themes"]})]}),a.jsx("div",{className:"flex-grow overflow-hidden",children:a.jsx(REe,{themes:e,messages:t,personas:n,onThemeDelete:s,focusGroupId:r,onQuoteClick:o})})]})},LEe=({messages:e,themes:t,personas:n=[]})=>{var g;const[r,i]=v.useState([{name:"Very Positive",value:0,color:"#4ade80"},{name:"Positive",value:0,color:"#a3e635"},{name:"Neutral",value:0,color:"#93c5fd"},{name:"Negative",value:0,color:"#fb923c"},{name:"Very Negative",value:0,color:"#f87171"}]),[s,o]=v.useState([]),[l,c]=v.useState({}),[u,d]=v.useState({isBalanced:!1,score:0,reason:""}),f=m=>{const x=n.find(b=>b.id===m);return x?x.name:`Participant ${m}`};v.useEffect(()=>{if(e.length===0)return;const m={"Very Positive":0,Positive:0,Neutral:0,Negative:0,"Very Negative":0},x={},b={};e.forEach(j=>{if(j.senderId!=="moderator"&&j.senderId!=="facilitator"){const S=j.text.toLowerCase();let N="Neutral";S.includes("love")||S.includes("excellent")||S.includes("amazing")?N="Very Positive":S.includes("good")||S.includes("like")||S.includes("great")?N="Positive":S.includes("bad")||S.includes("issue")||S.includes("problem")?N="Negative":(S.includes("terrible")||S.includes("hate")||S.includes("awful"))&&(N="Very Negative"),m[N]++,b[j.senderId]||(b[j.senderId]={"Very Positive":0,Positive:0,Neutral:0,Negative:0,"Very Negative":0}),b[j.senderId][N]++,x[j.senderId]=(x[j.senderId]||0)+1}}),i(j=>j.map(S=>({...S,value:m[S.name]||0})));const y=Object.entries(x).map(([j,S])=>({name:f(j),messages:S}));o(y);const w={};Object.entries(b).forEach(([j,S])=>{w[j]={name:f(j),sentiments:S}}),c(w),h(x,b)},[e,n,f]);const h=(m,x)=>{if(Object.keys(m).length===0){d({isBalanced:!1,score:0,reason:"No participant data available"});return}const y=Object.values(m).reduce((V,I)=>V+I,0)/Object.keys(m).length,w=Object.values(m).map(V=>Math.abs(V-y)/y),j=w.reduce((V,I)=>V+I,0)/w.length,S=Object.values(x).map(V=>Object.values(V).filter(I=>I>0).length),N=S.reduce((V,I)=>V+I,0)/S.length,P=["Very Positive","Positive","Neutral","Negative","Very Negative"],_=Object.values(x).map(V=>{const I=Math.max(...Object.values(V));return P.find(L=>V[L]===I)||"Neutral"}),A=new Set(_).size,O=A/P.length,$=Math.max(0,100-j*100),T=N/5*100,M=O*100,R=Math.round($*.6+T*.2+M*.2);let H="";const F=R>=70;j>.3&&(H+="Participation is uneven among participants. "),N<2&&(H+="Limited range of sentiments expressed. "),A<=1?H+="Participants show similar sentiment patterns, suggesting potential group-think. ":A>=4&&(H+="Wide divergence in participant sentiments, showing healthy diversity of opinions. "),H===""&&(H=F?"Good mix of participation and diverse opinions.":"Multiple factors affecting balance."),d({isBalanced:F,score:R,reason:H})},p=m=>{const x=l[m];if(!x)return"N/A";const b=x.sentiments;let y=0,w="Neutral";return Object.entries(b).forEach(([j,S])=>{S>y&&(y=S,w=j)}),w};return a.jsx("div",{className:"glass-panel rounded-xl p-4",children:a.jsxs(Io,{defaultValue:"sentiment",children:[a.jsxs(Sa,{className:"grid grid-cols-2 mb-4",children:[a.jsxs(Ft,{value:"sentiment",className:"flex items-center",children:[a.jsx(lG,{className:"h-4 w-4 mr-2"}),"Sentiment"]}),a.jsxs(Ft,{value:"participation",className:"flex items-center",children:[a.jsx(zw,{className:"h-4 w-4 mr-2"}),"Participation"]})]}),a.jsx(Bt,{value:"sentiment",children:a.jsx(Ge,{children:a.jsxs(tt,{className:"pt-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"Sentiment Analysis"}),a.jsxs("div",{className:`px-3 py-1 rounded-full text-sm ${u.isBalanced?"bg-green-100 text-green-800":"bg-amber-100 text-amber-800"}`,children:["Balance score: ",u.score,"/100"]})]}),a.jsx("div",{className:"h-60",children:a.jsx(ra,{width:"100%",height:"100%",children:a.jsxs(UP,{children:[a.jsx(cr,{}),a.jsx(os,{data:r,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,label:({name:m,percent:x})=>x>0?`${m} ${(x*100).toFixed(0)}%`:"",children:r.map((m,x)=>a.jsx($p,{fill:m.color},`cell-${x}`))}),a.jsx(na,{})]})})}),a.jsxs("div",{className:"mt-4",children:[a.jsx("h4",{className:"text-sm font-medium mb-2",children:"Sentiment by Participant"}),a.jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto pr-2",children:Object.entries(l).map(([m,x])=>{var w;const b=p(m),y=((w=r.find(j=>j.name===b))==null?void 0:w.color)||"#93c5fd";return a.jsxs("div",{className:"flex items-center justify-between p-2 bg-slate-50 rounded",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(Og,{className:"h-4 w-4 text-slate-400 mr-2"}),a.jsx("span",{className:"text-sm",children:x.name})]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx("span",{className:"text-xs mr-2",children:"Predominant:"}),a.jsx("span",{className:"text-xs font-medium px-2 py-0.5 rounded",style:{backgroundColor:`${y}30`,color:y},children:b})]})]},m)})})]}),a.jsxs("div",{className:"mt-4 pt-4 border-t",children:[a.jsx("h4",{className:"text-sm font-medium mb-2",children:"Focus Group Balance Assessment"}),a.jsxs("div",{className:`p-3 rounded text-sm ${u.isBalanced?"bg-green-50 text-green-700":"bg-amber-50 text-amber-700"}`,children:[a.jsx("span",{className:"font-medium",children:u.isBalanced?"Balanced Focus Group":"Potential Balance Issues"}),a.jsx("p",{className:"mt-1 text-xs",children:u.reason})]})]})]})})}),a.jsx(Bt,{value:"participation",children:a.jsx(Ge,{children:a.jsxs(tt,{className:"pt-6",children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Participation Distribution"}),a.jsx("div",{className:"h-60",children:a.jsx(ra,{width:"100%",height:"100%",children:a.jsxs(Vz,{data:s,layout:"vertical",margin:{top:5,right:30,left:20,bottom:5},children:[a.jsx(tp,{strokeDasharray:"3 3"}),a.jsx(_o,{type:"number"}),a.jsx(Po,{dataKey:"name",type:"category",width:100}),a.jsx(cr,{}),a.jsx(Fo,{dataKey:"messages",fill:"#8884d8",name:"Messages"})]})})}),a.jsx("p",{className:"text-sm text-muted-foreground mt-4",children:s.length>0?`Most active: ${(g=s.sort((m,x)=>x.messages-m.messages)[0])==null?void 0:g.name}`:"No participation data available"})]})})})]})})},FEe=({focusGroupId:e,personas:t,isVisible:n,onToggle:r})=>{const[i,s]=v.useState(null),[o,l]=v.useState(null),[c,u]=v.useState(null),[d,f]=v.useState(null),[h,p]=v.useState(!1),[g,m]=v.useState(null),[x,b]=v.useState(null);v.useEffect(()=>{if(n&&e){y();const P=setInterval(y,3e4);return()=>clearInterval(P)}},[n,e]);const y=async()=>{p(!0),m(null);try{const[P,_,A,O]=await Promise.allSettled([fn.getConversationAnalytics(e),fn.getConversationState(e),fn.getAutonomousConversationStatus(e),fn.getConversationInsights(e)]);P.status==="fulfilled"&&s(P.value.data.analytics),_.status==="fulfilled"&&l(_.value.data.state),A.status==="fulfilled"&&u(A.value.data.status),O.status==="fulfilled"&&f(O.value.data.insights),b(new Date)}catch(P){console.error("Error fetching dashboard data:",P),m("Failed to load dashboard data")}finally{p(!1)}},w=()=>{y()},j=P=>{switch(P){case"running":return"bg-green-500";case"paused":return"bg-amber-500";case"completed":return"bg-blue-500";case"error":return"bg-red-500";default:return"bg-gray-500"}},S=P=>{switch(P){case"positive":return"text-green-600";case"negative":return"text-red-600";default:return"text-gray-600"}},N=P=>{switch(P){case"excellent":return"text-green-600";case"good":return"text-blue-600";case"fair":return"text-amber-600";case"poor":return"text-red-600";default:return"text-gray-600"}};return n?a.jsxs("div",{className:"fixed right-4 top-4 bottom-4 w-80 bg-white rounded-lg shadow-lg border border-gray-200 flex flex-col overflow-hidden z-50",children:[a.jsxs("div",{className:"p-4 border-b border-gray-200 bg-gray-50",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Tc,{className:"h-5 w-5 text-blue-600"}),a.jsx("h3",{className:"font-semibold text-gray-900",children:"AI Dashboard"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(oe,{variant:"ghost",size:"sm",onClick:w,disabled:h,className:"p-1",children:a.jsx($c,{className:`h-4 w-4 ${h?"animate-spin":""}`})}),a.jsx(oe,{variant:"ghost",size:"sm",onClick:r,className:"p-1",children:a.jsx(hG,{className:"h-4 w-4"})})]})]}),x&&a.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Last updated: ",x.toLocaleTimeString()]})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[g&&a.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(cG,{className:"h-4 w-4 text-red-600"}),a.jsx("span",{className:"text-sm text-red-800",children:g})]})}),c&&a.jsxs(Ge,{children:[a.jsx($r,{className:"pb-3",children:a.jsxs(Xr,{className:"text-sm flex items-center gap-2",children:[a.jsx("div",{className:`w-3 h-3 rounded-full ${j(c.conversation_state)}`}),"Autonomous Status"]})}),a.jsx(tt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"State:"}),a.jsx(lr,{variant:c.conversation_state==="running"?"default":"secondary",children:c.conversation_state})]}),a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Actions:"}),a.jsx("span",{className:"font-medium",children:c.action_count||0})]})]})})]}),o&&a.jsxs(Ge,{children:[a.jsx($r,{className:"pb-3",children:a.jsxs(Xr,{className:"text-sm flex items-center gap-2",children:[a.jsx(Hs,{className:"h-4 w-4"}),"Conversation Health"]})}),a.jsx(tt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-sm",children:"Overall Health:"}),a.jsx(lr,{className:N(o.conversation_health.status),children:o.conversation_health.status})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Score:"}),a.jsxs("span",{className:"font-medium",children:[o.conversation_health.score,"/100"]})]}),a.jsx(tl,{value:o.conversation_health.score,className:"h-2"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("span",{className:"text-xs text-gray-600",children:"Indicators:"}),a.jsx("div",{className:"flex flex-wrap gap-1",children:o.conversation_health.indicators.map((P,_)=>a.jsx(lr,{variant:"outline",className:"text-xs",children:P.replace("_"," ")},_))})]})]})})]}),i&&a.jsxs(Ge,{children:[a.jsx($r,{className:"pb-3",children:a.jsxs(Xr,{className:"text-sm flex items-center gap-2",children:[a.jsx(Hn,{className:"h-4 w-4"}),"Participation"]})}),a.jsx(tt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-lg font-semibold text-blue-600",children:i.overview.active_participants}),a.jsx("div",{className:"text-xs text-gray-600",children:"Active"})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-lg font-semibold text-green-600",children:i.overview.participant_messages}),a.jsx("div",{className:"text-xs text-gray-600",children:"Messages"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Balance:"}),a.jsx(lr,{variant:i.participation.participation_balance==="balanced"?"default":"secondary",children:i.participation.participation_balance.replace("_"," ")})]}),i.participation.dominant_participants.length>0&&a.jsxs("div",{className:"text-xs text-amber-600",children:["Dominant: ",i.participation.dominant_participants.length," participant(s)"]}),i.participation.quiet_participants.length>0&&a.jsxs("div",{className:"text-xs text-blue-600",children:["Quiet: ",i.participation.quiet_participants.length," participant(s)"]})]})]})})]}),i&&a.jsxs(Ge,{children:[a.jsx($r,{className:"pb-3",children:a.jsxs(Xr,{className:"text-sm flex items-center gap-2",children:[a.jsx(OG,{className:"h-4 w-4"}),"Sentiment"]})}),a.jsx(tt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-sm",children:"Overall:"}),a.jsx(lr,{className:S(i.sentiment_analysis.overall_sentiment),children:i.sentiment_analysis.overall_sentiment})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-xs",children:[a.jsxs("span",{children:["Positive: ",i.sentiment_analysis.sentiment_distribution.positive]}),a.jsxs("span",{children:["Neutral: ",i.sentiment_analysis.sentiment_distribution.neutral]}),a.jsxs("span",{children:["Negative: ",i.sentiment_analysis.sentiment_distribution.negative]})]}),a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Trend:"}),a.jsx("span",{className:"font-medium",children:i.sentiment_analysis.sentiment_trend})]})]})]})})]}),i&&a.jsxs(Ge,{children:[a.jsx($r,{className:"pb-3",children:a.jsxs(Xr,{className:"text-sm flex items-center gap-2",children:[a.jsx(oG,{className:"h-4 w-4"}),"Quality Metrics"]})}),a.jsx(tt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Engagement:"}),a.jsxs("span",{className:"font-medium",children:[Math.round(i.quality_metrics.engagement_score),"/100"]})]}),a.jsx(tl,{value:i.quality_metrics.engagement_score,className:"h-2"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Depth:"}),a.jsxs("span",{className:"font-medium",children:[Math.round(i.quality_metrics.depth_score),"/100"]})]}),a.jsx(tl,{value:i.quality_metrics.depth_score,className:"h-2"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Overall:"}),a.jsxs("span",{className:"font-medium",children:[Math.round(i.quality_metrics.quality_score),"/100"]})]}),a.jsx(tl,{value:i.quality_metrics.quality_score,className:"h-2"})]})]})})]}),d&&a.jsxs(Ge,{children:[a.jsx($r,{className:"pb-3",children:a.jsxs(Xr,{className:"text-sm flex items-center gap-2",children:[a.jsx(Nl,{className:"h-4 w-4"}),"AI Insights"]})}),a.jsx(tt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Energy:"}),a.jsx(lr,{variant:d.conversation_energy==="high"?"default":"secondary",children:d.conversation_energy})]}),a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Engagement:"}),a.jsx(lr,{variant:d.topic_engagement==="high"?"default":"secondary",children:d.topic_engagement})]}),d.next_suggested_action&&a.jsx("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-2 mt-2",children:a.jsxs("div",{className:"text-xs text-blue-800",children:[a.jsx("strong",{children:"Suggestion:"})," ",d.next_suggested_action]})})]})})]}),i&&i.recommendations.length>0&&a.jsxs(Ge,{children:[a.jsx($r,{className:"pb-3",children:a.jsxs(Xr,{className:"text-sm flex items-center gap-2",children:[a.jsx(Cg,{className:"h-4 w-4"}),"Recommendations"]})}),a.jsx(tt,{className:"pt-0",children:a.jsx("div",{className:"space-y-2",children:i.recommendations.map((P,_)=>a.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-2",children:a.jsx("div",{className:"text-xs text-amber-800",children:P})},_))})})]})]})]}):null},BEe=({discussionGuide:e,moderatorStatus:t,onSectionSelect:n,onSetPosition:r,onSave:i,focusGroupId:s,isOpen:o,onToggle:l,className:c,onEditingChange:u})=>{console.log("๐Ÿ“‹ CollapsibleDiscussionGuide render",{isOpen:o,hasModerator:!!t,guideTitle:e==null?void 0:e.title,timestamp:new Date().toISOString()});const[d,f]=v.useState(!1),h=async()=>{if(!e){pe.error("No discussion guide available",{description:"The discussion guide is not available for download"});return}f(!0);try{await At.downloadDiscussionGuide(s),pe.success("Discussion guide downloaded",{description:"The guide has been saved to your downloads folder"})}catch(g){console.error("Error downloading discussion guide:",g),pe.error("Download failed",{description:"Unable to download the discussion guide. Please try again."})}finally{f(!1)}},p=e&&typeof e=="object"&&e.sections;return a.jsx("div",{className:Me("w-full border-b bg-white shadow-sm",c),children:a.jsxs(xp,{open:o,onOpenChange:l,children:[a.jsx(bp,{asChild:!0,children:a.jsxs("div",{className:"w-full px-4 py-3 flex items-center justify-between hover:bg-slate-50 transition-colors cursor-pointer",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(fG,{className:"h-5 w-5 text-slate-600"}),a.jsxs("div",{children:[a.jsx("h2",{className:"font-semibold text-slate-900",children:"Discussion Guide"}),p&&a.jsxs("p",{className:"text-xs text-slate-500",children:[e.title," โ€ข ",e.total_duration," minutes"]})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(oe,{variant:"ghost",size:"sm",onClick:g=>{g.stopPropagation(),h()},disabled:!e||d,className:"h-8",children:d?a.jsx(_l,{className:"h-4 w-4 animate-spin"}):a.jsx(Ku,{className:"h-4 w-4"})}),o?a.jsx(pp,{className:"h-4 w-4 text-slate-500"}):a.jsx(ja,{className:"h-4 w-4 text-slate-500"})]})]})}),a.jsx(wp,{children:a.jsx("div",{className:"border-t bg-slate-50",children:a.jsx(Ge,{className:"mx-4 mb-4 mt-2",children:a.jsx(tt,{className:"p-4",children:a.jsx("div",{className:"max-h-[70vh] overflow-y-auto",children:a.jsx(I5,{discussionGuide:e,moderatorStatus:t,onSectionSelect:n,onSetPosition:r,onSave:i,showProgress:!0,collapsible:!0,focusGroupId:s})})})})})})]})})},zEe=C.memo(BEe,(e,t)=>{const n=["discussionGuide","onSectionSelect","onSave","focusGroupId","isOpen","onToggle","className"];let r=!1;for(const i of n)if(e[i]!==t[i]){r=!0;break}return e.moderatorStatus!==t.moderatorStatus&&!r||!r&&e.moderatorStatus===t.moderatorStatus?!0:(console.log("๐Ÿ”„ Will re-render (props changed)",{changedProps:n.filter(i=>e[i]!==t[i]),timestamp:new Date().toISOString()}),!1)}),UEe=({focusGroupId:e,focusGroupName:t="Focus Group",onNoteClick:n})=>{const[r,i]=v.useState([]),[s,o]=v.useState(!0),[l,c]=v.useState(null);v.useEffect(()=>{u()},[e]);const u=async()=>{try{o(!0);const y=await At.getNotes(e);if(y.data&&Array.isArray(y.data)){const w=y.data.map(j=>({...j,timestamp:new Date(j.timestamp),createdAt:new Date(j.createdAt)}));i(x(w))}}catch(y){console.error("Error fetching notes:",y),pe.error("Failed to load notes",{description:"Please refresh the page to try again."})}finally{o(!1)}},d=async y=>{c(y);try{await At.deleteNote(e,y),i(r.filter(w=>w.id!==y)),pe.success("Note deleted successfully")}catch(w){console.error("Error deleting note:",w),pe.error("Failed to delete note",{description:"Please try again."})}finally{c(null)}},f=y=>{y.associatedMessageId&&n?n(y.associatedMessageId):pe.info("No associated message",{description:"This note is not linked to a specific discussion point."})},h=()=>{if(r.length===0){pe.warning("No notes to export",{description:"Create some notes first before exporting."});return}const y=p(),w=document.createElement("a"),j=new Blob([y],{type:"text/markdown"});w.href=URL.createObjectURL(j),w.download=`${t.replace(/[^a-z0-9]/gi,"_").toLowerCase()}_notes.md`,document.body.appendChild(w),w.click(),document.body.removeChild(w),pe.success("Notes exported successfully",{description:`Downloaded ${r.length} notes as Markdown file.`})},p=()=>{const y=[`# Notes: ${t}`,"",`Exported on: ${new Date().toLocaleString()}`,`Total notes: ${r.length}`,"","---",""];return r.forEach((w,j)=>{var S;y.push(`## Note ${j+1}`),y.push(""),y.push(`**Created:** ${w.createdAt.toLocaleString()}`),(S=w.sectionInfo)!=null&&S.sectionTitle&&y.push(`**Section:** ${w.sectionInfo.sectionTitle}`),y.push(`**Elapsed Time:** ${g(w.elapsedTime)}`),y.push(""),y.push("**Content:**"),y.push(w.content),y.push(""),y.push("---"),y.push("")}),y.join(` -`)},g=y=>{const w=Math.floor(y/1e3),j=Math.floor(w/60),S=w%60;return`${j}:${S.toString().padStart(2,"0")}`},m=y=>y.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),x=y=>[...y].sort((w,j)=>j.createdAt.getTime()-w.createdAt.getTime()),b=y=>{i(w=>x([...w,y]))};return v.useEffect(()=>(window.notesPanelAddNote=b,()=>{delete window.notesPanelAddNote}),[]),s?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(Eg,{className:"h-5 w-5 text-primary mr-2"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"Notes"}),r.length>0&&a.jsxs("span",{className:"ml-2 text-sm text-slate-500",children:["(",r.length,")"]})]}),a.jsxs(oe,{variant:"outline",size:"sm",onClick:h,disabled:r.length===0,children:[a.jsx(Ku,{className:"mr-2 h-4 w-4"}),"Export Notes"]})]}),a.jsx(o0,{className:"flex-1",children:r.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center bg-slate-50 rounded-lg",children:[a.jsx(Eg,{className:"h-8 w-8 text-slate-400 mb-3"}),a.jsx("p",{className:"text-slate-600",children:"No notes yet."}),a.jsx("p",{className:"text-sm text-slate-500 mt-2",children:'Click the "Note" button during the session to add contextual notes.'})]}):a.jsx("div",{className:"space-y-4",children:r.map(y=>{var w;return a.jsxs(Ge,{className:"hover:shadow-md transition-shadow cursor-pointer group",onClick:()=>f(y),children:[a.jsx($r,{className:"pb-2",children:a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(Xr,{className:"text-sm font-medium text-slate-600",children:m(y.createdAt)}),((w=y.sectionInfo)==null?void 0:w.sectionTitle)&&a.jsx("div",{className:"text-xs text-slate-500 mt-1",children:a.jsx("span",{children:y.sectionInfo.sectionTitle})})]}),a.jsxs("div",{className:"flex items-center space-x-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[y.associatedMessageId&&a.jsx(oe,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:j=>{j.stopPropagation(),f(y)},title:"Go to discussion point",children:a.jsx(SG,{className:"h-3 w-3"})}),a.jsx(oe,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-red-600 hover:text-red-700",onClick:j=>{j.stopPropagation(),d(y.id)},disabled:l===y.id,title:"Delete note",children:a.jsx(gn,{className:"h-3 w-3"})})]})]})}),a.jsx(tt,{className:"pt-0",children:a.jsx("p",{className:"text-sm text-slate-700 whitespace-pre-wrap",children:y.content})})]},y.id)})})})]})},VEe=({isOpen:e,onClose:t,focusGroupId:n,associatedMessageId:r,sectionInfo:i,messageTimestamp:s,onNoteSaved:o})=>{const[l,c]=v.useState(""),[u,d]=v.useState(!1),f=async()=>{if(!l.trim()){pe.error("Note content cannot be empty");return}d(!0);try{const p={content:l.trim(),associatedMessageId:r,sectionInfo:i,elapsedTime:0,timestamp:s.toISOString(),createdAt:new Date().toISOString()},g=await At.createNote(n,p);if(g.data){const m={...g.data,timestamp:new Date(g.data.timestamp),createdAt:new Date(g.data.createdAt)},x=i!=null&&i.sectionTitle?`'${i.sectionTitle}'`:"current section",b=s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});pe.success("Quick note saved",{description:`Note linked to ${x} at ${b}`}),o&&o(m),c(""),t()}}catch(p){console.error("Error saving note:",p),pe.error("Failed to save note",{description:"Please try again or check your connection."})}finally{d(!1)}},h=()=>{c(""),t()};return a.jsx(cu,{open:e,onOpenChange:h,children:a.jsxs(kl,{className:"sm:max-w-md",children:[a.jsx(Tl,{children:a.jsx($l,{children:"Quick Note"})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"text-sm text-slate-600",children:[a.jsxs("div",{children:[a.jsx("strong",{children:"Section:"})," ",(i==null?void 0:i.sectionTitle)||"Unknown section"]}),a.jsxs("div",{children:[a.jsx("strong",{children:"Time:"})," ",s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),a.jsx(Qe,{placeholder:"Enter your note here...",value:l,onChange:p=>c(p.target.value),className:"min-h-[100px] resize-none",autoFocus:!0})]}),a.jsxs(uu,{children:[a.jsx(oe,{variant:"outline",onClick:h,disabled:u,children:"Cancel"}),a.jsx(oe,{onClick:f,disabled:u,children:u?"Saving...":"Save Note"})]})]})})},WEe=()=>{const{id:e}=hR(),t=Cn(),[n,r]=v.useState([]),[i,s]=v.useState([]),[o,l]=v.useState([]),[c,u]=v.useState(null),[d,f]=v.useState([]),[h,p]=v.useState("chat"),[g,m]=v.useState(null),[x,b]=v.useState(!1),[y,w]=v.useState(!1),[j,S]=v.useState(!0),[N,P]=v.useState(!1),[_,A]=v.useState(!1),O=v.useRef(!1),[$,T]=v.useState([]),[M,R]=v.useState(!1),[H,F]=v.useState(null),[V,I]=v.useState([]),[L,Z]=v.useState(!1),[ee,re]=v.useState(!1),[me,z]=v.useState(!1),[ae,de]=v.useState({isOpen:!1}),fe=v.useRef(!1),[Ne,he]=v.useState(""),ue=v.useRef(""),Ee=v.useRef(!1),ie=async()=>{var G;if(e)try{const q=await fn.getModeratorStatus(e);if((G=q==null?void 0:q.data)!=null&&G.status){const k=q.data.status;if(g){const B=g.current_section_id!==k.current_section_id||g.current_item_id!==k.current_item_id||g.progress!==k.progress}O.current||m(k)}}catch(q){console.error("Error fetching moderator status:",q)}},Xe=async()=>{if(!e)return{aiActive:!1,sessionStatus:""};try{if(typeof(At==null?void 0:At.getById)!="function")return console.error("focusGroupsApi.getById is not a function:",typeof(At==null?void 0:At.getById)),{aiActive:y,sessionStatus:Ne};const G=await At.getById(e);if(!G||typeof G!="object")return console.error("Invalid response object received:",G),{aiActive:y,sessionStatus:Ne};if(!G.data||typeof G.data!="object")return console.warn("Focus group response missing data property:",G),{aiActive:y,sessionStatus:Ne};const q=G.data.status;if(typeof q>"u")return console.warn("Focus group response missing status field:",G.data),{aiActive:y,sessionStatus:Ne};const k=q==="ai_mode";return q==="autonomous_active"?console.warn('Detected legacy "autonomous_active" status - backend may need updating to "ai_mode"'):["ai_mode","active","completed","paused","draft","in-progress"].includes(q)||console.warn("Unexpected focus group status value:",q),{aiActive:k,sessionStatus:q}}catch(G){console.error("Error checking AI mode status:",G);const q={focusGroupId:e,currentAiModeStatus:y,errorType:"unknown",timestamp:new Date().toISOString()};return G.response?(q.errorType="api_error",q.status=G.response.status,q.data=G.response.data,console.error("API error response:",G.response.status,G.response.data),G.response.status===404?console.warn("Focus group not found - may have been deleted"):G.response.status===500&&console.error("Server error during status check - backend issue")):G.request?(q.errorType="network_error",console.error("Network error - no response received, check connectivity")):(q.errorType="request_setup",q.message=G.message,console.error("Request setup error:",G.message)),console.debug("Status check error details:",q),{aiActive:y,sessionStatus:Ne}}},K=async(G,q)=>{if(!e||Ee.current)return;const k=["completed","paused"],W=["ai_mode","autonomous_active","active","in-progress"].includes(q),ne=k.includes(G);if(W&&ne){Ee.current=!0;try{let J="session_ended";G==="completed"?J="auto_complete":G==="paused"&&(J="manual_stop");const ye=await fn.endSession(e,J);ye!=null&&ye.data&&(Ze.success("Session concluded",{description:"The focus group session has ended with a concluding statement from the moderator."}),setTimeout(()=>{ve()},1e3))}catch(J){console.error("โŒ Error ending session with concluding statement:",J),Ze.error("Error ending session",{description:"Failed to add concluding statement, but the session has ended."})}}},ve=async()=>{var G;if(e)try{const q=await At.getMessages(e);let k=[],B=[];q&&q.data&&(Array.isArray(q.data)?(k=q.data,B=[]):q.data.messages||q.data.mode_events?(k=q.data.messages||[],B=q.data.mode_events||[]):(k=Array.isArray(q.data)?q.data:[],B=[]));const W=k.map(se=>({id:se._id||se.id||`msg-${Date.now()}`,senderId:se.senderId,text:se.text,timestamp:new Date(se.timestamp||se.created_at||new Date),type:se.type||"response",highlighted:se.highlighted||!1})),ne=B.map(se=>({id:se._id||se.id||`event-${Date.now()}`,focus_group_id:se.focus_group_id,event_type:se.event_type,timestamp:new Date(se.timestamp||se.created_at||new Date),user_id:se.user_id,created_at:new Date(se.created_at||new Date)}));s(ne),W.length>0?r(se=>{if(se.length===0)return W;{const Pe=new Map;se.forEach(Ct=>Pe.set(Ct.id,Ct));const _e=W.map(Ct=>{if(Pe.has(Ct.id)){const pt=Pe.get(Ct.id);return{...Ct,highlighted:pt.highlighted}}return Ct}),et=new Set(_e.map(Ct=>Ct.id)),Ie=se.filter(Ct=>!et.has(Ct.id));return[..._e,...Ie].sort((Ct,pt)=>Ct.timestamp.getTime()-pt.timestamp.getTime())}}):W.length===0&&r(se=>se.length===0?[]:se);const J=W.filter(se=>se.highlighted),ye=J.length>0?J.map(se=>({id:`theme-${se.id}`,text:se.text.substring(0,40)+(se.text.length>40?"...":""),count:1,messages:[se.id],source:"highlight"})):[];try{const se=await fn.getKeyThemes(e);if((G=se==null?void 0:se.data)!=null&&G.themes&&Array.isArray(se.data.themes)){const Pe=se.data.themes;l([...ye,...Pe])}else l(ye)}catch(se){console.error("Error fetching AI-generated themes:",se),l(ye)}}catch(q){console.error("Error fetching messages:",q),n.length===0&&Ze.error("Failed to fetch messages",{description:"Please try again later or restart the session."})}},Se=async()=>{if(!e)return!1;try{const q=(await Nn.getAll()).data||[],k=await At.getById(e);if(k&&k.data){const B=k.data;console.log("Focus group data from API:",B);const W={id:B._id||B.id,name:B.name,status:B.status||"in-progress",participants:B.participants||[],date:B.date||new Date().toISOString(),duration:B.duration||60,topic:B.topic||"general",discussionGuide:B.discussionGuide||""};if(u(W),B.participants_data&&Array.isArray(B.participants_data))f(B.participants_data.map(J=>({...J,id:J._id||J.id})));else if(W.participants&&Array.isArray(W.participants)){console.log("Matching participants from DB:",{focusGroupParticipants:W.participants,allPersonas:q.map(ye=>({id:ye._id||ye.id,name:ye.name}))});const J=q.filter(ye=>{const se=ye._id||ye.id;return W.participants.includes(se)});console.log("Matched participants:",J.map(ye=>ye.name)),f(J)}await ve(),await ie();const ne=await Xe();return w(ne.aiActive),he(ne.sessionStatus),fe.current=ne.aiActive,ue.current=ne.sessionStatus,!0}return!1}catch(G){return console.error("Error fetching focus group:",G),!1}};v.useEffect(()=>{console.log("Looking for focus group with ID:",e);const G=async()=>{try{return(await Nn.getAll()).data||[]}catch(W){return console.error("Error fetching personas:",W),[]}},q=async W=>{try{const ne=await At.getById(e);if(ne&&ne.data){const J=ne.data;console.log("Focus group data from API:",J);const ye={id:J._id||J.id,name:J.name,status:J.status||"in-progress",participants:J.participants||[],date:J.date||new Date().toISOString(),duration:J.duration||60,topic:J.topic||"general",discussionGuide:J.discussionGuide||""};if(u(ye),J.participants_data&&Array.isArray(J.participants_data))f(J.participants_data.map(se=>({...se,id:se._id||se.id})));else if(ye.participants&&Array.isArray(ye.participants)){console.log("Matching participants from DB:",{focusGroupParticipants:ye.participants,allPersonas:W.map(Pe=>({id:Pe._id||Pe.id,name:Pe.name}))});const se=W.filter(Pe=>{const _e=Pe._id||Pe.id;return ye.participants.includes(_e)});console.log("Matched participants:",se.map(Pe=>Pe.name)),f(se)}return ve(),ie(),S(!1),!0}return!1}catch(ne){return console.error("Error fetching focus group:",ne),!1}};let k,B;return G().then(W=>{q(W).then(ne=>{ne?((()=>{ve(),ie(),k&&window.clearInterval(k);const se=y?3e3:1e4;console.log("๐Ÿ“ก Setting up message polling:",{aiModeActive:y,pollInterval:se,timestamp:new Date().toISOString()}),k=window.setInterval(()=>{O.current?console.log("๐Ÿ“ก Skipping poll - editing discussion guide"):(console.log("๐Ÿ“ก Polling for messages...",new Date().toISOString()),ve(),ie())},se)})(),B=window.setInterval(async()=>{const se=fe.current,Pe=ue.current,_e=await Xe();if(fe.current=_e.aiActive,ue.current=_e.sessionStatus,w(_e.aiActive),he(_e.sessionStatus),Pe&&Pe!==_e.sessionStatus&&await K(_e.sessionStatus,Pe),se!==_e.aiActive&&k){window.clearInterval(k);const et=_e.aiActive?3e3:1e4;k=window.setInterval(()=>{O.current||(ve(),ie())},et)}},15e3)):(console.error("Focus group not found with ID:",e),S(!1),Ze.error("Focus group not found",{description:`Could not find focus group with ID: ${e}`}))})}),()=>{k&&window.clearInterval(k),B&&window.clearInterval(B)}},[e,t]);const $e=G=>{if(!G||!G.sections||!Array.isArray(G.sections))return{content:"Welcome to our focus group session! Let's begin our discussion.",sectionId:"welcome",itemId:"welcome-message"};const q=G.sections[0];if(!q)return{content:"Welcome to our focus group session! Let's begin our discussion.",sectionId:"welcome",itemId:"welcome-message"};const k=W=>W.questions&&Array.isArray(W.questions)&&W.questions.length>0?{content:W.questions[0].content,itemId:W.questions[0].id,type:"question"}:W.activities&&Array.isArray(W.activities)&&W.activities.length>0?{content:W.activities[0].content,itemId:W.activities[0].id,type:"activity"}:null;let B=k(q);if(!B&&q.subsections&&Array.isArray(q.subsections)){for(const W of q.subsections)if(B=k(W),B)break}return B?{content:B.content,sectionId:q.id,itemId:B.itemId}:{content:`Welcome to our focus group session on "${q.title||"our topic"}". Let's begin our discussion.`,sectionId:q.id,itemId:"section-intro"}},E=async()=>{var G,q,k,B,W,ne;if(e)try{Ze.info("Starting focus group session...",{description:"The session is now ready for AI moderation."});try{const J=await fn.getModeratorStatus(e),ye=(q=(G=J==null?void 0:J.data)==null?void 0:G.status)==null?void 0:q.moderator_position;ye?console.log("๐Ÿ“ Preserving existing moderator position:",ye):(await fn.setModeratorPosition(e,((W=(B=(k=c==null?void 0:c.discussionGuide)==null?void 0:k.sections)==null?void 0:B[0])==null?void 0:W.id)||"welcome"),console.log("๐Ÿš€ Moderator position initialized to start of discussion guide (first time)"))}catch(J){console.warn("Failed to check/initialize moderator position:",J)}await At.update(e,{status:"active"});try{const J=$e(c==null?void 0:c.discussionGuide),ye={id:`msg-${Date.now()}`,senderId:"moderator",text:J.content,timestamp:new Date,type:"question"},se=await At.sendMessage(e,{senderId:"moderator",text:ye.text,type:"question"});(ne=se==null?void 0:se.data)!=null&&ne.message_id&&(ye.id=se.data.message_id),D(ye),console.log("๐Ÿš€ Initial moderator message created:",{content:J.content,sectionId:J.sectionId,itemId:J.itemId})}catch(J){console.warn("Failed to create initial moderator message:",J)}Ze.success("Focus group session started",{description:"The discussion has begun. Use the control panel below to moderate."})}catch(J){console.error("Error starting session:",J),Ze.error("Error starting session",{description:"There was a problem connecting to the server."})}},D=G=>{r(q=>[...q,G])},U=async G=>{const q=[...n],k=q.findIndex(B=>B.id===G);if(k!==-1){const B=q[k],W=!B.highlighted;if(q[k]={...B,highlighted:W},r(q),e)try{!G.startsWith("local-")&&!G.startsWith("msg-")?await At.updateMessageHighlight(e,G,W):console.log("Skipping database update for local message:",G)}catch(ne){console.error("Error updating message highlight state:",ne),Ze.error("Failed to save highlight state",{description:"The highlight may not persist if the page is refreshed."})}}},Q=G=>d.find(q=>q.id===G||q._id===G),te=()=>{const G=n.map(B=>{var J;let W;return B.senderId==="moderator"?W="AI Moderator":B.senderId==="facilitator"?W="Human Facilitator":W=((J=Q(B.senderId))==null?void 0:J.name)||"Unknown",`[${B.timestamp.toLocaleTimeString()}] ${W}: ${B.text}`}).join(` - -`),q=document.createElement("a"),k=new Blob([G],{type:"text/plain"});q.href=URL.createObjectURL(k),q.download=`focus-group-${e}-transcript.txt`,document.body.appendChild(q),q.click(),document.body.removeChild(q),Ze.success("Transcript downloaded",{description:"The focus group transcript has been saved to your device."})},Y=(G,q)=>{const k=_e=>{const et=_e.match(/^\[([^\]]+)\]:\s*(.*)$/);return et?et[2].trim():_e.trim()},B=_e=>_e.toLowerCase().replace(/[^\w\s]/g," ").replace(/\s+/g," ").trim(),W=(_e,et)=>{const Ie=B(_e),ft=B(et);if(Ie===ft)return 1;if(Ie.includes(ft)||ft.includes(Ie))return Math.min(Ie.length,ft.length)/Math.max(Ie.length,ft.length);const Ct=Ie.split(" "),pt=ft.split(" "),tr=Ct.filter(Ea=>pt.includes(Ea)&&Ea.length>2);return Ct.length===0||pt.length===0?0:tr.length/Math.max(Ct.length,pt.length)},ne=typeof G=="object"&&G!==null,J=ne?G.text:k(G),ye=ne?G.original:G;let se=null,Pe="";if(q&&(se=n.find(_e=>_e.id===q),se?Pe="direct_message_id_match":console.warn(`Message ID ${q} not found in current messages array`)),se||(se=n.find(_e=>_e.text.includes(ye)),se&&(Pe="exact_full_match")),se||(se=n.find(_e=>_e.text.includes(J)),se&&(Pe="exact_text_match")),se||(se=n.find(_e=>J.includes(_e.text.trim())),se&&(Pe="reverse_exact_match")),!se){const _e=J.toLowerCase();se=n.find(et=>et.text.toLowerCase().includes(_e)||_e.includes(et.text.toLowerCase())),se&&(Pe="case_insensitive_match")}if(!se){const _e=n.map(et=>({message:et,similarity:W(J,et.text)})).filter(et=>et.similarity>.7).sort((et,Ie)=>Ie.similarity-et.similarity);_e.length>0&&(se=_e[0].message,Pe=`fuzzy_match_${Math.round(_e[0].similarity*100)}%`)}if(!se){const et=B(J).split(" ").filter(Ie=>Ie.length>3);et.length>0&&(se=n.find(Ie=>{const ft=B(Ie.text);return et.every(Ct=>ft.includes(Ct))}),se&&(Pe="partial_word_match"))}se?(console.log(`Quote match found using strategy: ${Pe}`,{quoteType:ne?"QuoteData":"string",providedMessageId:q,extractedText:J,matchedMessage:se.text.substring(0,100),matchedMessageId:se.id,originalQuote:ye.substring(0,100)}),p("chat"),setTimeout(()=>{const _e=document.getElementById(`message-${se.id}`);_e&&(_||_e.scrollIntoView({behavior:"smooth",block:"center"}),_e.style.backgroundColor="#fbbf24",_e.style.transition="background-color 0.3s ease",setTimeout(()=>{_e.style.backgroundColor=""},2e3))},100)):(console.warn("Quote match failed",{quoteType:ne?"QuoteData":"string",providedMessageId:q,originalQuote:ye.substring(0,100),extractedText:J.substring(0,100),totalMessages:n.length,messageSample:n.slice(0,3).map(_e=>({id:_e.id,text:_e.text.substring(0,50)}))}),Ze.warning("Message not found",{description:"Could not locate the original message for this quote. The quote may have been paraphrased by the AI."}))},xe=G=>{l(q=>{const k=new Set(q.map(W=>W.id)),B=G.filter(W=>!k.has(W.id));return[...q,...B]})},je=async G=>{if(!e)return;const q=o.find(k=>k.id===G);if(q)try{"source"in q&&q.source==="generated"&&await fn.deleteKeyTheme(e,G),l(o.filter(k=>k.id!==G))}catch(k){console.error("Error deleting theme:",k),Ze.error("Failed to delete theme",{description:"There was an error removing the theme. Please try again."})}},Fe=v.useCallback(async(G,q)=>{if(e)try{await fn.setModeratorPosition(e,G,q),await ie(),Ze.success("Moderator position updated",{description:"The moderator has been moved to the selected section."})}catch(k){console.error("Error setting moderator position:",k),Ze.error("Failed to update moderator position",{description:"There was an error updating the moderator position."})}},[e]),ce=v.useCallback(async G=>{if(e)try{await At.update(e,{discussionGuide:G}),u(q=>q?{...q,discussionGuide:G}:null)}catch(q){throw console.error("Error saving discussion guide:",q),q}},[e]),ke=v.useCallback(()=>{P(G=>!G)},[]),Be=v.useCallback((G,q,k,B,W,ne)=>{de({isOpen:!0,sectionId:G,itemId:q,content:k,sectionTitle:B,itemTitle:W,itemType:ne})},[]),mt=G=>{console.log("๐Ÿ” EXTRACT ASSET FILENAME DEBUG - Input content:",G);const q=[/'([^']*\.[a-zA-Z]{3,4})'/g,/"([^"]*\.[a-zA-Z]{3,4})"/g,/titled\s+['"]([^'"]*\.[a-zA-Z]{3,4})['"](?:\.|,|\s|$)/gi,/asset[:\s]+['"]?([^'"\s]*\.[a-zA-Z]{3,4})['"]?(?:\.|,|\s|$)/gi,/image[:\s]+['"]?([^'"\s]*\.[a-zA-Z]{3,4})['"]?(?:\.|,|\s|$)/gi,/file[:\s]+['"]?([^'"\s]*\.[a-zA-Z]{3,4})['"]?(?:\.|,|\s|$)/gi,/\b([a-zA-Z0-9_-]+\.[a-zA-Z]{3,4})\b/g];for(let k=0;k0){const ne=W[0][1];if(console.log(`๐Ÿ” Pattern ${k+1} extracted filename:`,ne),ne&&ne.includes("."))return console.log("โœ… EXTRACT ASSET FILENAME - Found:",ne),ne}}return console.warn("โŒ EXTRACT ASSET FILENAME - No filename found in content"),null},_t=()=>{if(g)return{sectionId:g.current_section_id,sectionTitle:g.current_section,itemId:g.current_item_id,itemTitle:g.current_item}},Pt=()=>{if(n.length!==0)return n[n.length-1].id},qt=()=>{const G=Pt();if(!G||n.length===0)return new Date;const q=n.find(k=>k.id===G);return q?q.timestamp:new Date},mn=async()=>{if(e){Z(!0),re(!1),z(!1),Ze.info("Analyzing discussion for key themes...",{description:"This may take a moment as we process the entire conversation."});try{const G=await fn.generateKeyThemes(e);G.data&&G.data.themes?(re(!0),Ze.success(`Generated ${G.data.themes.length} key themes`,{description:"New themes have been added to the analysis."}),l(q=>[...q,...G.data.themes])):(re(!0),Ze.warning("No new themes were generated",{description:"Try again when the discussion has more content."}))}catch(G){console.error("Error generating key themes:",G),z(!0),Ze.error("Failed to generate key themes",{description:"There was an error analyzing the discussion. Please try again."})}}},Wt=()=>{Z(!1),re(!1),z(!1)},zt=()=>{H||F(new Date),R(!0)},mr=G=>{T(q=>[...q,G].sort((k,B)=>B.createdAt.getTime()-k.createdAt.getTime())),window.notesPanelAddNote&&window.notesPanelAddNote(G)},Je=G=>{const q=n.find(k=>k.id===G);q?(p("chat"),setTimeout(()=>{const k=document.getElementById(`message-${q.id}`);k&&(_||k.scrollIntoView({behavior:"smooth",block:"center"}),k.style.backgroundColor="#fbbf24",k.style.transition="background-color 0.3s ease",setTimeout(()=>{k.style.backgroundColor=""},2e3))},100)):Ze.info("Message not found",{description:"Could not locate the original message for this note."})};v.useEffect(()=>{n.length>0&&!H&&F(new Date)},[n.length,H]),v.useEffect(()=>{O.current=_,_||ie()},[_]);const X=G=>{I(q=>q.includes(G)?q.filter(k=>k!==G):[...q,G])};return j?a.jsxs("div",{className:"min-h-screen bg-slate-50 pt-20 pb-16 px-4",children:[a.jsx(ea,{}),a.jsxs("div",{className:"max-w-7xl mx-auto text-center py-12",children:[a.jsx("div",{className:"flex justify-center items-center",children:a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}),a.jsx("p",{className:"mt-4 text-slate-600",children:"Loading focus group..."})]})]}):c?a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(ea,{}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center mb-4",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(oe,{variant:"ghost",onClick:()=>t("/focus-groups"),className:"mr-2",children:a.jsx(Kf,{className:"h-4 w-4"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"font-sf text-2xl font-bold text-slate-900",children:c.name}),a.jsx("p",{className:"text-slate-600",children:new Date(c.date).toLocaleString()})]})]}),a.jsxs("div",{className:"flex items-center space-x-4 mt-4 sm:mt-0",children:[a.jsxs(oe,{variant:"outline",onClick:()=>b(!x),className:x?"bg-blue-50 text-blue-600":"",children:[a.jsx(zw,{className:"mr-2 h-4 w-4"}),"AI Dashboard"]}),a.jsxs(oe,{variant:"outline",onClick:te,children:[a.jsx(Ku,{className:"mr-2 h-4 w-4"}),"Download Transcript"]})]})]}),L&&a.jsx("div",{className:"mb-6",children:a.jsx(S_,{isActive:L,isComplete:ee,hasError:me,label:"Analyzing discussion for key themes",onComplete:Wt,className:"max-w-4xl mx-auto"})}),a.jsx(zEe,{discussionGuide:c.discussionGuide,moderatorStatus:g,onSectionSelect:Fe,onSetPosition:Be,onSave:ce,focusGroupId:e||"",isOpen:N,onToggle:ke,onEditingChange:A}),a.jsxs("div",{className:"flex flex-col lg:flex-row gap-6 h-[calc(100vh-12rem)]",children:[a.jsx(aEe,{participants:d,selectedParticipantIds:V,onToggleParticipantFilter:X}),a.jsx("div",{className:"flex-1 flex flex-col",children:a.jsxs(Io,{defaultValue:"chat",value:h,onValueChange:p,className:"w-full h-full flex flex-col",children:[a.jsxs(Sa,{className:"grid grid-cols-4 mb-4",children:[a.jsxs(Ft,{value:"chat",className:"flex items-center",children:[a.jsx(di,{className:"h-4 w-4 mr-2"}),"Discussion"]}),a.jsxs(Ft,{value:"themes",className:"flex items-center",children:[a.jsx(Nl,{className:"h-4 w-4 mr-2"}),"Key Themes"]}),a.jsxs(Ft,{value:"notes",className:"flex items-center",children:[a.jsx(Eg,{className:"h-4 w-4 mr-2"}),"Notes"]}),a.jsxs(Ft,{value:"analytics",className:"flex items-center",children:[a.jsx(zw,{className:"h-4 w-4 mr-2"}),"Analytics"]})]}),a.jsx(Bt,{value:"chat",className:"m-0 flex-1 flex flex-col h-0",children:n.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[a.jsx("p",{className:"text-lg text-slate-600",children:"No messages yet. Start the session to begin the discussion."}),a.jsxs(oe,{onClick:E,size:"lg",className:"flex items-center gap-2",children:[a.jsx(Uw,{className:"h-5 w-5"}),"Start Session"]})]}):a.jsx(MEe,{messages:n,modeEvents:i,personas:d,isSpeaking:!1,focusGroupId:e||"",isAiModeActive:y,selectedParticipantIds:V,onToggleHighlight:U,onAdvanceDiscussion:()=>null,onNewMessage:D,onStatusChange:Se,isEditingDiscussionGuide:_})}),a.jsx(Bt,{value:"themes",className:"m-0",children:a.jsx(DEe,{themes:o,messages:n,personas:d,focusGroupId:e||"",onThemesGenerated:xe,onThemeDelete:je,onQuoteClick:Y,onGenerateKeyThemes:mn})}),a.jsx(Bt,{value:"notes",className:"m-0",style:{height:"calc(100% - 3.5rem)"},children:a.jsx("div",{className:"h-full",children:a.jsx(UEe,{focusGroupId:e||"",focusGroupName:c==null?void 0:c.name,onNoteClick:Je})})}),a.jsx(Bt,{value:"analytics",className:"m-0",children:a.jsx(LEe,{messages:n,themes:o,personas:d})})]})})]})]}),n.length>0&&a.jsx("div",{className:"fixed bottom-6 right-6 z-40",children:a.jsx(oe,{onClick:zt,className:"rounded-full h-12 w-12 p-0 shadow-lg",title:"Take a quick note",children:a.jsx(Eg,{className:"h-5 w-5"})})}),a.jsx(VEe,{isOpen:M,onClose:()=>R(!1),focusGroupId:e||"",associatedMessageId:Pt(),sectionInfo:_t(),messageTimestamp:qt(),onNoteSaved:mr}),a.jsx(cu,{open:ae.isOpen,onOpenChange:G=>de(q=>({...q,isOpen:G})),children:a.jsxs(kl,{children:[a.jsxs(Tl,{children:[a.jsx($l,{children:"Set Moderator Position"}),a.jsxs(mh,{children:['Are you sure you want to set the moderator position to "',ae.itemTitle,'" in section "',ae.sectionTitle,'"? This will make the moderator ask this question in the chat.']})]}),a.jsxs(uu,{children:[a.jsx(oe,{variant:"outline",disabled:ae.isLoading,onClick:()=>de({isOpen:!1}),children:"Cancel"}),a.jsxs(oe,{disabled:ae.isLoading,onClick:async()=>{var G,q,k,B,W,ne,J,ye,se;if(!(!e||!ae.sectionId||!ae.itemId||!ae.content)){de(Pe=>({...Pe,isLoading:!0}));try{await fn.setModeratorPosition(e,ae.sectionId,ae.itemId);let Pe=[],_e=!1,et=ae.content;const Ie=ae.content?mt(ae.content):null,ft=!!Ie;if(console.log("๐Ÿ” MANUAL POSITION DEBUG:",{itemType:ae.itemType,hasImageAttached:ft,assetFilename:Ie,content:ae.content,sectionTitle:ae.sectionTitle,itemTitle:ae.itemTitle,contentLength:(G=ae.content)==null?void 0:G.length}),ft&&ae.content&&Ie)if(console.log("๐Ÿ” ASSET EXTRACTION DEBUG:",{originalContent:ae.content,extractedFilename:Ie,contentLength:ae.content.length}),Ie){Pe=[Ie],_e=!0,console.log("๐ŸŽจ MANUAL POSITION: Creative review detected, will activate visual context for:",Ie);try{console.log("๐ŸŽจ MANUAL MODE: Requesting AI description for",Ie);try{console.log("๐Ÿ” TESTING: Calling test endpoint first...");const tr=await He.post(`/focus-groups/${e}/test-endpoint`,{test:"data"});console.log("โœ… TEST: Test endpoint response:",tr.data)}catch(tr){console.error("โŒ TEST: Test endpoint failed:",tr)}const pt=await At.describeAsset(e,Ie);pt.data.description&&(et=ae.content.replace(`'${Ie}'`,`'${Ie}' - ${pt.data.description}`),console.log("โœ… MANUAL MODE: Enhanced question with AI description"),console.log("๐Ÿ” Original:",ae.content),console.log("๐Ÿ” Enhanced:",et))}catch(pt){console.error("โš ๏ธ MANUAL MODE: Failed to generate AI description:",pt),console.error("โš ๏ธ Error response data:",(q=pt.response)==null?void 0:q.data),console.error("โš ๏ธ Error status:",(k=pt.response)==null?void 0:k.status),console.error("โš ๏ธ Error headers:",(B=pt.response)==null?void 0:B.headers),console.error("โš ๏ธ Full axios error:",{message:pt.message,code:pt.code,status:(W=pt.response)==null?void 0:W.status,statusText:(ne=pt.response)==null?void 0:ne.statusText,url:(J=pt.config)==null?void 0:J.url,method:(ye=pt.config)==null?void 0:ye.method}),Ze.warning("AI description failed",{description:"Using original question text. Image will still be available to participants."})}}else console.warn("โš ๏ธ MANUAL POSITION: Creative review detected but no asset filename extracted from content");const Ct={id:`msg-${Date.now()}`,senderId:"moderator",text:et,timestamp:new Date,type:"question"};try{const pt=await At.sendMessage(e,{senderId:"moderator",text:et,type:"question",attached_assets:Pe,activates_visual_context:_e});(se=pt==null?void 0:pt.data)!=null&&se.message_id&&(Ct.id=pt.data.message_id)}catch(pt){console.warn("Failed to save message to API, showing locally:",pt)}D(Ct),de({isOpen:!1}),setTimeout(async()=>{await ie(),setTimeout(()=>ie(),500)},200),Ze.success("Moderator position set",{description:`Position set to "${ae.itemTitle}" in "${ae.sectionTitle}"`})}catch(Pe){console.error("Error setting moderator position:",Pe),de(_e=>({..._e,isLoading:!1})),Ze.error("Failed to set moderator position",{description:"There was an error setting the moderator position."})}}},className:"flex items-center gap-2",children:[ae.isLoading&&a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),ae.isLoading?"Generating detailed image description...":"Confirm"]})]})]})}),a.jsx(FEe,{focusGroupId:e,personas:d,isVisible:x,onToggle:()=>b(!x)})]}):a.jsxs("div",{className:"min-h-screen bg-slate-50 pt-20 pb-16 px-4",children:[a.jsx(ea,{}),a.jsxs("div",{className:"max-w-7xl mx-auto text-center py-12",children:[a.jsx("h1",{className:"text-2xl font-bold",children:"Focus group not found"}),a.jsx("p",{className:"mt-2 text-slate-600",children:"We couldn't find the focus group you're looking for."}),a.jsxs(oe,{onClick:()=>t("/focus-groups"),className:"mt-4",children:[a.jsx(Kf,{className:"mr-2 h-4 w-4"})," Back to Focus Groups"]})]})]})},HEe=({title:e,description:t})=>a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center mb-8",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"font-sf text-3xl font-bold text-slate-900",children:e}),a.jsx("p",{className:"text-slate-600 mt-1",children:t})]}),a.jsxs("div",{className:"mt-4 sm:mt-0 flex gap-2",children:[a.jsx(oe,{variant:"outline",children:"Export Data"}),a.jsx(oe,{children:"Generate Report"})]})]}),Mb=({title:e,value:t,changePercentage:n,icon:r})=>a.jsx(Ge,{className:"p-6 hover:shadow-md transition-shadow",children:a.jsxs("div",{className:"flex justify-between items-start",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-muted-foreground text-sm",children:e}),a.jsx("h3",{className:"text-2xl font-bold mt-1",children:t}),a.jsxs("p",{className:`${n>=0?"text-green-500":"text-red-500"} text-xs mt-1`,children:[n>=0?"โ†‘":"โ†“"," ",Math.abs(n),"% from last month"]})]}),a.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:a.jsx(r,{className:"h-6 w-6 text-primary"})})]})}),GEe=[{name:"Jan",users:20,groups:3,interactions:120},{name:"Feb",users:25,groups:4,interactions:160},{name:"Mar",users:30,groups:5,interactions:220},{name:"Apr",users:40,groups:6,interactions:280},{name:"May",users:45,groups:7,interactions:350},{name:"Jun",users:48,groups:7,interactions:420}],qEe=[{id:"1",title:"User Interface Feedback",description:"Users consistently mentioned difficulty with the navigation menu on mobile devices.",source:"Mobile App Focus Group",date:"2023-06-12",sentiment:"negative"},{id:"2",title:"Feature Adoption",description:'The new search functionality is well-received, with 85% of users rating it as "very useful".',source:"Product Testing Group",date:"2023-06-10",sentiment:"positive"},{id:"3",title:"Pricing Strategy",description:"Price-conscious users expressed willingness to pay up to 20% more for premium features.",source:"Pricing Model Analysis",date:"2023-06-08",sentiment:"positive"},{id:"4",title:"Competitive Analysis",description:"Users who switched from competitor products cited our streamlined onboarding as a key factor.",source:"Customer Journey Mapping",date:"2023-06-05",sentiment:"positive"}],KEe=()=>a.jsxs("div",{className:"space-y-6",children:[a.jsxs(Ge,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-semibold mb-4",children:"Research Activity"}),a.jsx("div",{className:"h-64",children:a.jsx(ra,{width:"100%",height:"100%",children:a.jsxs(Hz,{data:GEe,margin:{top:10,right:30,left:0,bottom:0},children:[a.jsx(tp,{strokeDasharray:"3 3"}),a.jsx(_o,{dataKey:"name"}),a.jsx(Po,{}),a.jsx(cr,{}),a.jsx(Yi,{type:"monotone",dataKey:"users",stackId:"1",stroke:"#8884d8",fill:"#8884d8",name:"Synthetic Users"}),a.jsx(Yi,{type:"monotone",dataKey:"groups",stackId:"2",stroke:"#82ca9d",fill:"#82ca9d",name:"Focus Groups"}),a.jsx(Yi,{type:"monotone",dataKey:"interactions",stackId:"3",stroke:"#ffc658",fill:"#ffc658",name:"Interactions"})]})})})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs(Ge,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-semibold mb-4",children:"Recent AI Insights"}),a.jsxs("div",{className:"space-y-4",children:[qEe.slice(0,3).map(e=>a.jsx("div",{className:"border-b pb-4 last:border-b-0 last:pb-0",children:a.jsxs("div",{className:"flex items-start",children:[a.jsx("div",{className:`p-2 rounded-full mr-3 ${e.sentiment==="positive"?"bg-green-100":e.sentiment==="negative"?"bg-red-100":"bg-slate-100"}`,children:a.jsx(fa,{className:`h-4 w-4 ${e.sentiment==="positive"?"text-green-600":e.sentiment==="negative"?"text-red-600":"text-slate-600"}`})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:e.title}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e.description}),a.jsxs("div",{className:"flex items-center text-xs text-muted-foreground mt-2",children:[a.jsx("span",{children:e.source}),a.jsx("span",{className:"mx-2",children:"โ€ข"}),a.jsx("span",{children:e.date})]})]})]})},e.id)),a.jsx(oe,{variant:"ghost",className:"w-full text-sm",size:"sm",children:"View All Insights"})]})]}),a.jsxs(Ge,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-semibold mb-4",children:"Upcoming Research Tasks"}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start",children:[a.jsx("div",{className:"bg-blue-100 p-2 rounded-full mr-3",children:a.jsx(lm,{className:"h-4 w-4 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:"Website Redesign Feedback"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Focus group scheduled for Jun 20"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx("div",{className:"bg-purple-100 p-2 rounded-full mr-3",children:a.jsx(lm,{className:"h-4 w-4 text-purple-600"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:"Mobile App User Testing"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"8 participants needed by Jun 25"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx("div",{className:"bg-amber-100 p-2 rounded-full mr-3",children:a.jsx(lm,{className:"h-4 w-4 text-amber-600"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:"Pricing Strategy Evaluation"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Create discussion guide by Jun 22"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx("div",{className:"bg-green-100 p-2 rounded-full mr-3",children:a.jsx(lm,{className:"h-4 w-4 text-green-600"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:"Product Onboarding Flow"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Results analysis due Jun 30"})]})]}),a.jsx(oe,{variant:"ghost",className:"w-full text-sm",size:"sm",children:"Manage Research Calendar"})]})]})]})]}),XEe=[{name:"18-24",value:15},{name:"25-34",value:35},{name:"35-44",value:25},{name:"45-54",value:15},{name:"55+",value:10}],YEe=()=>a.jsxs(Ge,{className:"p-6",children:[a.jsxs("div",{className:"flex justify-between items-center mb-4",children:[a.jsx("h3",{className:"font-sf text-lg font-semibold",children:"Synthetic Persona Analytics"}),a.jsx(oe,{variant:"outline",size:"sm",children:"View Demographics"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Persona Demographics"}),a.jsx("div",{className:"h-60",children:a.jsx(ra,{width:"100%",height:"100%",children:a.jsxs(UP,{children:[a.jsx(cr,{}),a.jsx(os,{data:XEe,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,fill:"#FFDEE2",label:!0})]})})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Persona Distribution"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Age: 25-34"}),a.jsx("span",{children:"35%"})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-pink-400 rounded-full",style:{width:"35%"}})})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Tech Savvy"}),a.jsx("span",{children:"72%"})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-pink-300 rounded-full",style:{width:"72%"}})})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Brand Loyal"}),a.jsx("span",{children:"58%"})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-pink-500 rounded-full",style:{width:"58%"}})})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Price Sensitive"}),a.jsx("span",{children:"67%"})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-pink-200 rounded-full",style:{width:"67%"}})})]})]})]})]}),a.jsx("div",{className:"flex justify-center mt-6",children:a.jsx(oe,{onClick:()=>window.location.href="/synthetic-users",children:"Manage Synthetic Personas"})})]}),ZEe=[{name:"Jan",users:20,groups:3,interactions:120},{name:"Feb",users:25,groups:4,interactions:160},{name:"Mar",users:30,groups:5,interactions:220},{name:"Apr",users:40,groups:6,interactions:280},{name:"May",users:45,groups:7,interactions:350},{name:"Jun",users:48,groups:7,interactions:420}],qT=[{name:"Very Positive",value:25,color:"#4ade80"},{name:"Positive",value:40,color:"#a3e635"},{name:"Neutral",value:20,color:"#93c5fd"},{name:"Negative",value:10,color:"#fb923c"},{name:"Very Negative",value:5,color:"#f87171"}],QEe=[{name:"Navigation",count:42},{name:"Performance",count:28},{name:"UX Design",count:36},{name:"Features",count:22},{name:"Onboarding",count:18}],JEe=()=>{const e=Cn();return a.jsxs(Ge,{className:"p-6",children:[a.jsxs("div",{className:"flex justify-between items-center mb-4",children:[a.jsx("h3",{className:"font-sf text-lg font-semibold",children:"Focus Group Insights"}),a.jsx(oe,{variant:"outline",size:"sm",onClick:()=>e("/focus-groups"),children:"View All Sessions"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 mb-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Session Analytics"}),a.jsx("div",{className:"h-60",children:a.jsx(ra,{width:"100%",height:"100%",children:a.jsxs(Hz,{data:ZEe,margin:{top:10,right:30,left:0,bottom:0},children:[a.jsx(tp,{strokeDasharray:"3 3"}),a.jsx(_o,{dataKey:"name"}),a.jsx(Po,{}),a.jsx(cr,{}),a.jsx(Yi,{type:"monotone",dataKey:"interactions",stroke:"#8884d8",fill:"#8884d8",name:"User Interactions"})]})})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Feedback Sentiment"}),a.jsx("div",{className:"h-60",children:a.jsx(ra,{width:"100%",height:"100%",children:a.jsxs(UP,{children:[a.jsx(cr,{}),a.jsx(os,{data:qT,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,label:({name:t,percent:n})=>`${t} ${(n*100).toFixed(0)}%`,children:qT.map((t,n)=>a.jsx($p,{fill:t.color},`cell-${n}`))}),a.jsx(na,{})]})})})]})]}),a.jsxs("div",{className:"mb-6",children:[a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Topic Frequency Analysis"}),a.jsx("div",{className:"h-60",children:a.jsx(ra,{width:"100%",height:"100%",children:a.jsxs(Vz,{data:QEe,margin:{top:5,right:30,left:20,bottom:5},children:[a.jsx(tp,{strokeDasharray:"3 3"}),a.jsx(_o,{dataKey:"name"}),a.jsx(Po,{}),a.jsx(cr,{}),a.jsx(na,{}),a.jsx(Fo,{dataKey:"count",name:"Mentions",fill:"#8884d8"})]})})})]}),a.jsx("div",{className:"flex justify-center",children:a.jsx(oe,{onClick:()=>e("/focus-groups"),children:"Manage Focus Groups"})})]})},eOe=()=>{const[e,t]=v.useState("overview");return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(ea,{}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsx(HEe,{title:"Dashboard",description:"Monitor and analyze your research insights"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 mb-8",children:[a.jsx(Mb,{title:"Total Synthetic Users",value:48,changePercentage:12,icon:Hn}),a.jsx(Mb,{title:"Active Focus Groups",value:7,changePercentage:5,icon:pa}),a.jsx(Mb,{title:"Research Insights",value:124,changePercentage:18,icon:Nl})]}),a.jsxs(Io,{value:e,onValueChange:t,className:"glass-panel rounded-xl p-6",children:[a.jsxs(Sa,{className:"grid w-full grid-cols-3 mb-6",children:[a.jsx(Ft,{value:"overview",children:"Overview"}),a.jsx(Ft,{value:"users",children:"Synthetic Users"}),a.jsx(Ft,{value:"focus-groups",children:"Focus Groups"})]}),a.jsx(Bt,{value:"overview",children:a.jsx(KEe,{})}),a.jsx(Bt,{value:"users",children:a.jsx(YEe,{})}),a.jsx(Bt,{value:"focus-groups",children:a.jsx(JEe,{})})]})]})]})};function tOe({persona:e}){const t=e.id==="0",n=e.id==="1";return a.jsxs(Ge,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsx("div",{className:"h-16 w-16 rounded-full bg-muted flex items-center justify-center",children:a.jsx("img",{src:Zu(e),alt:e.name,className:"h-16 w-16 rounded-full object-cover"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"font-sf text-xl font-semibold",children:e.name}),a.jsx("p",{className:"text-muted-foreground",children:e.occupation})]})]}),a.jsxs("div",{className:"mt-6 space-y-4",children:[a.jsxs("div",{className:"sidebar-section",children:[a.jsx(Hn,{className:"sidebar-icon"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-sm",children:"Demographics"}),a.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:[e.age," ",e.gender?a.jsxs(a.Fragment,{children:["โ€ข ",e.gender]}):null,e.ethnicity?a.jsxs(a.Fragment,{children:[" โ€ข ",e.ethnicity]}):null]}),e.education&&a.jsx("p",{className:"sidebar-sub-item",children:e.education}),e.socialGrade&&a.jsxs("p",{className:"sidebar-sub-item",children:["Social Grade: ",e.socialGrade]}),e.householdIncome&&a.jsxs("p",{className:"sidebar-sub-item",children:["Household Income: ",e.householdIncome]}),e.householdComposition&&a.jsxs("p",{className:"sidebar-sub-item",children:["Household: ",e.householdComposition]})]})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(jR,{className:"sidebar-icon"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-sm",children:"Location"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:e.location}),e.livingSituation&&a.jsx("p",{className:"sidebar-sub-item",children:e.livingSituation})]})]}),e.interests&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(Ag,{className:"sidebar-icon"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-sm",children:"Interests"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:e.interests})]})]}),e.mediaConsumption&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(z0,{className:"sidebar-icon"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-sm",children:"Media"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:e.mediaConsumption})]})]}),a.jsxs("div",{className:"pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-sm mb-3",children:"Digital Behavior"}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Tech Savviness"}),a.jsxs("span",{children:[e.techSavviness,"%"]})]}),a.jsx("div",{className:"h-1.5 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-blue-500 rounded-full",style:{width:`${e.techSavviness}%`}})})]}),e.brandLoyalty!==void 0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Brand Loyalty"}),a.jsxs("span",{children:[e.brandLoyalty,"%"]})]}),a.jsx("div",{className:"h-1.5 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-purple-500 rounded-full",style:{width:`${e.brandLoyalty}%`}})})]}),e.priceConsciousness!==void 0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Price Sensitivity"}),a.jsxs("span",{children:[e.priceConsciousness,"%"]})]}),a.jsx("div",{className:"h-1.5 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-amber-500 rounded-full",style:{width:`${e.priceConsciousness}%`}})})]}),e.environmentalConcern!==void 0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Environmental Concern"}),a.jsxs("span",{children:[e.environmentalConcern,"%"]})]}),a.jsx("div",{className:"h-1.5 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-green-500 rounded-full",style:{width:`${e.environmentalConcern}%`}})})]}),e.deviceUsage&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-medium mt-3",children:"Device Usage"}),a.jsx("p",{className:"sidebar-sub-item text-xs",children:e.deviceUsage})]}),e.shoppingHabits&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-medium mt-3",children:"Shopping Habits"}),a.jsx("p",{className:"sidebar-sub-item text-xs",children:e.shoppingHabits})]})]})]}),a.jsxs("div",{className:"pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-sm mb-3",children:"Additional Information"}),a.jsxs("div",{className:"space-y-2",children:[e.brandPreferences&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(Ag,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:e.brandPreferences})]}),e.communicationPreferences&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(Og,{className:"sidebar-icon"}),a.jsxs("span",{className:"text-muted-foreground text-sm",children:["Prefers: ",e.communicationPreferences]})]}),e.deviceUsage&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(bG,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:e.deviceUsage})]}),e.shoppingHabits&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(NG,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:e.shoppingHabits})]}),e.additionalInformation&&typeof e.additionalInformation=="string"&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(mG,{className:"sidebar-icon"}),a.jsx("div",{className:"sidebar-sub-item",children:e.additionalInformation.split(` -`).map((r,i)=>a.jsx("div",{className:"mb-1",children:r.trim().startsWith("โ€ข")||r.trim().startsWith("-")?r.trim():`โ€ข ${r.trim()}`},i))})]}),t&&a.jsxs("div",{className:"pt-2 space-y-2",children:[a.jsxs("div",{className:"sidebar-section",children:[a.jsx(IA,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Maintains an extensive network of financial and luxury industry contacts"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(Hw,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Owns vacation properties in the Cotswolds and South of France"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(z0,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Collector of rare first-edition books and limited-edition art prints"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(MA,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Significant investment portfolio with focus on sustainable luxury ventures"})]})]}),n&&a.jsxs("div",{className:"pt-2 space-y-2",children:[a.jsxs("div",{className:"sidebar-section",children:[a.jsx(z0,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Active in industry panels, luxury brand collaborations, follows influencers in luxury & design"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(Hw,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Modern flat in exclusive Chelsea, accessible to boutique services"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(MA,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Uses premium digital payment & secure banking for HNWIs"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(IA,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Respected network in London's luxury sector; attends exclusive events"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(Og,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Seeks autonomy, bespoke service, and acknowledgment for taste"})]})]})]})]})]})]})}function nOe({persona:e}){var t,n,r,i,s,o,l,c,u;return a.jsxs("div",{className:"space-y-6",children:[a.jsx(Ge,{children:a.jsxs(tt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(SN,{className:"h-5 w-5 text-primary mr-2"}),a.jsx("h3",{className:"font-sf text-lg font-medium",children:"Goals"})]}),a.jsx("ul",{className:"space-y-2",children:(t=e.goals)==null?void 0:t.map((d,f)=>a.jsxs("li",{className:"flex items-start",children:[a.jsx("div",{className:"h-5 w-5 rounded-full bg-primary/10 flex items-center justify-center mt-0.5 mr-3",children:a.jsx("span",{className:"text-xs text-primary font-medium",children:f+1})}),a.jsx("p",{className:"text-sm",children:d})]},f))})]})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx(Ge,{children:a.jsxs(tt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(NN,{className:"h-5 w-5 text-amber-500 mr-2"}),a.jsx("h3",{className:"font-sf text-lg font-medium",children:"Frustrations"})]}),a.jsx("ul",{className:"space-y-2",children:(n=e.frustrations)==null?void 0:n.map((d,f)=>a.jsxs("li",{className:"text-sm flex items-start",children:[a.jsx("span",{className:"text-amber-500 mr-2",children:"โ€ข"}),a.jsx("span",{children:d})]},f))})]})}),a.jsx(Ge,{children:a.jsxs(tt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(Hs,{className:"h-5 w-5 text-green-500 mr-2"}),a.jsx("h3",{className:"font-sf text-lg font-medium",children:"Motivations"})]}),a.jsx("ul",{className:"space-y-2",children:(r=e.motivations)==null?void 0:r.map((d,f)=>a.jsxs("li",{className:"text-sm flex items-start",children:[a.jsx("span",{className:"text-green-500 mr-2",children:"โ€ข"}),a.jsx("span",{children:d})]},f))})]})})]}),a.jsx(Ge,{children:a.jsxs(tt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-medium mb-4",children:"Think, Feel, Do"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center mb-3",children:[a.jsx(fa,{className:"h-5 w-5 text-blue-500 mr-2"}),a.jsx("h4",{className:"font-medium text-sm",children:"Thinks"})]}),a.jsx("ul",{className:"space-y-2",children:(s=(i=e.thinkFeelDo)==null?void 0:i.thinks)==null?void 0:s.map((d,f)=>a.jsxs("li",{className:"text-sm bg-blue-50 p-2 rounded-md",children:['"',d,'"']},f))})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center mb-3",children:[a.jsx(Ag,{className:"h-5 w-5 text-red-500 mr-2"}),a.jsx("h4",{className:"font-medium text-sm",children:"Feels"})]}),a.jsx("ul",{className:"space-y-2",children:(l=(o=e.thinkFeelDo)==null?void 0:o.feels)==null?void 0:l.map((d,f)=>a.jsxs("li",{className:"text-sm bg-red-50 p-2 rounded-md",children:['"',d,'"']},f))})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center mb-3",children:[a.jsx(Hs,{className:"h-5 w-5 text-green-500 mr-2"}),a.jsx("h4",{className:"font-medium text-sm",children:"Does"})]}),a.jsx("ul",{className:"space-y-2",children:(u=(c=e.thinkFeelDo)==null?void 0:c.does)==null?void 0:u.map((d,f)=>a.jsxs("li",{className:"text-sm bg-green-50 p-2 rounded-md",children:['"',d,'"']},f))})]})]})]})})]})}function rOe({persona:e}){var n,r,i,s,o;const t=[{trait:"Openness",value:((n=e.oceanTraits)==null?void 0:n.openness)||50},{trait:"Conscientiousness",value:((r=e.oceanTraits)==null?void 0:r.conscientiousness)||50},{trait:"Extraversion",value:((i=e.oceanTraits)==null?void 0:i.extraversion)||50},{trait:"Agreeableness",value:((s=e.oceanTraits)==null?void 0:s.agreeableness)||50},{trait:"Neuroticism",value:((o=e.oceanTraits)==null?void 0:o.neuroticism)||50}];return a.jsx(Ge,{children:a.jsxs(tt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-medium mb-4",children:"OCEAN Personality Traits"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx("div",{className:"h-80",children:a.jsx(ra,{width:"100%",height:"100%",children:a.jsxs(Wz,{outerRadius:90,data:t,children:[a.jsx(TP,{}),a.jsx(Xl,{dataKey:"trait"}),a.jsx(Kl,{domain:[0,100]}),a.jsx(yd,{name:"Personality",dataKey:"value",stroke:"#8884d8",fill:"#8884d8",fillOpacity:.5})]})})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Openness to Experience"}),a.jsxs("span",{className:"font-medium",children:[t[0].value,"%"]})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-purple-500 rounded-full",style:{width:`${t[0].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t[0].value>75?"Highly creative and curious":t[0].value>50?"Somewhat imaginative and open to new ideas":"Practical and prefers routine"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Conscientiousness"}),a.jsxs("span",{className:"font-medium",children:[t[1].value,"%"]})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-blue-500 rounded-full",style:{width:`${t[1].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t[1].value>75?"Highly organized and responsible":t[1].value>50?"Generally reliable and hardworking":"Spontaneous and flexible"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Extraversion"}),a.jsxs("span",{className:"font-medium",children:[t[2].value,"%"]})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-green-500 rounded-full",style:{width:`${t[2].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t[2].value>75?"Highly sociable and outgoing":t[2].value>50?"Moderately social and talkative":"Reserved and reflective"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Agreeableness"}),a.jsxs("span",{className:"font-medium",children:[t[3].value,"%"]})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-amber-500 rounded-full",style:{width:`${t[3].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t[3].value>75?"Highly cooperative and compassionate":t[3].value>50?"Generally kind and helpful":"Competitive and challenging"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Neuroticism"}),a.jsxs("span",{className:"font-medium",children:[t[4].value,"%"]})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-red-500 rounded-full",style:{width:`${t[4].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t[4].value>75?"Highly sensitive and prone to stress":t[4].value>50?"Moderately reactive to challenges":"Emotionally stable and resilient"})]})]})]})]})})}function iOe({persona:e}){var r;const t=(i,s)=>{const o=[a.jsx(vG,{className:"sidebar-icon"},"grid"),a.jsx(_G,{className:"sidebar-icon"},"smartphone"),a.jsx(gG,{className:"sidebar-icon"},"laptop"),a.jsx(pG,{className:"sidebar-icon"},"grid2x2")];return o[s%o.length]},n=()=>e.scenarioType?e.scenarioType:"Life Scenarios";return a.jsx(Ge,{children:a.jsxs(tt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-medium mb-4",children:n()}),a.jsx("div",{className:"space-y-4",children:(r=e.scenarios)==null?void 0:r.map((i,s)=>a.jsx("div",{className:"bg-slate-50 p-4 rounded-lg border",children:a.jsxs("div",{className:"sidebar-section",children:[t(i,s),a.jsxs("div",{children:[a.jsxs("h4",{className:"font-medium text-sm mb-2",children:["Scenario ",s+1]}),a.jsx("p",{className:"text-sm",children:i})]})]})},s))})]})})}function sOe(){const e=Cn();return a.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center",children:a.jsxs(Ge,{className:"w-96 text-center p-6",children:[a.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Persona Not Found"}),a.jsx("p",{className:"text-muted-foreground mb-6",children:"The persona you're looking for couldn't be found."}),a.jsx(oe,{onClick:()=>e("/synthetic-users"),children:"Return to Personas"})]})})}function bt({className:e,...t}){return a.jsx("div",{className:Me("animate-pulse rounded-md bg-muted",e),...t})}function aOe(){return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(ea,{}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsxs("div",{className:"flex items-center mb-6 relative",children:[a.jsx(bt,{className:"absolute left-0 top-0 h-10 w-20"}),a.jsx(bt,{className:"h-8 w-48 mx-auto"}),a.jsx(bt,{className:"absolute right-0 top-0 h-10 w-32"})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 mt-10",children:[a.jsx("div",{className:"lg:col-span-1",children:a.jsxs(Ge,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsx(bt,{className:"h-16 w-16 rounded-full"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(bt,{className:"h-6 w-32 mb-2"}),a.jsx(bt,{className:"h-4 w-24"})]})]}),a.jsxs("div",{className:"mt-6 space-y-4",children:[a.jsxs("div",{className:"flex items-start",children:[a.jsx(bt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(bt,{className:"h-4 w-20 mb-2"}),a.jsx(bt,{className:"h-3 w-40 mb-1"}),a.jsx(bt,{className:"h-3 w-36"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx(bt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(bt,{className:"h-4 w-16 mb-2"}),a.jsx(bt,{className:"h-3 w-32"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx(bt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(bt,{className:"h-4 w-16 mb-2"}),a.jsx(bt,{className:"h-3 w-full"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx(bt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(bt,{className:"h-4 w-12 mb-2"}),a.jsx(bt,{className:"h-3 w-full"})]})]}),a.jsxs("div",{className:"pt-4 border-t",children:[a.jsx(bt,{className:"h-4 w-32 mb-3"}),a.jsx("div",{className:"space-y-3",children:[...Array(4)].map((e,t)=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx(bt,{className:"h-3 w-24"}),a.jsx(bt,{className:"h-3 w-8"})]}),a.jsx(bt,{className:"h-1.5 w-full rounded-full"})]},t))})]}),a.jsxs("div",{className:"pt-4 border-t",children:[a.jsx(bt,{className:"h-4 w-36 mb-3"}),a.jsx("div",{className:"space-y-2",children:[...Array(3)].map((e,t)=>a.jsxs("div",{className:"flex items-center",children:[a.jsx(bt,{className:"h-4 w-4 mr-2"}),a.jsx(bt,{className:"h-3 w-40"})]},t))})]})]})]})}),a.jsxs("div",{className:"lg:col-span-2",children:[a.jsxs("div",{className:"grid w-full grid-cols-3 gap-2 mb-6",children:[a.jsx(bt,{className:"h-10 w-full"}),a.jsx(bt,{className:"h-10 w-full"}),a.jsx(bt,{className:"h-10 w-full"})]}),a.jsx(Ge,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsx(bt,{className:"h-6 w-48"}),a.jsx(bt,{className:"h-4 w-full"}),a.jsx(bt,{className:"h-4 w-full"}),a.jsx(bt,{className:"h-4 w-3/4"}),a.jsxs("div",{className:"mt-8 space-y-4",children:[a.jsx(bt,{className:"h-6 w-32"}),a.jsx(bt,{className:"h-4 w-full"}),a.jsx(bt,{className:"h-4 w-full"}),a.jsx(bt,{className:"h-4 w-2/3"})]}),a.jsxs("div",{className:"mt-8 space-y-4",children:[a.jsx(bt,{className:"h-6 w-40"}),a.jsx(bt,{className:"h-4 w-full"}),a.jsx(bt,{className:"h-4 w-full"}),a.jsx(bt,{className:"h-4 w-5/6"})]})]})})]})]})]})]})}function oOe({message:e,onLoginSuccess:t,onCancel:n}){const{login:r}=Ul(),i=Cn(),[s,o]=v.useState("user"),[l,c]=v.useState("pass"),[u,d]=v.useState(!1),f=async()=>{if(!s||!l){pe.error("Please enter username and password");return}d(!0);try{await r(s,l),pe.success("Login successful"),t&&t()}catch(p){console.error("Login error:",p),pe.error("Login failed",{description:"Please check your credentials and try again"})}finally{d(!1)}},h=()=>{n?n():i("/synthetic-users")};return a.jsxs(Ge,{className:"max-w-md mx-auto shadow-lg",children:[a.jsxs($r,{children:[a.jsx(Xr,{children:"Login Required"}),a.jsx(FN,{children:e||"You need to log in to save personas to the database"})]}),a.jsxs(tt,{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(uo,{htmlFor:"username",children:"Username"}),a.jsx(St,{id:"username",placeholder:"Username",value:s,onChange:p=>o(p.target.value),disabled:u})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(uo,{htmlFor:"password",children:"Password"}),a.jsx(St,{id:"password",type:"password",placeholder:"Password",value:l,onChange:p=>c(p.target.value),disabled:u})]}),a.jsx("div",{className:"text-sm text-muted-foreground",children:"Default credentials: user / pass"})]}),a.jsxs(BN,{className:"flex justify-between",children:[a.jsx(oe,{variant:"outline",onClick:h,disabled:u,children:"Cancel"}),a.jsx(oe,{onClick:f,disabled:u,children:u?a.jsxs(a.Fragment,{children:[a.jsx(_l,{className:"h-4 w-4 mr-2 animate-spin"}),"Logging in..."]}):"Login"})]})]})}function lOe({persona:e,onSave:t,onCancel:n}){var _,A,O,$,T,M,R,H,F,V,I,L,Z,ee,re,me;const r={...e,education:e.education||"",interests:e.interests||"",brandLoyalty:e.brandLoyalty||0,priceConsciousness:e.priceConsciousness||0,environmentalConcern:e.environmentalConcern||0,hasPurchasingPower:e.hasPurchasingPower||!1,hasChildren:e.hasChildren||!1,goals:e.goals||[],frustrations:e.frustrations||[],motivations:e.motivations||[],scenarios:e.scenarios||[],oceanTraits:e.oceanTraits||{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},thinkFeelDo:e.thinkFeelDo||{thinks:[],feels:[],does:[]}},[i,s]=v.useState(r),[o,l]=v.useState(!1),[c,u]=v.useState(!1),[d,f]=v.useState(null);v.useState(!1);const{isAuthenticated:h,token:p}=Ul();v.useEffect(()=>{(async()=>{c&&h&&p&&(u(!1),d&&await P())})()},[h,p,c]);const g=(z,ae)=>{s(de=>({...de,[z]:ae}))},m=(z,ae)=>{s(de=>({...de,oceanTraits:{...de.oceanTraits,[z]:ae}}))},x=z=>{s(ae=>({...ae,[z]:[...ae[z]||[],""]}))},b=(z,ae,de)=>{s(fe=>{const Ne=[...fe[z]||[]];return Ne[ae]=de,{...fe,[z]:Ne}})},y=(z,ae)=>{s(de=>{const fe=[...de[z]||[]];return fe.splice(ae,1),{...de,[z]:fe}})},w=(z,ae,de)=>{s(fe=>{const Ne={...fe.thinkFeelDo},he=[...Ne[z]||[]];return he[ae]=de,Ne[z]=he,{...fe,thinkFeelDo:Ne}})},j=z=>{s(ae=>{var fe;const de={...ae.thinkFeelDo,[z]:[...((fe=ae.thinkFeelDo)==null?void 0:fe[z])||[],""]};return{...ae,thinkFeelDo:de}})},S=(z,ae)=>{s(de=>{const fe={...de.thinkFeelDo},Ne=[...fe[z]||[]];return Ne.splice(ae,1),fe[z]=Ne,{...de,thinkFeelDo:fe}})},N=()=>{d&&(pe.error("Login canceled - Persona changes not saved"),u(!1),f(null),n())},P=async()=>{if(d){l(!0);try{const z={...d};delete z._id,delete z.isDbPersona;const ae=await Nn.create(z),de={...d,id:ae.data._id||ae.data.id,_id:ae.data._id||ae.data.id,isDbPersona:!0};pe.success("Persona saved to database successfully"),u(!1),f(null),t(de)}catch(z){console.error("Error saving after login:",z),pe.error("Failed to save to database after login"),u(!1),f(null)}finally{l(!1)}}};return c?a.jsxs("div",{className:"max-w-5xl mx-auto bg-background p-6",children:[a.jsx("div",{className:"flex justify-between items-center mb-6",children:a.jsx("h2",{className:"font-sf text-2xl font-bold",children:"Authentication Required"})}),a.jsx("p",{className:"mb-6 text-muted-foreground",children:"Login is required to save personas to the database. You can either:"}),a.jsxs("ul",{className:"list-disc ml-6 mt-2 mb-6",children:[a.jsx("li",{children:"Log in to save this persona to the database"}),a.jsx("li",{children:"Cancel to discard your changes"})]}),a.jsx(oOe,{message:"Login is required to save your persona to the database",onLoginSuccess:P,onCancel:N})]}):a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(oe,{variant:"ghost",onClick:n,className:"mr-2",children:a.jsx(Kf,{className:"h-5 w-5"})}),a.jsx("h2",{className:"font-sf text-2xl font-bold",children:"Edit Persona"})]}),a.jsxs(oe,{onClick:async()=>{l(!0);try{const z=i._id||i.id,ae={...i};ae._id&&delete ae._id,delete ae.isDbPersona;let de;if(z&&typeof z=="string"&&z.startsWith("local-")){console.log("Creating new persona instead of updating local ID"),de=await Nn.create(ae),pe.success("Persona saved to database");const fe={...i,id:de.data._id||de.data.id,_id:de.data._id||de.data.id,isDbPersona:!0};t(fe)}else if(z){de=await Nn.update(z,ae),pe.success("Persona updated successfully");const fe={...i,isDbPersona:!0};t(fe)}else{de=await Nn.create(ae);const fe={...i,id:de.data._id||de.data.id,_id:de.data._id||de.data.id,isDbPersona:!0};pe.success("Persona created successfully"),t(fe)}}catch(z){console.error("Error saving persona:",z),z.response&&z.response.status===401?h&&p?(console.log("Auth error despite having token - token likely invalid"),pe.error("Authentication error - saving locally instead"),t(i)):(f(i),u(!0)):(pe.error("Failed to save persona"),t(i))}finally{l(!1)}},disabled:o,children:[o?a.jsx(_l,{className:"h-4 w-4 mr-2 animate-spin"}):a.jsx(wN,{className:"h-4 w-4 mr-2"}),o?"Saving...":"Save Changes"]})]}),a.jsxs(Io,{defaultValue:"basic",children:[a.jsxs(Sa,{className:"grid w-full grid-cols-6",children:[a.jsx(Ft,{value:"basic",children:"Basic"}),a.jsx(Ft,{value:"cooper",children:"Cooper"}),a.jsx(Ft,{value:"personality",children:"Personality"}),a.jsx(Ft,{value:"demographics",children:"Demographics"}),a.jsx(Ft,{value:"lifestyle",children:"Lifestyle"}),a.jsx(Ft,{value:"extended",children:"Extended"})]}),a.jsx(Bt,{value:"basic",className:"mt-6",children:a.jsx(Ge,{children:a.jsx(tt,{className:"p-6",children:a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Name"}),a.jsx(St,{value:i.name||"",onChange:z=>g("name",z.target.value)})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Age Range"}),a.jsxs(Xn,{value:i.age||"",onValueChange:z=>g("age",z),children:[a.jsx(Fn,{children:a.jsx(Yn,{placeholder:"Select age range"})}),a.jsxs(Bn,{children:[a.jsx(be,{value:"18-24",children:"18-24"}),a.jsx(be,{value:"25-34",children:"25-34"}),a.jsx(be,{value:"35-44",children:"35-44"}),a.jsx(be,{value:"45-54",children:"45-54"}),a.jsx(be,{value:"55-64",children:"55-64"}),a.jsx(be,{value:"65+",children:"65+"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Gender"}),a.jsxs(Xn,{value:i.gender||"",onValueChange:z=>g("gender",z),children:[a.jsx(Fn,{children:a.jsx(Yn,{placeholder:"Select gender"})}),a.jsxs(Bn,{children:[a.jsx(be,{value:"Male",children:"Male"}),a.jsx(be,{value:"Female",children:"Female"}),a.jsx(be,{value:"Non-binary",children:"Non-binary"}),a.jsx(be,{value:"Other",children:"Other"})]})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Occupation"}),a.jsx(St,{value:i.occupation||"",onChange:z=>g("occupation",z.target.value)})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Education"}),a.jsxs(Xn,{value:i.education||"",onValueChange:z=>g("education",z),children:[a.jsx(Fn,{children:a.jsx(Yn,{placeholder:"Select education level"})}),a.jsxs(Bn,{children:[a.jsx(be,{value:"High School",children:"High School"}),a.jsx(be,{value:"Some College",children:"Some College"}),a.jsx(be,{value:"Associate's Degree",children:"Associate's Degree"}),a.jsx(be,{value:"Bachelor's Degree",children:"Bachelor's Degree"}),a.jsx(be,{value:"Master's Degree",children:"Master's Degree"}),a.jsx(be,{value:"PhD",children:"PhD"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Location"}),a.jsx(St,{value:i.location||"",onChange:z=>g("location",z.target.value)})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Ethnicity (Optional)"}),a.jsxs(Xn,{value:i.ethnicity||"",onValueChange:z=>g("ethnicity",z),children:[a.jsx(Fn,{children:a.jsx(Yn,{placeholder:"Select ethnicity"})}),a.jsxs(Bn,{children:[a.jsx(be,{value:"white",children:"White"}),a.jsx(be,{value:"black",children:"Black"}),a.jsx(be,{value:"asian",children:"Asian"}),a.jsx(be,{value:"hispanic",children:"Hispanic/Latino"}),a.jsx(be,{value:"native-american",children:"Native American"}),a.jsx(be,{value:"middle-eastern",children:"Middle Eastern"}),a.jsx(be,{value:"mixed",children:"Mixed"}),a.jsx(be,{value:"other",children:"Other"}),a.jsx(be,{value:"prefer-not-to-say",children:"Prefer not to say"})]})]})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Personality"}),a.jsx(Qe,{value:i.personality||"",onChange:z=>g("personality",z.target.value),rows:3})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Interests"}),a.jsx(Qe,{value:i.interests||"",onChange:z=>g("interests",z.target.value),rows:3,placeholder:"Tech, travel, cooking, etc."})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Tech Savviness"}),a.jsxs("span",{className:"text-sm",children:[i.techSavviness,"%"]})]}),a.jsx(On,{value:[i.techSavviness],onValueChange:z=>g("techSavviness",z[0]),max:100,step:1})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Brand Loyalty"}),a.jsxs("span",{className:"text-sm",children:[i.brandLoyalty||0,"%"]})]}),a.jsx(On,{value:[i.brandLoyalty||0],onValueChange:z=>g("brandLoyalty",z[0]),max:100,step:1})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Price Consciousness"}),a.jsxs("span",{className:"text-sm",children:[i.priceConsciousness||0,"%"]})]}),a.jsx(On,{value:[i.priceConsciousness||0],onValueChange:z=>g("priceConsciousness",z[0]),max:100,step:1})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Environmental Concern"}),a.jsxs("span",{className:"text-sm",children:[i.environmentalConcern||0,"%"]})]}),a.jsx(On,{value:[i.environmentalConcern||0],onValueChange:z=>g("environmentalConcern",z[0]),max:100,step:1})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("label",{className:"text-sm font-medium",children:"Purchasing Power"}),a.jsx(fh,{checked:i.hasPurchasingPower||!1,onCheckedChange:z=>g("hasPurchasingPower",z)})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("label",{className:"text-sm font-medium",children:"Has Children"}),a.jsx(fh,{checked:i.hasChildren||!1,onCheckedChange:z=>g("hasChildren",z)})]})]})]})]})})})}),a.jsxs(Bt,{value:"cooper",className:"mt-6 space-y-6",children:[a.jsx(Ge,{children:a.jsxs(tt,{className:"p-6",children:[a.jsxs("div",{className:"mb-4",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Goals"}),(i.goals||[]).map((z,ae)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(St,{value:z||"",onChange:de=>b("goals",ae,de.target.value)}),a.jsx(oe,{variant:"ghost",size:"icon",onClick:()=>y("goals",ae),children:a.jsx(gn,{className:"h-4 w-4 text-muted-foreground"})})]},ae)),a.jsxs(oe,{variant:"outline",size:"sm",onClick:()=>x("goals"),className:"mt-2",children:[a.jsx(or,{className:"h-4 w-4 mr-2"}),"Add Goal"]})]}),a.jsxs("div",{className:"mb-4 pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Frustrations"}),(i.frustrations||[]).map((z,ae)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(St,{value:z||"",onChange:de=>b("frustrations",ae,de.target.value)}),a.jsx(oe,{variant:"ghost",size:"icon",onClick:()=>y("frustrations",ae),children:a.jsx(gn,{className:"h-4 w-4 text-muted-foreground"})})]},ae)),a.jsxs(oe,{variant:"outline",size:"sm",onClick:()=>x("frustrations"),className:"mt-2",children:[a.jsx(or,{className:"h-4 w-4 mr-2"}),"Add Frustration"]})]}),a.jsxs("div",{className:"mb-4 pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Motivations"}),(i.motivations||[]).map((z,ae)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(St,{value:z||"",onChange:de=>b("motivations",ae,de.target.value)}),a.jsx(oe,{variant:"ghost",size:"icon",onClick:()=>y("motivations",ae),children:a.jsx(gn,{className:"h-4 w-4 text-muted-foreground"})})]},ae)),a.jsxs(oe,{variant:"outline",size:"sm",onClick:()=>x("motivations"),className:"mt-2",children:[a.jsx(or,{className:"h-4 w-4 mr-2"}),"Add Motivation"]})]})]})}),a.jsx(Ge,{children:a.jsxs(tt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Think, Feel, Do"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Thinks"}),(((_=i.thinkFeelDo)==null?void 0:_.thinks)||[]).map((z,ae)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(St,{value:z||"",onChange:de=>w("thinks",ae,de.target.value)}),a.jsx(oe,{variant:"ghost",size:"icon",onClick:()=>S("thinks",ae),children:a.jsx(gn,{className:"h-4 w-4 text-muted-foreground"})})]},ae)),a.jsxs(oe,{variant:"outline",size:"sm",onClick:()=>j("thinks"),className:"mt-2",children:[a.jsx(or,{className:"h-4 w-4 mr-2"}),"Add Thought"]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Feels"}),(((A=i.thinkFeelDo)==null?void 0:A.feels)||[]).map((z,ae)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(St,{value:z||"",onChange:de=>w("feels",ae,de.target.value)}),a.jsx(oe,{variant:"ghost",size:"icon",onClick:()=>S("feels",ae),children:a.jsx(gn,{className:"h-4 w-4 text-muted-foreground"})})]},ae)),a.jsxs(oe,{variant:"outline",size:"sm",onClick:()=>j("feels"),className:"mt-2",children:[a.jsx(or,{className:"h-4 w-4 mr-2"}),"Add Feeling"]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Does"}),(((O=i.thinkFeelDo)==null?void 0:O.does)||[]).map((z,ae)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(St,{value:z||"",onChange:de=>w("does",ae,de.target.value)}),a.jsx(oe,{variant:"ghost",size:"icon",onClick:()=>S("does",ae),children:a.jsx(gn,{className:"h-4 w-4 text-muted-foreground"})})]},ae)),a.jsxs(oe,{variant:"outline",size:"sm",onClick:()=>j("does"),className:"mt-2",children:[a.jsx(or,{className:"h-4 w-4 mr-2"}),"Add Action"]})]})]})]})}),a.jsx(Ge,{children:a.jsxs(tt,{className:"p-6",children:[a.jsx("div",{className:"space-y-4 mb-6",children:a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Scenario Section Title"}),a.jsx(St,{value:i.scenarioType||"",onChange:z=>g("scenarioType",z.target.value),placeholder:"Life Scenarios"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:'Custom title for the scenarios section (e.g., "Customer Journey", "Use Cases")'})]})}),a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Usage Scenarios"}),(i.scenarios||[]).map((z,ae)=>a.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[a.jsx(Qe,{value:z||"",onChange:de=>b("scenarios",ae,de.target.value),rows:2}),a.jsx(oe,{variant:"ghost",size:"icon",onClick:()=>y("scenarios",ae),children:a.jsx(gn,{className:"h-4 w-4 text-muted-foreground"})})]},ae)),a.jsxs(oe,{variant:"outline",size:"sm",onClick:()=>x("scenarios"),className:"mt-2",children:[a.jsx(or,{className:"h-4 w-4 mr-2"}),"Add Scenario"]})]})})]}),a.jsx(Bt,{value:"personality",className:"mt-6",children:a.jsx(Ge,{children:a.jsxs(tt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"OCEAN Personality Traits"}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Openness to Experience"}),a.jsxs("span",{className:"text-sm",children:[(($=i.oceanTraits)==null?void 0:$.openness)||50,"%"]})]}),a.jsx(On,{value:[((T=i.oceanTraits)==null?void 0:T.openness)||50],onValueChange:z=>m("openness",z[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Creativity, curiosity, and openness to new ideas"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Conscientiousness"}),a.jsxs("span",{className:"text-sm",children:[((M=i.oceanTraits)==null?void 0:M.conscientiousness)||50,"%"]})]}),a.jsx(On,{value:[((R=i.oceanTraits)==null?void 0:R.conscientiousness)||50],onValueChange:z=>m("conscientiousness",z[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Organization, responsibility, and self-discipline"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Extraversion"}),a.jsxs("span",{className:"text-sm",children:[((H=i.oceanTraits)==null?void 0:H.extraversion)||50,"%"]})]}),a.jsx(On,{value:[((F=i.oceanTraits)==null?void 0:F.extraversion)||50],onValueChange:z=>m("extraversion",z[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Sociability, assertiveness, and talkativeness"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Agreeableness"}),a.jsxs("span",{className:"text-sm",children:[((V=i.oceanTraits)==null?void 0:V.agreeableness)||50,"%"]})]}),a.jsx(On,{value:[((I=i.oceanTraits)==null?void 0:I.agreeableness)||50],onValueChange:z=>m("agreeableness",z[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Compassion, cooperation, and concern for others"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Neuroticism"}),a.jsxs("span",{className:"text-sm",children:[((L=i.oceanTraits)==null?void 0:L.neuroticism)||50,"%"]})]}),a.jsx(On,{value:[((Z=i.oceanTraits)==null?void 0:Z.neuroticism)||50],onValueChange:z=>m("neuroticism",z[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Emotional reactivity, anxiety, and sensitivity to stress"})]})]})]})})}),a.jsx(Bt,{value:"demographics",className:"mt-6",children:a.jsx(Ge,{children:a.jsxs(tt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Demographic Information"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Social Grade"}),a.jsxs(Xn,{value:i.socialGrade||"",onValueChange:z=>g("socialGrade",z),children:[a.jsx(Fn,{children:a.jsx(Yn,{placeholder:"Select social grade"})}),a.jsxs(Bn,{children:[a.jsx(be,{value:"A",children:"A - Higher managerial"}),a.jsx(be,{value:"B",children:"B - Intermediate managerial"}),a.jsx(be,{value:"C1",children:"C1 - Supervisory or clerical"}),a.jsx(be,{value:"C2",children:"C2 - Skilled manual workers"}),a.jsx(be,{value:"D",children:"D - Semi and unskilled manual workers"}),a.jsx(be,{value:"E",children:"E - State pensioners, unemployed"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Household Income"}),a.jsxs(Xn,{value:i.householdIncome||"",onValueChange:z=>g("householdIncome",z),children:[a.jsx(Fn,{children:a.jsx(Yn,{placeholder:"Select income range"})}),a.jsxs(Bn,{children:[a.jsx(be,{value:"Under $25k",children:"Under $25,000"}),a.jsx(be,{value:"$25k-$50k",children:"$25,000 - $50,000"}),a.jsx(be,{value:"$50k-$75k",children:"$50,000 - $75,000"}),a.jsx(be,{value:"$75k-$100k",children:"$75,000 - $100,000"}),a.jsx(be,{value:"$100k-$150k",children:"$100,000 - $150,000"}),a.jsx(be,{value:"$150k-$250k",children:"$150,000 - $250,000"}),a.jsx(be,{value:"Over $250k",children:"Over $250,000"}),a.jsx(be,{value:"Prefer not to say",children:"Prefer not to say"})]})]})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Household Composition"}),a.jsxs(Xn,{value:i.householdComposition||"",onValueChange:z=>g("householdComposition",z),children:[a.jsx(Fn,{children:a.jsx(Yn,{placeholder:"Select household type"})}),a.jsxs(Bn,{children:[a.jsx(be,{value:"Single person",children:"Single person"}),a.jsx(be,{value:"Couple without children",children:"Couple without children"}),a.jsx(be,{value:"Couple with children",children:"Couple with children"}),a.jsx(be,{value:"Single parent",children:"Single parent"}),a.jsx(be,{value:"Multi-generational",children:"Multi-generational"}),a.jsx(be,{value:"Shared housing",children:"Shared housing"}),a.jsx(be,{value:"Other",children:"Other"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Living Situation"}),a.jsxs(Xn,{value:i.livingSituation||"",onValueChange:z=>g("livingSituation",z),children:[a.jsx(Fn,{children:a.jsx(Yn,{placeholder:"Select living situation"})}),a.jsxs(Bn,{children:[a.jsx(be,{value:"Own home",children:"Own home"}),a.jsx(be,{value:"Rent apartment",children:"Rent apartment"}),a.jsx(be,{value:"Rent house",children:"Rent house"}),a.jsx(be,{value:"Live with family",children:"Live with family"}),a.jsx(be,{value:"Student housing",children:"Student housing"}),a.jsx(be,{value:"Assisted living",children:"Assisted living"}),a.jsx(be,{value:"Other",children:"Other"})]})]})]})]})]})]})})}),a.jsx(Bt,{value:"lifestyle",className:"mt-6",children:a.jsx(Ge,{children:a.jsxs(tt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Lifestyle & Behavior"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Media Consumption"}),a.jsx(Qe,{value:i.mediaConsumption||"",onChange:z=>g("mediaConsumption",z.target.value),rows:3,placeholder:"TV shows, podcasts, news sources, social media platforms"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Describe media consumption habits and preferences"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Device Usage"}),a.jsx(Qe,{value:i.deviceUsage||"",onChange:z=>g("deviceUsage",z.target.value),rows:3,placeholder:"Smartphone, laptop, tablet, smart TV, gaming console"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Primary devices and usage patterns"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Shopping Habits"}),a.jsx(Qe,{value:i.shoppingHabits||"",onChange:z=>g("shoppingHabits",z.target.value),rows:3,placeholder:"Online vs in-store, frequency, preferred retailers"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Shopping behavior and preferences"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Brand Preferences"}),a.jsx(Qe,{value:i.brandPreferences||"",onChange:z=>g("brandPreferences",z.target.value),rows:3,placeholder:"Favorite brands, brand values alignment"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Preferred brands and reasoning"})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Communication Preferences"}),a.jsx(Qe,{value:i.communicationPreferences||"",onChange:z=>g("communicationPreferences",z.target.value),rows:3,placeholder:"Email, phone, text, video calls, in-person"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Preferred communication methods and channels"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Payment Methods"}),a.jsx(Qe,{value:i.paymentMethods||"",onChange:z=>g("paymentMethods",z.target.value),rows:3,placeholder:"Credit cards, digital wallets, cash, BNPL"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Preferred payment methods and financial tools"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Purchase Behavior"}),a.jsx(Qe,{value:i.purchaseBehaviour||"",onChange:z=>g("purchaseBehaviour",z.target.value),rows:3,placeholder:"Research habits, decision factors, impulse vs planned buying"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"How they approach making purchase decisions"})]})]})]})]})})}),a.jsxs(Bt,{value:"extended",className:"mt-6 space-y-6",children:[a.jsx(Ge,{children:a.jsxs(tt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Extended Profile"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Core Values"}),a.jsx(Qe,{value:i.coreValues||"",onChange:z=>g("coreValues",z.target.value),rows:3,placeholder:"Key principles and values that guide decisions"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Lifestyle Choices"}),a.jsx(Qe,{value:i.lifestyleChoices||"",onChange:z=>g("lifestyleChoices",z.target.value),rows:3,placeholder:"Health, fitness, diet, work-life balance preferences"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Social Activities"}),a.jsx(Qe,{value:i.socialActivities||"",onChange:z=>g("socialActivities",z.target.value),rows:3,placeholder:"Social hobbies, community involvement, networking"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Category Knowledge"}),a.jsx(Qe,{value:i.categoryKnowledge||"",onChange:z=>g("categoryKnowledge",z.target.value),rows:3,placeholder:"Expertise in specific product/service categories"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Decision Influences"}),a.jsx(Qe,{value:i.decisionInfluences||"",onChange:z=>g("decisionInfluences",z.target.value),rows:3,placeholder:"What factors most influence their decisions"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Pain Points"}),a.jsx(Qe,{value:i.painPoints||"",onChange:z=>g("painPoints",z.target.value),rows:3,placeholder:"Common challenges and friction points"})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Journey Context"}),a.jsx(Qe,{value:i.journeyContext||"",onChange:z=>g("journeyContext",z.target.value),rows:3,placeholder:"Current life stage and contextual factors"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Key Touchpoints"}),a.jsx(Qe,{value:i.keyTouchpoints||"",onChange:z=>g("keyTouchpoints",z.target.value),rows:3,placeholder:"Important interaction points and channels"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h4",{className:"font-medium text-sm",children:"Self-Determination Needs"}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Autonomy"}),a.jsx(Qe,{value:((ee=i.selfDeterminationNeeds)==null?void 0:ee.autonomy)||"",onChange:z=>g("selfDeterminationNeeds",{...i.selfDeterminationNeeds,autonomy:z.target.value}),rows:2,placeholder:"Need for independence and self-direction"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Competence"}),a.jsx(Qe,{value:((re=i.selfDeterminationNeeds)==null?void 0:re.competence)||"",onChange:z=>g("selfDeterminationNeeds",{...i.selfDeterminationNeeds,competence:z.target.value}),rows:2,placeholder:"Need to feel capable and effective"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Relatedness"}),a.jsx(Qe,{value:((me=i.selfDeterminationNeeds)==null?void 0:me.relatedness)||"",onChange:z=>g("selfDeterminationNeeds",{...i.selfDeterminationNeeds,relatedness:z.target.value}),rows:2,placeholder:"Need for connection and belonging"})]})]})]})]})]})}),a.jsx(Ge,{children:a.jsx(tt,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Fears & Concerns"}),(i.fears||[]).map((z,ae)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(St,{value:z,onChange:de=>b("fears",ae,de.target.value),placeholder:"Enter a fear or concern"}),a.jsx(oe,{variant:"ghost",size:"icon",onClick:()=>y("fears",ae),children:a.jsx(gn,{className:"h-4 w-4 text-muted-foreground"})})]},ae)),a.jsxs(oe,{variant:"outline",size:"sm",onClick:()=>x("fears"),className:"mt-2",children:[a.jsx(or,{className:"h-4 w-4 mr-2"}),"Add Fear/Concern"]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Personal Narrative"}),a.jsx(Qe,{value:i.narrative||"",onChange:z=>g("narrative",z.target.value),rows:4,placeholder:"Personal story, background, key life experiences"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"A brief narrative that captures their personal story"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Additional Information"}),a.jsx(Qe,{value:i.additionalInformation||"",onChange:z=>g("additionalInformation",z.target.value),rows:4,placeholder:"Any other relevant details or context"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Additional context or details not covered elsewhere"})]})]})})})]})]})]})}function cOe(){const{id:e}=hR(),t=rs(),n=Cn(),[r,i]=v.useState(void 0),[s,o]=v.useState(!1),[l,c]=v.useState(!1),[u,d]=v.useState(!0);return v.useEffect(()=>{if(!e){d(!1);return}let p=!0;const m=new URLSearchParams(t.search).get("fromReview")==="true";return o(m),d(!0),(async()=>{try{const b=e.startsWith("local-")?e.substring(6):e,y=await Nn.getById(b);if(y&&y.data){const w=y.data;if(p){console.log("Found persona in database:",w),i({...w,id:w.id||w._id,isDbPersona:!0}),d(!1);return}}console.error("Could not find persona with id:",e),p&&(i(void 0),d(!1),pe.error("Persona not found"))}catch(b){console.error("Error fetching persona:",b),p&&(i(void 0),d(!1),pe.error("Failed to load persona details"))}})(),()=>{p=!1}},[e,t.search]),{currentPersona:r,isEditing:l,isFromReview:s,isLoading:u,setIsEditing:c,handleGoBack:()=>{n(s?"/synthetic-users?mode=create&tab=ai&step=review":"/synthetic-users")},handleSaveEdit:async p=>{try{c(!1);const g=p.isDbPersona||e&&e.length===24&&/^[0-9a-f]{24}$/i.test(e),m={...p};if(m._id&&delete m._id,delete m.isDbPersona,g&&e&&e.length===24&&/^[0-9a-f]{24}$/i.test(e)){const x=await Nn.update(e,m);console.log("Updated persona in database:",x);const b={...p,isDbPersona:!0};i(b),pe.success("Persona updated in database successfully")}else{const x=await Nn.create(m);console.log("Created new persona in database:",x.data);const b={...p,id:x.data._id||x.data.id,_id:x.data._id||x.data.id,isDbPersona:!0};i(b),pe.success("Persona saved to database successfully")}}catch(g){return console.error("Error saving persona:",g),g.response&&g.response.status===401?pe.error("Authentication error - Please log in to save personas"):g.response&&g.response.status===404?pe.error("API endpoint not found - Database service may be unavailable"):pe.error("Failed to save persona to database: "+(g.message||"Unknown error")),!1}return!0}}}function KT(){const{currentPersona:e,isEditing:t,isFromReview:n,isLoading:r,setIsEditing:i,handleGoBack:s,handleSaveEdit:o}=cOe();return r?a.jsx(aOe,{}):e?a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(ea,{}),a.jsx("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:t?a.jsx(lOe,{persona:e,onSave:o,onCancel:()=>i(!1)}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center mb-6 relative",children:[a.jsx(oe,{variant:"ghost",onClick:s,className:"absolute left-0 top-0 flex items-center",children:a.jsx(Kf,{className:"h-5 w-5"})}),a.jsx("h1",{className:"font-sf text-3xl font-bold text-slate-900 mx-auto",children:"Persona Profile"}),a.jsxs(oe,{onClick:()=>i(!0),className:"absolute right-0 top-0",children:[a.jsx(CG,{className:"h-4 w-4 mr-2"}),"Edit Persona"]})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 mt-10",children:[a.jsx("div",{className:"lg:col-span-1",children:a.jsx(tOe,{persona:e})}),a.jsx("div",{className:"lg:col-span-2",children:a.jsxs(Io,{defaultValue:"cooper-profile",children:[a.jsxs(Sa,{className:"grid w-full grid-cols-3",children:[a.jsx(Ft,{value:"cooper-profile",children:"Cooper Profile"}),a.jsx(Ft,{value:"personality",children:"Personality"}),a.jsx(Ft,{value:"scenarios",children:"Scenarios"})]}),a.jsx(Bt,{value:"cooper-profile",className:"mt-6",children:a.jsx(nOe,{persona:e})}),a.jsx(Bt,{value:"personality",className:"mt-6",children:a.jsx(rOe,{persona:e})}),a.jsx(Bt,{value:"scenarios",className:"mt-6",children:a.jsx(iOe,{persona:e})})]})})]})]})})]}):a.jsx(sOe,{})}const uOe=Le.object({username:Le.string().min(3,"Username must be at least 3 characters"),password:Le.string().min(4,"Password must be at least 4 characters")});function dOe(){var u;const e=Cn(),t=rs(),{login:n,isAuthenticated:r}=Ul(),[i,s]=v.useState(!1),o=((u=t.state)==null?void 0:u.from)||"/";console.log("Login page - destination path:",o),v.useEffect(()=>{r&&(console.log("User already authenticated, redirecting from login page"),e("/",{replace:!0}))},[r,e]);const l=Ky({resolver:Xy(uOe),defaultValues:{username:"",password:""}});async function c(d){s(!0);try{await n(d.username,d.password)?(console.log("Login successful, received token, navigating to:",o),e(o,{replace:!0})):(console.error("Login succeeded but no token received"),s(!1))}catch(f){console.error("Login error in form handler:",f),s(!1)}}return a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-gradient-to-br from-gray-100 to-gray-200 dark:from-gray-900 dark:to-gray-800 px-4",children:a.jsxs(Ge,{className:"w-full max-w-md",children:[a.jsxs($r,{className:"space-y-1",children:[a.jsx(Xr,{className:"text-2xl font-bold text-center",children:"Sign In"}),a.jsx(FN,{className:"text-center",children:"Enter your credentials to access your account"})]}),a.jsx(tt,{children:a.jsx(Zy,{...l,children:a.jsxs("form",{onSubmit:l.handleSubmit(c),className:"space-y-4",children:[a.jsx(at,{control:l.control,name:"username",render:({field:d})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Username"}),a.jsx(it,{children:a.jsx(St,{placeholder:"Enter your username",...d,disabled:i,autoComplete:"username"})}),a.jsx(st,{})]})}),a.jsx(at,{control:l.control,name:"password",render:({field:d})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Password"}),a.jsx(it,{children:a.jsx(St,{placeholder:"Enter your password",type:"password",...d,disabled:i,autoComplete:"current-password"})}),a.jsx(st,{})]})}),a.jsx(oe,{type:"submit",className:"w-full",disabled:i,children:i?"Signing in...":"Sign In"})]})})}),a.jsxs(BN,{className:"flex flex-col space-y-2",children:[a.jsx("div",{className:"text-sm text-center text-gray-500 mb-2",children:"Default account: user / pass"}),!i&&a.jsxs("div",{className:"flex flex-col items-center justify-center gap-2",children:[a.jsx(oe,{variant:"outline",onClick:()=>e("/",{replace:!0}),className:"mt-2",children:"Return to Home"}),a.jsx(oe,{variant:"link",onClick:()=>{localStorage.setItem("offline_mode","true");const d={username:"guest",email:"guest@example.com",role:"user"};localStorage.setItem("auth_token","offline-mode-token"),localStorage.setItem("user",JSON.stringify(d)),Ze.success("Offline mode activated",{description:"Using demo account with limited functionality"}),e("/",{replace:!0})},className:"text-sm text-gray-500",children:"Use offline mode"})]})]})]})})}function sc({children:e}){const{isAuthenticated:t,isLoading:n}=Ul(),r=rs();return console.log("ProtectedRoute check:",{isAuthenticated:t,isLoading:n,path:r.pathname}),n?a.jsx("div",{className:"flex items-center justify-center min-h-screen",children:a.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-primary"})}):t?(console.log("User is authenticated, showing protected content"),a.jsx(a.Fragment,{children:e})):(console.log("Not authenticated, redirecting to login"),a.jsx(vR,{to:"/login",state:{from:r.pathname},replace:!0}))}const fOe=new nH,hOe=()=>a.jsx(iH,{client:fOe,children:a.jsx(JH,{basename:"/semblance",children:a.jsx(cK,{children:a.jsxs($W,{children:[a.jsx(o7,{}),a.jsxs(GH,{children:[a.jsx(Ti,{path:"/",element:a.jsx(dK,{})}),a.jsx(Ti,{path:"/login",element:a.jsx(dOe,{})}),a.jsx(Ti,{path:"/synthetic-users",element:a.jsx(sc,{children:a.jsx(mee,{})})}),a.jsx(Ti,{path:"/synthetic-users/:id",element:a.jsx(sc,{children:a.jsx(KT,{})})}),a.jsx(Ti,{path:"/personas/:id",element:a.jsx(sc,{children:a.jsx(KT,{})})}),a.jsx(Ti,{path:"/focus-groups",element:a.jsx(sc,{children:a.jsx(sEe,{})})}),a.jsx(Ti,{path:"/focus-groups/:id",element:a.jsx(sc,{children:a.jsx(WEe,{})})}),a.jsx(Ti,{path:"/dashboard",element:a.jsx(sc,{children:a.jsx(eOe,{})})}),a.jsx(Ti,{path:"/old-path",element:a.jsx(vR,{to:"/",replace:!0})}),a.jsx(Ti,{path:"*",element:a.jsx(fK,{})})]})]})})})});vM(document.getElementById("root")).render(a.jsx(hOe,{})); diff --git a/dist/assets/index-Dod4tGHl.js b/dist/assets/index-Dod4tGHl.js new file mode 100644 index 00000000..01ea4a49 --- /dev/null +++ b/dist/assets/index-Dod4tGHl.js @@ -0,0 +1,732 @@ +var tC=e=>{throw TypeError(e)};var m0=(e,t,n)=>t.has(e)||tC("Cannot "+n);var je=(e,t,n)=>(m0(e,t,"read from private field"),n?n.call(e):t.get(e)),Ut=(e,t,n)=>t.has(e)?tC("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Nt=(e,t,n,r)=>(m0(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),cr=(e,t,n)=>(m0(e,t,"access private method"),n);var Gp=(e,t,n,r)=>({set _(s){Nt(e,t,s,n)},get _(){return je(e,t,r)}});function h8(e,t){for(var n=0;nr[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var qp=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var d$={exports:{}},by={},f$={exports:{}},Ot={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var hp=Symbol.for("react.element"),p8=Symbol.for("react.portal"),m8=Symbol.for("react.fragment"),g8=Symbol.for("react.strict_mode"),v8=Symbol.for("react.profiler"),y8=Symbol.for("react.provider"),x8=Symbol.for("react.context"),b8=Symbol.for("react.forward_ref"),w8=Symbol.for("react.suspense"),j8=Symbol.for("react.memo"),S8=Symbol.for("react.lazy"),nC=Symbol.iterator;function N8(e){return e===null||typeof e!="object"?null:(e=nC&&e[nC]||e["@@iterator"],typeof e=="function"?e:null)}var h$={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},p$=Object.assign,m$={};function Hu(e,t,n){this.props=e,this.context=t,this.refs=m$,this.updater=n||h$}Hu.prototype.isReactComponent={};Hu.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Hu.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function g$(){}g$.prototype=Hu.prototype;function dS(e,t,n){this.props=e,this.context=t,this.refs=m$,this.updater=n||h$}var fS=dS.prototype=new g$;fS.constructor=dS;p$(fS,Hu.prototype);fS.isPureReactComponent=!0;var rC=Array.isArray,v$=Object.prototype.hasOwnProperty,hS={current:null},y$={key:!0,ref:!0,__self:!0,__source:!0};function x$(e,t,n){var r,s={},i=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)v$.call(t,r)&&!y$.hasOwnProperty(r)&&(s[r]=t[r]);var l=arguments.length-2;if(l===1)s.children=n;else if(1>>1,ee=$[Q];if(0>>1;Qs(he,Y))pes(ue,he)?($[Q]=ue,$[pe]=Y,Q=pe):($[Q]=he,$[W]=Y,Q=W);else if(pes(ue,Y))$[Q]=ue,$[pe]=Y,Q=pe;else break e}}return L}function s($,L){var Y=$.sortIndex-L.sortIndex;return Y!==0?Y:$.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],u=[],d=1,f=null,h=3,p=!1,g=!1,m=!1,x=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w($){for(var L=n(u);L!==null;){if(L.callback===null)r(u);else if(L.startTime<=$)r(u),L.sortIndex=L.expirationTime,t(c,L);else break;L=n(u)}}function j($){if(m=!1,w($),!g)if(n(c)!==null)g=!0,F(S);else{var L=n(u);L!==null&&V(j,L.startTime-$)}}function S($,L){g=!1,m&&(m=!1,b(_),_=-1),p=!0;var Y=h;try{for(w(L),f=n(c);f!==null&&(!(f.expirationTime>L)||$&&!T());){var Q=f.callback;if(typeof Q=="function"){f.callback=null,h=f.priorityLevel;var ee=Q(f.expirationTime<=L);L=e.unstable_now(),typeof ee=="function"?f.callback=ee:f===n(c)&&r(c),w(L)}else r(c);f=n(c)}if(f!==null)var fe=!0;else{var W=n(u);W!==null&&V(j,W.startTime-L),fe=!1}return fe}finally{f=null,h=Y,p=!1}}var N=!1,P=null,_=-1,A=5,O=-1;function T(){return!(e.unstable_now()-O$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function($){switch(h){case 1:case 2:case 3:var L=3;break;default:L=h}var Y=h;h=L;try{return $()}finally{h=Y}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function($,L){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var Y=h;h=$;try{return L()}finally{h=Y}},e.unstable_scheduleCallback=function($,L,Y){var Q=e.unstable_now();switch(typeof Y=="object"&&Y!==null?(Y=Y.delay,Y=typeof Y=="number"&&0Q?($.sortIndex=Y,t(u,$),n(c)===null&&$===n(u)&&(m?(b(_),_=-1):m=!0,V(j,Y-Q))):($.sortIndex=ee,t(c,$),g||p||(g=!0,F(S))),$},e.unstable_shouldYield=T,e.unstable_wrapCallback=function($){var L=h;return function(){var Y=h;h=L;try{return $.apply(this,arguments)}finally{h=Y}}}})(_$);N$.exports=_$;var M8=N$.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var R8=v,cs=M8;function Ee(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ub=Object.prototype.hasOwnProperty,D8=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,iC={},aC={};function L8(e){return Ub.call(aC,e)?!0:Ub.call(iC,e)?!1:D8.test(e)?aC[e]=!0:(iC[e]=!0,!1)}function F8(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function B8(e,t,n,r){if(t===null||typeof t>"u"||F8(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function $r(e,t,n,r,s,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var ar={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ar[e]=new $r(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ar[t]=new $r(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ar[e]=new $r(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ar[e]=new $r(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){ar[e]=new $r(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ar[e]=new $r(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ar[e]=new $r(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ar[e]=new $r(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ar[e]=new $r(e,5,!1,e.toLowerCase(),null,!1,!1)});var mS=/[\-:]([a-z])/g;function gS(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(mS,gS);ar[t]=new $r(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(mS,gS);ar[t]=new $r(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(mS,gS);ar[t]=new $r(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ar[e]=new $r(e,1,!1,e.toLowerCase(),null,!1,!1)});ar.xlinkHref=new $r("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ar[e]=new $r(e,1,!1,e.toLowerCase(),null,!0,!0)});function vS(e,t,n,r){var s=ar.hasOwnProperty(t)?ar[t]:null;(s!==null?s.type!==0:r||!(2l||s[o]!==i[l]){var c=` +`+s[o].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{y0=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Jd(e):""}function z8(e){switch(e.tag){case 5:return Jd(e.type);case 16:return Jd("Lazy");case 13:return Jd("Suspense");case 19:return Jd("SuspenseList");case 0:case 2:case 15:return e=x0(e.type,!1),e;case 11:return e=x0(e.type.render,!1),e;case 1:return e=x0(e.type,!0),e;default:return""}}function Gb(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case vc:return"Fragment";case gc:return"Portal";case Vb:return"Profiler";case yS:return"StrictMode";case Wb:return"Suspense";case Hb:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case A$:return(e.displayName||"Context")+".Consumer";case C$:return(e._context.displayName||"Context")+".Provider";case xS:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case bS:return t=e.displayName||null,t!==null?t:Gb(e.type)||"Memo";case Ha:t=e._payload,e=e._init;try{return Gb(e(t))}catch{}}return null}function U8(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Gb(t);case 8:return t===yS?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function _o(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function O$(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function V8(e){var t=O$(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Yp(e){e._valueTracker||(e._valueTracker=V8(e))}function k$(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=O$(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function rg(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function qb(e,t){var n=t.checked;return hn({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function lC(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=_o(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function T$(e,t){t=t.checked,t!=null&&vS(e,"checked",t,!1)}function Kb(e,t){T$(e,t);var n=_o(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Xb(e,t.type,n):t.hasOwnProperty("defaultValue")&&Xb(e,t.type,_o(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function cC(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Xb(e,t,n){(t!=="number"||rg(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var ef=Array.isArray;function $c(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=Zp.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function If(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var df={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},W8=["Webkit","ms","Moz","O"];Object.keys(df).forEach(function(e){W8.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),df[t]=df[e]})});function R$(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||df.hasOwnProperty(e)&&df[e]?(""+t).trim():t+"px"}function D$(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=R$(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var H8=hn({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Qb(e,t){if(t){if(H8[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Ee(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Ee(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Ee(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Ee(62))}}function Jb(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var ew=null;function wS(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var tw=null,Ic=null,Mc=null;function fC(e){if(e=gp(e)){if(typeof tw!="function")throw Error(Ee(280));var t=e.stateNode;t&&(t=_y(t),tw(e.stateNode,e.type,t))}}function L$(e){Ic?Mc?Mc.push(e):Mc=[e]:Ic=e}function F$(){if(Ic){var e=Ic,t=Mc;if(Mc=Ic=null,fC(e),t)for(e=0;e>>=0,e===0?32:31-(nU(e)/rU|0)|0}var Qp=64,Jp=4194304;function tf(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function og(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~s;l!==0?r=tf(l):(i&=o,i!==0&&(r=tf(i)))}else o=n&~s,o!==0?r=tf(o):i!==0&&(r=tf(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function pp(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Zs(t),e[t]=n}function oU(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=hf),wC=" ",jC=!1;function iI(e,t){switch(e){case"keyup":return MU.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function aI(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var yc=!1;function DU(e,t){switch(e){case"compositionend":return aI(t);case"keypress":return t.which!==32?null:(jC=!0,wC);case"textInput":return e=t.data,e===wC&&jC?null:e;default:return null}}function LU(e,t){if(yc)return e==="compositionend"||!ES&&iI(e,t)?(e=rI(),Fm=PS=io=null,yc=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=PC(n)}}function uI(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?uI(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function dI(){for(var e=window,t=rg();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=rg(e.document)}return t}function OS(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function qU(e){var t=dI(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&uI(n.ownerDocument.documentElement,n)){if(r!==null&&OS(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=CC(n,i);var o=CC(n,r);s&&o&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,xc=null,ow=null,mf=null,lw=!1;function AC(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;lw||xc==null||xc!==rg(r)||(r=xc,"selectionStart"in r&&OS(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),mf&&Bf(mf,r)||(mf=r,r=ug(ow,"onSelect"),0jc||(e.current=pw[jc],pw[jc]=null,jc--)}function en(e,t){jc++,pw[jc]=e.current,e.current=t}var Po={},xr=Fo(Po),Vr=Fo(!1),Ol=Po;function au(e,t){var n=e.type.contextTypes;if(!n)return Po;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Wr(e){return e=e.childContextTypes,e!=null}function fg(){an(Vr),an(xr)}function MC(e,t,n){if(xr.current!==Po)throw Error(Ee(168));en(xr,t),en(Vr,n)}function bI(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(Ee(108,U8(e)||"Unknown",s));return hn({},n,r)}function hg(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Po,Ol=xr.current,en(xr,e),en(Vr,Vr.current),!0}function RC(e,t,n){var r=e.stateNode;if(!r)throw Error(Ee(169));n?(e=bI(e,t,Ol),r.__reactInternalMemoizedMergedChildContext=e,an(Vr),an(xr),en(xr,e)):an(Vr),en(Vr,n)}var Zi=null,Py=!1,$0=!1;function wI(e){Zi===null?Zi=[e]:Zi.push(e)}function iV(e){Py=!0,wI(e)}function Bo(){if(!$0&&Zi!==null){$0=!0;var e=0,t=Gt;try{var n=Zi;for(Gt=1;e>=o,s-=o,ea=1<<32-Zs(t)+s|n<_?(A=P,P=null):A=P.sibling;var O=h(b,P,w[_],j);if(O===null){P===null&&(P=A);break}e&&P&&O.alternate===null&&t(b,P),y=i(O,y,_),N===null?S=O:N.sibling=O,N=O,P=A}if(_===w.length)return n(b,P),ln&&tl(b,_),S;if(P===null){for(;__?(A=P,P=null):A=P.sibling;var T=h(b,P,O.value,j);if(T===null){P===null&&(P=A);break}e&&P&&T.alternate===null&&t(b,P),y=i(T,y,_),N===null?S=T:N.sibling=T,N=T,P=A}if(O.done)return n(b,P),ln&&tl(b,_),S;if(P===null){for(;!O.done;_++,O=w.next())O=f(b,O.value,j),O!==null&&(y=i(O,y,_),N===null?S=O:N.sibling=O,N=O);return ln&&tl(b,_),S}for(P=r(b,P);!O.done;_++,O=w.next())O=p(P,b,_,O.value,j),O!==null&&(e&&O.alternate!==null&&P.delete(O.key===null?_:O.key),y=i(O,y,_),N===null?S=O:N.sibling=O,N=O);return e&&P.forEach(function(k){return t(b,k)}),ln&&tl(b,_),S}function x(b,y,w,j){if(typeof w=="object"&&w!==null&&w.type===vc&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Xp:e:{for(var S=w.key,N=y;N!==null;){if(N.key===S){if(S=w.type,S===vc){if(N.tag===7){n(b,N.sibling),y=s(N,w.props.children),y.return=b,b=y;break e}}else if(N.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Ha&&FC(S)===N.type){n(b,N.sibling),y=s(N,w.props),y.ref=Td(b,N,w),y.return=b,b=y;break e}n(b,N);break}else t(b,N);N=N.sibling}w.type===vc?(y=Nl(w.props.children,b.mode,j,w.key),y.return=b,b=y):(j=qm(w.type,w.key,w.props,null,b.mode,j),j.ref=Td(b,y,w),j.return=b,b=j)}return o(b);case gc:e:{for(N=w.key;y!==null;){if(y.key===N)if(y.tag===4&&y.stateNode.containerInfo===w.containerInfo&&y.stateNode.implementation===w.implementation){n(b,y.sibling),y=s(y,w.children||[]),y.return=b,b=y;break e}else{n(b,y);break}else t(b,y);y=y.sibling}y=z0(w,b.mode,j),y.return=b,b=y}return o(b);case Ha:return N=w._init,x(b,y,N(w._payload),j)}if(ef(w))return g(b,y,w,j);if(Cd(w))return m(b,y,w,j);am(b,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,y!==null&&y.tag===6?(n(b,y.sibling),y=s(y,w),y.return=b,b=y):(n(b,y),y=B0(w,b.mode,j),y.return=b,b=y),o(b)):n(b,y)}return x}var lu=_I(!0),PI=_I(!1),gg=Fo(null),vg=null,_c=null,IS=null;function MS(){IS=_c=vg=null}function RS(e){var t=gg.current;an(gg),e._currentValue=t}function vw(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Dc(e,t){vg=e,IS=_c=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(zr=!0),e.firstContext=null)}function Os(e){var t=e._currentValue;if(IS!==e)if(e={context:e,memoizedValue:t,next:null},_c===null){if(vg===null)throw Error(Ee(308));_c=e,vg.dependencies={lanes:0,firstContext:e}}else _c=_c.next=e;return t}var cl=null;function DS(e){cl===null?cl=[e]:cl.push(e)}function CI(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,DS(t)):(n.next=s.next,s.next=n),t.interleaved=n,va(e,r)}function va(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Ga=!1;function LS(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function AI(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function aa(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function mo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Rt&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,va(e,n)}return s=r.interleaved,s===null?(t.next=t,DS(r)):(t.next=s.next,s.next=t),r.interleaved=t,va(e,n)}function zm(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,SS(e,n)}}function BC(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function yg(e,t,n,r){var s=e.updateQueue;Ga=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?i=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(i!==null){var f=s.baseState;o=0,d=u=c=null,l=i;do{var h=l.lane,p=l.eventTime;if((r&h)===h){d!==null&&(d=d.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var g=e,m=l;switch(h=t,p=n,m.tag){case 1:if(g=m.payload,typeof g=="function"){f=g.call(p,f,h);break e}f=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=m.payload,h=typeof g=="function"?g.call(p,f,h):g,h==null)break e;f=hn({},f,h);break e;case 2:Ga=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,h=s.effects,h===null?s.effects=[l]:h.push(l))}else p={eventTime:p,lane:h,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=p,c=f):d=d.next=p,o|=h;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;h=l,l=h.next,h.next=null,s.lastBaseUpdate=h,s.shared.pending=null}}while(!0);if(d===null&&(c=f),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=d,t=s.shared.interleaved,t!==null){s=t;do o|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);$l|=o,e.lanes=o,e.memoizedState=f}}function zC(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=M0.transition;M0.transition={};try{e(!1),t()}finally{Gt=n,M0.transition=r}}function HI(){return ks().memoizedState}function cV(e,t,n){var r=vo(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},GI(e))qI(t,n);else if(n=CI(e,t,n,r),n!==null){var s=Or();Qs(n,e,r,s),KI(n,t,r)}}function uV(e,t,n){var r=vo(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(GI(e))qI(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,l=i(o,n);if(s.hasEagerState=!0,s.eagerState=l,ri(l,o)){var c=t.interleaved;c===null?(s.next=s,DS(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}n=CI(e,t,s,r),n!==null&&(s=Or(),Qs(n,e,r,s),KI(n,t,r))}}function GI(e){var t=e.alternate;return e===fn||t!==null&&t===fn}function qI(e,t){gf=bg=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function KI(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,SS(e,n)}}var wg={readContext:Os,useCallback:ur,useContext:ur,useEffect:ur,useImperativeHandle:ur,useInsertionEffect:ur,useLayoutEffect:ur,useMemo:ur,useReducer:ur,useRef:ur,useState:ur,useDebugValue:ur,useDeferredValue:ur,useTransition:ur,useMutableSource:ur,useSyncExternalStore:ur,useId:ur,unstable_isNewReconciler:!1},dV={readContext:Os,useCallback:function(e,t){return gi().memoizedState=[e,t===void 0?null:t],e},useContext:Os,useEffect:VC,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Vm(4194308,4,BI.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Vm(4194308,4,e,t)},useInsertionEffect:function(e,t){return Vm(4,2,e,t)},useMemo:function(e,t){var n=gi();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=gi();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=cV.bind(null,fn,e),[r.memoizedState,e]},useRef:function(e){var t=gi();return e={current:e},t.memoizedState=e},useState:UC,useDebugValue:GS,useDeferredValue:function(e){return gi().memoizedState=e},useTransition:function(){var e=UC(!1),t=e[0];return e=lV.bind(null,e[1]),gi().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=fn,s=gi();if(ln){if(n===void 0)throw Error(Ee(407));n=n()}else{if(n=t(),Jn===null)throw Error(Ee(349));Tl&30||TI(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,VC(II.bind(null,r,i,e),[e]),r.flags|=2048,Kf(9,$I.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=gi(),t=Jn.identifierPrefix;if(ln){var n=ta,r=ea;n=(r&~(1<<32-Zs(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Gf++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[wi]=t,e[Vf]=r,sM(e,t,!1,!1),t.stateNode=e;e:{switch(o=Jb(n,r),n){case"dialog":nn("cancel",e),nn("close",e),s=r;break;case"iframe":case"object":case"embed":nn("load",e),s=r;break;case"video":case"audio":for(s=0;sdu&&(t.flags|=128,r=!0,$d(i,!1),t.lanes=4194304)}else{if(!r)if(e=xg(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),$d(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!ln)return dr(t),null}else 2*Nn()-i.renderingStartTime>du&&n!==1073741824&&(t.flags|=128,r=!0,$d(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Nn(),t.sibling=null,n=dn.current,en(dn,r?n&1|2:n&1),t):(dr(t),null);case 22:case 23:return QS(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Jr&1073741824&&(dr(t),t.subtreeFlags&6&&(t.flags|=8192)):dr(t),null;case 24:return null;case 25:return null}throw Error(Ee(156,t.tag))}function xV(e,t){switch(TS(t),t.tag){case 1:return Wr(t.type)&&fg(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return cu(),an(Vr),an(xr),zS(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return BS(t),null;case 13:if(an(dn),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Ee(340));ou()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return an(dn),null;case 4:return cu(),null;case 10:return RS(t.type._context),null;case 22:case 23:return QS(),null;case 24:return null;default:return null}}var lm=!1,gr=!1,bV=typeof WeakSet=="function"?WeakSet:Set,He=null;function Pc(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){gn(e,t,r)}else n.current=null}function Pw(e,t,n){try{n()}catch(r){gn(e,t,r)}}var eA=!1;function wV(e,t){if(cw=lg,e=dI(),OS(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var p;f!==n||s!==0&&f.nodeType!==3||(l=o+s),f!==i||r!==0&&f.nodeType!==3||(c=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===e)break t;if(h===n&&++u===s&&(l=o),h===i&&++d===r&&(c=o),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(uw={focusedElem:e,selectionRange:n},lg=!1,He=t;He!==null;)if(t=He,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,He=e;else for(;He!==null;){t=He;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var m=g.memoizedProps,x=g.memoizedState,b=t.stateNode,y=b.getSnapshotBeforeUpdate(t.elementType===t.type?m:Bs(t.type,m),x);b.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Ee(163))}}catch(j){gn(t,t.return,j)}if(e=t.sibling,e!==null){e.return=t.return,He=e;break}He=t.return}return g=eA,eA=!1,g}function vf(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&Pw(t,n,i)}s=s.next}while(s!==r)}}function Ey(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Cw(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function oM(e){var t=e.alternate;t!==null&&(e.alternate=null,oM(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[wi],delete t[Vf],delete t[hw],delete t[rV],delete t[sV])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function lM(e){return e.tag===5||e.tag===3||e.tag===4}function tA(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||lM(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Aw(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=dg));else if(r!==4&&(e=e.child,e!==null))for(Aw(e,t,n),e=e.sibling;e!==null;)Aw(e,t,n),e=e.sibling}function Ew(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Ew(e,t,n),e=e.sibling;e!==null;)Ew(e,t,n),e=e.sibling}var sr=null,Vs=!1;function Fa(e,t,n){for(n=n.child;n!==null;)cM(e,t,n),n=n.sibling}function cM(e,t,n){if(Ci&&typeof Ci.onCommitFiberUnmount=="function")try{Ci.onCommitFiberUnmount(wy,n)}catch{}switch(n.tag){case 5:gr||Pc(n,t);case 6:var r=sr,s=Vs;sr=null,Fa(e,t,n),sr=r,Vs=s,sr!==null&&(Vs?(e=sr,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):sr.removeChild(n.stateNode));break;case 18:sr!==null&&(Vs?(e=sr,n=n.stateNode,e.nodeType===8?T0(e.parentNode,n):e.nodeType===1&&T0(e,n),Lf(e)):T0(sr,n.stateNode));break;case 4:r=sr,s=Vs,sr=n.stateNode.containerInfo,Vs=!0,Fa(e,t,n),sr=r,Vs=s;break;case 0:case 11:case 14:case 15:if(!gr&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&Pw(n,t,o),s=s.next}while(s!==r)}Fa(e,t,n);break;case 1:if(!gr&&(Pc(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){gn(n,t,l)}Fa(e,t,n);break;case 21:Fa(e,t,n);break;case 22:n.mode&1?(gr=(r=gr)||n.memoizedState!==null,Fa(e,t,n),gr=r):Fa(e,t,n);break;default:Fa(e,t,n)}}function nA(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new bV),t.forEach(function(r){var s=OV.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Rs(e,t){var n=t.deletions;if(n!==null)for(var r=0;rs&&(s=o),r&=~i}if(r=s,r=Nn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*SV(r/1960))-r,10e?16:e,ao===null)var r=!1;else{if(e=ao,ao=null,Ng=0,Rt&6)throw Error(Ee(331));var s=Rt;for(Rt|=4,He=e.current;He!==null;){var i=He,o=i.child;if(He.flags&16){var l=i.deletions;if(l!==null){for(var c=0;cNn()-YS?Sl(e,0):XS|=n),Hr(e,t)}function vM(e,t){t===0&&(e.mode&1?(t=Jp,Jp<<=1,!(Jp&130023424)&&(Jp=4194304)):t=1);var n=Or();e=va(e,t),e!==null&&(pp(e,t,n),Hr(e,n))}function EV(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),vM(e,n)}function OV(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(Ee(314))}r!==null&&r.delete(t),vM(e,n)}var yM;yM=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Vr.current)zr=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return zr=!1,vV(e,t,n);zr=!!(e.flags&131072)}else zr=!1,ln&&t.flags&1048576&&jI(t,mg,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Wm(e,t),e=t.pendingProps;var s=au(t,xr.current);Dc(t,n),s=VS(null,t,r,e,s,n);var i=WS();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Wr(r)?(i=!0,hg(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,LS(t),s.updater=Ay,t.stateNode=s,s._reactInternals=t,xw(t,r,e,n),t=jw(null,t,r,!0,i,n)):(t.tag=0,ln&&i&&kS(t),Nr(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Wm(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=TV(r),e=Bs(r,e),s){case 0:t=ww(null,t,r,e,n);break e;case 1:t=ZC(null,t,r,e,n);break e;case 11:t=XC(null,t,r,e,n);break e;case 14:t=YC(null,t,r,Bs(r.type,e),n);break e}throw Error(Ee(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Bs(r,s),ww(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Bs(r,s),ZC(e,t,r,s,n);case 3:e:{if(tM(t),e===null)throw Error(Ee(387));r=t.pendingProps,i=t.memoizedState,s=i.element,AI(e,t),yg(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=uu(Error(Ee(423)),t),t=QC(e,t,r,n,s);break e}else if(r!==s){s=uu(Error(Ee(424)),t),t=QC(e,t,r,n,s);break e}else for(ss=po(t.stateNode.containerInfo.firstChild),is=t,ln=!0,Gs=null,n=PI(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ou(),r===s){t=ya(e,t,n);break e}Nr(e,t,r,n)}t=t.child}return t;case 5:return EI(t),e===null&&gw(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,o=s.children,dw(r,s)?o=null:i!==null&&dw(r,i)&&(t.flags|=32),eM(e,t),Nr(e,t,o,n),t.child;case 6:return e===null&&gw(t),null;case 13:return nM(e,t,n);case 4:return FS(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=lu(t,null,r,n):Nr(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Bs(r,s),XC(e,t,r,s,n);case 7:return Nr(e,t,t.pendingProps,n),t.child;case 8:return Nr(e,t,t.pendingProps.children,n),t.child;case 12:return Nr(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,o=s.value,en(gg,r._currentValue),r._currentValue=o,i!==null)if(ri(i.value,o)){if(i.children===s.children&&!Vr.current){t=ya(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){o=i.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=aa(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),vw(i.return,n,t),l.lanes|=n;break}c=c.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(Ee(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),vw(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}Nr(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,Dc(t,n),s=Os(s),r=r(s),t.flags|=1,Nr(e,t,r,n),t.child;case 14:return r=t.type,s=Bs(r,t.pendingProps),s=Bs(r.type,s),YC(e,t,r,s,n);case 15:return QI(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Bs(r,s),Wm(e,t),t.tag=1,Wr(r)?(e=!0,hg(t)):e=!1,Dc(t,n),XI(t,r,s),xw(t,r,s,n),jw(null,t,r,!0,e,n);case 19:return rM(e,t,n);case 22:return JI(e,t,n)}throw Error(Ee(156,t.tag))};function xM(e,t){return G$(e,t)}function kV(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ns(e,t,n,r){return new kV(e,t,n,r)}function eN(e){return e=e.prototype,!(!e||!e.isReactComponent)}function TV(e){if(typeof e=="function")return eN(e)?1:0;if(e!=null){if(e=e.$$typeof,e===xS)return 11;if(e===bS)return 14}return 2}function yo(e,t){var n=e.alternate;return n===null?(n=Ns(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function qm(e,t,n,r,s,i){var o=2;if(r=e,typeof e=="function")eN(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case vc:return Nl(n.children,s,i,t);case yS:o=8,s|=8;break;case Vb:return e=Ns(12,n,t,s|2),e.elementType=Vb,e.lanes=i,e;case Wb:return e=Ns(13,n,t,s),e.elementType=Wb,e.lanes=i,e;case Hb:return e=Ns(19,n,t,s),e.elementType=Hb,e.lanes=i,e;case E$:return ky(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case C$:o=10;break e;case A$:o=9;break e;case xS:o=11;break e;case bS:o=14;break e;case Ha:o=16,r=null;break e}throw Error(Ee(130,e==null?e:typeof e,""))}return t=Ns(o,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function Nl(e,t,n,r){return e=Ns(7,e,r,t),e.lanes=n,e}function ky(e,t,n,r){return e=Ns(22,e,r,t),e.elementType=E$,e.lanes=n,e.stateNode={isHidden:!1},e}function B0(e,t,n){return e=Ns(6,e,null,t),e.lanes=n,e}function z0(e,t,n){return t=Ns(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function $V(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=w0(0),this.expirationTimes=w0(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=w0(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function tN(e,t,n,r,s,i,o,l,c){return e=new $V(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Ns(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},LS(i),e}function IV(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(SM)}catch(e){console.error(e)}}SM(),S$.exports=ds;var Xs=S$.exports;const NM=Bt(Xs);var _M,uA=Xs;_M=uA.createRoot,uA.hydrateRoot;var dA=["light","dark"],FV="(prefers-color-scheme: dark)",BV=v.createContext(void 0),zV={setTheme:e=>{},themes:[]},UV=()=>{var e;return(e=v.useContext(BV))!=null?e:zV};v.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:s,defaultTheme:i,value:o,attrs:l,nonce:c})=>{let u=i==="system",d=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${l.map(g=>`'${g}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,f=s?dA.includes(i)&&i?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${i}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",h=(g,m=!1,x=!0)=>{let b=o?o[g]:g,y=m?g+"|| ''":`'${b}'`,w="";return s&&x&&!m&&dA.includes(g)&&(w+=`d.style.colorScheme = '${g}';`),n==="class"?m||b?w+=`c.add(${y})`:w+="null":b&&(w+=`d[s](n,${y})`),w},p=e?`!function(){${d}${h(e)}}()`:r?`!function(){try{${d}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${u})){var t='${FV}',m=window.matchMedia(t);if(m.media!==t||m.matches){${h("dark")}}else{${h("light")}}}else if(e){${o?`var x=${JSON.stringify(o)};`:""}${h(o?"x[e]":"e",!0)}}${u?"":"else{"+h(i,!1,!1)+"}"}${f}}catch(e){}}()`:`!function(){try{${d}var e=localStorage.getItem('${t}');if(e){${o?`var x=${JSON.stringify(o)};`:""}${h(o?"x[e]":"e",!0)}}else{${h(i,!1,!1)};}${f}}catch(t){}}();`;return v.createElement("script",{nonce:c,dangerouslySetInnerHTML:{__html:p}})});var VV=e=>{switch(e){case"success":return GV;case"info":return KV;case"warning":return qV;case"error":return XV;default:return null}},WV=Array(12).fill(0),HV=({visible:e})=>C.createElement("div",{className:"sonner-loading-wrapper","data-visible":e},C.createElement("div",{className:"sonner-spinner"},WV.map((t,n)=>C.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),GV=C.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},C.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),qV=C.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},C.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),KV=C.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},C.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),XV=C.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},C.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),YV=()=>{let[e,t]=C.useState(document.hidden);return C.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},Iw=1,ZV=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:n,...r}=e,s=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:Iw++,i=this.toasts.find(l=>l.id===s),o=e.dismissible===void 0?!0:e.dismissible;return i?this.toasts=this.toasts.map(l=>l.id===s?(this.publish({...l,...e,id:s,title:n}),{...l,...e,id:s,dismissible:o,title:n}):l):this.addToast({title:n,...r,dismissible:o,id:s}),s},this.dismiss=e=>(e||this.toasts.forEach(t=>{this.subscribers.forEach(n=>n({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let r=e instanceof Promise?e:e(),s=n!==void 0;return r.then(async i=>{if(JV(i)&&!i.ok){s=!1;let o=typeof t.error=="function"?await t.error(`HTTP error! status: ${i.status}`):t.error,l=typeof t.description=="function"?await t.description(`HTTP error! status: ${i.status}`):t.description;this.create({id:n,type:"error",message:o,description:l})}else if(t.success!==void 0){s=!1;let o=typeof t.success=="function"?await t.success(i):t.success,l=typeof t.description=="function"?await t.description(i):t.description;this.create({id:n,type:"success",message:o,description:l})}}).catch(async i=>{if(t.error!==void 0){s=!1;let o=typeof t.error=="function"?await t.error(i):t.error,l=typeof t.description=="function"?await t.description(i):t.description;this.create({id:n,type:"error",message:o,description:l})}}).finally(()=>{var i;s&&(this.dismiss(n),n=void 0),(i=t.finally)==null||i.call(t)}),n},this.custom=(e,t)=>{let n=(t==null?void 0:t.id)||Iw++;return this.create({jsx:e(n),id:n,...t}),n},this.subscribers=[],this.toasts=[]}},Qr=new ZV,QV=(e,t)=>{let n=(t==null?void 0:t.id)||Iw++;return Qr.addToast({title:e,...t,id:n}),n},JV=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",e7=QV,t7=()=>Qr.toasts,ce=Object.assign(e7,{success:Qr.success,info:Qr.info,warning:Qr.warning,error:Qr.error,custom:Qr.custom,message:Qr.message,promise:Qr.promise,dismiss:Qr.dismiss,loading:Qr.loading},{getHistory:t7});function n7(e,{insertAt:t}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}n7(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999}:where([data-sonner-toaster][data-x-position="right"]){right:max(var(--offset),env(safe-area-inset-right))}:where([data-sonner-toaster][data-x-position="left"]){left:max(var(--offset),env(safe-area-inset-left))}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:max(var(--offset),env(safe-area-inset-top))}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:max(var(--offset),env(safe-area-inset-bottom))}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;background:var(--gray1);color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:0;right:0;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount, 0px));transition:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation:swipe-out .2s ease-out forwards}@keyframes swipe-out{0%{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount)));opacity:1}to{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;--mobile-offset: 16px;right:var(--mobile-offset);left:var(--mobile-offset);width:100%}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset)}[data-sonner-toaster][data-y-position=bottom]{bottom:20px}[data-sonner-toaster][data-y-position=top]{top:20px}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset);right:var(--mobile-offset);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} +`);function dm(e){return e.label!==void 0}var r7=3,s7="32px",i7=4e3,a7=356,o7=14,l7=20,c7=200;function u7(...e){return e.filter(Boolean).join(" ")}var d7=e=>{var t,n,r,s,i,o,l,c,u,d;let{invert:f,toast:h,unstyled:p,interacting:g,setHeights:m,visibleToasts:x,heights:b,index:y,toasts:w,expanded:j,removeToast:S,defaultRichColors:N,closeButton:P,style:_,cancelButtonStyle:A,actionButtonStyle:O,className:T="",descriptionClassName:k="",duration:M,position:R,gap:H,loadingIcon:F,expandByDefault:V,classNames:$,icons:L,closeButtonAriaLabel:Y="Close toast",pauseWhenPageIsHidden:Q,cn:ee}=e,[fe,W]=C.useState(!1),[he,pe]=C.useState(!1),[ue,Ae]=C.useState(!1),[de,oe]=C.useState(!1),[xe,te]=C.useState(0),[Ye,G]=C.useState(0),ve=C.useRef(null),Pe=C.useRef(null),Ie=y===0,E=y+1<=x,D=h.type,U=h.dismissible!==!1,K=h.className||"",J=h.descriptionClassName||"",X=C.useMemo(()=>b.findIndex(tt=>tt.toastId===h.id)||0,[b,h.id]),be=C.useMemo(()=>{var tt;return(tt=h.closeButton)!=null?tt:P},[h.closeButton,P]),_e=C.useMemo(()=>h.duration||M||i7,[h.duration,M]),Fe=C.useRef(0),ie=C.useRef(0),Te=C.useRef(0),Be=C.useRef(null),[gt,At]=R.split("-"),pn=C.useMemo(()=>b.reduce((tt,It,kt)=>kt>=X?tt:tt+It.height,0),[b,X]),Zt=YV(),bn=h.invert||f,Xt=D==="loading";ie.current=C.useMemo(()=>X*H+pn,[X,pn]),C.useEffect(()=>{W(!0)},[]),C.useLayoutEffect(()=>{if(!fe)return;let tt=Pe.current,It=tt.style.height;tt.style.height="auto";let kt=tt.getBoundingClientRect().height;tt.style.height=It,G(kt),m(Dn=>Dn.find(q=>q.toastId===h.id)?Dn.map(q=>q.toastId===h.id?{...q,height:kt}:q):[{toastId:h.id,height:kt,position:h.position},...Dn])},[fe,h.title,h.description,m,h.id]);let yt=C.useCallback(()=>{pe(!0),te(ie.current),m(tt=>tt.filter(It=>It.toastId!==h.id)),setTimeout(()=>{S(h)},c7)},[h,S,m,ie]);C.useEffect(()=>{if(h.promise&&D==="loading"||h.duration===1/0||h.type==="loading")return;let tt,It=_e;return j||g||Q&&Zt?(()=>{if(Te.current{var kt;(kt=h.onAutoClose)==null||kt.call(h,h),yt()},It)),()=>clearTimeout(tt)},[j,g,V,h,_e,yt,h.promise,D,Q,Zt]),C.useEffect(()=>{let tt=Pe.current;if(tt){let It=tt.getBoundingClientRect().height;return G(It),m(kt=>[{toastId:h.id,height:It,position:h.position},...kt]),()=>m(kt=>kt.filter(Dn=>Dn.toastId!==h.id))}},[m,h.id]),C.useEffect(()=>{h.delete&&yt()},[yt,h.delete]);function Rr(){return L!=null&&L.loading?C.createElement("div",{className:"sonner-loader","data-visible":D==="loading"},L.loading):F?C.createElement("div",{className:"sonner-loader","data-visible":D==="loading"},F):C.createElement(HV,{visible:D==="loading"})}return C.createElement("li",{"aria-live":h.important?"assertive":"polite","aria-atomic":"true",role:"status",tabIndex:0,ref:Pe,className:ee(T,K,$==null?void 0:$.toast,(t=h==null?void 0:h.classNames)==null?void 0:t.toast,$==null?void 0:$.default,$==null?void 0:$[D],(n=h==null?void 0:h.classNames)==null?void 0:n[D]),"data-sonner-toast":"","data-rich-colors":(r=h.richColors)!=null?r:N,"data-styled":!(h.jsx||h.unstyled||p),"data-mounted":fe,"data-promise":!!h.promise,"data-removed":he,"data-visible":E,"data-y-position":gt,"data-x-position":At,"data-index":y,"data-front":Ie,"data-swiping":ue,"data-dismissible":U,"data-type":D,"data-invert":bn,"data-swipe-out":de,"data-expanded":!!(j||V&&fe),style:{"--index":y,"--toasts-before":y,"--z-index":w.length-y,"--offset":`${he?xe:ie.current}px`,"--initial-height":V?"auto":`${Ye}px`,..._,...h.style},onPointerDown:tt=>{Xt||!U||(ve.current=new Date,te(ie.current),tt.target.setPointerCapture(tt.pointerId),tt.target.tagName!=="BUTTON"&&(Ae(!0),Be.current={x:tt.clientX,y:tt.clientY}))},onPointerUp:()=>{var tt,It,kt,Dn;if(de||!U)return;Be.current=null;let q=Number(((tt=Pe.current)==null?void 0:tt.style.getPropertyValue("--swipe-amount").replace("px",""))||0),we=new Date().getTime()-((It=ve.current)==null?void 0:It.getTime()),I=Math.abs(q)/we;if(Math.abs(q)>=l7||I>.11){te(ie.current),(kt=h.onDismiss)==null||kt.call(h,h),yt(),oe(!0);return}(Dn=Pe.current)==null||Dn.style.setProperty("--swipe-amount","0px"),Ae(!1)},onPointerMove:tt=>{var It;if(!Be.current||!U)return;let kt=tt.clientY-Be.current.y,Dn=tt.clientX-Be.current.x,q=(gt==="top"?Math.min:Math.max)(0,kt),we=tt.pointerType==="touch"?10:2;Math.abs(q)>we?(It=Pe.current)==null||It.style.setProperty("--swipe-amount",`${kt}px`):Math.abs(Dn)>we&&(Be.current=null)}},be&&!h.jsx?C.createElement("button",{"aria-label":Y,"data-disabled":Xt,"data-close-button":!0,onClick:Xt||!U?()=>{}:()=>{var tt;yt(),(tt=h.onDismiss)==null||tt.call(h,h)},className:ee($==null?void 0:$.closeButton,(s=h==null?void 0:h.classNames)==null?void 0:s.closeButton)},C.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},C.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),C.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))):null,h.jsx||C.isValidElement(h.title)?h.jsx||h.title:C.createElement(C.Fragment,null,D||h.icon||h.promise?C.createElement("div",{"data-icon":"",className:ee($==null?void 0:$.icon,(i=h==null?void 0:h.classNames)==null?void 0:i.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||Rr():null,h.type!=="loading"?h.icon||(L==null?void 0:L[D])||VV(D):null):null,C.createElement("div",{"data-content":"",className:ee($==null?void 0:$.content,(o=h==null?void 0:h.classNames)==null?void 0:o.content)},C.createElement("div",{"data-title":"",className:ee($==null?void 0:$.title,(l=h==null?void 0:h.classNames)==null?void 0:l.title)},h.title),h.description?C.createElement("div",{"data-description":"",className:ee(k,J,$==null?void 0:$.description,(c=h==null?void 0:h.classNames)==null?void 0:c.description)},h.description):null),C.isValidElement(h.cancel)?h.cancel:h.cancel&&dm(h.cancel)?C.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||A,onClick:tt=>{var It,kt;dm(h.cancel)&&U&&((kt=(It=h.cancel).onClick)==null||kt.call(It,tt),yt())},className:ee($==null?void 0:$.cancelButton,(u=h==null?void 0:h.classNames)==null?void 0:u.cancelButton)},h.cancel.label):null,C.isValidElement(h.action)?h.action:h.action&&dm(h.action)?C.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||O,onClick:tt=>{var It,kt;dm(h.action)&&(tt.defaultPrevented||((kt=(It=h.action).onClick)==null||kt.call(It,tt),yt()))},className:ee($==null?void 0:$.actionButton,(d=h==null?void 0:h.classNames)==null?void 0:d.actionButton)},h.action.label):null))};function fA(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}var f7=e=>{let{invert:t,position:n="bottom-right",hotkey:r=["altKey","KeyT"],expand:s,closeButton:i,className:o,offset:l,theme:c="light",richColors:u,duration:d,style:f,visibleToasts:h=r7,toastOptions:p,dir:g=fA(),gap:m=o7,loadingIcon:x,icons:b,containerAriaLabel:y="Notifications",pauseWhenPageIsHidden:w,cn:j=u7}=e,[S,N]=C.useState([]),P=C.useMemo(()=>Array.from(new Set([n].concat(S.filter(Q=>Q.position).map(Q=>Q.position)))),[S,n]),[_,A]=C.useState([]),[O,T]=C.useState(!1),[k,M]=C.useState(!1),[R,H]=C.useState(c!=="system"?c:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),F=C.useRef(null),V=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),$=C.useRef(null),L=C.useRef(!1),Y=C.useCallback(Q=>{var ee;(ee=S.find(fe=>fe.id===Q.id))!=null&&ee.delete||Qr.dismiss(Q.id),N(fe=>fe.filter(({id:W})=>W!==Q.id))},[S]);return C.useEffect(()=>Qr.subscribe(Q=>{if(Q.dismiss){N(ee=>ee.map(fe=>fe.id===Q.id?{...fe,delete:!0}:fe));return}setTimeout(()=>{NM.flushSync(()=>{N(ee=>{let fe=ee.findIndex(W=>W.id===Q.id);return fe!==-1?[...ee.slice(0,fe),{...ee[fe],...Q},...ee.slice(fe+1)]:[Q,...ee]})})})}),[]),C.useEffect(()=>{if(c!=="system"){H(c);return}c==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?H("dark"):H("light")),typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",({matches:Q})=>{H(Q?"dark":"light")})},[c]),C.useEffect(()=>{S.length<=1&&T(!1)},[S]),C.useEffect(()=>{let Q=ee=>{var fe,W;r.every(he=>ee[he]||ee.code===he)&&(T(!0),(fe=F.current)==null||fe.focus()),ee.code==="Escape"&&(document.activeElement===F.current||(W=F.current)!=null&&W.contains(document.activeElement))&&T(!1)};return document.addEventListener("keydown",Q),()=>document.removeEventListener("keydown",Q)},[r]),C.useEffect(()=>{if(F.current)return()=>{$.current&&($.current.focus({preventScroll:!0}),$.current=null,L.current=!1)}},[F.current]),S.length?C.createElement("section",{"aria-label":`${y} ${V}`,tabIndex:-1},P.map((Q,ee)=>{var fe;let[W,he]=Q.split("-");return C.createElement("ol",{key:Q,dir:g==="auto"?fA():g,tabIndex:-1,ref:F,className:o,"data-sonner-toaster":!0,"data-theme":R,"data-y-position":W,"data-x-position":he,style:{"--front-toast-height":`${((fe=_[0])==null?void 0:fe.height)||0}px`,"--offset":typeof l=="number"?`${l}px`:l||s7,"--width":`${a7}px`,"--gap":`${m}px`,...f},onBlur:pe=>{L.current&&!pe.currentTarget.contains(pe.relatedTarget)&&(L.current=!1,$.current&&($.current.focus({preventScroll:!0}),$.current=null))},onFocus:pe=>{pe.target instanceof HTMLElement&&pe.target.dataset.dismissible==="false"||L.current||(L.current=!0,$.current=pe.relatedTarget)},onMouseEnter:()=>T(!0),onMouseMove:()=>T(!0),onMouseLeave:()=>{k||T(!1)},onPointerDown:pe=>{pe.target instanceof HTMLElement&&pe.target.dataset.dismissible==="false"||M(!0)},onPointerUp:()=>M(!1)},S.filter(pe=>!pe.position&&ee===0||pe.position===Q).map((pe,ue)=>{var Ae,de;return C.createElement(d7,{key:pe.id,icons:b,index:ue,toast:pe,defaultRichColors:u,duration:(Ae=p==null?void 0:p.duration)!=null?Ae:d,className:p==null?void 0:p.className,descriptionClassName:p==null?void 0:p.descriptionClassName,invert:t,visibleToasts:h,closeButton:(de=p==null?void 0:p.closeButton)!=null?de:i,interacting:k,position:Q,style:p==null?void 0:p.style,unstyled:p==null?void 0:p.unstyled,classNames:p==null?void 0:p.classNames,cancelButtonStyle:p==null?void 0:p.cancelButtonStyle,actionButtonStyle:p==null?void 0:p.actionButtonStyle,removeToast:Y,toasts:S.filter(oe=>oe.position==pe.position),heights:_.filter(oe=>oe.position==pe.position),setHeights:A,expandByDefault:s,gap:m,loadingIcon:x,expanded:O,pauseWhenPageIsHidden:w,cn:j})}))})):null};const h7=({...e})=>{const{theme:t="system"}=UV();return a.jsx(f7,{theme:t,className:"toaster group",position:"bottom-right",visibleToasts:2,closeButton:!0,toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg group-[.toaster]:pr-8",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",closeButton:"group-[.toast]:absolute group-[.toast]:left-3 group-[.toast]:top-3 group-[.toast]:h-5 group-[.toast]:w-5 group-[.toast]:rounded-md group-[.toast]:p-1 group-[.toast]:text-foreground/70 group-[.toast]:opacity-100 group-[.toast]:transition-opacity hover:group-[.toast]:text-foreground hover:group-[.toast]:bg-muted/50 focus:group-[.toast]:opacity-100 focus:group-[.toast]:outline-none focus:group-[.toast]:ring-1 focus:group-[.toast]:ring-ring"}},...e})};function $e(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function p7(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Ry(...e){return t=>e.forEach(n=>p7(n,t))}function pt(...e){return v.useCallback(Ry(...e),e)}function m7(e,t){const n=v.createContext(t),r=i=>{const{children:o,...l}=i,c=v.useMemo(()=>l,Object.values(l));return a.jsx(n.Provider,{value:c,children:o})};r.displayName=e+"Provider";function s(i){const o=v.useContext(n);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,s]}function Ir(e,t=[]){let n=[];function r(i,o){const l=v.createContext(o),c=n.length;n=[...n,o];const u=f=>{var b;const{scope:h,children:p,...g}=f,m=((b=h==null?void 0:h[e])==null?void 0:b[c])||l,x=v.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:x,children:p})};u.displayName=i+"Provider";function d(f,h){var m;const p=((m=h==null?void 0:h[e])==null?void 0:m[c])||l,g=v.useContext(p);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[u,d]}const s=()=>{const i=n.map(o=>v.createContext(o));return function(l){const c=(l==null?void 0:l[e])||i;return v.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[r,g7(s,...t)]}function g7(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(i)[`__scope${u}`];return{...l,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var xa=v.forwardRef((e,t)=>{const{children:n,...r}=e,s=v.Children.toArray(n),i=s.find(v7);if(i){const o=i.props.children,l=s.map(c=>c===i?v.Children.count(o)>1?v.Children.only(null):v.isValidElement(o)?o.props.children:null:c);return a.jsx(Mw,{...r,ref:t,children:v.isValidElement(o)?v.cloneElement(o,void 0,l):null})}return a.jsx(Mw,{...r,ref:t,children:n})});xa.displayName="Slot";var Mw=v.forwardRef((e,t)=>{const{children:n,...r}=e;if(v.isValidElement(n)){const s=x7(n);return v.cloneElement(n,{...y7(r,n.props),ref:t?Ry(t,s):s})}return v.Children.count(n)>1?v.Children.only(null):null});Mw.displayName="SlotClone";var iN=({children:e})=>a.jsx(a.Fragment,{children:e});function v7(e){return v.isValidElement(e)&&e.type===iN}function y7(e,t){const n={...t};for(const r in t){const s=e[r],i=t[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...l)=>{i(...l),s(...l)}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...e,...n}}function x7(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var b7=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Xe=b7.reduce((e,t)=>{const n=v.forwardRef((r,s)=>{const{asChild:i,...o}=r,l=i?xa:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(l,{...o,ref:s})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function PM(e,t){e&&Xs.flushSync(()=>e.dispatchEvent(t))}function Vn(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function w7(e,t=globalThis==null?void 0:globalThis.document){const n=Vn(e);v.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var j7="DismissableLayer",Rw="dismissableLayer.update",S7="dismissableLayer.pointerDownOutside",N7="dismissableLayer.focusOutside",hA,CM=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),yp=v.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:i,onInteractOutside:o,onDismiss:l,...c}=e,u=v.useContext(CM),[d,f]=v.useState(null),h=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=v.useState({}),g=pt(t,P=>f(P)),m=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),b=m.indexOf(x),y=d?m.indexOf(d):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,j=y>=b,S=C7(P=>{const _=P.target,A=[...u.branches].some(O=>O.contains(_));!j||A||(s==null||s(P),o==null||o(P),P.defaultPrevented||l==null||l())},h),N=A7(P=>{const _=P.target;[...u.branches].some(O=>O.contains(_))||(i==null||i(P),o==null||o(P),P.defaultPrevented||l==null||l())},h);return w7(P=>{y===u.layers.size-1&&(r==null||r(P),!P.defaultPrevented&&l&&(P.preventDefault(),l()))},h),v.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(hA=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),pA(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=hA)}},[d,h,n,u]),v.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),pA())},[d,u]),v.useEffect(()=>{const P=()=>p({});return document.addEventListener(Rw,P),()=>document.removeEventListener(Rw,P)},[]),a.jsx(Xe.div,{...c,ref:g,style:{pointerEvents:w?j?"auto":"none":void 0,...e.style},onFocusCapture:$e(e.onFocusCapture,N.onFocusCapture),onBlurCapture:$e(e.onBlurCapture,N.onBlurCapture),onPointerDownCapture:$e(e.onPointerDownCapture,S.onPointerDownCapture)})});yp.displayName=j7;var _7="DismissableLayerBranch",P7=v.forwardRef((e,t)=>{const n=v.useContext(CM),r=v.useRef(null),s=pt(t,r);return v.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),a.jsx(Xe.div,{...e,ref:s})});P7.displayName=_7;function C7(e,t=globalThis==null?void 0:globalThis.document){const n=Vn(e),r=v.useRef(!1),s=v.useRef(()=>{});return v.useEffect(()=>{const i=l=>{if(l.target&&!r.current){let c=function(){AM(S7,n,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=c,t.addEventListener("click",s.current,{once:!0})):c()}else t.removeEventListener("click",s.current);r.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",i),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function A7(e,t=globalThis==null?void 0:globalThis.document){const n=Vn(e),r=v.useRef(!1);return v.useEffect(()=>{const s=i=>{i.target&&!r.current&&AM(N7,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function pA(){const e=new CustomEvent(Rw);document.dispatchEvent(e)}function AM(e,t,n,{discrete:r}){const s=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?PM(s,i):s.dispatchEvent(i)}var or=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{},E7=w$.useId||(()=>{}),O7=0;function Cs(e){const[t,n]=v.useState(E7());return or(()=>{n(r=>r??String(O7++))},[e]),t?`radix-${t}`:""}const k7=["top","right","bottom","left"],Co=Math.min,ns=Math.max,Cg=Math.round,fm=Math.floor,Ao=e=>({x:e,y:e}),T7={left:"right",right:"left",bottom:"top",top:"bottom"},$7={start:"end",end:"start"};function Dw(e,t,n){return ns(e,Co(t,n))}function ba(e,t){return typeof e=="function"?e(t):e}function wa(e){return e.split("-")[0]}function Ku(e){return e.split("-")[1]}function aN(e){return e==="x"?"y":"x"}function oN(e){return e==="y"?"height":"width"}function Eo(e){return["top","bottom"].includes(wa(e))?"y":"x"}function lN(e){return aN(Eo(e))}function I7(e,t,n){n===void 0&&(n=!1);const r=Ku(e),s=lN(e),i=oN(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=Ag(o)),[o,Ag(o)]}function M7(e){const t=Ag(e);return[Lw(e),t,Lw(t)]}function Lw(e){return e.replace(/start|end/g,t=>$7[t])}function R7(e,t,n){const r=["left","right"],s=["right","left"],i=["top","bottom"],o=["bottom","top"];switch(e){case"top":case"bottom":return n?t?s:r:t?r:s;case"left":case"right":return t?i:o;default:return[]}}function D7(e,t,n,r){const s=Ku(e);let i=R7(wa(e),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),t&&(i=i.concat(i.map(Lw)))),i}function Ag(e){return e.replace(/left|right|bottom|top/g,t=>T7[t])}function L7(e){return{top:0,right:0,bottom:0,left:0,...e}}function EM(e){return typeof e!="number"?L7(e):{top:e,right:e,bottom:e,left:e}}function Eg(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function mA(e,t,n){let{reference:r,floating:s}=e;const i=Eo(t),o=lN(t),l=oN(o),c=wa(t),u=i==="y",d=r.x+r.width/2-s.width/2,f=r.y+r.height/2-s.height/2,h=r[l]/2-s[l]/2;let p;switch(c){case"top":p={x:d,y:r.y-s.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-s.width,y:f};break;default:p={x:r.x,y:r.y}}switch(Ku(t)){case"start":p[o]-=h*(n&&u?-1:1);break;case"end":p[o]+=h*(n&&u?-1:1);break}return p}const F7=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=n,l=i.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t));let u=await o.getElementRects({reference:e,floating:t,strategy:s}),{x:d,y:f}=mA(u,r,c),h=r,p={},g=0;for(let m=0;m({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:i,platform:o,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=ba(e,t)||{};if(u==null)return{};const f=EM(d),h={x:n,y:r},p=lN(s),g=oN(p),m=await o.getDimensions(u),x=p==="y",b=x?"top":"left",y=x?"bottom":"right",w=x?"clientHeight":"clientWidth",j=i.reference[g]+i.reference[p]-h[p]-i.floating[g],S=h[p]-i.reference[p],N=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let P=N?N[w]:0;(!P||!await(o.isElement==null?void 0:o.isElement(N)))&&(P=l.floating[w]||i.floating[g]);const _=j/2-S/2,A=P/2-m[g]/2-1,O=Co(f[b],A),T=Co(f[y],A),k=O,M=P-m[g]-T,R=P/2-m[g]/2+_,H=Dw(k,R,M),F=!c.arrow&&Ku(s)!=null&&R!==H&&i.reference[g]/2-(RR<=0)){var T,k;const R=(((T=i.flip)==null?void 0:T.index)||0)+1,H=P[R];if(H)return{data:{index:R,overflows:O},reset:{placement:H}};let F=(k=O.filter(V=>V.overflows[0]<=0).sort((V,$)=>V.overflows[1]-$.overflows[1])[0])==null?void 0:k.placement;if(!F)switch(p){case"bestFit":{var M;const V=(M=O.filter($=>{if(N){const L=Eo($.placement);return L===y||L==="y"}return!0}).map($=>[$.placement,$.overflows.filter(L=>L>0).reduce((L,Y)=>L+Y,0)]).sort(($,L)=>$[1]-L[1])[0])==null?void 0:M[0];V&&(F=V);break}case"initialPlacement":F=l;break}if(s!==F)return{reset:{placement:F}}}return{}}}};function gA(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function vA(e){return k7.some(t=>e[t]>=0)}const U7=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...s}=ba(e,t);switch(r){case"referenceHidden":{const i=await Yf(t,{...s,elementContext:"reference"}),o=gA(i,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:vA(o)}}}case"escaped":{const i=await Yf(t,{...s,altBoundary:!0}),o=gA(i,n.floating);return{data:{escapedOffsets:o,escaped:vA(o)}}}default:return{}}}}};async function V7(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=wa(n),l=Ku(n),c=Eo(n)==="y",u=["left","top"].includes(o)?-1:1,d=i&&c?-1:1,f=ba(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof g=="number"&&(p=l==="end"?g*-1:g),c?{x:p*d,y:h*u}:{x:h*u,y:p*d}}const W7=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:i,placement:o,middlewareData:l}=t,c=await V7(t,e);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:i+c.y,data:{...c,placement:o}}}}},H7=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s}=t,{mainAxis:i=!0,crossAxis:o=!1,limiter:l={fn:x=>{let{x:b,y}=x;return{x:b,y}}},...c}=ba(e,t),u={x:n,y:r},d=await Yf(t,c),f=Eo(wa(s)),h=aN(f);let p=u[h],g=u[f];if(i){const x=h==="y"?"top":"left",b=h==="y"?"bottom":"right",y=p+d[x],w=p-d[b];p=Dw(y,p,w)}if(o){const x=f==="y"?"top":"left",b=f==="y"?"bottom":"right",y=g+d[x],w=g-d[b];g=Dw(y,g,w)}const m=l.fn({...t,[h]:p,[f]:g});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[h]:i,[f]:o}}}}}},G7=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:i,middlewareData:o}=t,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=ba(e,t),d={x:n,y:r},f=Eo(s),h=aN(f);let p=d[h],g=d[f];const m=ba(l,t),x=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(c){const w=h==="y"?"height":"width",j=i.reference[h]-i.floating[w]+x.mainAxis,S=i.reference[h]+i.reference[w]-x.mainAxis;pS&&(p=S)}if(u){var b,y;const w=h==="y"?"width":"height",j=["top","left"].includes(wa(s)),S=i.reference[f]-i.floating[w]+(j&&((b=o.offset)==null?void 0:b[f])||0)+(j?0:x.crossAxis),N=i.reference[f]+i.reference[w]+(j?0:((y=o.offset)==null?void 0:y[f])||0)-(j?x.crossAxis:0);gN&&(g=N)}return{[h]:p,[f]:g}}}},q7=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:i,platform:o,elements:l}=t,{apply:c=()=>{},...u}=ba(e,t),d=await Yf(t,u),f=wa(s),h=Ku(s),p=Eo(s)==="y",{width:g,height:m}=i.floating;let x,b;f==="top"||f==="bottom"?(x=f,b=h===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(b=f,x=h==="end"?"top":"bottom");const y=m-d.top-d.bottom,w=g-d.left-d.right,j=Co(m-d[x],y),S=Co(g-d[b],w),N=!t.middlewareData.shift;let P=j,_=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(_=w),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(P=y),N&&!h){const O=ns(d.left,0),T=ns(d.right,0),k=ns(d.top,0),M=ns(d.bottom,0);p?_=g-2*(O!==0||T!==0?O+T:ns(d.left,d.right)):P=m-2*(k!==0||M!==0?k+M:ns(d.top,d.bottom))}await c({...t,availableWidth:_,availableHeight:P});const A=await o.getDimensions(l.floating);return g!==A.width||m!==A.height?{reset:{rects:!0}}:{}}}};function Dy(){return typeof window<"u"}function Xu(e){return OM(e)?(e.nodeName||"").toLowerCase():"#document"}function as(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Fi(e){var t;return(t=(OM(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function OM(e){return Dy()?e instanceof Node||e instanceof as(e).Node:!1}function si(e){return Dy()?e instanceof Element||e instanceof as(e).Element:!1}function Ii(e){return Dy()?e instanceof HTMLElement||e instanceof as(e).HTMLElement:!1}function yA(e){return!Dy()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof as(e).ShadowRoot}function xp(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=ii(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(s)}function K7(e){return["table","td","th"].includes(Xu(e))}function Ly(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function cN(e){const t=uN(),n=si(e)?ii(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function X7(e){let t=Oo(e);for(;Ii(t)&&!fu(t);){if(cN(t))return t;if(Ly(t))return null;t=Oo(t)}return null}function uN(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function fu(e){return["html","body","#document"].includes(Xu(e))}function ii(e){return as(e).getComputedStyle(e)}function Fy(e){return si(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Oo(e){if(Xu(e)==="html")return e;const t=e.assignedSlot||e.parentNode||yA(e)&&e.host||Fi(e);return yA(t)?t.host:t}function kM(e){const t=Oo(e);return fu(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ii(t)&&xp(t)?t:kM(t)}function Zf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=kM(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),o=as(s);if(i){const l=Fw(o);return t.concat(o,o.visualViewport||[],xp(s)?s:[],l&&n?Zf(l):[])}return t.concat(s,Zf(s,[],n))}function Fw(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function TM(e){const t=ii(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=Ii(e),i=s?e.offsetWidth:n,o=s?e.offsetHeight:r,l=Cg(n)!==i||Cg(r)!==o;return l&&(n=i,r=o),{width:n,height:r,$:l}}function dN(e){return si(e)?e:e.contextElement}function Fc(e){const t=dN(e);if(!Ii(t))return Ao(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=TM(t);let o=(i?Cg(n.width):n.width)/r,l=(i?Cg(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const Y7=Ao(0);function $M(e){const t=as(e);return!uN()||!t.visualViewport?Y7:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Z7(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==as(e)?!1:t}function Ml(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=dN(e);let o=Ao(1);t&&(r?si(r)&&(o=Fc(r)):o=Fc(e));const l=Z7(i,n,r)?$M(i):Ao(0);let c=(s.left+l.x)/o.x,u=(s.top+l.y)/o.y,d=s.width/o.x,f=s.height/o.y;if(i){const h=as(i),p=r&&si(r)?as(r):r;let g=h,m=Fw(g);for(;m&&r&&p!==g;){const x=Fc(m),b=m.getBoundingClientRect(),y=ii(m),w=b.left+(m.clientLeft+parseFloat(y.paddingLeft))*x.x,j=b.top+(m.clientTop+parseFloat(y.paddingTop))*x.y;c*=x.x,u*=x.y,d*=x.x,f*=x.y,c+=w,u+=j,g=as(m),m=Fw(g)}}return Eg({width:d,height:f,x:c,y:u})}function Q7(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",o=Fi(r),l=t?Ly(t.floating):!1;if(r===o||l&&i)return n;let c={scrollLeft:0,scrollTop:0},u=Ao(1);const d=Ao(0),f=Ii(r);if((f||!f&&!i)&&((Xu(r)!=="body"||xp(o))&&(c=Fy(r)),Ii(r))){const h=Ml(r);u=Fc(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x,y:n.y*u.y-c.scrollTop*u.y+d.y}}function J7(e){return Array.from(e.getClientRects())}function Bw(e,t){const n=Fy(e).scrollLeft;return t?t.left+n:Ml(Fi(e)).left+n}function e9(e){const t=Fi(e),n=Fy(e),r=e.ownerDocument.body,s=ns(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=ns(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Bw(e);const l=-n.scrollTop;return ii(r).direction==="rtl"&&(o+=ns(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:o,y:l}}function t9(e,t){const n=as(e),r=Fi(e),s=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,l=0,c=0;if(s){i=s.width,o=s.height;const u=uN();(!u||u&&t==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}return{width:i,height:o,x:l,y:c}}function n9(e,t){const n=Ml(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=Ii(e)?Fc(e):Ao(1),o=e.clientWidth*i.x,l=e.clientHeight*i.y,c=s*i.x,u=r*i.y;return{width:o,height:l,x:c,y:u}}function xA(e,t,n){let r;if(t==="viewport")r=t9(e,n);else if(t==="document")r=e9(Fi(e));else if(si(t))r=n9(t,n);else{const s=$M(e);r={...t,x:t.x-s.x,y:t.y-s.y}}return Eg(r)}function IM(e,t){const n=Oo(e);return n===t||!si(n)||fu(n)?!1:ii(n).position==="fixed"||IM(n,t)}function r9(e,t){const n=t.get(e);if(n)return n;let r=Zf(e,[],!1).filter(l=>si(l)&&Xu(l)!=="body"),s=null;const i=ii(e).position==="fixed";let o=i?Oo(e):e;for(;si(o)&&!fu(o);){const l=ii(o),c=cN(o);!c&&l.position==="fixed"&&(s=null),(i?!c&&!s:!c&&l.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||xp(o)&&!c&&IM(e,o))?r=r.filter(d=>d!==o):s=l,o=Oo(o)}return t.set(e,r),r}function s9(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const o=[...n==="clippingAncestors"?Ly(t)?[]:r9(t,this._c):[].concat(n),r],l=o[0],c=o.reduce((u,d)=>{const f=xA(t,d,s);return u.top=ns(f.top,u.top),u.right=Co(f.right,u.right),u.bottom=Co(f.bottom,u.bottom),u.left=ns(f.left,u.left),u},xA(t,l,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function i9(e){const{width:t,height:n}=TM(e);return{width:t,height:n}}function a9(e,t,n){const r=Ii(t),s=Fi(t),i=n==="fixed",o=Ml(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=Ao(0);if(r||!r&&!i)if((Xu(t)!=="body"||xp(s))&&(l=Fy(t)),r){const p=Ml(t,!0,i,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else s&&(c.x=Bw(s));let u=0,d=0;if(s&&!r&&!i){const p=s.getBoundingClientRect();d=p.top+l.scrollTop,u=p.left+l.scrollLeft-Bw(s,p)}const f=o.left+l.scrollLeft-c.x-u,h=o.top+l.scrollTop-c.y-d;return{x:f,y:h,width:o.width,height:o.height}}function U0(e){return ii(e).position==="static"}function bA(e,t){if(!Ii(e)||ii(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Fi(e)===n&&(n=n.ownerDocument.body),n}function MM(e,t){const n=as(e);if(Ly(e))return n;if(!Ii(e)){let s=Oo(e);for(;s&&!fu(s);){if(si(s)&&!U0(s))return s;s=Oo(s)}return n}let r=bA(e,t);for(;r&&K7(r)&&U0(r);)r=bA(r,t);return r&&fu(r)&&U0(r)&&!cN(r)?n:r||X7(e)||n}const o9=async function(e){const t=this.getOffsetParent||MM,n=this.getDimensions,r=await n(e.floating);return{reference:a9(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function l9(e){return ii(e).direction==="rtl"}const c9={convertOffsetParentRelativeRectToViewportRelativeRect:Q7,getDocumentElement:Fi,getClippingRect:s9,getOffsetParent:MM,getElementRects:o9,getClientRects:J7,getDimensions:i9,getScale:Fc,isElement:si,isRTL:l9};function u9(e,t){let n=null,r;const s=Fi(e);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function o(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),i();const{left:u,top:d,width:f,height:h}=e.getBoundingClientRect();if(l||t(),!f||!h)return;const p=fm(d),g=fm(s.clientWidth-(u+f)),m=fm(s.clientHeight-(d+h)),x=fm(u),y={rootMargin:-p+"px "+-g+"px "+-m+"px "+-x+"px",threshold:ns(0,Co(1,c))||1};let w=!0;function j(S){const N=S[0].intersectionRatio;if(N!==c){if(!w)return o();N?o(!1,N):r=setTimeout(()=>{o(!1,1e-7)},1e3)}w=!1}try{n=new IntersectionObserver(j,{...y,root:s.ownerDocument})}catch{n=new IntersectionObserver(j,y)}n.observe(e)}return o(!0),i}function d9(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=dN(e),d=s||i?[...u?Zf(u):[],...Zf(t)]:[];d.forEach(b=>{s&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const f=u&&l?u9(u,n):null;let h=-1,p=null;o&&(p=new ResizeObserver(b=>{let[y]=b;y&&y.target===u&&p&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(t)})),n()}),u&&!c&&p.observe(u),p.observe(t));let g,m=c?Ml(e):null;c&&x();function x(){const b=Ml(e);m&&(b.x!==m.x||b.y!==m.y||b.width!==m.width||b.height!==m.height)&&n(),m=b,g=requestAnimationFrame(x)}return n(),()=>{var b;d.forEach(y=>{s&&y.removeEventListener("scroll",n),i&&y.removeEventListener("resize",n)}),f==null||f(),(b=p)==null||b.disconnect(),p=null,c&&cancelAnimationFrame(g)}}const f9=W7,h9=H7,p9=z7,m9=q7,g9=U7,wA=B7,v9=G7,y9=(e,t,n)=>{const r=new Map,s={platform:c9,...n},i={...s.platform,_c:r};return F7(e,t,{...s,platform:i})};var Km=typeof document<"u"?v.useLayoutEffect:v.useEffect;function Og(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Og(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&e.$$typeof)&&!Og(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function RM(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function jA(e,t){const n=RM(e);return Math.round(t*n)/n}function V0(e){const t=v.useRef(e);return Km(()=>{t.current=e}),t}function x9(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:o}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,f]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=v.useState(r);Og(h,r)||p(r);const[g,m]=v.useState(null),[x,b]=v.useState(null),y=v.useCallback($=>{$!==N.current&&(N.current=$,m($))},[]),w=v.useCallback($=>{$!==P.current&&(P.current=$,b($))},[]),j=i||g,S=o||x,N=v.useRef(null),P=v.useRef(null),_=v.useRef(d),A=c!=null,O=V0(c),T=V0(s),k=V0(u),M=v.useCallback(()=>{if(!N.current||!P.current)return;const $={placement:t,strategy:n,middleware:h};T.current&&($.platform=T.current),y9(N.current,P.current,$).then(L=>{const Y={...L,isPositioned:k.current!==!1};R.current&&!Og(_.current,Y)&&(_.current=Y,Xs.flushSync(()=>{f(Y)}))})},[h,t,n,T,k]);Km(()=>{u===!1&&_.current.isPositioned&&(_.current.isPositioned=!1,f($=>({...$,isPositioned:!1})))},[u]);const R=v.useRef(!1);Km(()=>(R.current=!0,()=>{R.current=!1}),[]),Km(()=>{if(j&&(N.current=j),S&&(P.current=S),j&&S){if(O.current)return O.current(j,S,M);M()}},[j,S,M,O,A]);const H=v.useMemo(()=>({reference:N,floating:P,setReference:y,setFloating:w}),[y,w]),F=v.useMemo(()=>({reference:j,floating:S}),[j,S]),V=v.useMemo(()=>{const $={position:n,left:0,top:0};if(!F.floating)return $;const L=jA(F.floating,d.x),Y=jA(F.floating,d.y);return l?{...$,transform:"translate("+L+"px, "+Y+"px)",...RM(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:L,top:Y}},[n,l,F.floating,d.x,d.y]);return v.useMemo(()=>({...d,update:M,refs:H,elements:F,floatingStyles:V}),[d,M,H,F,V])}const b9=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?wA({element:r.current,padding:s}).fn(n):{}:r?wA({element:r,padding:s}).fn(n):{}}}},w9=(e,t)=>({...f9(e),options:[e,t]}),j9=(e,t)=>({...h9(e),options:[e,t]}),S9=(e,t)=>({...v9(e),options:[e,t]}),N9=(e,t)=>({...p9(e),options:[e,t]}),_9=(e,t)=>({...m9(e),options:[e,t]}),P9=(e,t)=>({...g9(e),options:[e,t]}),C9=(e,t)=>({...b9(e),options:[e,t]});var A9="Arrow",DM=v.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...i}=e;return a.jsx(Xe.svg,{...i,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});DM.displayName=A9;var E9=DM;function O9(e,t=[]){let n=[];function r(i,o){const l=v.createContext(o),c=n.length;n=[...n,o];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[e][c])||l,x=v.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:x,children:p})}function d(f,h){const p=(h==null?void 0:h[e][c])||l,g=v.useContext(p);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${i}\``)}return u.displayName=i+"Provider",[u,d]}const s=()=>{const i=n.map(o=>v.createContext(o));return function(l){const c=(l==null?void 0:l[e])||i;return v.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[r,k9(s,...t)]}function k9(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(i)[`__scope${u}`];return{...l,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}function bp(e){const[t,n]=v.useState(void 0);return or(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let o,l;if("borderBoxSize"in i){const c=i.borderBoxSize,u=Array.isArray(c)?c[0]:c;o=u.inlineSize,l=u.blockSize}else o=e.offsetWidth,l=e.offsetHeight;n({width:o,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var fN="Popper",[LM,Yu]=O9(fN),[T9,FM]=LM(fN),BM=e=>{const{__scopePopper:t,children:n}=e,[r,s]=v.useState(null);return a.jsx(T9,{scope:t,anchor:r,onAnchorChange:s,children:n})};BM.displayName=fN;var zM="PopperAnchor",UM=v.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,i=FM(zM,n),o=v.useRef(null),l=pt(t,o);return v.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||o.current)}),r?null:a.jsx(Xe.div,{...s,ref:l})});UM.displayName=zM;var hN="PopperContent",[$9,I9]=LM(hN),VM=v.forwardRef((e,t)=>{var ue,Ae,de,oe,xe,te;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:g,...m}=e,x=FM(hN,n),[b,y]=v.useState(null),w=pt(t,Ye=>y(Ye)),[j,S]=v.useState(null),N=bp(j),P=(N==null?void 0:N.width)??0,_=(N==null?void 0:N.height)??0,A=r+(i!=="center"?"-"+i:""),O=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},T=Array.isArray(u)?u:[u],k=T.length>0,M={padding:O,boundary:T.filter(R9),altBoundary:k},{refs:R,floatingStyles:H,placement:F,isPositioned:V,middlewareData:$}=x9({strategy:"fixed",placement:A,whileElementsMounted:(...Ye)=>d9(...Ye,{animationFrame:p==="always"}),elements:{reference:x.anchor},middleware:[w9({mainAxis:s+_,alignmentAxis:o}),c&&j9({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?S9():void 0,...M}),c&&N9({...M}),_9({...M,apply:({elements:Ye,rects:G,availableWidth:ve,availableHeight:Pe})=>{const{width:Ie,height:E}=G.reference,D=Ye.floating.style;D.setProperty("--radix-popper-available-width",`${ve}px`),D.setProperty("--radix-popper-available-height",`${Pe}px`),D.setProperty("--radix-popper-anchor-width",`${Ie}px`),D.setProperty("--radix-popper-anchor-height",`${E}px`)}}),j&&C9({element:j,padding:l}),D9({arrowWidth:P,arrowHeight:_}),h&&P9({strategy:"referenceHidden",...M})]}),[L,Y]=GM(F),Q=Vn(g);or(()=>{V&&(Q==null||Q())},[V,Q]);const ee=(ue=$.arrow)==null?void 0:ue.x,fe=(Ae=$.arrow)==null?void 0:Ae.y,W=((de=$.arrow)==null?void 0:de.centerOffset)!==0,[he,pe]=v.useState();return or(()=>{b&&pe(window.getComputedStyle(b).zIndex)},[b]),a.jsx("div",{ref:R.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:V?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:he,"--radix-popper-transform-origin":[(oe=$.transformOrigin)==null?void 0:oe.x,(xe=$.transformOrigin)==null?void 0:xe.y].join(" "),...((te=$.hide)==null?void 0:te.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:a.jsx($9,{scope:n,placedSide:L,onArrowChange:S,arrowX:ee,arrowY:fe,shouldHideArrow:W,children:a.jsx(Xe.div,{"data-side":L,"data-align":Y,...m,ref:w,style:{...m.style,animation:V?void 0:"none"}})})})});VM.displayName=hN;var WM="PopperArrow",M9={top:"bottom",right:"left",bottom:"top",left:"right"},HM=v.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,i=I9(WM,r),o=M9[i.placedSide];return a.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:a.jsx(E9,{...s,ref:n,style:{...s.style,display:"block"}})})});HM.displayName=WM;function R9(e){return e!==null}var D9=e=>({name:"transformOrigin",options:e,fn(t){var x,b,y;const{placement:n,rects:r,middlewareData:s}=t,o=((x=s.arrow)==null?void 0:x.centerOffset)!==0,l=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[u,d]=GM(n),f={start:"0%",center:"50%",end:"100%"}[d],h=(((b=s.arrow)==null?void 0:b.x)??0)+l/2,p=(((y=s.arrow)==null?void 0:y.y)??0)+c/2;let g="",m="";return u==="bottom"?(g=o?f:`${h}px`,m=`${-c}px`):u==="top"?(g=o?f:`${h}px`,m=`${r.floating.height+c}px`):u==="right"?(g=`${-c}px`,m=o?f:`${p}px`):u==="left"&&(g=`${r.floating.width+c}px`,m=o?f:`${p}px`),{data:{x:g,y:m}}}});function GM(e){const[t,n="center"]=e.split("-");return[t,n]}var qM=BM,pN=UM,mN=VM,gN=HM,L9="Portal",By=v.forwardRef((e,t)=>{var l;const{container:n,...r}=e,[s,i]=v.useState(!1);or(()=>i(!0),[]);const o=n||s&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?NM.createPortal(a.jsx(Xe.div,{...r,ref:t}),o):null});By.displayName=L9;function F9(e,t){return v.useReducer((n,r)=>t[n][r]??n,e)}var lr=e=>{const{present:t,children:n}=e,r=B9(t),s=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),i=pt(r.ref,z9(s));return typeof n=="function"||r.isPresent?v.cloneElement(s,{ref:i}):null};lr.displayName="Presence";function B9(e){const[t,n]=v.useState(),r=v.useRef({}),s=v.useRef(e),i=v.useRef("none"),o=e?"mounted":"unmounted",[l,c]=F9(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const u=hm(r.current);i.current=l==="mounted"?u:"none"},[l]),or(()=>{const u=r.current,d=s.current;if(d!==e){const h=i.current,p=hm(u);e?c("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&h!==p?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,c]),or(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=p=>{const m=hm(r.current).includes(p.animationName);if(p.target===t&&m&&(c("ANIMATION_END"),!s.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},h=p=>{p.target===t&&(i.current=hm(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:v.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function hm(e){return(e==null?void 0:e.animationName)||"none"}function z9(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function us({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,s]=U9({defaultProp:t,onChange:n}),i=e!==void 0,o=i?e:r,l=Vn(n),c=v.useCallback(u=>{if(i){const f=typeof u=="function"?u(e):u;f!==e&&l(f)}else s(u)},[i,e,s,l]);return[o,c]}function U9({defaultProp:e,onChange:t}){const n=v.useState(e),[r]=n,s=v.useRef(r),i=Vn(t);return v.useEffect(()=>{s.current!==r&&(i(r),s.current=r)},[r,s,i]),n}var V9="VisuallyHidden",vN=v.forwardRef((e,t)=>a.jsx(Xe.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));vN.displayName=V9;var W9=vN,[zy,wOe]=Ir("Tooltip",[Yu]),yN=Yu(),KM="TooltipProvider",H9=700,SA="tooltip.open",[G9,XM]=zy(KM),YM=e=>{const{__scopeTooltip:t,delayDuration:n=H9,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=e,[o,l]=v.useState(!0),c=v.useRef(!1),u=v.useRef(0);return v.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),a.jsx(G9,{scope:t,isOpenDelayed:o,delayDuration:n,onOpen:v.useCallback(()=>{window.clearTimeout(u.current),l(!1)},[]),onClose:v.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>l(!0),r)},[r]),isPointerInTransitRef:c,onPointerInTransitChange:v.useCallback(d=>{c.current=d},[]),disableHoverableContent:s,children:i})};YM.displayName=KM;var ZM="Tooltip",[jOe,Uy]=zy(ZM),zw="TooltipTrigger",q9=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=Uy(zw,n),i=XM(zw,n),o=yN(n),l=v.useRef(null),c=pt(t,l,s.onTriggerChange),u=v.useRef(!1),d=v.useRef(!1),f=v.useCallback(()=>u.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),a.jsx(pN,{asChild:!0,...o,children:a.jsx(Xe.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:c,onPointerMove:$e(e.onPointerMove,h=>{h.pointerType!=="touch"&&!d.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),d.current=!0)}),onPointerLeave:$e(e.onPointerLeave,()=>{s.onTriggerLeave(),d.current=!1}),onPointerDown:$e(e.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:$e(e.onFocus,()=>{u.current||s.onOpen()}),onBlur:$e(e.onBlur,s.onClose),onClick:$e(e.onClick,s.onClose)})})});q9.displayName=zw;var K9="TooltipPortal",[SOe,X9]=zy(K9,{forceMount:void 0}),hu="TooltipContent",QM=v.forwardRef((e,t)=>{const n=X9(hu,e.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=e,o=Uy(hu,e.__scopeTooltip);return a.jsx(lr,{present:r||o.open,children:o.disableHoverableContent?a.jsx(JM,{side:s,...i,ref:t}):a.jsx(Y9,{side:s,...i,ref:t})})}),Y9=v.forwardRef((e,t)=>{const n=Uy(hu,e.__scopeTooltip),r=XM(hu,e.__scopeTooltip),s=v.useRef(null),i=pt(t,s),[o,l]=v.useState(null),{trigger:c,onClose:u}=n,d=s.current,{onPointerInTransitChange:f}=r,h=v.useCallback(()=>{l(null),f(!1)},[f]),p=v.useCallback((g,m)=>{const x=g.currentTarget,b={x:g.clientX,y:g.clientY},y=eW(b,x.getBoundingClientRect()),w=tW(b,y),j=nW(m.getBoundingClientRect()),S=sW([...w,...j]);l(S),f(!0)},[f]);return v.useEffect(()=>()=>h(),[h]),v.useEffect(()=>{if(c&&d){const g=x=>p(x,d),m=x=>p(x,c);return c.addEventListener("pointerleave",g),d.addEventListener("pointerleave",m),()=>{c.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",m)}}},[c,d,p,h]),v.useEffect(()=>{if(o){const g=m=>{const x=m.target,b={x:m.clientX,y:m.clientY},y=(c==null?void 0:c.contains(x))||(d==null?void 0:d.contains(x)),w=!rW(b,o);y?h():w&&(h(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,d,o,u,h]),a.jsx(JM,{...e,ref:i})}),[Z9,Q9]=zy(ZM,{isInside:!1}),JM=v.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:o,...l}=e,c=Uy(hu,n),u=yN(n),{onClose:d}=c;return v.useEffect(()=>(document.addEventListener(SA,d),()=>document.removeEventListener(SA,d)),[d]),v.useEffect(()=>{if(c.trigger){const f=h=>{const p=h.target;p!=null&&p.contains(c.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,d]),a.jsx(yp,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:a.jsxs(mN,{"data-state":c.stateAttribute,...u,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[a.jsx(iN,{children:r}),a.jsx(Z9,{scope:n,isInside:!0,children:a.jsx(W9,{id:c.contentId,role:"tooltip",children:s||r})})]})})});QM.displayName=hu;var eR="TooltipArrow",J9=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=yN(n);return Q9(eR,n).isInside?null:a.jsx(gN,{...s,...r,ref:t})});J9.displayName=eR;function eW(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,s,i)){case i:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function tW(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function nW(e){const{top:t,right:n,bottom:r,left:s}=e;return[{x:s,y:t},{x:n,y:t},{x:n,y:r},{x:s,y:r}]}function rW(e,t){const{x:n,y:r}=e;let s=!1;for(let i=0,o=t.length-1;ir!=d>r&&n<(u-l)*(r-c)/(d-c)+l&&(s=!s)}return s}function sW(e){const t=e.slice();return t.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),iW(t)}function iW(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r=2;){const i=t[t.length-1],o=t[t.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))t.pop();else break}t.push(s)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const s=e[r];for(;n.length>=2;){const i=n[n.length-1],o=n[n.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))n.pop();else break}n.push(s)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var aW=YM,tR=QM;function nR(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t{const t=cW(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{const l=o.split(xN);return l[0]===""&&l.length!==1&&l.shift(),rR(l,t)||lW(o)},getConflictingClassGroupIds:(o,l)=>{const c=n[o]||[];return l&&r[o]?[...c,...r[o]]:c}}},rR=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),s=r?rR(e.slice(1),r):void 0;if(s)return s;if(t.validators.length===0)return;const i=e.join(xN);return(o=t.validators.find(({validator:l})=>l(i)))==null?void 0:o.classGroupId},NA=/^\[(.+)\]$/,lW=e=>{if(NA.test(e)){const t=NA.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},cW=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return dW(Object.entries(e.classGroups),n).forEach(([i,o])=>{Uw(o,r,i,t)}),r},Uw=(e,t,n,r)=>{e.forEach(s=>{if(typeof s=="string"){const i=s===""?t:_A(t,s);i.classGroupId=n;return}if(typeof s=="function"){if(uW(s)){Uw(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([i,o])=>{Uw(o,_A(t,i),n,r)})})},_A=(e,t)=>{let n=e;return t.split(xN).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},uW=e=>e.isThemeGetter,dW=(e,t)=>t?e.map(([n,r])=>{const s=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([o,l])=>[t+o,l])):i);return[n,s]}):e,fW=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const s=(i,o)=>{n.set(i,o),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let o=n.get(i);if(o!==void 0)return o;if((o=r.get(i))!==void 0)return s(i,o),o},set(i,o){n.has(i)?n.set(i,o):s(i,o)}}},sR="!",hW=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,s=t[0],i=t.length,o=l=>{const c=[];let u=0,d=0,f;for(let x=0;xd?f-d:void 0;return{modifiers:c,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:m}};return n?l=>n({className:l,parseClassName:o}):o},pW=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},mW=e=>({cache:fW(e.cacheSize),parseClassName:hW(e),...oW(e)}),gW=/\s+/,vW=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s}=t,i=[],o=e.trim().split(gW);let l="";for(let c=o.length-1;c>=0;c-=1){const u=o[c],{modifiers:d,hasImportantModifier:f,baseClassName:h,maybePostfixModifierPosition:p}=n(u);let g=!!p,m=r(g?h.substring(0,p):h);if(!m){if(!g){l=u+(l.length>0?" "+l:l);continue}if(m=r(h),!m){l=u+(l.length>0?" "+l:l);continue}g=!1}const x=pW(d).join(":"),b=f?x+sR:x,y=b+m;if(i.includes(y))continue;i.push(y);const w=s(m,g);for(let j=0;j0?" "+l:l)}return l};function yW(){let e=0,t,n,r="";for(;e{if(typeof e=="string")return e;let t,n="";for(let r=0;rf(d),e());return n=mW(u),r=n.cache.get,s=n.cache.set,i=l,l(c)}function l(c){const u=r(c);if(u)return u;const d=vW(c,n);return s(c,d),d}return function(){return i(yW.apply(null,arguments))}}const tn=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},aR=/^\[(?:([a-z-]+):)?(.+)\]$/i,bW=/^\d+\/\d+$/,wW=new Set(["px","full","screen"]),jW=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,SW=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,NW=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,_W=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,PW=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Vi=e=>Bc(e)||wW.has(e)||bW.test(e),Ba=e=>Zu(e,"length",IW),Bc=e=>!!e&&!Number.isNaN(Number(e)),W0=e=>Zu(e,"number",Bc),Md=e=>!!e&&Number.isInteger(Number(e)),CW=e=>e.endsWith("%")&&Bc(e.slice(0,-1)),wt=e=>aR.test(e),za=e=>jW.test(e),AW=new Set(["length","size","percentage"]),EW=e=>Zu(e,AW,oR),OW=e=>Zu(e,"position",oR),kW=new Set(["image","url"]),TW=e=>Zu(e,kW,RW),$W=e=>Zu(e,"",MW),Rd=()=>!0,Zu=(e,t,n)=>{const r=aR.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},IW=e=>SW.test(e)&&!NW.test(e),oR=()=>!1,MW=e=>_W.test(e),RW=e=>PW.test(e),DW=()=>{const e=tn("colors"),t=tn("spacing"),n=tn("blur"),r=tn("brightness"),s=tn("borderColor"),i=tn("borderRadius"),o=tn("borderSpacing"),l=tn("borderWidth"),c=tn("contrast"),u=tn("grayscale"),d=tn("hueRotate"),f=tn("invert"),h=tn("gap"),p=tn("gradientColorStops"),g=tn("gradientColorStopPositions"),m=tn("inset"),x=tn("margin"),b=tn("opacity"),y=tn("padding"),w=tn("saturate"),j=tn("scale"),S=tn("sepia"),N=tn("skew"),P=tn("space"),_=tn("translate"),A=()=>["auto","contain","none"],O=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto",wt,t],k=()=>[wt,t],M=()=>["",Vi,Ba],R=()=>["auto",Bc,wt],H=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],F=()=>["solid","dashed","dotted","double","none"],V=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],$=()=>["start","end","center","between","around","evenly","stretch"],L=()=>["","0",wt],Y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Q=()=>[Bc,wt];return{cacheSize:500,separator:":",theme:{colors:[Rd],spacing:[Vi,Ba],blur:["none","",za,wt],brightness:Q(),borderColor:[e],borderRadius:["none","","full",za,wt],borderSpacing:k(),borderWidth:M(),contrast:Q(),grayscale:L(),hueRotate:Q(),invert:L(),gap:k(),gradientColorStops:[e],gradientColorStopPositions:[CW,Ba],inset:T(),margin:T(),opacity:Q(),padding:k(),saturate:Q(),scale:Q(),sepia:L(),skew:Q(),space:k(),translate:k()},classGroups:{aspect:[{aspect:["auto","square","video",wt]}],container:["container"],columns:[{columns:[za]}],"break-after":[{"break-after":Y()}],"break-before":[{"break-before":Y()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...H(),wt]}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Md,wt]}],basis:[{basis:T()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",wt]}],grow:[{grow:L()}],shrink:[{shrink:L()}],order:[{order:["first","last","none",Md,wt]}],"grid-cols":[{"grid-cols":[Rd]}],"col-start-end":[{col:["auto",{span:["full",Md,wt]},wt]}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":[Rd]}],"row-start-end":[{row:["auto",{span:[Md,wt]},wt]}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",wt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",wt]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...$()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...$(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...$(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[y]}],px:[{px:[y]}],py:[{py:[y]}],ps:[{ps:[y]}],pe:[{pe:[y]}],pt:[{pt:[y]}],pr:[{pr:[y]}],pb:[{pb:[y]}],pl:[{pl:[y]}],m:[{m:[x]}],mx:[{mx:[x]}],my:[{my:[x]}],ms:[{ms:[x]}],me:[{me:[x]}],mt:[{mt:[x]}],mr:[{mr:[x]}],mb:[{mb:[x]}],ml:[{ml:[x]}],"space-x":[{"space-x":[P]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[P]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",wt,t]}],"min-w":[{"min-w":[wt,t,"min","max","fit"]}],"max-w":[{"max-w":[wt,t,"none","full","min","max","fit","prose",{screen:[za]},za]}],h:[{h:[wt,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[wt,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[wt,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[wt,t,"auto","min","max","fit"]}],"font-size":[{text:["base",za,Ba]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",W0]}],"font-family":[{font:[Rd]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",wt]}],"line-clamp":[{"line-clamp":["none",Bc,W0]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Vi,wt]}],"list-image":[{"list-image":["none",wt]}],"list-style-type":[{list:["none","disc","decimal",wt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...F(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Vi,Ba]}],"underline-offset":[{"underline-offset":["auto",Vi,wt]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",wt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",wt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...H(),OW]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",EW]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},TW]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...F(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:F()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...F()]}],"outline-offset":[{"outline-offset":[Vi,wt]}],"outline-w":[{outline:[Vi,Ba]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:M()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[Vi,Ba]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",za,$W]}],"shadow-color":[{shadow:[Rd]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...V(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":V()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",za,wt]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[w]}],sepia:[{sepia:[S]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[S]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",wt]}],duration:[{duration:Q()}],ease:[{ease:["linear","in","out","in-out",wt]}],delay:[{delay:Q()}],animate:[{animate:["none","spin","ping","pulse","bounce",wt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[j]}],"scale-x":[{"scale-x":[j]}],"scale-y":[{"scale-y":[j]}],rotate:[{rotate:[Md,wt]}],"translate-x":[{"translate-x":[_]}],"translate-y":[{"translate-y":[_]}],"skew-x":[{"skew-x":[N]}],"skew-y":[{"skew-y":[N]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",wt]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",wt]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",wt]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Vi,Ba,W0]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},LW=xW(DW);function Me(...e){return LW(mt(e))}const FW=aW,BW=v.forwardRef(({className:e,sideOffset:t=4,...n},r)=>a.jsx(tR,{ref:r,sideOffset:t,className:Me("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n}));BW.displayName=tR.displayName;var Vy=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Wy=typeof window>"u"||"Deno"in globalThis;function zs(){}function zW(e,t){return typeof e=="function"?e(t):e}function UW(e){return typeof e=="number"&&e>=0&&e!==1/0}function VW(e,t){return Math.max(e+(t||0)-Date.now(),0)}function PA(e,t){return typeof e=="function"?e(t):e}function WW(e,t){return typeof e=="function"?e(t):e}function CA(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:o,stale:l}=e;if(o){if(r){if(t.queryHash!==bN(o,t.options))return!1}else if(!Jf(t.queryKey,o))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||s&&s!==t.state.fetchStatus||i&&!i(t))}function AA(e,t){const{exact:n,status:r,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Qf(t.options.mutationKey)!==Qf(i))return!1}else if(!Jf(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function bN(e,t){return((t==null?void 0:t.queryKeyHashFn)||Qf)(e)}function Qf(e){return JSON.stringify(e,(t,n)=>Vw(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Jf(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!Jf(e[n],t[n])):!1}function lR(e,t){if(e===t)return e;const n=EA(e)&&EA(t);if(n||Vw(e)&&Vw(t)){const r=n?e:Object.keys(e),s=r.length,i=n?t:Object.keys(t),o=i.length,l=n?[]:{};let c=0;for(let u=0;u{setTimeout(t,e)})}function GW(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?lR(e,t):t}function qW(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function KW(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var wN=Symbol();function cR(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===wN?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var xl,eo,Yc,r$,XW=(r$=class extends Vy{constructor(){super();Ut(this,xl);Ut(this,eo);Ut(this,Yc);Nt(this,Yc,t=>{if(!Wy&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){je(this,eo)||this.setEventListener(je(this,Yc))}onUnsubscribe(){var t;this.hasListeners()||((t=je(this,eo))==null||t.call(this),Nt(this,eo,void 0))}setEventListener(t){var n;Nt(this,Yc,t),(n=je(this,eo))==null||n.call(this),Nt(this,eo,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){je(this,xl)!==t&&(Nt(this,xl,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof je(this,xl)=="boolean"?je(this,xl):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},xl=new WeakMap,eo=new WeakMap,Yc=new WeakMap,r$),uR=new XW,Zc,to,Qc,s$,YW=(s$=class extends Vy{constructor(){super();Ut(this,Zc,!0);Ut(this,to);Ut(this,Qc);Nt(this,Qc,t=>{if(!Wy&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){je(this,to)||this.setEventListener(je(this,Qc))}onUnsubscribe(){var t;this.hasListeners()||((t=je(this,to))==null||t.call(this),Nt(this,to,void 0))}setEventListener(t){var n;Nt(this,Qc,t),(n=je(this,to))==null||n.call(this),Nt(this,to,t(this.setOnline.bind(this)))}setOnline(t){je(this,Zc)!==t&&(Nt(this,Zc,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return je(this,Zc)}},Zc=new WeakMap,to=new WeakMap,Qc=new WeakMap,s$),kg=new YW;function ZW(){let e,t;const n=new Promise((s,i)=>{e=s,t=i});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}function QW(e){return Math.min(1e3*2**e,3e4)}function dR(e){return(e??"online")==="online"?kg.isOnline():!0}var fR=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function H0(e){return e instanceof fR}function hR(e){let t=!1,n=0,r=!1,s;const i=ZW(),o=m=>{var x;r||(h(new fR(m)),(x=e.abort)==null||x.call(e))},l=()=>{t=!0},c=()=>{t=!1},u=()=>uR.isFocused()&&(e.networkMode==="always"||kg.isOnline())&&e.canRun(),d=()=>dR(e.networkMode)&&e.canRun(),f=m=>{var x;r||(r=!0,(x=e.onSuccess)==null||x.call(e,m),s==null||s(),i.resolve(m))},h=m=>{var x;r||(r=!0,(x=e.onError)==null||x.call(e,m),s==null||s(),i.reject(m))},p=()=>new Promise(m=>{var x;s=b=>{(r||u())&&m(b)},(x=e.onPause)==null||x.call(e)}).then(()=>{var m;s=void 0,r||(m=e.onContinue)==null||m.call(e)}),g=()=>{if(r)return;let m;const x=n===0?e.initialPromise:void 0;try{m=x??e.fn()}catch(b){m=Promise.reject(b)}Promise.resolve(m).then(f).catch(b=>{var N;if(r)return;const y=e.retry??(Wy?0:3),w=e.retryDelay??QW,j=typeof w=="function"?w(n,b):w,S=y===!0||typeof y=="number"&&nu()?void 0:p()).then(()=>{t?h(b):g()})})};return{promise:i,cancel:o,continue:()=>(s==null||s(),i),cancelRetry:l,continueRetry:c,canStart:d,start:()=>(d()?g():p().then(g),i)}}function JW(){let e=[],t=0,n=l=>{l()},r=l=>{l()},s=l=>setTimeout(l,0);const i=l=>{t?e.push(l):s(()=>{n(l)})},o=()=>{const l=e;e=[],l.length&&s(()=>{r(()=>{l.forEach(c=>{n(c)})})})};return{batch:l=>{let c;t++;try{c=l()}finally{t--,t||o()}return c},batchCalls:l=>(...c)=>{i(()=>{l(...c)})},schedule:i,setNotifyFunction:l=>{n=l},setBatchNotifyFunction:l=>{r=l},setScheduler:l=>{s=l}}}var Pr=JW(),bl,i$,pR=(i$=class{constructor(){Ut(this,bl)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),UW(this.gcTime)&&Nt(this,bl,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Wy?1/0:5*60*1e3))}clearGcTimeout(){je(this,bl)&&(clearTimeout(je(this,bl)),Nt(this,bl,void 0))}},bl=new WeakMap,i$),Jc,eu,gs,fr,dp,wl,Us,Gi,a$,eH=(a$=class extends pR{constructor(t){super();Ut(this,Us);Ut(this,Jc);Ut(this,eu);Ut(this,gs);Ut(this,fr);Ut(this,dp);Ut(this,wl);Nt(this,wl,!1),Nt(this,dp,t.defaultOptions),this.setOptions(t.options),this.observers=[],Nt(this,gs,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Nt(this,Jc,nH(this.options)),this.state=t.state??je(this,Jc),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=je(this,fr))==null?void 0:t.promise}setOptions(t){this.options={...je(this,dp),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&je(this,gs).remove(this)}setData(t,n){const r=GW(this.state.data,t,this.options);return cr(this,Us,Gi).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){cr(this,Us,Gi).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,s;const n=(r=je(this,fr))==null?void 0:r.promise;return(s=je(this,fr))==null||s.cancel(t),n?n.then(zs).catch(zs):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(je(this,Jc))}isActive(){return this.observers.some(t=>WW(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===wN||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!VW(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=je(this,fr))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=je(this,fr))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),je(this,gs).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(je(this,fr)&&(je(this,wl)?je(this,fr).cancel({revert:!0}):je(this,fr).cancelRetry()),this.scheduleGc()),je(this,gs).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||cr(this,Us,Gi).call(this,{type:"invalidate"})}fetch(t,n){var c,u,d;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(je(this,fr))return je(this,fr).continueRetry(),je(this,fr).promise}if(t&&this.setOptions(t),!this.options.queryFn){const f=this.observers.find(h=>h.options.queryFn);f&&this.setOptions(f.options)}const r=new AbortController,s=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(Nt(this,wl,!0),r.signal)})},i=()=>{const f=cR(this.options,n),h={queryKey:this.queryKey,meta:this.meta};return s(h),Nt(this,wl,!1),this.options.persister?this.options.persister(f,h,this):f(h)},o={fetchOptions:n,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:i};s(o),(c=this.options.behavior)==null||c.onFetch(o,this),Nt(this,eu,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=o.fetchOptions)==null?void 0:u.meta))&&cr(this,Us,Gi).call(this,{type:"fetch",meta:(d=o.fetchOptions)==null?void 0:d.meta});const l=f=>{var h,p,g,m;H0(f)&&f.silent||cr(this,Us,Gi).call(this,{type:"error",error:f}),H0(f)||((p=(h=je(this,gs).config).onError)==null||p.call(h,f,this),(m=(g=je(this,gs).config).onSettled)==null||m.call(g,this.state.data,f,this)),this.scheduleGc()};return Nt(this,fr,hR({initialPromise:n==null?void 0:n.initialPromise,fn:o.fetchFn,abort:r.abort.bind(r),onSuccess:f=>{var h,p,g,m;if(f===void 0){l(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(f)}catch(x){l(x);return}(p=(h=je(this,gs).config).onSuccess)==null||p.call(h,f,this),(m=(g=je(this,gs).config).onSettled)==null||m.call(g,f,this.state.error,this),this.scheduleGc()},onError:l,onFail:(f,h)=>{cr(this,Us,Gi).call(this,{type:"failed",failureCount:f,error:h})},onPause:()=>{cr(this,Us,Gi).call(this,{type:"pause"})},onContinue:()=>{cr(this,Us,Gi).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0})),je(this,fr).start()}},Jc=new WeakMap,eu=new WeakMap,gs=new WeakMap,fr=new WeakMap,dp=new WeakMap,wl=new WeakMap,Us=new WeakSet,Gi=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...tH(r.data,this.options),fetchMeta:t.meta??null};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const s=t.error;return H0(s)&&s.revert&&je(this,eu)?{...je(this,eu),fetchStatus:"idle"}:{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Pr.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),je(this,gs).notify({query:this,type:"updated",action:t})})},a$);function tH(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:dR(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function nH(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var yi,o$,rH=(o$=class extends Vy{constructor(t={}){super();Ut(this,yi);this.config=t,Nt(this,yi,new Map)}build(t,n,r){const s=n.queryKey,i=n.queryHash??bN(s,n);let o=this.get(i);return o||(o=new eH({cache:this,queryKey:s,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){je(this,yi).has(t.queryHash)||(je(this,yi).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=je(this,yi).get(t.queryHash);n&&(t.destroy(),n===t&&je(this,yi).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Pr.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return je(this,yi).get(t)}getAll(){return[...je(this,yi).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>CA(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>CA(t,r)):n}notify(t){Pr.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Pr.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Pr.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},yi=new WeakMap,o$),xi,jr,jl,bi,Ua,l$,sH=(l$=class extends pR{constructor(t){super();Ut(this,bi);Ut(this,xi);Ut(this,jr);Ut(this,jl);this.mutationId=t.mutationId,Nt(this,jr,t.mutationCache),Nt(this,xi,[]),this.state=t.state||iH(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){je(this,xi).includes(t)||(je(this,xi).push(t),this.clearGcTimeout(),je(this,jr).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Nt(this,xi,je(this,xi).filter(n=>n!==t)),this.scheduleGc(),je(this,jr).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){je(this,xi).length||(this.state.status==="pending"?this.scheduleGc():je(this,jr).remove(this))}continue(){var t;return((t=je(this,jl))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var s,i,o,l,c,u,d,f,h,p,g,m,x,b,y,w,j,S,N,P;Nt(this,jl,hR({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(_,A)=>{cr(this,bi,Ua).call(this,{type:"failed",failureCount:_,error:A})},onPause:()=>{cr(this,bi,Ua).call(this,{type:"pause"})},onContinue:()=>{cr(this,bi,Ua).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>je(this,jr).canRun(this)}));const n=this.state.status==="pending",r=!je(this,jl).canStart();try{if(!n){cr(this,bi,Ua).call(this,{type:"pending",variables:t,isPaused:r}),await((i=(s=je(this,jr).config).onMutate)==null?void 0:i.call(s,t,this));const A=await((l=(o=this.options).onMutate)==null?void 0:l.call(o,t));A!==this.state.context&&cr(this,bi,Ua).call(this,{type:"pending",context:A,variables:t,isPaused:r})}const _=await je(this,jl).start();return await((u=(c=je(this,jr).config).onSuccess)==null?void 0:u.call(c,_,t,this.state.context,this)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,_,t,this.state.context)),await((p=(h=je(this,jr).config).onSettled)==null?void 0:p.call(h,_,null,this.state.variables,this.state.context,this)),await((m=(g=this.options).onSettled)==null?void 0:m.call(g,_,null,t,this.state.context)),cr(this,bi,Ua).call(this,{type:"success",data:_}),_}catch(_){try{throw await((b=(x=je(this,jr).config).onError)==null?void 0:b.call(x,_,t,this.state.context,this)),await((w=(y=this.options).onError)==null?void 0:w.call(y,_,t,this.state.context)),await((S=(j=je(this,jr).config).onSettled)==null?void 0:S.call(j,void 0,_,this.state.variables,this.state.context,this)),await((P=(N=this.options).onSettled)==null?void 0:P.call(N,void 0,_,t,this.state.context)),_}finally{cr(this,bi,Ua).call(this,{type:"error",error:_})}}finally{je(this,jr).runNext(this)}}},xi=new WeakMap,jr=new WeakMap,jl=new WeakMap,bi=new WeakSet,Ua=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Pr.batch(()=>{je(this,xi).forEach(r=>{r.onMutationUpdate(t)}),je(this,jr).notify({mutation:this,type:"updated",action:t})})},l$);function iH(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Zr,fp,c$,aH=(c$=class extends Vy{constructor(t={}){super();Ut(this,Zr);Ut(this,fp);this.config=t,Nt(this,Zr,new Map),Nt(this,fp,Date.now())}build(t,n,r){const s=new sH({mutationCache:this,mutationId:++Gp(this,fp)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){const n=pm(t),r=je(this,Zr).get(n)??[];r.push(t),je(this,Zr).set(n,r),this.notify({type:"added",mutation:t})}remove(t){var r;const n=pm(t);if(je(this,Zr).has(n)){const s=(r=je(this,Zr).get(n))==null?void 0:r.filter(i=>i!==t);s&&(s.length===0?je(this,Zr).delete(n):je(this,Zr).set(n,s))}this.notify({type:"removed",mutation:t})}canRun(t){var r;const n=(r=je(this,Zr).get(pm(t)))==null?void 0:r.find(s=>s.state.status==="pending");return!n||n===t}runNext(t){var r;const n=(r=je(this,Zr).get(pm(t)))==null?void 0:r.find(s=>s!==t&&s.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}clear(){Pr.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}getAll(){return[...je(this,Zr).values()].flat()}find(t){const n={exact:!0,...t};return this.getAll().find(r=>AA(n,r))}findAll(t={}){return this.getAll().filter(n=>AA(t,n))}notify(t){Pr.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Pr.batch(()=>Promise.all(t.map(n=>n.continue().catch(zs))))}},Zr=new WeakMap,fp=new WeakMap,c$);function pm(e){var t;return((t=e.options.scope)==null?void 0:t.id)??String(e.mutationId)}function kA(e){return{onFetch:(t,n)=>{var d,f,h,p,g;const r=t.options,s=(h=(f=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:h.direction,i=((p=t.state.data)==null?void 0:p.pages)||[],o=((g=t.state.data)==null?void 0:g.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const u=async()=>{let m=!1;const x=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(t.signal.aborted?m=!0:t.signal.addEventListener("abort",()=>{m=!0}),t.signal)})},b=cR(t.options,t.fetchOptions),y=async(w,j,S)=>{if(m)return Promise.reject();if(j==null&&w.pages.length)return Promise.resolve(w);const N={queryKey:t.queryKey,pageParam:j,direction:S?"backward":"forward",meta:t.options.meta};x(N);const P=await b(N),{maxPages:_}=t.options,A=S?KW:qW;return{pages:A(w.pages,P,_),pageParams:A(w.pageParams,j,_)}};if(s&&i.length){const w=s==="backward",j=w?oH:TA,S={pages:i,pageParams:o},N=j(r,S);l=await y(S,N,w)}else{const w=e??i.length;do{const j=c===0?o[0]??r.initialPageParam:TA(r,l);if(c>0&&j==null)break;l=await y(l,j),c++}while(c{var m,x;return(x=(m=t.options).persister)==null?void 0:x.call(m,u,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function TA(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function oH(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var mn,no,ro,tu,nu,so,ru,su,u$,lH=(u$=class{constructor(e={}){Ut(this,mn);Ut(this,no);Ut(this,ro);Ut(this,tu);Ut(this,nu);Ut(this,so);Ut(this,ru);Ut(this,su);Nt(this,mn,e.queryCache||new rH),Nt(this,no,e.mutationCache||new aH),Nt(this,ro,e.defaultOptions||{}),Nt(this,tu,new Map),Nt(this,nu,new Map),Nt(this,so,0)}mount(){Gp(this,so)._++,je(this,so)===1&&(Nt(this,ru,uR.subscribe(async e=>{e&&(await this.resumePausedMutations(),je(this,mn).onFocus())})),Nt(this,su,kg.subscribe(async e=>{e&&(await this.resumePausedMutations(),je(this,mn).onOnline())})))}unmount(){var e,t;Gp(this,so)._--,je(this,so)===0&&((e=je(this,ru))==null||e.call(this),Nt(this,ru,void 0),(t=je(this,su))==null||t.call(this),Nt(this,su,void 0))}isFetching(e){return je(this,mn).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return je(this,no).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=je(this,mn).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.getQueryData(e.queryKey);if(t===void 0)return this.fetchQuery(e);{const n=this.defaultQueryOptions(e),r=je(this,mn).build(this,n);return e.revalidateIfStale&&r.isStaleByTime(PA(n.staleTime,r))&&this.prefetchQuery(n),Promise.resolve(t)}}getQueriesData(e){return je(this,mn).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=je(this,mn).get(r.queryHash),i=s==null?void 0:s.state.data,o=zW(t,i);if(o!==void 0)return je(this,mn).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return Pr.batch(()=>je(this,mn).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=je(this,mn).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=je(this,mn);Pr.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=je(this,mn),r={type:"active",...e};return Pr.batch(()=>(n.findAll(e).forEach(s=>{s.reset()}),this.refetchQueries(r,t)))}cancelQueries(e={},t={}){const n={revert:!0,...t},r=Pr.batch(()=>je(this,mn).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(zs).catch(zs)}invalidateQueries(e={},t={}){return Pr.batch(()=>{if(je(this,mn).findAll(e).forEach(r=>{r.invalidate()}),e.refetchType==="none")return Promise.resolve();const n={...e,type:e.refetchType??e.type??"active"};return this.refetchQueries(n,t)})}refetchQueries(e={},t){const n={...t,cancelRefetch:(t==null?void 0:t.cancelRefetch)??!0},r=Pr.batch(()=>je(this,mn).findAll(e).filter(s=>!s.isDisabled()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(zs)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(zs)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=je(this,mn).build(this,t);return n.isStaleByTime(PA(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(zs).catch(zs)}fetchInfiniteQuery(e){return e.behavior=kA(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(zs).catch(zs)}ensureInfiniteQueryData(e){return e.behavior=kA(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return kg.isOnline()?je(this,no).resumePausedMutations():Promise.resolve()}getQueryCache(){return je(this,mn)}getMutationCache(){return je(this,no)}getDefaultOptions(){return je(this,ro)}setDefaultOptions(e){Nt(this,ro,e)}setQueryDefaults(e,t){je(this,tu).set(Qf(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...je(this,tu).values()];let n={};return t.forEach(r=>{Jf(e,r.queryKey)&&(n={...n,...r.defaultOptions})}),n}setMutationDefaults(e,t){je(this,nu).set(Qf(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...je(this,nu).values()];let n={};return t.forEach(r=>{Jf(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...je(this,ro).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=bN(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.enabled!==!0&&t.queryFn===wN&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...je(this,ro).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){je(this,mn).clear(),je(this,no).clear()}},mn=new WeakMap,no=new WeakMap,ro=new WeakMap,tu=new WeakMap,nu=new WeakMap,so=new WeakMap,ru=new WeakMap,su=new WeakMap,u$),cH=v.createContext(void 0),uH=({client:e,children:t})=>(v.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),a.jsx(cH.Provider,{value:e,children:t}));/** + * @remix-run/router v1.20.0 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function eh(){return eh=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function mR(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function fH(){return Math.random().toString(36).substr(2,8)}function IA(e,t){return{usr:e.state,key:e.key,idx:t}}function Ww(e,t,n,r){return n===void 0&&(n=null),eh({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Qu(t):t,{state:n,key:t&&t.key||r||fH()})}function Tg(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function Qu(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function hH(e,t,n,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:i=!1}=r,o=s.history,l=oo.Pop,c=null,u=d();u==null&&(u=0,o.replaceState(eh({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function f(){l=oo.Pop;let x=d(),b=x==null?null:x-u;u=x,c&&c({action:l,location:m.location,delta:b})}function h(x,b){l=oo.Push;let y=Ww(m.location,x,b);u=d()+1;let w=IA(y,u),j=m.createHref(y);try{o.pushState(w,"",j)}catch(S){if(S instanceof DOMException&&S.name==="DataCloneError")throw S;s.location.assign(j)}i&&c&&c({action:l,location:m.location,delta:1})}function p(x,b){l=oo.Replace;let y=Ww(m.location,x,b);u=d();let w=IA(y,u),j=m.createHref(y);o.replaceState(w,"",j),i&&c&&c({action:l,location:m.location,delta:0})}function g(x){let b=s.location.origin!=="null"?s.location.origin:s.location.href,y=typeof x=="string"?x:Tg(x);return y=y.replace(/ $/,"%20"),Pn(b,"No window.location.(origin|href) available to create URL for href: "+y),new URL(y,b)}let m={get action(){return l},get location(){return e(s,o)},listen(x){if(c)throw new Error("A history only accepts one active listener");return s.addEventListener($A,f),c=x,()=>{s.removeEventListener($A,f),c=null}},createHref(x){return t(s,x)},createURL:g,encodeLocation(x){let b=g(x);return{pathname:b.pathname,search:b.search,hash:b.hash}},push:h,replace:p,go(x){return o.go(x)}};return m}var MA;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(MA||(MA={}));function pH(e,t,n){return n===void 0&&(n="/"),mH(e,t,n,!1)}function mH(e,t,n,r){let s=typeof t=="string"?Qu(t):t,i=jN(s.pathname||"/",n);if(i==null)return null;let o=gR(e);gH(o);let l=null;for(let c=0;l==null&&c{let c={relativePath:l===void 0?i.path||"":l,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};c.relativePath.startsWith("/")&&(Pn(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let u=xo([r,c.relativePath]),d=n.concat(c);i.children&&i.children.length>0&&(Pn(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),gR(i.children,t,d,u)),!(i.path==null&&!i.index)&&t.push({path:u,score:SH(u,i.index),routesMeta:d})};return e.forEach((i,o)=>{var l;if(i.path===""||!((l=i.path)!=null&&l.includes("?")))s(i,o);else for(let c of vR(i.path))s(i,o,c)}),t}function vR(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return s?[i,""]:[i];let o=vR(r.join("/")),l=[];return l.push(...o.map(c=>c===""?i:[i,c].join("/"))),s&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function gH(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:NH(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const vH=/^:[\w-]+$/,yH=3,xH=2,bH=1,wH=10,jH=-2,RA=e=>e==="*";function SH(e,t){let n=e.split("/"),r=n.length;return n.some(RA)&&(r+=jH),t&&(r+=xH),n.filter(s=>!RA(s)).reduce((s,i)=>s+(vH.test(i)?yH:i===""?bH:wH),r)}function NH(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function _H(e,t,n){let{routesMeta:r}=e,s={},i="/",o=[];for(let l=0;l{let{paramName:h,isOptional:p}=d;if(h==="*"){let m=l[f]||"";o=i.slice(0,i.length-m.length).replace(/(.)\/+$/,"$1")}const g=l[f];return p&&!g?u[h]=void 0:u[h]=(g||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:o,pattern:e}}function PH(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),mR(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function CH(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return mR(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function jN(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function AH(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?Qu(e):e;return{pathname:n?n.startsWith("/")?n:EH(n,t):t,search:TH(r),hash:$H(s)}}function EH(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function G0(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function OH(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function SN(e,t){let n=OH(e);return t?n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function NN(e,t,n,r){r===void 0&&(r=!1);let s;typeof e=="string"?s=Qu(e):(s=eh({},e),Pn(!s.pathname||!s.pathname.includes("?"),G0("?","pathname","search",s)),Pn(!s.pathname||!s.pathname.includes("#"),G0("#","pathname","hash",s)),Pn(!s.search||!s.search.includes("#"),G0("#","search","hash",s)));let i=e===""||s.pathname==="",o=i?"/":s.pathname,l;if(o==null)l=n;else{let f=t.length-1;if(!r&&o.startsWith("..")){let h=o.split("/");for(;h[0]==="..";)h.shift(),f-=1;s.pathname=h.join("/")}l=f>=0?t[f]:"/"}let c=AH(s,l),u=o&&o!=="/"&&o.endsWith("/"),d=(i||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const xo=e=>e.join("/").replace(/\/\/+/g,"/"),kH=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),TH=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,$H=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function IH(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const yR=["post","put","patch","delete"];new Set(yR);const MH=["get",...yR];new Set(MH);/** + * React Router v6.27.0 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function th(){return th=Object.assign?Object.assign.bind():function(e){for(var t=1;t{l.current=!0}),v.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let f=NN(u,JSON.parse(o),i,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:xo([t,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[t,r,o,i,e])}function wR(){let{matches:e}=v.useContext(ka),t=e[e.length-1];return t?t.params:{}}function jR(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=v.useContext(zo),{matches:s}=v.useContext(ka),{pathname:i}=ci(),o=JSON.stringify(SN(s,r.v7_relativeSplatPath));return v.useMemo(()=>NN(e,JSON.parse(o),i,n==="path"),[e,o,i,n])}function FH(e,t){return BH(e,t)}function BH(e,t,n,r){Ju()||Pn(!1);let{navigator:s}=v.useContext(zo),{matches:i}=v.useContext(ka),o=i[i.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let u=ci(),d;if(t){var f;let x=typeof t=="string"?Qu(t):t;c==="/"||(f=x.pathname)!=null&&f.startsWith(c)||Pn(!1),d=x}else d=u;let h=d.pathname||"/",p=h;if(c!=="/"){let x=c.replace(/^\//,"").split("/");p="/"+h.replace(/^\//,"").split("/").slice(x.length).join("/")}let g=pH(e,{pathname:p}),m=HH(g&&g.map(x=>Object.assign({},x,{params:Object.assign({},l,x.params),pathname:xo([c,s.encodeLocation?s.encodeLocation(x.pathname).pathname:x.pathname]),pathnameBase:x.pathnameBase==="/"?c:xo([c,s.encodeLocation?s.encodeLocation(x.pathnameBase).pathname:x.pathnameBase])})),i,n,r);return t&&m?v.createElement(Hy.Provider,{value:{location:th({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:oo.Pop}},m):m}function zH(){let e=XH(),t=IH(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},t),n?v.createElement("pre",{style:s},n):null,null)}const UH=v.createElement(zH,null);class VH extends v.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?v.createElement(ka.Provider,{value:this.props.routeContext},v.createElement(xR.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function WH(e){let{routeContext:t,match:n,children:r}=e,s=v.useContext(_N);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),v.createElement(ka.Provider,{value:t},r)}function HH(e,t,n,r){var s;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var i;if(!n)return null;if(n.errors)e=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,l=(s=n)==null?void 0:s.errors;if(l!=null){let d=o.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);d>=0||Pn(!1),o=o.slice(0,Math.min(o.length,d+1))}let c=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((d,f,h)=>{let p,g=!1,m=null,x=null;n&&(p=l&&f.route.id?l[f.route.id]:void 0,m=f.route.errorElement||UH,c&&(u<0&&h===0?(g=!0,x=null):u===h&&(g=!0,x=f.route.hydrateFallbackElement||null)));let b=t.concat(o.slice(0,h+1)),y=()=>{let w;return p?w=m:g?w=x:f.route.Component?w=v.createElement(f.route.Component,null):f.route.element?w=f.route.element:w=d,v.createElement(WH,{match:f,routeContext:{outlet:d,matches:b,isDataRoute:n!=null},children:w})};return n&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?v.createElement(VH,{location:n.location,revalidation:n.revalidation,component:m,error:p,children:y(),routeContext:{outlet:null,matches:b,isDataRoute:!0}}):y()},null)}var SR=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(SR||{}),$g=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}($g||{});function GH(e){let t=v.useContext(_N);return t||Pn(!1),t}function qH(e){let t=v.useContext(RH);return t||Pn(!1),t}function KH(e){let t=v.useContext(ka);return t||Pn(!1),t}function NR(e){let t=KH(),n=t.matches[t.matches.length-1];return n.route.id||Pn(!1),n.route.id}function XH(){var e;let t=v.useContext(xR),n=qH($g.UseRouteError),r=NR($g.UseRouteError);return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function YH(){let{router:e}=GH(SR.UseNavigateStable),t=NR($g.UseNavigateStable),n=v.useRef(!1);return bR(()=>{n.current=!0}),v.useCallback(function(s,i){i===void 0&&(i={}),n.current&&(typeof s=="number"?e.navigate(s):e.navigate(s,th({fromRouteId:t},i)))},[e,t])}function _R(e){let{to:t,replace:n,state:r,relative:s}=e;Ju()||Pn(!1);let{future:i,static:o}=v.useContext(zo),{matches:l}=v.useContext(ka),{pathname:c}=ci(),u=Rn(),d=NN(t,SN(l,i.v7_relativeSplatPath),c,s==="path"),f=JSON.stringify(d);return v.useEffect(()=>u(JSON.parse(f),{replace:n,state:r,relative:s}),[u,f,s,n,r]),null}function Ls(e){Pn(!1)}function ZH(e){let{basename:t="/",children:n=null,location:r,navigationType:s=oo.Pop,navigator:i,static:o=!1,future:l}=e;Ju()&&Pn(!1);let c=t.replace(/^\/*/,"/"),u=v.useMemo(()=>({basename:c,navigator:i,static:o,future:th({v7_relativeSplatPath:!1},l)}),[c,l,i,o]);typeof r=="string"&&(r=Qu(r));let{pathname:d="/",search:f="",hash:h="",state:p=null,key:g="default"}=r,m=v.useMemo(()=>{let x=jN(d,c);return x==null?null:{location:{pathname:x,search:f,hash:h,state:p,key:g},navigationType:s}},[c,d,f,h,p,g,s]);return m==null?null:v.createElement(zo.Provider,{value:u},v.createElement(Hy.Provider,{children:n,value:m}))}function QH(e){let{children:t,location:n}=e;return FH(Hw(t),n)}new Promise(()=>{});function Hw(e,t){t===void 0&&(t=[]);let n=[];return v.Children.forEach(e,(r,s)=>{if(!v.isValidElement(r))return;let i=[...t,s];if(r.type===v.Fragment){n.push.apply(n,Hw(r.props.children,i));return}r.type!==Ls&&Pn(!1),!r.props.index||!r.props.children||Pn(!1);let o={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=Hw(r.props.children,i)),n.push(o)}),n}/** + * React Router DOM v6.27.0 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function Gw(){return Gw=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[s]=e[s]);return n}function eG(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function tG(e,t){return e.button===0&&(!t||t==="_self")&&!eG(e)}const nG=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],rG="6";try{window.__reactRouterVersion=rG}catch{}const sG="startTransition",LA=w$[sG];function iG(e){let{basename:t,children:n,future:r,window:s}=e,i=v.useRef();i.current==null&&(i.current=dH({window:s,v5Compat:!0}));let o=i.current,[l,c]=v.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},d=v.useCallback(f=>{u&&LA?LA(()=>c(f)):c(f)},[c,u]);return v.useLayoutEffect(()=>o.listen(d),[o,d]),v.createElement(ZH,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:o,future:r})}const aG=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",oG=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,js=v.forwardRef(function(t,n){let{onClick:r,relative:s,reloadDocument:i,replace:o,state:l,target:c,to:u,preventScrollReset:d,viewTransition:f}=t,h=JH(t,nG),{basename:p}=v.useContext(zo),g,m=!1;if(typeof u=="string"&&oG.test(u)&&(g=u,aG))try{let w=new URL(window.location.href),j=u.startsWith("//")?new URL(w.protocol+u):new URL(u),S=jN(j.pathname,p);j.origin===w.origin&&S!=null?u=S+j.search+j.hash:m=!0}catch{}let x=DH(u,{relative:s}),b=lG(u,{replace:o,state:l,target:c,preventScrollReset:d,relative:s,viewTransition:f});function y(w){r&&r(w),w.defaultPrevented||b(w)}return v.createElement("a",Gw({},h,{href:g||x,onClick:m||i?r:y,ref:n,target:c}))});var FA;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(FA||(FA={}));var BA;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(BA||(BA={}));function lG(e,t){let{target:n,replace:r,state:s,preventScrollReset:i,relative:o,viewTransition:l}=t===void 0?{}:t,c=Rn(),u=ci(),d=jR(e,{relative:o});return v.useCallback(f=>{if(tG(f,n)){f.preventDefault();let h=r!==void 0?r:Tg(u)===Tg(d);c(e,{replace:h,state:s,preventScrollReset:i,relative:o,viewTransition:l})}},[u,c,d,r,s,n,e,i,o,l])}/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const cG=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),PR=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var uG={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const dG=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:i,iconNode:o,...l},c)=>v.createElement("svg",{ref:c,...uG,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:PR("lucide",s),...l},[...o.map(([u,d])=>v.createElement(u,d)),...Array.isArray(i)?i:[i]]));/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Le=(e,t)=>{const n=v.forwardRef(({className:r,...s},i)=>v.createElement(dG,{ref:i,iconNode:t,className:PR(`lucide-${cG(e)}`,r),...s}));return n.displayName=`${e}`,n};/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Qi=Le("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const zA=Le("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const nh=Le("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const q0=Le("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const bo=Le("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ja=Le("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const UA=Le("Briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const fG=Le("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const hG=Le("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const qw=Le("ChartNoAxesColumnIncreasing",[["line",{x1:"12",x2:"12",y1:"20",y2:"10",key:"1vz5eb"}],["line",{x1:"18",x2:"18",y1:"20",y2:"4",key:"cun8e5"}],["line",{x1:"6",x2:"6",y1:"20",y2:"16",key:"hq0ia6"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const pG=Le("ChartPie",[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Sa=Le("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ta=Le("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const vi=Le("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const wp=Le("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const mG=Le("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ig=Le("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const rf=Le("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Kw=Le("CirclePlay",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const gG=Le("CircleUser",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const vG=Le("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const bf=Le("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const yG=Le("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const rh=Le("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const CR=Le("CloudUpload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const VA=Le("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ed=Le("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Xw=Le("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xG=Le("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Yw=Le("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const PN=Le("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const AR=Le("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ws=Le("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const bG=Le("Grid2x2",[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 12h18",key:"1i2n21"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const WA=Le("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Mg=Le("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Zw=Le("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ER=Le("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const wG=Le("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const jG=Le("Laptop",[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Qw=Le("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const SG=Le("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Rl=Le("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const mm=Le("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Dl=Le("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const NG=Le("Loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const HA=Le("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const GA=Le("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const OR=Le("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _G=Le("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const vs=Le("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Na=Le("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const PG=Le("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const qA=Le("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const KA=Le("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const CG=Le("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const AG=Le("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const pr=Le("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const EG=Le("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const zc=Le("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const CN=Le("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const AN=Le("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const EN=Le("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const OG=Le("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const kG=Le("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const TG=Le("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $G=Le("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const IG=Le("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Rg=Le("StickyNote",[["path",{d:"M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z",key:"qazsjp"}],["path",{d:"M15 3v4a2 2 0 0 0 2 2h4",key:"40519r"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const MG=Le("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ON=Le("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const wn=Le("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const RG=Le("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const DG=Le("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const kR=Le("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Dg=Le("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const er=Le("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const LG=Le("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ei=Le("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** + * @license lucide-react v0.462.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const kN=Le("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function TR(e,t){return function(){return e.apply(t,arguments)}}const{toString:FG}=Object.prototype,{getPrototypeOf:TN}=Object,{iterator:Gy,toStringTag:$R}=Symbol,qy=(e=>t=>{const n=FG.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),ui=e=>(e=e.toLowerCase(),t=>qy(t)===e),Ky=e=>t=>typeof t===e,{isArray:td}=Array,sh=Ky("undefined");function BG(e){return e!==null&&!sh(e)&&e.constructor!==null&&!sh(e.constructor)&&Gr(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const IR=ui("ArrayBuffer");function zG(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&IR(e.buffer),t}const UG=Ky("string"),Gr=Ky("function"),MR=Ky("number"),Xy=e=>e!==null&&typeof e=="object",VG=e=>e===!0||e===!1,Xm=e=>{if(qy(e)!=="object")return!1;const t=TN(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!($R in e)&&!(Gy in e)},WG=ui("Date"),HG=ui("File"),GG=ui("Blob"),qG=ui("FileList"),KG=e=>Xy(e)&&Gr(e.pipe),XG=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Gr(e.append)&&((t=qy(e))==="formdata"||t==="object"&&Gr(e.toString)&&e.toString()==="[object FormData]"))},YG=ui("URLSearchParams"),[ZG,QG,JG,eq]=["ReadableStream","Request","Response","Headers"].map(ui),tq=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function jp(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),td(e))for(r=0,s=e.length;r0;)if(s=n[r],t===s.toLowerCase())return s;return null}const dl=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,DR=e=>!sh(e)&&e!==dl;function Jw(){const{caseless:e}=DR(this)&&this||{},t={},n=(r,s)=>{const i=e&&RR(t,s)||s;Xm(t[i])&&Xm(r)?t[i]=Jw(t[i],r):Xm(r)?t[i]=Jw({},r):td(r)?t[i]=r.slice():t[i]=r};for(let r=0,s=arguments.length;r(jp(t,(s,i)=>{n&&Gr(s)?e[i]=TR(s,n):e[i]=s},{allOwnKeys:r}),e),rq=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),sq=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},iq=(e,t,n,r)=>{let s,i,o;const l={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!r||r(o,e,t))&&!l[o]&&(t[o]=e[o],l[o]=!0);e=n!==!1&&TN(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},aq=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},oq=e=>{if(!e)return null;if(td(e))return e;let t=e.length;if(!MR(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},lq=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&TN(Uint8Array)),cq=(e,t)=>{const r=(e&&e[Gy]).call(e);let s;for(;(s=r.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},uq=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},dq=ui("HTMLFormElement"),fq=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),XA=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),hq=ui("RegExp"),LR=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};jp(n,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(r[i]=o||s)}),Object.defineProperties(e,r)},pq=e=>{LR(e,(t,n)=>{if(Gr(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(Gr(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},mq=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return td(e)?r(e):r(String(e).split(t)),n},gq=()=>{},vq=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function yq(e){return!!(e&&Gr(e.append)&&e[$R]==="FormData"&&e[Gy])}const xq=e=>{const t=new Array(10),n=(r,s)=>{if(Xy(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[s]=r;const i=td(r)?[]:{};return jp(r,(o,l)=>{const c=n(o,s+1);!sh(c)&&(i[l]=c)}),t[s]=void 0,i}}return r};return n(e,0)},bq=ui("AsyncFunction"),wq=e=>e&&(Xy(e)||Gr(e))&&Gr(e.then)&&Gr(e.catch),FR=((e,t)=>e?setImmediate:t?((n,r)=>(dl.addEventListener("message",({source:s,data:i})=>{s===dl&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),dl.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Gr(dl.postMessage)),jq=typeof queueMicrotask<"u"?queueMicrotask.bind(dl):typeof process<"u"&&process.nextTick||FR,Sq=e=>e!=null&&Gr(e[Gy]),ae={isArray:td,isArrayBuffer:IR,isBuffer:BG,isFormData:XG,isArrayBufferView:zG,isString:UG,isNumber:MR,isBoolean:VG,isObject:Xy,isPlainObject:Xm,isReadableStream:ZG,isRequest:QG,isResponse:JG,isHeaders:eq,isUndefined:sh,isDate:WG,isFile:HG,isBlob:GG,isRegExp:hq,isFunction:Gr,isStream:KG,isURLSearchParams:YG,isTypedArray:lq,isFileList:qG,forEach:jp,merge:Jw,extend:nq,trim:tq,stripBOM:rq,inherits:sq,toFlatObject:iq,kindOf:qy,kindOfTest:ui,endsWith:aq,toArray:oq,forEachEntry:cq,matchAll:uq,isHTMLForm:dq,hasOwnProperty:XA,hasOwnProp:XA,reduceDescriptors:LR,freezeMethods:pq,toObjectSet:mq,toCamelCase:fq,noop:gq,toFiniteNumber:vq,findKey:RR,global:dl,isContextDefined:DR,isSpecCompliantForm:yq,toJSONObject:xq,isAsyncFn:bq,isThenable:wq,setImmediate:FR,asap:jq,isIterable:Sq};function xt(e,t,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}ae.inherits(xt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:ae.toJSONObject(this.config),code:this.code,status:this.status}}});const BR=xt.prototype,zR={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{zR[e]={value:e}});Object.defineProperties(xt,zR);Object.defineProperty(BR,"isAxiosError",{value:!0});xt.from=(e,t,n,r,s,i)=>{const o=Object.create(BR);return ae.toFlatObject(e,o,function(c){return c!==Error.prototype},l=>l!=="isAxiosError"),xt.call(o,e.message,t,n,r,s),o.cause=e,o.name=e.name,i&&Object.assign(o,i),o};const Nq=null;function e1(e){return ae.isPlainObject(e)||ae.isArray(e)}function UR(e){return ae.endsWith(e,"[]")?e.slice(0,-2):e}function YA(e,t,n){return e?e.concat(t).map(function(s,i){return s=UR(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function _q(e){return ae.isArray(e)&&!e.some(e1)}const Pq=ae.toFlatObject(ae,{},null,function(t){return/^is[A-Z]/.test(t)});function Yy(e,t,n){if(!ae.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=ae.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,x){return!ae.isUndefined(x[m])});const r=n.metaTokens,s=n.visitor||d,i=n.dots,o=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&ae.isSpecCompliantForm(t);if(!ae.isFunction(s))throw new TypeError("visitor must be a function");function u(g){if(g===null)return"";if(ae.isDate(g))return g.toISOString();if(!c&&ae.isBlob(g))throw new xt("Blob is not supported. Use a Buffer instead.");return ae.isArrayBuffer(g)||ae.isTypedArray(g)?c&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function d(g,m,x){let b=g;if(g&&!x&&typeof g=="object"){if(ae.endsWith(m,"{}"))m=r?m:m.slice(0,-2),g=JSON.stringify(g);else if(ae.isArray(g)&&_q(g)||(ae.isFileList(g)||ae.endsWith(m,"[]"))&&(b=ae.toArray(g)))return m=UR(m),b.forEach(function(w,j){!(ae.isUndefined(w)||w===null)&&t.append(o===!0?YA([m],j,i):o===null?m:m+"[]",u(w))}),!1}return e1(g)?!0:(t.append(YA(x,m,i),u(g)),!1)}const f=[],h=Object.assign(Pq,{defaultVisitor:d,convertValue:u,isVisitable:e1});function p(g,m){if(!ae.isUndefined(g)){if(f.indexOf(g)!==-1)throw Error("Circular reference detected in "+m.join("."));f.push(g),ae.forEach(g,function(b,y){(!(ae.isUndefined(b)||b===null)&&s.call(t,b,ae.isString(y)?y.trim():y,m,h))===!0&&p(b,m?m.concat(y):[y])}),f.pop()}}if(!ae.isObject(e))throw new TypeError("data must be an object");return p(e),t}function ZA(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function $N(e,t){this._pairs=[],e&&Yy(e,this,t)}const VR=$N.prototype;VR.append=function(t,n){this._pairs.push([t,n])};VR.toString=function(t){const n=t?function(r){return t.call(this,r,ZA)}:ZA;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function Cq(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function WR(e,t,n){if(!t)return e;const r=n&&n.encode||Cq;ae.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(t,n):i=ae.isURLSearchParams(t)?t.toString():new $N(t,n).toString(r),i){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class QA{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){ae.forEach(this.handlers,function(r){r!==null&&t(r)})}}const HR={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Aq=typeof URLSearchParams<"u"?URLSearchParams:$N,Eq=typeof FormData<"u"?FormData:null,Oq=typeof Blob<"u"?Blob:null,kq={isBrowser:!0,classes:{URLSearchParams:Aq,FormData:Eq,Blob:Oq},protocols:["http","https","file","blob","url","data"]},IN=typeof window<"u"&&typeof document<"u",t1=typeof navigator=="object"&&navigator||void 0,Tq=IN&&(!t1||["ReactNative","NativeScript","NS"].indexOf(t1.product)<0),$q=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Iq=IN&&window.location.href||"http://localhost",Mq=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:IN,hasStandardBrowserEnv:Tq,hasStandardBrowserWebWorkerEnv:$q,navigator:t1,origin:Iq},Symbol.toStringTag,{value:"Module"})),yr={...Mq,...kq};function Rq(e,t){return Yy(e,new yr.classes.URLSearchParams,Object.assign({visitor:function(n,r,s,i){return yr.isNode&&ae.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},t))}function Dq(e){return ae.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Lq(e){const t={},n=Object.keys(e);let r;const s=n.length;let i;for(r=0;r=n.length;return o=!o&&ae.isArray(s)?s.length:o,c?(ae.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!l):((!s[o]||!ae.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],i)&&ae.isArray(s[o])&&(s[o]=Lq(s[o])),!l)}if(ae.isFormData(e)&&ae.isFunction(e.entries)){const n={};return ae.forEachEntry(e,(r,s)=>{t(Dq(r),s,n,0)}),n}return null}function Fq(e,t,n){if(ae.isString(e))try{return(t||JSON.parse)(e),ae.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(0,JSON.stringify)(e)}const Sp={transitional:HR,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=ae.isObject(t);if(i&&ae.isHTMLForm(t)&&(t=new FormData(t)),ae.isFormData(t))return s?JSON.stringify(GR(t)):t;if(ae.isArrayBuffer(t)||ae.isBuffer(t)||ae.isStream(t)||ae.isFile(t)||ae.isBlob(t)||ae.isReadableStream(t))return t;if(ae.isArrayBufferView(t))return t.buffer;if(ae.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Rq(t,this.formSerializer).toString();if((l=ae.isFileList(t))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Yy(l?{"files[]":t}:t,c&&new c,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),Fq(t)):t}],transformResponse:[function(t){const n=this.transitional||Sp.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(ae.isResponse(t)||ae.isReadableStream(t))return t;if(t&&ae.isString(t)&&(r&&!this.responseType||s)){const o=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t)}catch(l){if(o)throw l.name==="SyntaxError"?xt.from(l,xt.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:yr.classes.FormData,Blob:yr.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ae.forEach(["delete","get","head","post","put","patch"],e=>{Sp.headers[e]={}});const Bq=ae.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),zq=e=>{const t={};let n,r,s;return e&&e.split(` +`).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||t[n]&&Bq[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},JA=Symbol("internals");function Dd(e){return e&&String(e).trim().toLowerCase()}function Ym(e){return e===!1||e==null?e:ae.isArray(e)?e.map(Ym):String(e)}function Uq(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const Vq=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function K0(e,t,n,r,s){if(ae.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!ae.isString(t)){if(ae.isString(r))return t.indexOf(r)!==-1;if(ae.isRegExp(r))return r.test(t)}}function Wq(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function Hq(e,t){const n=ae.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,i,o){return this[r].call(this,t,s,i,o)},configurable:!0})})}class qr{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function i(l,c,u){const d=Dd(c);if(!d)throw new Error("header name must be a non-empty string");const f=ae.findKey(s,d);(!f||s[f]===void 0||u===!0||u===void 0&&s[f]!==!1)&&(s[f||c]=Ym(l))}const o=(l,c)=>ae.forEach(l,(u,d)=>i(u,d,c));if(ae.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(ae.isString(t)&&(t=t.trim())&&!Vq(t))o(zq(t),n);else if(ae.isObject(t)&&ae.isIterable(t)){let l={},c,u;for(const d of t){if(!ae.isArray(d))throw TypeError("Object iterator must return a key-value pair");l[u=d[0]]=(c=l[u])?ae.isArray(c)?[...c,d[1]]:[c,d[1]]:d[1]}o(l,n)}else t!=null&&i(n,t,r);return this}get(t,n){if(t=Dd(t),t){const r=ae.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return Uq(s);if(ae.isFunction(n))return n.call(this,s,r);if(ae.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Dd(t),t){const r=ae.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||K0(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function i(o){if(o=Dd(o),o){const l=ae.findKey(r,o);l&&(!n||K0(r,r[l],l,n))&&(delete r[l],s=!0)}}return ae.isArray(t)?t.forEach(i):i(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!t||K0(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const n=this,r={};return ae.forEach(this,(s,i)=>{const o=ae.findKey(r,i);if(o){n[o]=Ym(s),delete n[i];return}const l=t?Wq(i):String(i).trim();l!==i&&delete n[i],n[l]=Ym(s),r[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return ae.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&ae.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` +`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[JA]=this[JA]={accessors:{}}).accessors,s=this.prototype;function i(o){const l=Dd(o);r[l]||(Hq(s,o),r[l]=!0)}return ae.isArray(t)?t.forEach(i):i(t),this}}qr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);ae.reduceDescriptors(qr.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});ae.freezeMethods(qr);function X0(e,t){const n=this||Sp,r=t||n,s=qr.from(r.headers);let i=r.data;return ae.forEach(e,function(l){i=l.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function qR(e){return!!(e&&e.__CANCEL__)}function nd(e,t,n){xt.call(this,e??"canceled",xt.ERR_CANCELED,t,n),this.name="CanceledError"}ae.inherits(nd,xt,{__CANCEL__:!0});function KR(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new xt("Request failed with status code "+n.status,[xt.ERR_BAD_REQUEST,xt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Gq(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function qq(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),d=r[i];o||(o=u),n[s]=c,r[s]=u;let f=i,h=0;for(;f!==s;)h+=n[f++],f=f%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),u-o{n=d,s=null,i&&(clearTimeout(i),i=null),e.apply(null,u)};return[(...u)=>{const d=Date.now(),f=d-n;f>=r?o(u,d):(s=u,i||(i=setTimeout(()=>{i=null,o(s)},r-f)))},()=>s&&o(s)]}const Lg=(e,t,n=3)=>{let r=0;const s=qq(50,250);return Kq(i=>{const o=i.loaded,l=i.lengthComputable?i.total:void 0,c=o-r,u=s(c),d=o<=l;r=o;const f={loaded:o,total:l,progress:l?o/l:void 0,bytes:c,rate:u||void 0,estimated:u&&l&&d?(l-o)/u:void 0,event:i,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(f)},n)},eE=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},tE=e=>(...t)=>ae.asap(()=>e(...t)),Xq=yr.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,yr.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(yr.origin),yr.navigator&&/(msie|trident)/i.test(yr.navigator.userAgent)):()=>!0,Yq=yr.hasStandardBrowserEnv?{write(e,t,n,r,s,i){const o=[e+"="+encodeURIComponent(t)];ae.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),ae.isString(r)&&o.push("path="+r),ae.isString(s)&&o.push("domain="+s),i===!0&&o.push("secure"),document.cookie=o.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Zq(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Qq(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function XR(e,t,n){let r=!Zq(t);return e&&(r||n==!1)?Qq(e,t):t}const nE=e=>e instanceof qr?{...e}:e;function Ll(e,t){t=t||{};const n={};function r(u,d,f,h){return ae.isPlainObject(u)&&ae.isPlainObject(d)?ae.merge.call({caseless:h},u,d):ae.isPlainObject(d)?ae.merge({},d):ae.isArray(d)?d.slice():d}function s(u,d,f,h){if(ae.isUndefined(d)){if(!ae.isUndefined(u))return r(void 0,u,f,h)}else return r(u,d,f,h)}function i(u,d){if(!ae.isUndefined(d))return r(void 0,d)}function o(u,d){if(ae.isUndefined(d)){if(!ae.isUndefined(u))return r(void 0,u)}else return r(void 0,d)}function l(u,d,f){if(f in t)return r(u,d);if(f in e)return r(void 0,u)}const c={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l,headers:(u,d,f)=>s(nE(u),nE(d),f,!0)};return ae.forEach(Object.keys(Object.assign({},e,t)),function(d){const f=c[d]||s,h=f(e[d],t[d],d);ae.isUndefined(h)&&f!==l||(n[d]=h)}),n}const YR=e=>{const t=Ll({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:l}=t;t.headers=o=qr.from(o),t.url=WR(XR(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let c;if(ae.isFormData(n)){if(yr.hasStandardBrowserEnv||yr.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((c=o.getContentType())!==!1){const[u,...d]=c?c.split(";").map(f=>f.trim()).filter(Boolean):[];o.setContentType([u||"multipart/form-data",...d].join("; "))}}if(yr.hasStandardBrowserEnv&&(r&&ae.isFunction(r)&&(r=r(t)),r||r!==!1&&Xq(t.url))){const u=s&&i&&Yq.read(i);u&&o.set(s,u)}return t},Jq=typeof XMLHttpRequest<"u",eK=Jq&&function(e){return new Promise(function(n,r){const s=YR(e);let i=s.data;const o=qr.from(s.headers).normalize();let{responseType:l,onUploadProgress:c,onDownloadProgress:u}=s,d,f,h,p,g;function m(){p&&p(),g&&g(),s.cancelToken&&s.cancelToken.unsubscribe(d),s.signal&&s.signal.removeEventListener("abort",d)}let x=new XMLHttpRequest;x.open(s.method.toUpperCase(),s.url,!0),x.timeout=s.timeout;function b(){if(!x)return;const w=qr.from("getAllResponseHeaders"in x&&x.getAllResponseHeaders()),S={data:!l||l==="text"||l==="json"?x.responseText:x.response,status:x.status,statusText:x.statusText,headers:w,config:e,request:x};KR(function(P){n(P),m()},function(P){r(P),m()},S),x=null}"onloadend"in x?x.onloadend=b:x.onreadystatechange=function(){!x||x.readyState!==4||x.status===0&&!(x.responseURL&&x.responseURL.indexOf("file:")===0)||setTimeout(b)},x.onabort=function(){x&&(r(new xt("Request aborted",xt.ECONNABORTED,e,x)),x=null)},x.onerror=function(){r(new xt("Network Error",xt.ERR_NETWORK,e,x)),x=null},x.ontimeout=function(){let j=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const S=s.transitional||HR;s.timeoutErrorMessage&&(j=s.timeoutErrorMessage),r(new xt(j,S.clarifyTimeoutError?xt.ETIMEDOUT:xt.ECONNABORTED,e,x)),x=null},i===void 0&&o.setContentType(null),"setRequestHeader"in x&&ae.forEach(o.toJSON(),function(j,S){x.setRequestHeader(S,j)}),ae.isUndefined(s.withCredentials)||(x.withCredentials=!!s.withCredentials),l&&l!=="json"&&(x.responseType=s.responseType),u&&([h,g]=Lg(u,!0),x.addEventListener("progress",h)),c&&x.upload&&([f,p]=Lg(c),x.upload.addEventListener("progress",f),x.upload.addEventListener("loadend",p)),(s.cancelToken||s.signal)&&(d=w=>{x&&(r(!w||w.type?new nd(null,e,x):w),x.abort(),x=null)},s.cancelToken&&s.cancelToken.subscribe(d),s.signal&&(s.signal.aborted?d():s.signal.addEventListener("abort",d)));const y=Gq(s.url);if(y&&yr.protocols.indexOf(y)===-1){r(new xt("Unsupported protocol "+y+":",xt.ERR_BAD_REQUEST,e));return}x.send(i||null)})},tK=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const i=function(u){if(!s){s=!0,l();const d=u instanceof Error?u:this.reason;r.abort(d instanceof xt?d:new nd(d instanceof Error?d.message:d))}};let o=t&&setTimeout(()=>{o=null,i(new xt(`timeout ${t} of ms exceeded`,xt.ETIMEDOUT))},t);const l=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(i):u.removeEventListener("abort",i)}),e=null)};e.forEach(u=>u.addEventListener("abort",i));const{signal:c}=r;return c.unsubscribe=()=>ae.asap(l),c}},nK=function*(e,t){let n=e.byteLength;if(n{const s=rK(e,t);let i=0,o,l=c=>{o||(o=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:u,value:d}=await s.next();if(u){l(),c.close();return}let f=d.byteLength;if(n){let h=i+=f;n(h)}c.enqueue(new Uint8Array(d))}catch(u){throw l(u),u}},cancel(c){return l(c),s.return()}},{highWaterMark:2})},Zy=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",ZR=Zy&&typeof ReadableStream=="function",iK=Zy&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),QR=(e,...t)=>{try{return!!e(...t)}catch{return!1}},aK=ZR&&QR(()=>{let e=!1;const t=new Request(yr.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),sE=64*1024,n1=ZR&&QR(()=>ae.isReadableStream(new Response("").body)),Fg={stream:n1&&(e=>e.body)};Zy&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Fg[t]&&(Fg[t]=ae.isFunction(e[t])?n=>n[t]():(n,r)=>{throw new xt(`Response type '${t}' is not supported`,xt.ERR_NOT_SUPPORT,r)})})})(new Response);const oK=async e=>{if(e==null)return 0;if(ae.isBlob(e))return e.size;if(ae.isSpecCompliantForm(e))return(await new Request(yr.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(ae.isArrayBufferView(e)||ae.isArrayBuffer(e))return e.byteLength;if(ae.isURLSearchParams(e)&&(e=e+""),ae.isString(e))return(await iK(e)).byteLength},lK=async(e,t)=>{const n=ae.toFiniteNumber(e.getContentLength());return n??oK(t)},cK=Zy&&(async e=>{let{url:t,method:n,data:r,signal:s,cancelToken:i,timeout:o,onDownloadProgress:l,onUploadProgress:c,responseType:u,headers:d,withCredentials:f="same-origin",fetchOptions:h}=YR(e);u=u?(u+"").toLowerCase():"text";let p=tK([s,i&&i.toAbortSignal()],o),g;const m=p&&p.unsubscribe&&(()=>{p.unsubscribe()});let x;try{if(c&&aK&&n!=="get"&&n!=="head"&&(x=await lK(d,r))!==0){let S=new Request(t,{method:"POST",body:r,duplex:"half"}),N;if(ae.isFormData(r)&&(N=S.headers.get("content-type"))&&d.setContentType(N),S.body){const[P,_]=eE(x,Lg(tE(c)));r=rE(S.body,sE,P,_)}}ae.isString(f)||(f=f?"include":"omit");const b="credentials"in Request.prototype;g=new Request(t,{...h,signal:p,method:n.toUpperCase(),headers:d.normalize().toJSON(),body:r,duplex:"half",credentials:b?f:void 0});let y=await fetch(g);const w=n1&&(u==="stream"||u==="response");if(n1&&(l||w&&m)){const S={};["status","statusText","headers"].forEach(A=>{S[A]=y[A]});const N=ae.toFiniteNumber(y.headers.get("content-length")),[P,_]=l&&eE(N,Lg(tE(l),!0))||[];y=new Response(rE(y.body,sE,P,()=>{_&&_(),m&&m()}),S)}u=u||"text";let j=await Fg[ae.findKey(Fg,u)||"text"](y,e);return!w&&m&&m(),await new Promise((S,N)=>{KR(S,N,{data:j,headers:qr.from(y.headers),status:y.status,statusText:y.statusText,config:e,request:g})})}catch(b){throw m&&m(),b&&b.name==="TypeError"&&/Load failed|fetch/i.test(b.message)?Object.assign(new xt("Network Error",xt.ERR_NETWORK,e,g),{cause:b.cause||b}):xt.from(b,b&&b.code,e,g)}}),r1={http:Nq,xhr:eK,fetch:cK};ae.forEach(r1,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const iE=e=>`- ${e}`,uK=e=>ae.isFunction(e)||e===null||e===!1,JR={getAdapter:e=>{e=ae.isArray(e)?e:[e];const{length:t}=e;let n,r;const s={};for(let i=0;i`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let o=t?i.length>1?`since : +`+i.map(iE).join(` +`):" "+iE(i[0]):"as no adapter specified";throw new xt("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r},adapters:r1};function Y0(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new nd(null,e)}function aE(e){return Y0(e),e.headers=qr.from(e.headers),e.data=X0.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),JR.getAdapter(e.adapter||Sp.adapter)(e).then(function(r){return Y0(e),r.data=X0.call(e,e.transformResponse,r),r.headers=qr.from(r.headers),r},function(r){return qR(r)||(Y0(e),r&&r.response&&(r.response.data=X0.call(e,e.transformResponse,r.response),r.response.headers=qr.from(r.response.headers))),Promise.reject(r)})}const eD="1.9.0",Qy={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Qy[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const oE={};Qy.transitional=function(t,n,r){function s(i,o){return"[Axios v"+eD+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,l)=>{if(t===!1)throw new xt(s(o," has been removed"+(n?" in "+n:"")),xt.ERR_DEPRECATED);return n&&!oE[o]&&(oE[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,o,l):!0}};Qy.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function dK(e,t,n){if(typeof e!="object")throw new xt("options must be an object",xt.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const i=r[s],o=t[i];if(o){const l=e[i],c=l===void 0||o(l,i,e);if(c!==!0)throw new xt("option "+i+" must be "+c,xt.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new xt("Unknown option "+i,xt.ERR_BAD_OPTION)}}const Zm={assertOptions:dK,validators:Qy},mi=Zm.validators;class _l{constructor(t){this.defaults=t||{},this.interceptors={request:new QA,response:new QA}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=` +`+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Ll(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&Zm.assertOptions(r,{silentJSONParsing:mi.transitional(mi.boolean),forcedJSONParsing:mi.transitional(mi.boolean),clarifyTimeoutError:mi.transitional(mi.boolean)},!1),s!=null&&(ae.isFunction(s)?n.paramsSerializer={serialize:s}:Zm.assertOptions(s,{encode:mi.function,serialize:mi.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Zm.assertOptions(n,{baseUrl:mi.spelling("baseURL"),withXsrfToken:mi.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&ae.merge(i.common,i[n.method]);i&&ae.forEach(["delete","get","head","post","put","patch","common"],g=>{delete i[g]}),n.headers=qr.concat(o,i);const l=[];let c=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(c=c&&m.synchronous,l.unshift(m.fulfilled,m.rejected))});const u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});let d,f=0,h;if(!c){const g=[aE.bind(this),void 0];for(g.unshift.apply(g,l),g.push.apply(g,u),h=g.length,d=Promise.resolve(n);f{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(l=>{r.subscribe(l),i=l}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,l){r.reason||(r.reason=new nd(i,o,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new MN(function(s){t=s}),cancel:t}}}function fK(e){return function(n){return e.apply(null,n)}}function hK(e){return ae.isObject(e)&&e.isAxiosError===!0}const s1={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(s1).forEach(([e,t])=>{s1[t]=e});function tD(e){const t=new _l(e),n=TR(_l.prototype.request,t);return ae.extend(n,_l.prototype,t,{allOwnKeys:!0}),ae.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return tD(Ll(e,s))},n}const Mn=tD(Sp);Mn.Axios=_l;Mn.CanceledError=nd;Mn.CancelToken=MN;Mn.isCancel=qR;Mn.VERSION=eD;Mn.toFormData=Yy;Mn.AxiosError=xt;Mn.Cancel=Mn.CanceledError;Mn.all=function(t){return Promise.all(t)};Mn.spread=fK;Mn.isAxiosError=hK;Mn.mergeConfig=Ll;Mn.AxiosHeaders=qr;Mn.formToJSON=e=>GR(ae.isHTMLForm(e)?new FormData(e):e);Mn.getAdapter=JR.getAdapter;Mn.HttpStatusCode=s1;Mn.default=Mn;const nD="https://ai-sandbox.oliver.solutions/semblance_back/api",qe=Mn.create({baseURL:nD,headers:{"Content-Type":"application/json"},timeout:6e5});qe.interceptors.request.use(e=>{var n;const t=localStorage.getItem("auth_token");return t&&(e.headers.Authorization=`Bearer ${t}`),e.method==="put"&&((n=e.url)!=null&&n.includes("/focus-groups/"))&&console.log("๐ŸŒ API Request:",{method:e.method,url:e.url,baseURL:e.baseURL,fullURL:`${e.baseURL}${e.url}`,data:e.data}),e},e=>Promise.reject(e));const i1="auth_error",pK=e=>{e!=null&&e.isPersonaCreation||(localStorage.removeItem("auth_token"),localStorage.removeItem("user"));const t=new CustomEvent(i1,{detail:e||{}});window.dispatchEvent(t)};qe.interceptors.response.use(e=>e,e=>{var t,n,r,s,i,o;if(e.response&&e.response.status===401){const l=e.config&&(((t=e.config.url)==null?void 0:t.includes("/personas"))||((n=e.config.url)==null?void 0:n.includes("/personas/batch"))||e.config.method&&((r=e.config.url)==null?void 0:r.startsWith("/personas")));console.log("API Error:",{url:(s=e.config)==null?void 0:s.url,method:(i=e.config)==null?void 0:i.method,isPersonaRequest:l}),l?console.warn("Authentication error in persona request, letting component handle it"):pK({source:(o=e.config)==null?void 0:o.url,isPersonaCreation:!1})}return Promise.reject(e)});const a1={login:(e,t)=>qe.post("/auth/login",{username:e,password:t}),register:(e,t,n)=>qe.post("/auth/register",{username:e,email:t,password:n}),getProfile:()=>qe.get("/auth/me")},$n={getAll:()=>qe.get("/personas/all"),getById:e=>qe.get(`/personas/${e}`),create:e=>qe.post("/personas",e),update:(e,t)=>e&&e.startsWith("local-")?(console.log("Cannot update with local ID, creating new instead:",e),qe.post("/personas",t)):qe.put(`/personas/${e}`,t),delete:e=>{const t=typeof e=="object"&&e!==null&&e._id||e;return console.log(`Deleting persona with ID: ${t}`),qe.delete(`/personas/${t}`)},createBatch:e=>qe.post("/personas/batch",e)},Xi={generate:e=>qe.post("/ai-personas/generate",e||{},{timeout:6e5}),generateAndSave:e=>qe.post("/ai-personas/generate-and-save",e||{},{timeout:6e5}),batchGenerate:e=>qe.post("/ai-personas/batch-generate",e,{timeout:6e5}),batchGenerateAndSave:e=>qe.post("/ai-personas/batch-generate-and-save",e,{timeout:6e5}),generateBasicProfiles:(e,t=5,n=.8)=>qe.post("/ai-personas/generate-basic-profiles",{audience_brief:e,count:t,temperature:n},{timeout:6e5}),completePersona:(e,t=.7)=>qe.post("/ai-personas/complete-persona",{basic_profile:e,temperature:t},{timeout:6e5}),completeAndSavePersona:(e,t=.7)=>qe.post("/ai-personas/complete-and-save-persona",{basic_profile:e,temperature:t},{timeout:6e5}),generatePersonaSummary:(e,t=.7)=>qe.post("/ai-personas/generate-persona-summary",{persona_data:e,temperature:t},{timeout:6e5}),batchGenerateWithStages:async(e,t,n=5,r=.7,s,i)=>{var o;try{console.log(`๐Ÿ“ก API call to generate-basic-profiles with model: ${i||"gemini-2.5-pro"}`);const c=(await qe.post("/ai-personas/generate-basic-profiles",{audience_brief:e,research_objective:t,count:n,temperature:.7,customer_data_session_id:s,llm_model:i||"gemini-2.5-pro"},{timeout:6e5})).data.profiles,u=[],d=[],f=[];console.log(`๐Ÿ“ก API call to complete-and-save-persona with model: ${i||"gemini-2.5-pro"}`);const h=c.map(g=>qe.post("/ai-personas/complete-and-save-persona",{basic_profile:g,temperature:r,customer_data_session_id:s,llm_model:i||"gemini-2.5-pro"},{timeout:6e5}));if((await Promise.allSettled(h)).forEach((g,m)=>{if(g.status==="fulfilled")u.push(g.value.data.persona),d.push(g.value.data.persona_id);else{const x=c[m],b={index:m,name:x.name||`Persona ${m+1}`,error:g.reason};f.push(b),console.error(`Failed to complete persona ${m+1} (${x.name||"unnamed"}):`,g.reason)}}),u.length===0&&f.length>0)throw new Error(`Failed to generate any personas. ${f.length} profile(s) failed.`);return{data:{message:`Generated and saved ${u.length} personas${f.length>0?` (${f.length} failed)`:""}`,personas:u,persona_ids:d,errors:f.length>0?f:void 0,partial_success:f.length>0&&u.length>0}}}catch(l){throw((o=l.response)==null?void 0:o.status)===504||l.code==="ECONNABORTED"?new Error("Timeout error: The server took too long to generate personas. Please try with fewer personas or try again later."):l}},enhanceAudienceBrief:(e,t,n=.7)=>qe.post("/ai-personas/enhance-audience-brief",{audience_brief:e,research_objective:t,temperature:n},{timeout:6e5}),batchGenerateSummaries:(e,t=.7,n)=>(console.log(`๐Ÿ“ก Frontend: API call to batch-generate-summaries with model: ${n||"gemini-2.5-pro"}`),qe.post("/ai-personas/batch-generate-summaries",{persona_ids:e,temperature:t,llm_model:n||"gemini-2.5-pro"},{timeout:9e5})),uploadCustomerData:e=>{const t=new FormData;for(let n=0;nqe.delete(`/ai-personas/cleanup-customer-data/${e}`)},Ct={getAll:()=>qe.get("/focus-groups"),getById:e=>qe.get(`/focus-groups/${e}`),create:e=>qe.post("/focus-groups",e),update:(e,t)=>qe.put(`/focus-groups/${e}`,t),delete:e=>qe.delete(`/focus-groups/${e}`),addParticipant:(e,t)=>qe.post(`/focus-groups/${e}/participants`,{persona_id:t}),removeParticipant:(e,t)=>qe.delete(`/focus-groups/${e}/participants/${t}`),sendMessage:(e,t)=>qe.post(`/focus-groups/${e}/messages`,t),getMessages:e=>qe.get(`/focus-groups/${e}/messages`),updateMessageHighlight:(e,t,n)=>qe.patch(`/focus-groups/${e}/messages/${t}`,{highlighted:n}),describeAsset:(e,t)=>qe.post(`/focus-groups/${e}/describe-asset`,{asset_filename:t},{timeout:12e4}),generateDiscussionGuide:e=>qe.post("/focus-groups/generate-discussion-guide",e,{timeout:6e5}),generateDiscussionGuideForGroup:(e,t)=>qe.post(`/focus-groups/${e}/generate-discussion-guide`,t,{timeout:6e5}),downloadDiscussionGuide:async e=>{try{const t=await qe.get(`/focus-groups/${e}/discussion-guide/download`,{responseType:"blob",timeout:3e4}),n=t.headers["content-disposition"];let r="discussion-guide.md";if(n){const l=n.match(/filename="([^"]+)"/);l&&(r=l[1])}const s=new Blob([t.data],{type:"text/markdown"}),i=URL.createObjectURL(s),o=document.createElement("a");return o.href=i,o.download=r,o.style.display="none",document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(i),{success:!0,filename:r}}catch(t){throw console.error("Error downloading discussion guide:",t),new Error("Failed to download discussion guide")}},createNote:(e,t)=>qe.post(`/focus-groups/${e}/notes`,t),getNotes:e=>qe.get(`/focus-groups/${e}/notes`),deleteNote:(e,t)=>qe.delete(`/focus-groups/${e}/notes/${t}`),uploadAssets:(e,t)=>qe.post(`/focus-groups/${e}/assets`,t,{headers:{"Content-Type":"multipart/form-data"},timeout:12e4}),getAssets:e=>qe.get(`/focus-groups/${e}/assets`),getAssetUrl:(e,t)=>`${nD}/focus-groups/${e}/assets/${t}`,deleteAsset:(e,t)=>qe.delete(`/focus-groups/${e}/assets/${t}`)},vn={generateResponse:(e,t,n,r=.7)=>qe.post("/focus-group-ai/generate-response",{focus_group_id:e,persona_id:t,current_topic:n,temperature:r},{timeout:6e5}),generateKeyThemes:(e,t=.7)=>qe.post("/focus-group-ai/generate-key-themes",{focus_group_id:e,temperature:t},{timeout:6e5}),getKeyThemes:e=>qe.get(`/focus-group-ai/key-themes/${e}`),deleteKeyTheme:(e,t)=>qe.delete(`/focus-group-ai/key-themes/${e}/${t}`),getModeratorStatus:e=>qe.get(`/focus-group-ai/moderator/status/${e}`),advanceModeratorDiscussion:e=>qe.post(`/focus-group-ai/moderator/advance/${e}`,{},{timeout:6e5}),setModeratorPosition:(e,t,n)=>qe.put(`/focus-group-ai/moderator/position/${e}`,{section_id:t,item_id:n}),startAutonomousConversation:(e,t)=>qe.post(`/focus-group-ai/autonomous/start/${e}`,{initial_prompt:t},{timeout:6e5}),stopAutonomousConversation:(e,t)=>qe.post(`/focus-group-ai/autonomous/stop/${e}`,{reason:t}),getAutonomousConversationStatus:e=>qe.get(`/focus-group-ai/autonomous/status/${e}`),getConversationState:e=>qe.get(`/focus-group-ai/conversation/state/${e}`),getConversationAnalytics:e=>qe.get(`/focus-group-ai/conversation/analytics/${e}`),makeConversationDecision:(e,t=.7,n="ai")=>qe.post(`/focus-group-ai/conversation/decision/${e}`,{temperature:t,mode:n},{timeout:6e5}),getConversationInsights:e=>qe.get(`/focus-group-ai/conversation/insights/${e}`,{timeout:6e5}),manualIntervention:(e,t,n,r)=>qe.post(`/focus-group-ai/conversation/intervene/${e}`,{action:t,message:n,participant_id:r}),getReasoningHistory:e=>qe.get(`/focus-group-ai/conversation/reasoning-history/${e}`),endSession:(e,t)=>qe.post(`/focus-group-ai/moderator/end-session/${e}`,{reason:t||"session_ended"})},rD=v.createContext(void 0);function mK({children:e}){const[t,n]=v.useState(null),[r,s]=v.useState(null),[i,o]=v.useState(!0),l=Rn();v.useEffect(()=>{const p=g=>{const x=g.detail||{};if(x.isPersonaCreation){console.log("Ignoring auth error from persona creation",x);return}s(null),n(null),ce.error("Session expired",{description:"Please log in again"}),l("/login")};return window.addEventListener(i1,p),()=>{window.removeEventListener(i1,p)}},[l]),v.useEffect(()=>{const p=localStorage.getItem("auth_token"),g=localStorage.getItem("user");if(console.log("AuthContext initializing - stored data check:",{hasToken:!!p,hasUser:!!g}),p&&g)try{s(p),n(JSON.parse(g)),console.log("User session restored from localStorage")}catch(m){console.error("Failed to parse stored user data:",m),localStorage.removeItem("auth_token"),localStorage.removeItem("user")}else console.log("No stored authentication data found");o(!1)},[]),v.useEffect(()=>{if(r){console.log("Verifying token...");const p=`token_validated_${r.substring(0,10)}`;if(sessionStorage.getItem(p)==="true"&&t){console.log("Token already validated this session, skipping validation");return}a1.getProfile().then(m=>{m&&"data"in m&&(console.log("Profile verified successfully"),n(m.data),sessionStorage.setItem(p,"true"))}).catch(m=>{m.response&&m.response.status===401?(console.error("Token invalid (401):",m),localStorage.removeItem("auth_token"),localStorage.removeItem("user"),s(null),n(null)):(console.warn("Profile validation error (not clearing token):",m),sessionStorage.setItem(p,"true"))})}else console.log("No token available, not validating profile")},[r,t]);const c=async(p,g)=>{var m,x;o(!0),console.log("Attempting login for user:",p);try{const b=await a1.login(p,g);if(console.log("Login API response received"),!b.data.access_token)throw new Error("No access token received from server");return localStorage.setItem("auth_token",b.data.access_token),localStorage.setItem("user",JSON.stringify(b.data.user)),s(b.data.access_token),n(b.data.user),console.log("Authentication state updated"),ce.success("Login successful!"),b.data.access_token}catch(b){throw console.error("Login failed:",b),ce.error("Login failed",{description:((x=(m=b.response)==null?void 0:m.data)==null?void 0:x.message)||"Invalid username or password"}),b}finally{o(!1)}},u=()=>{localStorage.removeItem("auth_token"),localStorage.removeItem("user"),s(null),n(null),ce.info("You have been logged out")},d=!!localStorage.getItem("auth_token"),h={user:t,token:r,isLoading:i,login:c,logout:u,isAuthenticated:!!r||d};return a.jsx(rD.Provider,{value:h,children:e})}function Zl(){const e=v.useContext(rD);if(e===void 0)throw new Error("useAuth must be used within an AuthProvider");return e}function oa(){const[e,t]=v.useState(!1),n=ci(),r=Rn(),{isAuthenticated:s,logout:i}=Zl(),o=[{name:"Home",href:"/",icon:Zw},{name:"Synthetic Personas",href:"/synthetic-users",icon:er},{name:"Focus Groups",href:"/focus-groups",icon:Na},{name:"Dashboard",href:"/dashboard",icon:Qw}],l=()=>{t(!e)},c=d=>n.pathname===d,u=d=>{if(d==="/synthetic-users"){const f=new CustomEvent("syntheticUsersNavigation");window.dispatchEvent(f)}r(d)};return a.jsxs("header",{className:"fixed top-0 left-0 right-0 z-50 bg-white/80 backdrop-blur-md border-b border-slate-200/80",children:[a.jsx("div",{className:"px-4 sm:px-6 lg:px-8",children:a.jsxs("div",{className:"flex h-16 items-center justify-between",children:[a.jsx("div",{className:"flex items-center",children:a.jsx(js,{to:"/",className:"flex items-center",children:a.jsx("span",{className:"font-sf text-2xl font-semibold text-gradient",children:"Semblance"})})}),a.jsx("nav",{className:"hidden md:block",children:a.jsxs("ul",{className:"flex items-center space-x-8",children:[o.map(d=>a.jsx("li",{children:d.href==="/"?a.jsxs(js,{to:d.href,className:Me("flex items-center px-1 py-2 text-sm font-medium hover-transition border-b-2",c(d.href)?"border-primary text-primary":"border-transparent text-slate-600 hover:text-slate-900 hover:border-slate-300"),children:[a.jsx(d.icon,{className:"mr-1 h-4 w-4"}),d.name]}):a.jsxs("button",{onClick:()=>u(d.href),className:Me("flex items-center px-1 py-2 text-sm font-medium hover-transition border-b-2",c(d.href)?"border-primary text-primary":"border-transparent text-slate-600 hover:text-slate-900 hover:border-slate-300"),children:[a.jsx(d.icon,{className:"mr-1 h-4 w-4"}),d.name]})},d.name)),a.jsx("li",{children:s?a.jsxs("button",{onClick:()=>{i(),r("/login")},className:"flex items-center px-3 py-2 text-sm font-medium text-slate-600 hover:text-slate-900 button-transition rounded-md hover:bg-slate-50",children:[a.jsx(GA,{className:"mr-1 h-4 w-4"}),"Logout"]}):a.jsxs(js,{to:"/login",className:"flex items-center px-3 py-2 text-sm font-medium text-slate-600 hover:text-slate-900 button-transition rounded-md hover:bg-slate-50",children:[a.jsx(HA,{className:"mr-1 h-4 w-4"}),"Login"]})})]})}),a.jsx("div",{className:"flex md:hidden",children:a.jsxs("button",{type:"button",className:"inline-flex items-center justify-center rounded-md p-2 text-slate-700 hover:bg-slate-100 hover:text-slate-900 button-transition",onClick:l,children:[a.jsx("span",{className:"sr-only",children:"Open main menu"}),e?a.jsx(Ei,{className:"block h-6 w-6","aria-hidden":"true"}):a.jsx(_G,{className:"block h-6 w-6","aria-hidden":"true"})]})})]})}),e&&a.jsx("div",{className:"md:hidden glass-panel animate-fade-in",children:a.jsxs("div",{className:"space-y-1 px-4 pb-3 pt-2",children:[o.map(d=>a.jsx("div",{children:d.href==="/"?a.jsxs(js,{to:d.href,className:Me("flex items-center rounded-md px-3 py-2 text-base font-medium button-transition",c(d.href)?"bg-primary text-white":"text-slate-600 hover:bg-slate-50 hover:text-slate-900"),onClick:()=>t(!1),children:[a.jsx(d.icon,{className:"mr-3 h-5 w-5"}),d.name]}):a.jsxs("button",{className:Me("flex items-center rounded-md px-3 py-2 text-base font-medium button-transition w-full text-left",c(d.href)?"bg-primary text-white":"text-slate-600 hover:bg-slate-50 hover:text-slate-900"),onClick:()=>{t(!1),u(d.href)},children:[a.jsx(d.icon,{className:"mr-3 h-5 w-5"}),d.name]})},d.name)),s?a.jsxs("button",{onClick:()=>{i(),t(!1),r("/login")},className:"flex items-center rounded-md px-3 py-2 text-base font-medium button-transition text-slate-600 hover:bg-slate-50 hover:text-slate-900 w-full",children:[a.jsx(GA,{className:"mr-3 h-5 w-5"}),"Logout"]}):a.jsxs(js,{to:"/login",className:"flex items-center rounded-md px-3 py-2 text-base font-medium button-transition text-slate-600 hover:bg-slate-50 hover:text-slate-900",onClick:()=>t(!1),children:[a.jsx(HA,{className:"mr-3 h-5 w-5"}),"Login"]})]})})]})}const lE=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,cE=mt,RN=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return cE(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:i}=t,o=Object.keys(s).map(u=>{const d=n==null?void 0:n[u],f=i==null?void 0:i[u];if(d===null)return null;const h=lE(d)||lE(f);return s[u][h]}),l=n&&Object.entries(n).reduce((u,d)=>{let[f,h]=d;return h===void 0||(u[f]=h),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:f,className:h,...p}=d;return Object.entries(p).every(g=>{let[m,x]=g;return Array.isArray(x)?x.includes({...i,...l}[m]):{...i,...l}[m]===x})?[...u,f,h]:u},[]);return cE(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)},DN=RN("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),se=v.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...s},i)=>{const o=r?xa:"button";return a.jsx(o,{className:Me(DN({variant:t,size:n,className:e})),ref:i,...s})});se.displayName="Button";function gK(){return a.jsxs("div",{className:"relative isolate overflow-hidden",children:[a.jsx("div",{className:"absolute inset-x-0 top-[-10rem] -z-10 transform-gpu overflow-hidden blur-3xl sm:top-[-20rem]","aria-hidden":"true",children:a.jsx("div",{className:"relative left-[calc(50%-11rem)] aspect-[1155/678] w-[36.125rem] -translate-x-1/2 rotate-[30deg] bg-gradient-to-tr from-primary to-blue-400 opacity-20 sm:left-[calc(50%-30rem)] sm:w-[72.1875rem]",style:{clipPath:"polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)"}})}),a.jsxs("div",{className:"mx-auto max-w-7xl px-6 py-24 sm:py-32 lg:flex lg:items-center lg:gap-x-10 lg:px-8 lg:py-40",children:[a.jsxs("div",{className:"mx-auto max-w-2xl lg:mx-0 lg:flex-auto",children:[a.jsx("div",{className:"flex",children:a.jsxs("div",{className:"relative flex items-center gap-x-4 rounded-full px-4 py-1 text-sm leading-6 text-gray-600 ring-1 ring-gray-900/10 hover:ring-gray-900/20",children:[a.jsx("span",{className:"font-semibold text-primary",children:"New"}),a.jsx("span",{className:"h-4 w-px bg-gray-900/10","aria-hidden":"true"}),a.jsx("span",{children:"Introducing AI-driven focus groups"})]})}),a.jsxs("h1",{className:"mt-10 max-w-lg text-4xl font-sf font-bold tracking-tight text-gray-900 sm:text-6xl",children:["Research with ",a.jsx("span",{className:"text-gradient",children:"synthetic personas"})]}),a.jsx("p",{className:"mt-6 text-lg leading-8 text-gray-600",children:"Conduct research using AI-powered synthetic personas and autonomous focus groups. Gain valuable insights without the limitations of traditional research methods."}),a.jsxs("div",{className:"mt-10 flex items-center gap-x-6",children:[a.jsx(js,{to:"/synthetic-users",children:a.jsxs(se,{className:"px-6 py-6 text-base hover:shadow-lg hover:translate-y-[-2px] button-transition",children:["Create synthetic personas",a.jsx(vi,{className:"ml-2 h-4 w-4"})]})}),a.jsxs(js,{to:"/focus-groups",className:"text-sm font-semibold leading-6 text-gray-900 hover:text-primary button-transition",children:["Set up focus groups ",a.jsx("span",{"aria-hidden":"true",children:"โ†’"})]})]})]}),a.jsx("div",{className:"mt-16 sm:mt-24 lg:mt-0 lg:flex-shrink-0 lg:flex-grow",children:a.jsxs("div",{className:"relative glass-card mx-auto w-[350px] h-[450px] rounded-2xl shadow-xl overflow-hidden animate-float",children:[a.jsxs("div",{className:"absolute top-4 left-4 right-4 h-12 bg-white/70 backdrop-blur-sm rounded-lg flex items-center px-4",children:[a.jsx("div",{className:"h-3 w-3 rounded-full bg-red-400 mr-2"}),a.jsx("div",{className:"h-3 w-3 rounded-full bg-yellow-400 mr-2"}),a.jsx("div",{className:"h-3 w-3 rounded-full bg-green-400 mr-2"}),a.jsx("div",{className:"text-xs text-gray-500 ml-2",children:"Shampoo Brand Perception"})]}),a.jsx("div",{className:"absolute top-20 left-4 right-4 bottom-4 bg-gray-50 rounded-lg overflow-hidden",children:[1,2,3,4].map(e=>a.jsx("div",{className:`flex ${e%2===0?"justify-end":"justify-start"} px-3 py-2`,children:a.jsxs("div",{className:`max-w-[70%] rounded-lg px-3 py-2 text-xs ${e%2===0?"bg-primary text-white":"bg-gray-200 text-gray-800"}`,children:[e===1&&"What qualities do you look for in a premium shampoo brand?",e===2&&"I value natural ingredients and a brand that feels luxurious but still eco-friendly.",e===3&&"How important is fragrance in your shampoo selection?",e===4&&"Very important - it affects my mood and how I feel about the product throughout the day."]})},e))})]})})]}),a.jsx("div",{className:"absolute inset-x-0 bottom-[-10rem] -z-10 transform-gpu overflow-hidden blur-3xl sm:bottom-[-20rem]","aria-hidden":"true",children:a.jsx("div",{className:"relative left-[calc(50%+11rem)] aspect-[1155/678] w-[36.125rem] -translate-x-1/2 rotate-[30deg] bg-gradient-to-tr from-blue-400 to-primary opacity-20 sm:left-[calc(50%+30rem)] sm:w-[72.1875rem]",style:{clipPath:"polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)"}})})]})}function ac({title:e,description:t,icon:n,className:r}){return a.jsxs("div",{className:Me("relative group glass-card rounded-xl overflow-hidden p-6 hover:shadow-lg hover:translate-y-[-4px] button-transition",r),children:[a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-primary/5 to-blue-400/5 opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"rounded-full bg-primary/10 w-12 h-12 flex items-center justify-center mb-4",children:a.jsx(n,{className:"h-6 w-6 text-primary"})}),a.jsx("h3",{className:"font-sf text-lg font-semibold mb-2",children:e}),a.jsx("p",{className:"text-gray-600 text-sm",children:t})]})]})}const vK=()=>(Zl(),Rn(),a.jsxs("div",{className:"min-h-screen overflow-hidden bg-background",children:[a.jsx(oa,{}),a.jsx("main",{children:a.jsxs("div",{className:"pt-16",children:[a.jsx(gK,{}),a.jsx("section",{className:"py-20 px-6 bg-white",children:a.jsxs("div",{className:"max-w-7xl mx-auto",children:[a.jsxs("div",{className:"text-center mb-16",children:[a.jsx("h2",{className:"text-3xl font-sf font-bold sm:text-4xl",children:"Why Synthetic Personas?"}),a.jsx("p",{className:"mt-4 text-lg text-gray-600 max-w-3xl mx-auto",children:"Our platform combines advanced AI with intuitive design to help researchers gain deeper insights faster than traditional methods."})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:[a.jsx(ac,{title:"Scalable Research",description:"Create and test with thousands of synthetic personas, each with unique demographic profiles and behaviors.",icon:er}),a.jsx(ac,{title:"AI-Driven Focus Groups",description:"Run autonomous focus groups moderated by AI that adapts to participant responses in real-time.",icon:Na}),a.jsx(ac,{title:"Instant Analysis",description:"Generate comprehensive reports and visualizations that highlight key insights and patterns.",icon:Qw}),a.jsx(ac,{title:"Diverse Perspectives",description:"Access synthetic personas from various backgrounds, ensuring representation across age, gender, and location.",icon:er}),a.jsx(ac,{title:"Dynamic Discussions",description:"AI moderators guide conversations naturally, following up on interesting points without bias.",icon:TG}),a.jsx(ac,{title:"Comprehensive Reporting",description:"Export detailed reports with sentiment analysis, key themes, and actionable recommendations.",icon:Qw})]})]})}),a.jsx("section",{className:"py-20 px-6 bg-gradient-to-b from-white to-slate-50",children:a.jsxs("div",{className:"max-w-7xl mx-auto",children:[a.jsxs("div",{className:"text-center mb-16",children:[a.jsx("h2",{className:"text-3xl font-sf font-bold sm:text-4xl",children:"How It Works"}),a.jsx("p",{className:"mt-4 text-lg text-gray-600 max-w-3xl mx-auto",children:"Just three simple steps to gather valuable insights from synthetic personas."})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8",children:[a.jsxs("div",{className:"text-center p-6",children:[a.jsx("div",{className:"rounded-full bg-primary/10 w-16 h-16 flex items-center justify-center mx-auto mb-4",children:a.jsx("span",{className:"text-2xl font-bold text-primary",children:"1"})}),a.jsx("h3",{className:"text-xl font-sf font-semibold mb-3",children:"Create Synthetic Personas"}),a.jsx("p",{className:"text-gray-600",children:"Define your target audience with customizable demographic profiles and personality traits."})]}),a.jsxs("div",{className:"text-center p-6",children:[a.jsx("div",{className:"rounded-full bg-primary/10 w-16 h-16 flex items-center justify-center mx-auto mb-4",children:a.jsx("span",{className:"text-2xl font-bold text-primary",children:"2"})}),a.jsx("h3",{className:"text-xl font-sf font-semibold mb-3",children:"Set Up Focus Groups"}),a.jsx("p",{className:"text-gray-600",children:"Configure your research objectives, topics, and parameters for the AI moderator."})]}),a.jsxs("div",{className:"text-center p-6",children:[a.jsx("div",{className:"rounded-full bg-primary/10 w-16 h-16 flex items-center justify-center mx-auto mb-4",children:a.jsx("span",{className:"text-2xl font-bold text-primary",children:"3"})}),a.jsx("h3",{className:"text-xl font-sf font-semibold mb-3",children:"Analyze Results"}),a.jsx("p",{className:"text-gray-600",children:"Review comprehensive visual reports and actionable insights from your synthetic research."})]})]}),a.jsx("div",{className:"text-center mt-12",children:a.jsx(js,{to:"synthetic-users",className:"inline-flex items-center justify-center px-6 py-3 border border-transparent text-base font-medium rounded-md text-white bg-primary hover:bg-primary/90 button-transition",children:"Get Started"})})]})}),a.jsxs("footer",{className:"bg-white py-12 px-6",children:[a.jsxs("div",{className:"max-w-7xl mx-auto flex flex-col md:flex-row justify-between items-center",children:[a.jsxs("div",{className:"mb-6 md:mb-0",children:[a.jsx("span",{className:"text-xl font-sf font-semibold text-gradient",children:"Semblance"}),a.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"AI-powered synthetic persona research"})]}),a.jsxs("div",{className:"flex flex-col md:flex-row gap-8",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-900 mb-3",children:"Platform"}),a.jsxs("ul",{className:"space-y-2",children:[a.jsx("li",{children:a.jsx(js,{to:"/",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Home"})}),a.jsx("li",{children:a.jsx(js,{to:"/synthetic-users",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Synthetic Personas"})}),a.jsx("li",{children:a.jsx(js,{to:"/focus-groups",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Focus Groups"})}),a.jsx("li",{children:a.jsx(js,{to:"/dashboard",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Dashboard"})})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-900 mb-3",children:"Company"}),a.jsxs("ul",{className:"space-y-2",children:[a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"About"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Blog"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Careers"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Contact"})})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-900 mb-3",children:"Legal"}),a.jsxs("ul",{className:"space-y-2",children:[a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Privacy"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Terms"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Security"})})]})]})]})]}),a.jsx("div",{className:"max-w-7xl mx-auto mt-8 pt-8 border-t border-gray-200",children:a.jsxs("p",{className:"text-sm text-gray-500 text-center",children:["ยฉ ",new Date().getFullYear()," Semblance. All rights reserved."]})})]})]})})]})),yK=()=>{const e=ci(),t=Rn();v.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",e.pathname)},[e.pathname]);const n=e.pathname.startsWith("/synthetic-users/"),s=new URLSearchParams(e.search).get("fromReview")==="true";return a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-100",children:a.jsxs("div",{className:"text-center p-8 max-w-md bg-white rounded-lg shadow-md",children:[a.jsx("h1",{className:"text-4xl font-bold mb-4",children:"404"}),n?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-xl text-gray-600 mb-4",children:"Persona Not Found"}),a.jsx("p",{className:"text-gray-500 mb-6",children:"The persona you're looking for may have been removed or doesn't exist."}),s?a.jsx(se,{onClick:()=>t("/synthetic-users?mode=create&tab=ai&step=review"),className:"mb-2 w-full",children:"Return to Review Page"}):a.jsx(se,{onClick:()=>t("/synthetic-users"),className:"mb-2 w-full",children:"View All Personas"})]}):a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-xl text-gray-600 mb-4",children:"Oops! Page not found"}),a.jsx("p",{className:"text-gray-500 mb-6",children:"The page you're looking for doesn't exist or has been moved."})]}),a.jsx(se,{variant:"outline",onClick:()=>t("/"),className:"w-full",children:"Return to Home"})]})})};function xK(e,t=[]){let n=[];function r(i,o){const l=v.createContext(o),c=n.length;n=[...n,o];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[e][c])||l,x=v.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:x,children:p})}function d(f,h){const p=(h==null?void 0:h[e][c])||l,g=v.useContext(p);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${i}\``)}return u.displayName=i+"Provider",[u,d]}const s=()=>{const i=n.map(o=>v.createContext(o));return function(l){const c=(l==null?void 0:l[e])||i;return v.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[r,bK(s,...t)]}function bK(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(i)[`__scope${u}`];return{...l,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var LN="Progress",FN=100,[wK,NOe]=xK(LN),[jK,SK]=wK(LN),sD=v.forwardRef((e,t)=>{const{__scopeProgress:n,value:r=null,max:s,getValueLabel:i=NK,...o}=e;(s||s===0)&&!uE(s)&&console.error(_K(`${s}`,"Progress"));const l=uE(s)?s:FN;r!==null&&!dE(r,l)&&console.error(PK(`${r}`,"Progress"));const c=dE(r,l)?r:null,u=Bg(c)?i(c,l):void 0;return a.jsx(jK,{scope:n,value:c,max:l,children:a.jsx(Xe.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":Bg(c)?c:void 0,"aria-valuetext":u,role:"progressbar","data-state":oD(c,l),"data-value":c??void 0,"data-max":l,...o,ref:t})})});sD.displayName=LN;var iD="ProgressIndicator",aD=v.forwardRef((e,t)=>{const{__scopeProgress:n,...r}=e,s=SK(iD,n);return a.jsx(Xe.div,{"data-state":oD(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...r,ref:t})});aD.displayName=iD;function NK(e,t){return`${Math.round(e/t*100)}%`}function oD(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function Bg(e){return typeof e=="number"}function uE(e){return Bg(e)&&!isNaN(e)&&e>0}function dE(e,t){return Bg(e)&&!isNaN(e)&&e<=t&&e>=0}function _K(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${FN}\`.`}function PK(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be: + - a positive number + - less than the value passed to \`max\` (or ${FN} if no \`max\` prop is set) + - \`null\` or \`undefined\` if the progress is indeterminate. + +Defaulting to \`null\`.`}var lD=sD,CK=aD;const fl=v.forwardRef(({className:e,value:t,...n},r)=>a.jsx(lD,{ref:r,className:Me("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...n,children:a.jsx(CK,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));fl.displayName=lD.displayName;var Np=e=>e.type==="checkbox",hl=e=>e instanceof Date,_r=e=>e==null;const cD=e=>typeof e=="object";var Cn=e=>!_r(e)&&!Array.isArray(e)&&cD(e)&&!hl(e),uD=e=>Cn(e)&&e.target?Np(e.target)?e.target.checked:e.target.value:e,AK=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,dD=(e,t)=>e.has(AK(t)),EK=e=>{const t=e.constructor&&e.constructor.prototype;return Cn(t)&&t.hasOwnProperty("isPrototypeOf")},BN=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Dr(e){let t;const n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(BN&&(e instanceof Blob||e instanceof FileList))&&(n||Cn(e)))if(t=n?[]:{},!n&&!EK(e))t=e;else for(const r in e)e.hasOwnProperty(r)&&(t[r]=Dr(e[r]));else return e;return t}var Jy=e=>Array.isArray(e)?e.filter(Boolean):[],yn=e=>e===void 0,De=(e,t,n)=>{if(!t||!Cn(e))return n;const r=Jy(t.split(/[,[\].]+?/)).reduce((s,i)=>_r(s)?s:s[i],e);return yn(r)||r===e?yn(e[t])?n:e[t]:r},ys=e=>typeof e=="boolean",zN=e=>/^\w*$/.test(e),fD=e=>Jy(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Vt=(e,t,n)=>{let r=-1;const s=zN(t)?[t]:fD(t),i=s.length,o=i-1;for(;++rC.useContext(hD),OK=e=>{const{children:t,...n}=e;return C.createElement(hD.Provider,{value:n},t)};var pD=(e,t,n,r=!0)=>{const s={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(s,i,{get:()=>{const o=i;return t._proxyFormState[o]!==qs.all&&(t._proxyFormState[o]=!r||qs.all),n&&(n[o]=!0),e[o]}});return s},Lr=e=>Cn(e)&&!Object.keys(e).length,mD=(e,t,n,r)=>{n(e);const{name:s,...i}=e;return Lr(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(o=>t[o]===(!r||qs.all))},wf=e=>Array.isArray(e)?e:[e],gD=(e,t,n)=>!e||!t||e===t||wf(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r)));function UN(e){const t=C.useRef(e);t.current=e,C.useEffect(()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}function kK(e){const t=ex(),{control:n=t.control,disabled:r,name:s,exact:i}=e||{},[o,l]=C.useState(n._formState),c=C.useRef(!0),u=C.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=C.useRef(s);return d.current=s,UN({disabled:r,next:f=>c.current&&gD(d.current,f.name,i)&&mD(f,u.current,n._updateFormState)&&l({...n._formState,...f}),subject:n._subjects.state}),C.useEffect(()=>(c.current=!0,u.current.isValid&&n._updateValid(!0),()=>{c.current=!1}),[n]),pD(o,n,u.current,!1)}var Ni=e=>typeof e=="string",vD=(e,t,n,r,s)=>Ni(e)?(r&&t.watch.add(e),De(n,e,s)):Array.isArray(e)?e.map(i=>(r&&t.watch.add(i),De(n,i))):(r&&(t.watchAll=!0),n);function TK(e){const t=ex(),{control:n=t.control,name:r,defaultValue:s,disabled:i,exact:o}=e||{},l=C.useRef(r);l.current=r,UN({disabled:i,subject:n._subjects.values,next:d=>{gD(l.current,d.name,o)&&u(Dr(vD(l.current,n._names,d.values||n._formValues,!1,s)))}});const[c,u]=C.useState(n._getWatch(r,s));return C.useEffect(()=>n._removeUnmounted()),c}function $K(e){const t=ex(),{name:n,disabled:r,control:s=t.control,shouldUnregister:i}=e,o=dD(s._names.array,n),l=TK({control:s,name:n,defaultValue:De(s._formValues,n,De(s._defaultValues,n,e.defaultValue)),exact:!0}),c=kK({control:s,name:n,exact:!0}),u=C.useRef(s.register(n,{...e.rules,value:l,...ys(e.disabled)?{disabled:e.disabled}:{}}));return C.useEffect(()=>{const d=s._options.shouldUnregister||i,f=(h,p)=>{const g=De(s._fields,h);g&&g._f&&(g._f.mount=p)};if(f(n,!0),d){const h=Dr(De(s._options.defaultValues,n));Vt(s._defaultValues,n,h),yn(De(s._formValues,n))&&Vt(s._formValues,n,h)}return()=>{(o?d&&!s._state.action:d)?s.unregister(n):f(n,!1)}},[n,s,o,i]),C.useEffect(()=>{De(s._fields,n)&&s._updateDisabledField({disabled:r,fields:s._fields,name:n,value:De(s._fields,n)._f.value})},[r,n,s]),{field:{name:n,value:l,...ys(r)||c.disabled?{disabled:c.disabled||r}:{},onChange:C.useCallback(d=>u.current.onChange({target:{value:uD(d),name:n},type:zg.CHANGE}),[n]),onBlur:C.useCallback(()=>u.current.onBlur({target:{value:De(s._formValues,n),name:n},type:zg.BLUR}),[n,s]),ref:C.useCallback(d=>{const f=De(s._fields,n);f&&d&&(f._f.ref={focus:()=>d.focus(),select:()=>d.select(),setCustomValidity:h=>d.setCustomValidity(h),reportValidity:()=>d.reportValidity()})},[s._fields,n])},formState:c,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!De(c.errors,n)},isDirty:{enumerable:!0,get:()=>!!De(c.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!De(c.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!De(c.validatingFields,n)},error:{enumerable:!0,get:()=>De(c.errors,n)}})}}const IK=e=>e.render($K(e));var yD=(e,t,n,r,s)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:s||!0}}:{},fE=e=>({isOnSubmit:!e||e===qs.onSubmit,isOnBlur:e===qs.onBlur,isOnChange:e===qs.onChange,isOnAll:e===qs.all,isOnTouch:e===qs.onTouched}),hE=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const jf=(e,t,n,r)=>{for(const s of n||Object.keys(e)){const i=De(e,s);if(i){const{_f:o,...l}=i;if(o){if(o.refs&&o.refs[0]&&t(o.refs[0],s)&&!r)return!0;if(o.ref&&t(o.ref,o.name)&&!r)return!0;if(jf(l,t))break}else if(Cn(l)&&jf(l,t))break}}};var MK=(e,t,n)=>{const r=wf(De(e,n));return Vt(r,"root",t[n]),Vt(e,n,r),e},VN=e=>e.type==="file",na=e=>typeof e=="function",Ug=e=>{if(!BN)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Qm=e=>Ni(e),WN=e=>e.type==="radio",Vg=e=>e instanceof RegExp;const pE={value:!1,isValid:!1},mE={value:!0,isValid:!0};var xD=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!yn(e[0].attributes.value)?yn(e[0].value)||e[0].value===""?mE:{value:e[0].value,isValid:!0}:mE:pE}return pE};const gE={isValid:!1,value:null};var bD=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,gE):gE;function vE(e,t,n="validate"){if(Qm(e)||Array.isArray(e)&&e.every(Qm)||ys(e)&&!e)return{type:n,message:Qm(e)?e:"",ref:t}}var oc=e=>Cn(e)&&!Vg(e)?e:{value:e,message:""},yE=async(e,t,n,r,s)=>{const{ref:i,refs:o,required:l,maxLength:c,minLength:u,min:d,max:f,pattern:h,validate:p,name:g,valueAsNumber:m,mount:x,disabled:b}=e._f,y=De(t,g);if(!x||b)return{};const w=o?o[0]:i,j=k=>{r&&w.reportValidity&&(w.setCustomValidity(ys(k)?"":k||""),w.reportValidity())},S={},N=WN(i),P=Np(i),_=N||P,A=(m||VN(i))&&yn(i.value)&&yn(y)||Ug(i)&&i.value===""||y===""||Array.isArray(y)&&!y.length,O=yD.bind(null,g,n,S),T=(k,M,R,H=Wi.maxLength,F=Wi.minLength)=>{const V=k?M:R;S[g]={type:k?H:F,message:V,ref:i,...O(k?H:F,V)}};if(s?!Array.isArray(y)||!y.length:l&&(!_&&(A||_r(y))||ys(y)&&!y||P&&!xD(o).isValid||N&&!bD(o).isValid)){const{value:k,message:M}=Qm(l)?{value:!!l,message:l}:oc(l);if(k&&(S[g]={type:Wi.required,message:M,ref:w,...O(Wi.required,M)},!n))return j(M),S}if(!A&&(!_r(d)||!_r(f))){let k,M;const R=oc(f),H=oc(d);if(!_r(y)&&!isNaN(y)){const F=i.valueAsNumber||y&&+y;_r(R.value)||(k=F>R.value),_r(H.value)||(M=Fnew Date(new Date().toDateString()+" "+Y),$=i.type=="time",L=i.type=="week";Ni(R.value)&&y&&(k=$?V(y)>V(R.value):L?y>R.value:F>new Date(R.value)),Ni(H.value)&&y&&(M=$?V(y)+k.value,H=!_r(M.value)&&y.length<+M.value;if((R||H)&&(T(R,k.message,M.message),!n))return j(S[g].message),S}if(h&&!A&&Ni(y)){const{value:k,message:M}=oc(h);if(Vg(k)&&!y.match(k)&&(S[g]={type:Wi.pattern,message:M,ref:i,...O(Wi.pattern,M)},!n))return j(M),S}if(p){if(na(p)){const k=await p(y,t),M=vE(k,w);if(M&&(S[g]={...M,...O(Wi.validate,M.message)},!n))return j(M.message),S}else if(Cn(p)){let k={};for(const M in p){if(!Lr(k)&&!n)break;const R=vE(await p[M](y,t),w,M);R&&(k={...R,...O(M,R.message)},j(R.message),n&&(S[g]=k))}if(!Lr(k)&&(S[g]={ref:w,...k},!n))return S}}return j(!0),S};function RK(e,t){const n=t.slice(0,-1).length;let r=0;for(;r{let e=[];return{get observers(){return e},next:s=>{for(const i of e)i.next&&i.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(i=>i!==s)}}),unsubscribe:()=>{e=[]}}},o1=e=>_r(e)||!cD(e);function Za(e,t){if(o1(e)||o1(t))return e===t;if(hl(e)&&hl(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const s of n){const i=e[s];if(!r.includes(s))return!1;if(s!=="ref"){const o=t[s];if(hl(i)&&hl(o)||Cn(i)&&Cn(o)||Array.isArray(i)&&Array.isArray(o)?!Za(i,o):i!==o)return!1}}return!0}var wD=e=>e.type==="select-multiple",LK=e=>WN(e)||Np(e),Q0=e=>Ug(e)&&e.isConnected,jD=e=>{for(const t in e)if(na(e[t]))return!0;return!1};function Wg(e,t={}){const n=Array.isArray(e);if(Cn(e)||n)for(const r in e)Array.isArray(e[r])||Cn(e[r])&&!jD(e[r])?(t[r]=Array.isArray(e[r])?[]:{},Wg(e[r],t[r])):_r(e[r])||(t[r]=!0);return t}function SD(e,t,n){const r=Array.isArray(e);if(Cn(e)||r)for(const s in e)Array.isArray(e[s])||Cn(e[s])&&!jD(e[s])?yn(t)||o1(n[s])?n[s]=Array.isArray(e[s])?Wg(e[s],[]):{...Wg(e[s])}:SD(e[s],_r(t)?{}:t[s],n[s]):n[s]=!Za(e[s],t[s]);return n}var Ld=(e,t)=>SD(e,t,Wg(t)),ND=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>yn(e)?e:t?e===""?NaN:e&&+e:n&&Ni(e)?new Date(e):r?r(e):e;function J0(e){const t=e.ref;if(!(e.refs?e.refs.every(n=>n.disabled):t.disabled))return VN(t)?t.files:WN(t)?bD(e.refs).value:wD(t)?[...t.selectedOptions].map(({value:n})=>n):Np(t)?xD(e.refs).value:ND(yn(t.value)?e.ref.value:t.value,e)}var FK=(e,t,n,r)=>{const s={};for(const i of e){const o=De(t,i);o&&Vt(s,i,o._f)}return{criteriaMode:n,names:[...e],fields:s,shouldUseNativeValidation:r}},Fd=e=>yn(e)?e:Vg(e)?e.source:Cn(e)?Vg(e.value)?e.value.source:e.value:e;const xE="AsyncFunction";var BK=e=>(!e||!e.validate)&&!!(na(e.validate)&&e.validate.constructor.name===xE||Cn(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===xE)),zK=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function bE(e,t,n){const r=De(e,n);if(r||zN(n))return{error:r,name:n};const s=n.split(".");for(;s.length;){const i=s.join("."),o=De(t,i),l=De(e,i);if(o&&!Array.isArray(o)&&n!==i)return{name:n};if(l&&l.type)return{name:i,error:l};s.pop()}return{name:n}}var UK=(e,t,n,r,s)=>s.isOnAll?!1:!n&&s.isOnTouch?!(t||e):(n?r.isOnBlur:s.isOnBlur)?!e:(n?r.isOnChange:s.isOnChange)?e:!0,VK=(e,t)=>!Jy(De(e,t)).length&&Fn(e,t);const WK={mode:qs.onSubmit,reValidateMode:qs.onChange,shouldFocusError:!0};function HK(e={}){let t={...WK,...e},n={submitCount:0,isDirty:!1,isLoading:na(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},s=Cn(t.defaultValues)||Cn(t.values)?Dr(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:Dr(s),o={action:!1,mount:!1,watch:!1},l={mount:new Set,unMount:new Set,array:new Set,watch:new Set},c,u=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={values:Z0(),array:Z0(),state:Z0()},h=fE(t.mode),p=fE(t.reValidateMode),g=t.criteriaMode===qs.all,m=E=>D=>{clearTimeout(u),u=setTimeout(E,D)},x=async E=>{if(!e.disabled&&(d.isValid||E)){const D=t.resolver?Lr((await _()).errors):await O(r,!0);D!==n.isValid&&f.state.next({isValid:D})}},b=(E,D)=>{!e.disabled&&(d.isValidating||d.validatingFields)&&((E||Array.from(l.mount)).forEach(U=>{U&&(D?Vt(n.validatingFields,U,D):Fn(n.validatingFields,U))}),f.state.next({validatingFields:n.validatingFields,isValidating:!Lr(n.validatingFields)}))},y=(E,D=[],U,K,J=!0,X=!0)=>{if(K&&U&&!e.disabled){if(o.action=!0,X&&Array.isArray(De(r,E))){const be=U(De(r,E),K.argA,K.argB);J&&Vt(r,E,be)}if(X&&Array.isArray(De(n.errors,E))){const be=U(De(n.errors,E),K.argA,K.argB);J&&Vt(n.errors,E,be),VK(n.errors,E)}if(d.touchedFields&&X&&Array.isArray(De(n.touchedFields,E))){const be=U(De(n.touchedFields,E),K.argA,K.argB);J&&Vt(n.touchedFields,E,be)}d.dirtyFields&&(n.dirtyFields=Ld(s,i)),f.state.next({name:E,isDirty:k(E,D),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Vt(i,E,D)},w=(E,D)=>{Vt(n.errors,E,D),f.state.next({errors:n.errors})},j=E=>{n.errors=E,f.state.next({errors:n.errors,isValid:!1})},S=(E,D,U,K)=>{const J=De(r,E);if(J){const X=De(i,E,yn(U)?De(s,E):U);yn(X)||K&&K.defaultChecked||D?Vt(i,E,D?X:J0(J._f)):H(E,X),o.mount&&x()}},N=(E,D,U,K,J)=>{let X=!1,be=!1;const _e={name:E};if(!e.disabled){const Fe=!!(De(r,E)&&De(r,E)._f&&De(r,E)._f.disabled);if(!U||K){d.isDirty&&(be=n.isDirty,n.isDirty=_e.isDirty=k(),X=be!==_e.isDirty);const ie=Fe||Za(De(s,E),D);be=!!(!Fe&&De(n.dirtyFields,E)),ie||Fe?Fn(n.dirtyFields,E):Vt(n.dirtyFields,E,!0),_e.dirtyFields=n.dirtyFields,X=X||d.dirtyFields&&be!==!ie}if(U){const ie=De(n.touchedFields,E);ie||(Vt(n.touchedFields,E,U),_e.touchedFields=n.touchedFields,X=X||d.touchedFields&&ie!==U)}X&&J&&f.state.next(_e)}return X?_e:{}},P=(E,D,U,K)=>{const J=De(n.errors,E),X=d.isValid&&ys(D)&&n.isValid!==D;if(e.delayError&&U?(c=m(()=>w(E,U)),c(e.delayError)):(clearTimeout(u),c=null,U?Vt(n.errors,E,U):Fn(n.errors,E)),(U?!Za(J,U):J)||!Lr(K)||X){const be={...K,...X&&ys(D)?{isValid:D}:{},errors:n.errors,name:E};n={...n,...be},f.state.next(be)}},_=async E=>{b(E,!0);const D=await t.resolver(i,t.context,FK(E||l.mount,r,t.criteriaMode,t.shouldUseNativeValidation));return b(E),D},A=async E=>{const{errors:D}=await _(E);if(E)for(const U of E){const K=De(D,U);K?Vt(n.errors,U,K):Fn(n.errors,U)}else n.errors=D;return D},O=async(E,D,U={valid:!0})=>{for(const K in E){const J=E[K];if(J){const{_f:X,...be}=J;if(X){const _e=l.array.has(X.name),Fe=J._f&&BK(J._f);Fe&&d.validatingFields&&b([K],!0);const ie=await yE(J,i,g,t.shouldUseNativeValidation&&!D,_e);if(Fe&&d.validatingFields&&b([K]),ie[X.name]&&(U.valid=!1,D))break;!D&&(De(ie,X.name)?_e?MK(n.errors,ie,X.name):Vt(n.errors,X.name,ie[X.name]):Fn(n.errors,X.name))}!Lr(be)&&await O(be,D,U)}}return U.valid},T=()=>{for(const E of l.unMount){const D=De(r,E);D&&(D._f.refs?D._f.refs.every(U=>!Q0(U)):!Q0(D._f.ref))&&pe(E)}l.unMount=new Set},k=(E,D)=>!e.disabled&&(E&&D&&Vt(i,E,D),!Za(Q(),s)),M=(E,D,U)=>vD(E,l,{...o.mount?i:yn(D)?s:Ni(E)?{[E]:D}:D},U,D),R=E=>Jy(De(o.mount?i:s,E,e.shouldUnregister?De(s,E,[]):[])),H=(E,D,U={})=>{const K=De(r,E);let J=D;if(K){const X=K._f;X&&(!X.disabled&&Vt(i,E,ND(D,X)),J=Ug(X.ref)&&_r(D)?"":D,wD(X.ref)?[...X.ref.options].forEach(be=>be.selected=J.includes(be.value)):X.refs?Np(X.ref)?X.refs.length>1?X.refs.forEach(be=>(!be.defaultChecked||!be.disabled)&&(be.checked=Array.isArray(J)?!!J.find(_e=>_e===be.value):J===be.value)):X.refs[0]&&(X.refs[0].checked=!!J):X.refs.forEach(be=>be.checked=be.value===J):VN(X.ref)?X.ref.value="":(X.ref.value=J,X.ref.type||f.values.next({name:E,values:{...i}})))}(U.shouldDirty||U.shouldTouch)&&N(E,J,U.shouldTouch,U.shouldDirty,!0),U.shouldValidate&&Y(E)},F=(E,D,U)=>{for(const K in D){const J=D[K],X=`${E}.${K}`,be=De(r,X);(l.array.has(E)||Cn(J)||be&&!be._f)&&!hl(J)?F(X,J,U):H(X,J,U)}},V=(E,D,U={})=>{const K=De(r,E),J=l.array.has(E),X=Dr(D);Vt(i,E,X),J?(f.array.next({name:E,values:{...i}}),(d.isDirty||d.dirtyFields)&&U.shouldDirty&&f.state.next({name:E,dirtyFields:Ld(s,i),isDirty:k(E,X)})):K&&!K._f&&!_r(X)?F(E,X,U):H(E,X,U),hE(E,l)&&f.state.next({...n}),f.values.next({name:o.mount?E:void 0,values:{...i}})},$=async E=>{o.mount=!0;const D=E.target;let U=D.name,K=!0;const J=De(r,U),X=()=>D.type?J0(J._f):uD(E),be=_e=>{K=Number.isNaN(_e)||hl(_e)&&isNaN(_e.getTime())||Za(_e,De(i,U,_e))};if(J){let _e,Fe;const ie=X(),Te=E.type===zg.BLUR||E.type===zg.FOCUS_OUT,Be=!zK(J._f)&&!t.resolver&&!De(n.errors,U)&&!J._f.deps||UK(Te,De(n.touchedFields,U),n.isSubmitted,p,h),gt=hE(U,l,Te);Vt(i,U,ie),Te?(J._f.onBlur&&J._f.onBlur(E),c&&c(0)):J._f.onChange&&J._f.onChange(E);const At=N(U,ie,Te,!1),pn=!Lr(At)||gt;if(!Te&&f.values.next({name:U,type:E.type,values:{...i}}),Be)return d.isValid&&(e.mode==="onBlur"?Te&&x():x()),pn&&f.state.next({name:U,...gt?{}:At});if(!Te&>&&f.state.next({...n}),t.resolver){const{errors:Zt}=await _([U]);if(be(ie),K){const bn=bE(n.errors,r,U),Xt=bE(Zt,r,bn.name||U);_e=Xt.error,U=Xt.name,Fe=Lr(Zt)}}else b([U],!0),_e=(await yE(J,i,g,t.shouldUseNativeValidation))[U],b([U]),be(ie),K&&(_e?Fe=!1:d.isValid&&(Fe=await O(r,!0)));K&&(J._f.deps&&Y(J._f.deps),P(U,Fe,_e,At))}},L=(E,D)=>{if(De(n.errors,D)&&E.focus)return E.focus(),1},Y=async(E,D={})=>{let U,K;const J=wf(E);if(t.resolver){const X=await A(yn(E)?E:J);U=Lr(X),K=E?!J.some(be=>De(X,be)):U}else E?(K=(await Promise.all(J.map(async X=>{const be=De(r,X);return await O(be&&be._f?{[X]:be}:be)}))).every(Boolean),!(!K&&!n.isValid)&&x()):K=U=await O(r);return f.state.next({...!Ni(E)||d.isValid&&U!==n.isValid?{}:{name:E},...t.resolver||!E?{isValid:U}:{},errors:n.errors}),D.shouldFocus&&!K&&jf(r,L,E?J:l.mount),K},Q=E=>{const D={...o.mount?i:s};return yn(E)?D:Ni(E)?De(D,E):E.map(U=>De(D,U))},ee=(E,D)=>({invalid:!!De((D||n).errors,E),isDirty:!!De((D||n).dirtyFields,E),error:De((D||n).errors,E),isValidating:!!De(n.validatingFields,E),isTouched:!!De((D||n).touchedFields,E)}),fe=E=>{E&&wf(E).forEach(D=>Fn(n.errors,D)),f.state.next({errors:E?n.errors:{}})},W=(E,D,U)=>{const K=(De(r,E,{_f:{}})._f||{}).ref,J=De(n.errors,E)||{},{ref:X,message:be,type:_e,...Fe}=J;Vt(n.errors,E,{...Fe,...D,ref:K}),f.state.next({name:E,errors:n.errors,isValid:!1}),U&&U.shouldFocus&&K&&K.focus&&K.focus()},he=(E,D)=>na(E)?f.values.subscribe({next:U=>E(M(void 0,D),U)}):M(E,D,!0),pe=(E,D={})=>{for(const U of E?wf(E):l.mount)l.mount.delete(U),l.array.delete(U),D.keepValue||(Fn(r,U),Fn(i,U)),!D.keepError&&Fn(n.errors,U),!D.keepDirty&&Fn(n.dirtyFields,U),!D.keepTouched&&Fn(n.touchedFields,U),!D.keepIsValidating&&Fn(n.validatingFields,U),!t.shouldUnregister&&!D.keepDefaultValue&&Fn(s,U);f.values.next({values:{...i}}),f.state.next({...n,...D.keepDirty?{isDirty:k()}:{}}),!D.keepIsValid&&x()},ue=({disabled:E,name:D,field:U,fields:K,value:J})=>{if(ys(E)&&o.mount||E){const X=E?void 0:yn(J)?J0(U?U._f:De(K,D)._f):J;Vt(i,D,X),N(D,X,!1,!1,!0)}},Ae=(E,D={})=>{let U=De(r,E);const K=ys(D.disabled)||ys(e.disabled);return Vt(r,E,{...U||{},_f:{...U&&U._f?U._f:{ref:{name:E}},name:E,mount:!0,...D}}),l.mount.add(E),U?ue({field:U,disabled:ys(D.disabled)?D.disabled:e.disabled,name:E,value:D.value}):S(E,!0,D.value),{...K?{disabled:D.disabled||e.disabled}:{},...t.progressive?{required:!!D.required,min:Fd(D.min),max:Fd(D.max),minLength:Fd(D.minLength),maxLength:Fd(D.maxLength),pattern:Fd(D.pattern)}:{},name:E,onChange:$,onBlur:$,ref:J=>{if(J){Ae(E,D),U=De(r,E);const X=yn(J.value)&&J.querySelectorAll&&J.querySelectorAll("input,select,textarea")[0]||J,be=LK(X),_e=U._f.refs||[];if(be?_e.find(Fe=>Fe===X):X===U._f.ref)return;Vt(r,E,{_f:{...U._f,...be?{refs:[..._e.filter(Q0),X,...Array.isArray(De(s,E))?[{}]:[]],ref:{type:X.type,name:E}}:{ref:X}}}),S(E,!1,void 0,X)}else U=De(r,E,{}),U._f&&(U._f.mount=!1),(t.shouldUnregister||D.shouldUnregister)&&!(dD(l.array,E)&&o.action)&&l.unMount.add(E)}}},de=()=>t.shouldFocusError&&jf(r,L,l.mount),oe=E=>{ys(E)&&(f.state.next({disabled:E}),jf(r,(D,U)=>{const K=De(r,U);K&&(D.disabled=K._f.disabled||E,Array.isArray(K._f.refs)&&K._f.refs.forEach(J=>{J.disabled=K._f.disabled||E}))},0,!1))},xe=(E,D)=>async U=>{let K;U&&(U.preventDefault&&U.preventDefault(),U.persist&&U.persist());let J=Dr(i);if(f.state.next({isSubmitting:!0}),t.resolver){const{errors:X,values:be}=await _();n.errors=X,J=be}else await O(r);if(Fn(n.errors,"root"),Lr(n.errors)){f.state.next({errors:{}});try{await E(J,U)}catch(X){K=X}}else D&&await D({...n.errors},U),de(),setTimeout(de);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Lr(n.errors)&&!K,submitCount:n.submitCount+1,errors:n.errors}),K)throw K},te=(E,D={})=>{De(r,E)&&(yn(D.defaultValue)?V(E,Dr(De(s,E))):(V(E,D.defaultValue),Vt(s,E,Dr(D.defaultValue))),D.keepTouched||Fn(n.touchedFields,E),D.keepDirty||(Fn(n.dirtyFields,E),n.isDirty=D.defaultValue?k(E,Dr(De(s,E))):k()),D.keepError||(Fn(n.errors,E),d.isValid&&x()),f.state.next({...n}))},Ye=(E,D={})=>{const U=E?Dr(E):s,K=Dr(U),J=Lr(E),X=J?s:K;if(D.keepDefaultValues||(s=U),!D.keepValues){if(D.keepDirtyValues){const be=new Set([...l.mount,...Object.keys(Ld(s,i))]);for(const _e of Array.from(be))De(n.dirtyFields,_e)?Vt(X,_e,De(i,_e)):V(_e,De(X,_e))}else{if(BN&&yn(E))for(const be of l.mount){const _e=De(r,be);if(_e&&_e._f){const Fe=Array.isArray(_e._f.refs)?_e._f.refs[0]:_e._f.ref;if(Ug(Fe)){const ie=Fe.closest("form");if(ie){ie.reset();break}}}}r={}}i=e.shouldUnregister?D.keepDefaultValues?Dr(s):{}:Dr(X),f.array.next({values:{...X}}),f.values.next({values:{...X}})}l={mount:D.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!d.isValid||!!D.keepIsValid||!!D.keepDirtyValues,o.watch=!!e.shouldUnregister,f.state.next({submitCount:D.keepSubmitCount?n.submitCount:0,isDirty:J?!1:D.keepDirty?n.isDirty:!!(D.keepDefaultValues&&!Za(E,s)),isSubmitted:D.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:J?{}:D.keepDirtyValues?D.keepDefaultValues&&i?Ld(s,i):n.dirtyFields:D.keepDefaultValues&&E?Ld(s,E):D.keepDirty?n.dirtyFields:{},touchedFields:D.keepTouched?n.touchedFields:{},errors:D.keepErrors?n.errors:{},isSubmitSuccessful:D.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},G=(E,D)=>Ye(na(E)?E(i):E,D);return{control:{register:Ae,unregister:pe,getFieldState:ee,handleSubmit:xe,setError:W,_executeSchema:_,_getWatch:M,_getDirty:k,_updateValid:x,_removeUnmounted:T,_updateFieldArray:y,_updateDisabledField:ue,_getFieldArray:R,_reset:Ye,_resetDefaultValues:()=>na(t.defaultValues)&&t.defaultValues().then(E=>{G(E,t.resetOptions),f.state.next({isLoading:!1})}),_updateFormState:E=>{n={...n,...E}},_disableForm:oe,_subjects:f,_proxyFormState:d,_setErrors:j,get _fields(){return r},get _formValues(){return i},get _state(){return o},set _state(E){o=E},get _defaultValues(){return s},get _names(){return l},set _names(E){l=E},get _formState(){return n},set _formState(E){n=E},get _options(){return t},set _options(E){t={...t,...E}}},trigger:Y,register:Ae,handleSubmit:xe,watch:he,setValue:V,getValues:Q,reset:G,resetField:te,clearErrors:fe,unregister:pe,setError:W,setFocus:(E,D={})=>{const U=De(r,E),K=U&&U._f;if(K){const J=K.refs?K.refs[0]:K.ref;J.focus&&(J.focus(),D.shouldSelect&&J.select())}},getFieldState:ee}}function tx(e={}){const t=C.useRef(),n=C.useRef(),[r,s]=C.useState({isDirty:!1,isValidating:!1,isLoading:na(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:na(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...HK(e),formState:r});const i=t.current.control;return i._options=e,UN({subject:i._subjects.state,next:o=>{mD(o,i._proxyFormState,i._updateFormState,!0)&&s({...i._formState})}}),C.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),C.useEffect(()=>{if(i._proxyFormState.isDirty){const o=i._getDirty();o!==r.isDirty&&i._subjects.state.next({isDirty:o})}},[i,r.isDirty]),C.useEffect(()=>{e.values&&!Za(e.values,n.current)?(i._reset(e.values,i._options.resetOptions),n.current=e.values,s(o=>({...o}))):i._resetDefaultValues()},[e.values,i]),C.useEffect(()=>{e.errors&&i._setErrors(e.errors)},[e.errors,i]),C.useEffect(()=>{i._state.mount||(i._updateValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),C.useEffect(()=>{e.shouldUnregister&&i._subjects.values.next({values:i._getWatch()})},[e.shouldUnregister,i]),C.useEffect(()=>{t.current&&(t.current.watch=t.current.watch.bind({}))},[r]),t.current.formState=pD(r,i),t.current}const wE=(e,t,n)=>{if(e&&"reportValidity"in e){const r=De(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},_D=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?wE(r.ref,n,e):r.refs&&r.refs.forEach(s=>wE(s,n,e))}},GK=(e,t)=>{t.shouldUseNativeValidation&&_D(e,t);const n={};for(const r in e){const s=De(t.fields,r),i=Object.assign(e[r]||{},{ref:s&&s.ref});if(qK(t.names||Object.keys(e),r)){const o=Object.assign({},De(n,r));Vt(o,"root",i),Vt(n,r,o)}else Vt(n,r,i)}return n},qK=(e,t)=>e.some(n=>n.startsWith(t+"."));var KK=function(e,t){for(var n={};e.length;){var r=e[0],s=r.code,i=r.message,o=r.path.join(".");if(!n[o])if("unionErrors"in r){var l=r.unionErrors[0].errors[0];n[o]={message:l.message,type:l.code}}else n[o]={message:i,type:s};if("unionErrors"in r&&r.unionErrors.forEach(function(d){return d.errors.forEach(function(f){return e.push(f)})}),t){var c=n[o].types,u=c&&c[r.code];n[o]=yD(o,t,n,s,u?[].concat(u,r.message):r.message)}e.shift()}return n},nx=function(e,t,n){return n===void 0&&(n={}),function(r,s,i){try{return Promise.resolve(function(o,l){try{var c=Promise.resolve(e[n.mode==="sync"?"parse":"parseAsync"](r,t)).then(function(u){return i.shouldUseNativeValidation&&_D({},i),{errors:{},values:n.raw?r:u}})}catch(u){return l(u)}return c&&c.then?c.then(void 0,l):c}(0,function(o){if(function(l){return Array.isArray(l==null?void 0:l.errors)}(o))return{values:{},errors:GK(KK(o.errors,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw o}))}catch(o){return Promise.reject(o)}}},Mt;(function(e){e.assertEqual=s=>s;function t(s){}e.assertIs=t;function n(s){throw new Error}e.assertNever=n,e.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},e.getValidEnumValues=s=>{const i=e.objectKeys(s).filter(l=>typeof s[s[l]]!="number"),o={};for(const l of i)o[l]=s[l];return e.objectValues(o)},e.objectValues=s=>e.objectKeys(s).map(function(i){return s[i]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},e.find=(s,i)=>{for(const o of s)if(i(o))return o},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(Mt||(Mt={}));var l1;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(l1||(l1={}));const We=Mt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Qa=e=>{switch(typeof e){case"undefined":return We.undefined;case"string":return We.string;case"number":return isNaN(e)?We.nan:We.number;case"boolean":return We.boolean;case"function":return We.function;case"bigint":return We.bigint;case"symbol":return We.symbol;case"object":return Array.isArray(e)?We.array:e===null?We.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?We.promise:typeof Map<"u"&&e instanceof Map?We.map:typeof Set<"u"&&e instanceof Set?We.set:typeof Date<"u"&&e instanceof Date?We.date:We.object;default:return We.unknown}},Oe=Mt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),XK=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class os extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const n=t||function(i){return i.message},r={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let l=r,c=0;for(;cn.message){const n={},r=[];for(const s of this.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(t(s))):r.push(t(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}os.create=e=>new os(e);const pu=(e,t)=>{let n;switch(e.code){case Oe.invalid_type:e.received===We.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case Oe.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Mt.jsonStringifyReplacer)}`;break;case Oe.unrecognized_keys:n=`Unrecognized key(s) in object: ${Mt.joinValues(e.keys,", ")}`;break;case Oe.invalid_union:n="Invalid input";break;case Oe.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Mt.joinValues(e.options)}`;break;case Oe.invalid_enum_value:n=`Invalid enum value. Expected ${Mt.joinValues(e.options)}, received '${e.received}'`;break;case Oe.invalid_arguments:n="Invalid function arguments";break;case Oe.invalid_return_type:n="Invalid function return type";break;case Oe.invalid_date:n="Invalid date";break;case Oe.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Mt.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case Oe.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case Oe.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case Oe.custom:n="Invalid input";break;case Oe.invalid_intersection_types:n="Intersection results could not be merged";break;case Oe.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Oe.not_finite:n="Number must be finite";break;default:n=t.defaultError,Mt.assertNever(e)}return{message:n}};let PD=pu;function YK(e){PD=e}function Hg(){return PD}const Gg=e=>{const{data:t,path:n,errorMaps:r,issueData:s}=e,i=[...n,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let l="";const c=r.filter(u=>!!u).slice().reverse();for(const u of c)l=u(o,{data:t,defaultError:l}).message;return{...s,path:i,message:l}},ZK=[];function Ve(e,t){const n=Hg(),r=Gg({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===pu?void 0:pu].filter(s=>!!s)});e.common.issues.push(r)}class br{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const s of n){if(s.status==="aborted")return ht;s.status==="dirty"&&t.dirty(),r.push(s.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const s of n){const i=await s.key,o=await s.value;r.push({key:i,value:o})}return br.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const s of n){const{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return ht;i.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:t.value,value:r}}}const ht=Object.freeze({status:"aborted"}),Ac=e=>({status:"dirty",value:e}),kr=e=>({status:"valid",value:e}),c1=e=>e.status==="aborted",u1=e=>e.status==="dirty",ih=e=>e.status==="valid",ah=e=>typeof Promise<"u"&&e instanceof Promise;function qg(e,t,n,r){if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function CD(e,t,n,r,s){if(typeof t=="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var Je;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Je||(Je={}));var sf,af;class Mi{constructor(t,n,r,s){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const jE=(e,t)=>{if(ih(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new os(e.common.issues);return this._error=n,this._error}}};function bt(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:s}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:s}:{errorMap:(o,l)=>{var c,u;const{message:d}=e;return o.code==="invalid_enum_value"?{message:d??l.defaultError}:typeof l.data>"u"?{message:(c=d??r)!==null&&c!==void 0?c:l.defaultError}:o.code!=="invalid_type"?{message:l.defaultError}:{message:(u=d??n)!==null&&u!==void 0?u:l.defaultError}},description:s}}class Pt{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return Qa(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Qa(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new br,ctx:{common:t.parent.common,data:t.data,parsedType:Qa(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(ah(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const s={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Qa(t)},i=this._parseSync({data:t,path:s.path,parent:s});return jE(s,i)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Qa(t)},s=this._parse({data:t,path:r.path,parent:r}),i=await(ah(s)?s:Promise.resolve(s));return jE(r,i)}refine(t,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{const o=t(s),l=()=>i.addIssue({code:Oe.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(l(),!1)):o?!0:(l(),!1)})}refinement(t,n){return this._refinement((r,s)=>t(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(t){return new ai({schema:this,typeName:dt.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return Oi.create(this,this._def)}nullable(){return Io.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Js.create(this,this._def)}promise(){return gu.create(this,this._def)}or(t){return uh.create([this,t],this._def)}and(t){return dh.create(this,t,this._def)}transform(t){return new ai({...bt(this._def),schema:this,typeName:dt.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new gh({...bt(this._def),innerType:this,defaultValue:n,typeName:dt.ZodDefault})}brand(){return new HN({typeName:dt.ZodBranded,type:this,...bt(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new vh({...bt(this._def),innerType:this,catchValue:n,typeName:dt.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return _p.create(this,t)}readonly(){return yh.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const QK=/^c[^\s-]{8,}$/i,JK=/^[0-9a-z]+$/,eX=/^[0-9A-HJKMNP-TV-Z]{26}$/,tX=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,nX=/^[a-z0-9_-]{21}$/i,rX=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,sX=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,iX="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let eb;const aX=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,oX=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,lX=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,AD="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",cX=new RegExp(`^${AD}$`);function ED(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function uX(e){return new RegExp(`^${ED(e)}$`)}function OD(e){let t=`${AD}T${ED(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function dX(e,t){return!!((t==="v4"||!t)&&aX.test(e)||(t==="v6"||!t)&&oX.test(e))}class Ys extends Pt{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==We.string){const i=this._getOrReturnCtx(t);return Ve(i,{code:Oe.invalid_type,expected:We.string,received:i.parsedType}),ht}const r=new br;let s;for(const i of this._def.checks)if(i.kind==="min")t.data.lengthi.value&&(s=this._getOrReturnCtx(t,s),Ve(s,{code:Oe.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const o=t.data.length>i.value,l=t.data.lengtht.test(s),{validation:n,code:Oe.invalid_string,...Je.errToObj(r)})}_addCheck(t){return new Ys({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Je.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Je.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Je.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Je.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Je.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Je.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Je.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Je.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Je.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Je.errToObj(t)})}datetime(t){var n,r;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,local:(r=t==null?void 0:t.local)!==null&&r!==void 0?r:!1,...Je.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...Je.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...Je.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...Je.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...Je.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...Je.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...Je.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...Je.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...Je.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...Je.errToObj(n)})}nonempty(t){return this.min(1,Je.errToObj(t))}trim(){return new Ys({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ys({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ys({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new Ys({checks:[],typeName:dt.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...bt(e)})};function fX(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,s=n>r?n:r,i=parseInt(e.toFixed(s).replace(".","")),o=parseInt(t.toFixed(s).replace(".",""));return i%o/Math.pow(10,s)}class ko extends Pt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==We.number){const i=this._getOrReturnCtx(t);return Ve(i,{code:Oe.invalid_type,expected:We.number,received:i.parsedType}),ht}let r;const s=new br;for(const i of this._def.checks)i.kind==="int"?Mt.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),Ve(r,{code:Oe.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?t.datai.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),Ve(r,{code:Oe.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?fX(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),Ve(r,{code:Oe.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),Ve(r,{code:Oe.not_finite,message:i.message}),s.dirty()):Mt.assertNever(i);return{status:s.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Je.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Je.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Je.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Je.toString(n))}setLimit(t,n,r,s){return new ko({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Je.toString(s)}]})}_addCheck(t){return new ko({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Je.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Je.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Je.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Je.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Je.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Je.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:Je.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Je.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Je.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuet.kind==="int"||t.kind==="multipleOf"&&Mt.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.valuenew ko({checks:[],typeName:dt.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...bt(e)});class To extends Pt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==We.bigint){const i=this._getOrReturnCtx(t);return Ve(i,{code:Oe.invalid_type,expected:We.bigint,received:i.parsedType}),ht}let r;const s=new br;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?t.datai.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),Ve(r,{code:Oe.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),Ve(r,{code:Oe.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):Mt.assertNever(i);return{status:s.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Je.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Je.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Je.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Je.toString(n))}setLimit(t,n,r,s){return new To({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Je.toString(s)}]})}_addCheck(t){return new To({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Je.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Je.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Je.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Je.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Je.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new To({checks:[],typeName:dt.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...bt(e)})};class oh extends Pt{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==We.boolean){const r=this._getOrReturnCtx(t);return Ve(r,{code:Oe.invalid_type,expected:We.boolean,received:r.parsedType}),ht}return kr(t.data)}}oh.create=e=>new oh({typeName:dt.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...bt(e)});class Fl extends Pt{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==We.date){const i=this._getOrReturnCtx(t);return Ve(i,{code:Oe.invalid_type,expected:We.date,received:i.parsedType}),ht}if(isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return Ve(i,{code:Oe.invalid_date}),ht}const r=new br;let s;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()i.value&&(s=this._getOrReturnCtx(t,s),Ve(s,{code:Oe.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):Mt.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Fl({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:Je.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:Je.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew Fl({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:dt.ZodDate,...bt(e)});class Kg extends Pt{_parse(t){if(this._getType(t)!==We.symbol){const r=this._getOrReturnCtx(t);return Ve(r,{code:Oe.invalid_type,expected:We.symbol,received:r.parsedType}),ht}return kr(t.data)}}Kg.create=e=>new Kg({typeName:dt.ZodSymbol,...bt(e)});class lh extends Pt{_parse(t){if(this._getType(t)!==We.undefined){const r=this._getOrReturnCtx(t);return Ve(r,{code:Oe.invalid_type,expected:We.undefined,received:r.parsedType}),ht}return kr(t.data)}}lh.create=e=>new lh({typeName:dt.ZodUndefined,...bt(e)});class ch extends Pt{_parse(t){if(this._getType(t)!==We.null){const r=this._getOrReturnCtx(t);return Ve(r,{code:Oe.invalid_type,expected:We.null,received:r.parsedType}),ht}return kr(t.data)}}ch.create=e=>new ch({typeName:dt.ZodNull,...bt(e)});class mu extends Pt{constructor(){super(...arguments),this._any=!0}_parse(t){return kr(t.data)}}mu.create=e=>new mu({typeName:dt.ZodAny,...bt(e)});class Pl extends Pt{constructor(){super(...arguments),this._unknown=!0}_parse(t){return kr(t.data)}}Pl.create=e=>new Pl({typeName:dt.ZodUnknown,...bt(e)});class _a extends Pt{_parse(t){const n=this._getOrReturnCtx(t);return Ve(n,{code:Oe.invalid_type,expected:We.never,received:n.parsedType}),ht}}_a.create=e=>new _a({typeName:dt.ZodNever,...bt(e)});class Xg extends Pt{_parse(t){if(this._getType(t)!==We.undefined){const r=this._getOrReturnCtx(t);return Ve(r,{code:Oe.invalid_type,expected:We.void,received:r.parsedType}),ht}return kr(t.data)}}Xg.create=e=>new Xg({typeName:dt.ZodVoid,...bt(e)});class Js extends Pt{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),s=this._def;if(n.parsedType!==We.array)return Ve(n,{code:Oe.invalid_type,expected:We.array,received:n.parsedType}),ht;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,l=n.data.lengths.maxLength.value&&(Ve(n,{code:Oe.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,l)=>s.type._parseAsync(new Mi(n,o,n.path,l)))).then(o=>br.mergeArray(r,o));const i=[...n.data].map((o,l)=>s.type._parseSync(new Mi(n,o,n.path,l)));return br.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new Js({...this._def,minLength:{value:t,message:Je.toString(n)}})}max(t,n){return new Js({...this._def,maxLength:{value:t,message:Je.toString(n)}})}length(t,n){return new Js({...this._def,exactLength:{value:t,message:Je.toString(n)}})}nonempty(t){return this.min(1,t)}}Js.create=(e,t)=>new Js({type:e,minLength:null,maxLength:null,exactLength:null,typeName:dt.ZodArray,...bt(t)});function mc(e){if(e instanceof un){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Oi.create(mc(r))}return new un({...e._def,shape:()=>t})}else return e instanceof Js?new Js({...e._def,type:mc(e.element)}):e instanceof Oi?Oi.create(mc(e.unwrap())):e instanceof Io?Io.create(mc(e.unwrap())):e instanceof Ri?Ri.create(e.items.map(t=>mc(t))):e}class un extends Pt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Mt.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==We.object){const u=this._getOrReturnCtx(t);return Ve(u,{code:Oe.invalid_type,expected:We.object,received:u.parsedType}),ht}const{status:r,ctx:s}=this._processInputParams(t),{shape:i,keys:o}=this._getCached(),l=[];if(!(this._def.catchall instanceof _a&&this._def.unknownKeys==="strip"))for(const u in s.data)o.includes(u)||l.push(u);const c=[];for(const u of o){const d=i[u],f=s.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new Mi(s,f,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof _a){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of l)c.push({key:{status:"valid",value:d},value:{status:"valid",value:s.data[d]}});else if(u==="strict")l.length>0&&(Ve(s,{code:Oe.unrecognized_keys,keys:l}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of l){const f=s.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new Mi(s,f,s.path,d)),alwaysSet:d in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of c){const f=await d.key,h=await d.value;u.push({key:f,value:h,alwaysSet:d.alwaysSet})}return u}).then(u=>br.mergeObjectSync(r,u)):br.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(t){return Je.errToObj,new un({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var s,i,o,l;const c=(o=(i=(s=this._def).errorMap)===null||i===void 0?void 0:i.call(s,n,r).message)!==null&&o!==void 0?o:r.defaultError;return n.code==="unrecognized_keys"?{message:(l=Je.errToObj(t).message)!==null&&l!==void 0?l:c}:{message:c}}}:{}})}strip(){return new un({...this._def,unknownKeys:"strip"})}passthrough(){return new un({...this._def,unknownKeys:"passthrough"})}extend(t){return new un({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new un({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:dt.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new un({...this._def,catchall:t})}pick(t){const n={};return Mt.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new un({...this._def,shape:()=>n})}omit(t){const n={};return Mt.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new un({...this._def,shape:()=>n})}deepPartial(){return mc(this)}partial(t){const n={};return Mt.objectKeys(this.shape).forEach(r=>{const s=this.shape[r];t&&!t[r]?n[r]=s:n[r]=s.optional()}),new un({...this._def,shape:()=>n})}required(t){const n={};return Mt.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Oi;)i=i._def.innerType;n[r]=i}}),new un({...this._def,shape:()=>n})}keyof(){return kD(Mt.objectKeys(this.shape))}}un.create=(e,t)=>new un({shape:()=>e,unknownKeys:"strip",catchall:_a.create(),typeName:dt.ZodObject,...bt(t)});un.strictCreate=(e,t)=>new un({shape:()=>e,unknownKeys:"strict",catchall:_a.create(),typeName:dt.ZodObject,...bt(t)});un.lazycreate=(e,t)=>new un({shape:e,unknownKeys:"strip",catchall:_a.create(),typeName:dt.ZodObject,...bt(t)});class uh extends Pt{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function s(i){for(const l of i)if(l.result.status==="valid")return l.result;for(const l of i)if(l.result.status==="dirty")return n.common.issues.push(...l.ctx.common.issues),l.result;const o=i.map(l=>new os(l.ctx.common.issues));return Ve(n,{code:Oe.invalid_union,unionErrors:o}),ht}if(n.common.async)return Promise.all(r.map(async i=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let i;const o=[];for(const c of r){const u={...n,common:{...n.common,issues:[]},parent:null},d=c._parseSync({data:n.data,path:n.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const l=o.map(c=>new os(c));return Ve(n,{code:Oe.invalid_union,unionErrors:l}),ht}}get options(){return this._def.options}}uh.create=(e,t)=>new uh({options:e,typeName:dt.ZodUnion,...bt(t)});const qi=e=>e instanceof hh?qi(e.schema):e instanceof ai?qi(e.innerType()):e instanceof ph?[e.value]:e instanceof $o?e.options:e instanceof mh?Mt.objectValues(e.enum):e instanceof gh?qi(e._def.innerType):e instanceof lh?[void 0]:e instanceof ch?[null]:e instanceof Oi?[void 0,...qi(e.unwrap())]:e instanceof Io?[null,...qi(e.unwrap())]:e instanceof HN||e instanceof yh?qi(e.unwrap()):e instanceof vh?qi(e._def.innerType):[];class rx extends Pt{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==We.object)return Ve(n,{code:Oe.invalid_type,expected:We.object,received:n.parsedType}),ht;const r=this.discriminator,s=n.data[r],i=this.optionsMap.get(s);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(Ve(n,{code:Oe.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),ht)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const s=new Map;for(const i of n){const o=qi(i.shape[t]);if(!o.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const l of o){if(s.has(l))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(l)}`);s.set(l,i)}}return new rx({typeName:dt.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:s,...bt(r)})}}function d1(e,t){const n=Qa(e),r=Qa(t);if(e===t)return{valid:!0,data:e};if(n===We.object&&r===We.object){const s=Mt.objectKeys(t),i=Mt.objectKeys(e).filter(l=>s.indexOf(l)!==-1),o={...e,...t};for(const l of i){const c=d1(e[l],t[l]);if(!c.valid)return{valid:!1};o[l]=c.data}return{valid:!0,data:o}}else if(n===We.array&&r===We.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let i=0;i{if(c1(i)||c1(o))return ht;const l=d1(i.value,o.value);return l.valid?((u1(i)||u1(o))&&n.dirty(),{status:n.value,value:l.data}):(Ve(r,{code:Oe.invalid_intersection_types}),ht)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}dh.create=(e,t,n)=>new dh({left:e,right:t,typeName:dt.ZodIntersection,...bt(n)});class Ri extends Pt{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==We.array)return Ve(r,{code:Oe.invalid_type,expected:We.array,received:r.parsedType}),ht;if(r.data.lengththis._def.items.length&&(Ve(r,{code:Oe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((o,l)=>{const c=this._def.items[l]||this._def.rest;return c?c._parse(new Mi(r,o,r.path,l)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>br.mergeArray(n,o)):br.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new Ri({...this._def,rest:t})}}Ri.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ri({items:e,typeName:dt.ZodTuple,rest:null,...bt(t)})};class fh extends Pt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==We.object)return Ve(r,{code:Oe.invalid_type,expected:We.object,received:r.parsedType}),ht;const s=[],i=this._def.keyType,o=this._def.valueType;for(const l in r.data)s.push({key:i._parse(new Mi(r,l,r.path,l)),value:o._parse(new Mi(r,r.data[l],r.path,l)),alwaysSet:l in r.data});return r.common.async?br.mergeObjectAsync(n,s):br.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Pt?new fh({keyType:t,valueType:n,typeName:dt.ZodRecord,...bt(r)}):new fh({keyType:Ys.create(),valueType:t,typeName:dt.ZodRecord,...bt(n)})}}class Yg extends Pt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==We.map)return Ve(r,{code:Oe.invalid_type,expected:We.map,received:r.parsedType}),ht;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([l,c],u)=>({key:s._parse(new Mi(r,l,r.path,[u,"key"])),value:i._parse(new Mi(r,c,r.path,[u,"value"]))}));if(r.common.async){const l=new Map;return Promise.resolve().then(async()=>{for(const c of o){const u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return ht;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),l.set(u.value,d.value)}return{status:n.value,value:l}})}else{const l=new Map;for(const c of o){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return ht;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),l.set(u.value,d.value)}return{status:n.value,value:l}}}}Yg.create=(e,t,n)=>new Yg({valueType:t,keyType:e,typeName:dt.ZodMap,...bt(n)});class Bl extends Pt{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==We.set)return Ve(r,{code:Oe.invalid_type,expected:We.set,received:r.parsedType}),ht;const s=this._def;s.minSize!==null&&r.data.sizes.maxSize.value&&(Ve(r,{code:Oe.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const i=this._def.valueType;function o(c){const u=new Set;for(const d of c){if(d.status==="aborted")return ht;d.status==="dirty"&&n.dirty(),u.add(d.value)}return{status:n.value,value:u}}const l=[...r.data.values()].map((c,u)=>i._parse(new Mi(r,c,r.path,u)));return r.common.async?Promise.all(l).then(c=>o(c)):o(l)}min(t,n){return new Bl({...this._def,minSize:{value:t,message:Je.toString(n)}})}max(t,n){return new Bl({...this._def,maxSize:{value:t,message:Je.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Bl.create=(e,t)=>new Bl({valueType:e,minSize:null,maxSize:null,typeName:dt.ZodSet,...bt(t)});class Uc extends Pt{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==We.function)return Ve(n,{code:Oe.invalid_type,expected:We.function,received:n.parsedType}),ht;function r(l,c){return Gg({data:l,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Hg(),pu].filter(u=>!!u),issueData:{code:Oe.invalid_arguments,argumentsError:c}})}function s(l,c){return Gg({data:l,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Hg(),pu].filter(u=>!!u),issueData:{code:Oe.invalid_return_type,returnTypeError:c}})}const i={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof gu){const l=this;return kr(async function(...c){const u=new os([]),d=await l._def.args.parseAsync(c,i).catch(p=>{throw u.addIssue(r(c,p)),u}),f=await Reflect.apply(o,this,d);return await l._def.returns._def.type.parseAsync(f,i).catch(p=>{throw u.addIssue(s(f,p)),u})})}else{const l=this;return kr(function(...c){const u=l._def.args.safeParse(c,i);if(!u.success)throw new os([r(c,u.error)]);const d=Reflect.apply(o,this,u.data),f=l._def.returns.safeParse(d,i);if(!f.success)throw new os([s(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new Uc({...this._def,args:Ri.create(t).rest(Pl.create())})}returns(t){return new Uc({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new Uc({args:t||Ri.create([]).rest(Pl.create()),returns:n||Pl.create(),typeName:dt.ZodFunction,...bt(r)})}}class hh extends Pt{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}hh.create=(e,t)=>new hh({getter:e,typeName:dt.ZodLazy,...bt(t)});class ph extends Pt{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return Ve(n,{received:n.data,code:Oe.invalid_literal,expected:this._def.value}),ht}return{status:"valid",value:t.data}}get value(){return this._def.value}}ph.create=(e,t)=>new ph({value:e,typeName:dt.ZodLiteral,...bt(t)});function kD(e,t){return new $o({values:e,typeName:dt.ZodEnum,...bt(t)})}class $o extends Pt{constructor(){super(...arguments),sf.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return Ve(n,{expected:Mt.joinValues(r),received:n.parsedType,code:Oe.invalid_type}),ht}if(qg(this,sf)||CD(this,sf,new Set(this._def.values)),!qg(this,sf).has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return Ve(n,{received:n.data,code:Oe.invalid_enum_value,options:r}),ht}return kr(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return $o.create(t,{...this._def,...n})}exclude(t,n=this._def){return $o.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}sf=new WeakMap;$o.create=kD;class mh extends Pt{constructor(){super(...arguments),af.set(this,void 0)}_parse(t){const n=Mt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==We.string&&r.parsedType!==We.number){const s=Mt.objectValues(n);return Ve(r,{expected:Mt.joinValues(s),received:r.parsedType,code:Oe.invalid_type}),ht}if(qg(this,af)||CD(this,af,new Set(Mt.getValidEnumValues(this._def.values))),!qg(this,af).has(t.data)){const s=Mt.objectValues(n);return Ve(r,{received:r.data,code:Oe.invalid_enum_value,options:s}),ht}return kr(t.data)}get enum(){return this._def.values}}af=new WeakMap;mh.create=(e,t)=>new mh({values:e,typeName:dt.ZodNativeEnum,...bt(t)});class gu extends Pt{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==We.promise&&n.common.async===!1)return Ve(n,{code:Oe.invalid_type,expected:We.promise,received:n.parsedType}),ht;const r=n.parsedType===We.promise?n.data:Promise.resolve(n.data);return kr(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}gu.create=(e,t)=>new gu({type:e,typeName:dt.ZodPromise,...bt(t)});class ai extends Pt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===dt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=this._def.effect||null,i={addIssue:o=>{Ve(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async l=>{if(n.value==="aborted")return ht;const c=await this._def.schema._parseAsync({data:l,path:r.path,parent:r});return c.status==="aborted"?ht:c.status==="dirty"||n.value==="dirty"?Ac(c.value):c});{if(n.value==="aborted")return ht;const l=this._def.schema._parseSync({data:o,path:r.path,parent:r});return l.status==="aborted"?ht:l.status==="dirty"||n.value==="dirty"?Ac(l.value):l}}if(s.type==="refinement"){const o=l=>{const c=s.refinement(l,i);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(r.common.async===!1){const l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return l.status==="aborted"?ht:(l.status==="dirty"&&n.dirty(),o(l.value),{status:n.value,value:l.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>l.status==="aborted"?ht:(l.status==="dirty"&&n.dirty(),o(l.value).then(()=>({status:n.value,value:l.value}))))}if(s.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!ih(o))return o;const l=s.transform(o.value,i);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:l}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>ih(o)?Promise.resolve(s.transform(o.value,i)).then(l=>({status:n.value,value:l})):o);Mt.assertNever(s)}}ai.create=(e,t,n)=>new ai({schema:e,typeName:dt.ZodEffects,effect:t,...bt(n)});ai.createWithPreprocess=(e,t,n)=>new ai({schema:t,effect:{type:"preprocess",transform:e},typeName:dt.ZodEffects,...bt(n)});class Oi extends Pt{_parse(t){return this._getType(t)===We.undefined?kr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Oi.create=(e,t)=>new Oi({innerType:e,typeName:dt.ZodOptional,...bt(t)});class Io extends Pt{_parse(t){return this._getType(t)===We.null?kr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Io.create=(e,t)=>new Io({innerType:e,typeName:dt.ZodNullable,...bt(t)});class gh extends Pt{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===We.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}gh.create=(e,t)=>new gh({innerType:e,typeName:dt.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...bt(t)});class vh extends Pt{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ah(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new os(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new os(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}vh.create=(e,t)=>new vh({innerType:e,typeName:dt.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...bt(t)});class Zg extends Pt{_parse(t){if(this._getType(t)!==We.nan){const r=this._getOrReturnCtx(t);return Ve(r,{code:Oe.invalid_type,expected:We.nan,received:r.parsedType}),ht}return{status:"valid",value:t.data}}}Zg.create=e=>new Zg({typeName:dt.ZodNaN,...bt(e)});const hX=Symbol("zod_brand");class HN extends Pt{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class _p extends Pt{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?ht:i.status==="dirty"?(n.dirty(),Ac(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?ht:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(t,n){return new _p({in:t,out:n,typeName:dt.ZodPipeline})}}class yh extends Pt{_parse(t){const n=this._def.innerType._parse(t),r=s=>(ih(s)&&(s.value=Object.freeze(s.value)),s);return ah(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}yh.create=(e,t)=>new yh({innerType:e,typeName:dt.ZodReadonly,...bt(t)});function TD(e,t={},n){return e?mu.create().superRefine((r,s)=>{var i,o;if(!e(r)){const l=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,c=(o=(i=l.fatal)!==null&&i!==void 0?i:n)!==null&&o!==void 0?o:!0,u=typeof l=="string"?{message:l}:l;s.addIssue({code:"custom",...u,fatal:c})}}):mu.create()}const pX={object:un.lazycreate};var dt;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(dt||(dt={}));const mX=(e,t={message:`Input not instance of ${e.name}`})=>TD(n=>n instanceof e,t),$D=Ys.create,ID=ko.create,gX=Zg.create,vX=To.create,MD=oh.create,yX=Fl.create,xX=Kg.create,bX=lh.create,wX=ch.create,jX=mu.create,SX=Pl.create,NX=_a.create,_X=Xg.create,PX=Js.create,CX=un.create,AX=un.strictCreate,EX=uh.create,OX=rx.create,kX=dh.create,TX=Ri.create,$X=fh.create,IX=Yg.create,MX=Bl.create,RX=Uc.create,DX=hh.create,LX=ph.create,FX=$o.create,BX=mh.create,zX=gu.create,SE=ai.create,UX=Oi.create,VX=Io.create,WX=ai.createWithPreprocess,HX=_p.create,GX=()=>$D().optional(),qX=()=>ID().optional(),KX=()=>MD().optional(),XX={string:e=>Ys.create({...e,coerce:!0}),number:e=>ko.create({...e,coerce:!0}),boolean:e=>oh.create({...e,coerce:!0}),bigint:e=>To.create({...e,coerce:!0}),date:e=>Fl.create({...e,coerce:!0})},YX=ht;var Re=Object.freeze({__proto__:null,defaultErrorMap:pu,setErrorMap:YK,getErrorMap:Hg,makeIssue:Gg,EMPTY_PATH:ZK,addIssueToContext:Ve,ParseStatus:br,INVALID:ht,DIRTY:Ac,OK:kr,isAborted:c1,isDirty:u1,isValid:ih,isAsync:ah,get util(){return Mt},get objectUtil(){return l1},ZodParsedType:We,getParsedType:Qa,ZodType:Pt,datetimeRegex:OD,ZodString:Ys,ZodNumber:ko,ZodBigInt:To,ZodBoolean:oh,ZodDate:Fl,ZodSymbol:Kg,ZodUndefined:lh,ZodNull:ch,ZodAny:mu,ZodUnknown:Pl,ZodNever:_a,ZodVoid:Xg,ZodArray:Js,ZodObject:un,ZodUnion:uh,ZodDiscriminatedUnion:rx,ZodIntersection:dh,ZodTuple:Ri,ZodRecord:fh,ZodMap:Yg,ZodSet:Bl,ZodFunction:Uc,ZodLazy:hh,ZodLiteral:ph,ZodEnum:$o,ZodNativeEnum:mh,ZodPromise:gu,ZodEffects:ai,ZodTransformer:ai,ZodOptional:Oi,ZodNullable:Io,ZodDefault:gh,ZodCatch:vh,ZodNaN:Zg,BRAND:hX,ZodBranded:HN,ZodPipeline:_p,ZodReadonly:yh,custom:TD,Schema:Pt,ZodSchema:Pt,late:pX,get ZodFirstPartyTypeKind(){return dt},coerce:XX,any:jX,array:PX,bigint:vX,boolean:MD,date:yX,discriminatedUnion:OX,effect:SE,enum:FX,function:RX,instanceof:mX,intersection:kX,lazy:DX,literal:LX,map:IX,nan:gX,nativeEnum:BX,never:NX,null:wX,nullable:VX,number:ID,object:CX,oboolean:KX,onumber:qX,optional:UX,ostring:GX,pipeline:HX,preprocess:WX,promise:zX,record:$X,set:MX,strictObject:AX,string:$D,symbol:xX,transformer:SE,tuple:TX,undefined:bX,union:EX,unknown:SX,void:_X,NEVER:YX,ZodIssueCode:Oe,quotelessJson:XK,ZodError:os}),ZX="Label",RD=v.forwardRef((e,t)=>a.jsx(Xe.label,{...e,ref:t,onMouseDown:n=>{var s;n.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));RD.displayName=ZX;var DD=RD;const QX=RN("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),ji=v.forwardRef(({className:e,...t},n)=>a.jsx(DD,{ref:n,className:Me(QX(),e),...t}));ji.displayName=DD.displayName;const sx=OK,LD=v.createContext({}),ot=({...e})=>a.jsx(LD.Provider,{value:{name:e.name},children:a.jsx(IK,{...e})}),ix=()=>{const e=v.useContext(LD),t=v.useContext(FD),{getFieldState:n,formState:r}=ex(),s=n(e.name,r);if(!e)throw new Error("useFormField should be used within ");const{id:i}=t;return{id:i,name:e.name,formItemId:`${i}-form-item`,formDescriptionId:`${i}-form-item-description`,formMessageId:`${i}-form-item-message`,...s}},FD=v.createContext({}),nt=v.forwardRef(({className:e,...t},n)=>{const r=v.useId();return a.jsx(FD.Provider,{value:{id:r},children:a.jsx("div",{ref:n,className:Me("space-y-2",e),...t})})});nt.displayName="FormItem";const rt=v.forwardRef(({className:e,...t},n)=>{const{error:r,formItemId:s}=ix();return a.jsx(ji,{ref:n,className:Me(r&&"text-destructive",e),htmlFor:s,...t})});rt.displayName="FormLabel";const st=v.forwardRef(({...e},t)=>{const{error:n,formItemId:r,formDescriptionId:s,formMessageId:i}=ix();return a.jsx(xa,{ref:t,id:r,"aria-describedby":n?`${s} ${i}`:`${s}`,"aria-invalid":!!n,...e})});st.displayName="FormControl";const on=v.forwardRef(({className:e,...t},n)=>{const{formDescriptionId:r}=ix();return a.jsx("p",{ref:n,id:r,className:Me("text-sm text-muted-foreground",e),...t})});on.displayName="FormDescription";const it=v.forwardRef(({className:e,children:t,...n},r)=>{const{error:s,formMessageId:i}=ix(),o=s?String(s==null?void 0:s.message):t;return o?a.jsx("p",{ref:r,id:i,className:Me("text-sm font-medium text-destructive",e),...n,children:o}):null});it.displayName="FormMessage";const _t=v.forwardRef(({className:e,type:t,...n},r)=>a.jsx("input",{type:t,className:Me("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...n}));_t.displayName="Input";const et=v.forwardRef(({className:e,...t},n)=>a.jsx("textarea",{className:Me("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));et.displayName="Textarea";function xh(e,[t,n]){return Math.min(n,Math.max(t,e))}function JX(e,t=[]){let n=[];function r(i,o){const l=v.createContext(o),c=n.length;n=[...n,o];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[e][c])||l,x=v.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:x,children:p})}function d(f,h){const p=(h==null?void 0:h[e][c])||l,g=v.useContext(p);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${i}\``)}return u.displayName=i+"Provider",[u,d]}const s=()=>{const i=n.map(o=>v.createContext(o));return function(l){const c=(l==null?void 0:l[e])||i;return v.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[r,eY(s,...t)]}function eY(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(i)[`__scope${u}`];return{...l,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}function Pp(e){const t=e+"CollectionProvider",[n,r]=JX(t),[s,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=p=>{const{scope:g,children:m}=p,x=C.useRef(null),b=C.useRef(new Map).current;return a.jsx(s,{scope:g,itemMap:b,collectionRef:x,children:m})};o.displayName=t;const l=e+"CollectionSlot",c=C.forwardRef((p,g)=>{const{scope:m,children:x}=p,b=i(l,m),y=pt(g,b.collectionRef);return a.jsx(xa,{ref:y,children:x})});c.displayName=l;const u=e+"CollectionItemSlot",d="data-radix-collection-item",f=C.forwardRef((p,g)=>{const{scope:m,children:x,...b}=p,y=C.useRef(null),w=pt(g,y),j=i(u,m);return C.useEffect(()=>(j.itemMap.set(y,{ref:y,...b}),()=>void j.itemMap.delete(y))),a.jsx(xa,{[d]:"",ref:w,children:x})});f.displayName=u;function h(p){const g=i(e+"CollectionConsumer",p);return C.useCallback(()=>{const x=g.collectionRef.current;if(!x)return[];const b=Array.from(x.querySelectorAll(`[${d}]`));return Array.from(g.itemMap.values()).sort((j,S)=>b.indexOf(j.ref.current)-b.indexOf(S.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:o,Slot:c,ItemSlot:f},h,r]}var tY=v.createContext(void 0);function Uo(e){const t=v.useContext(tY);return e||t||"ltr"}var tb=0;function GN(){v.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??NE()),document.body.insertAdjacentElement("beforeend",e[1]??NE()),tb++,()=>{tb===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),tb--}},[])}function NE(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var nb="focusScope.autoFocusOnMount",rb="focusScope.autoFocusOnUnmount",_E={bubbles:!1,cancelable:!0},nY="FocusScope",ax=v.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...o}=e,[l,c]=v.useState(null),u=Vn(s),d=Vn(i),f=v.useRef(null),h=pt(t,m=>c(m)),p=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let m=function(w){if(p.paused||!l)return;const j=w.target;l.contains(j)?f.current=j:Va(f.current,{select:!0})},x=function(w){if(p.paused||!l)return;const j=w.relatedTarget;j!==null&&(l.contains(j)||Va(f.current,{select:!0}))},b=function(w){if(document.activeElement===document.body)for(const S of w)S.removedNodes.length>0&&Va(l)};document.addEventListener("focusin",m),document.addEventListener("focusout",x);const y=new MutationObserver(b);return l&&y.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",x),y.disconnect()}}},[r,l,p.paused]),v.useEffect(()=>{if(l){CE.add(p);const m=document.activeElement;if(!l.contains(m)){const b=new CustomEvent(nb,_E);l.addEventListener(nb,u),l.dispatchEvent(b),b.defaultPrevented||(rY(lY(BD(l)),{select:!0}),document.activeElement===m&&Va(l))}return()=>{l.removeEventListener(nb,u),setTimeout(()=>{const b=new CustomEvent(rb,_E);l.addEventListener(rb,d),l.dispatchEvent(b),b.defaultPrevented||Va(m??document.body,{select:!0}),l.removeEventListener(rb,d),CE.remove(p)},0)}}},[l,u,d,p]);const g=v.useCallback(m=>{if(!n&&!r||p.paused)return;const x=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,b=document.activeElement;if(x&&b){const y=m.currentTarget,[w,j]=sY(y);w&&j?!m.shiftKey&&b===j?(m.preventDefault(),n&&Va(w,{select:!0})):m.shiftKey&&b===w&&(m.preventDefault(),n&&Va(j,{select:!0})):b===y&&m.preventDefault()}},[n,r,p.paused]);return a.jsx(Xe.div,{tabIndex:-1,...o,ref:h,onKeyDown:g})});ax.displayName=nY;function rY(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Va(r,{select:t}),document.activeElement!==n)return}function sY(e){const t=BD(e),n=PE(t,e),r=PE(t.reverse(),e);return[n,r]}function BD(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function PE(e,t){for(const n of e)if(!iY(n,{upTo:t}))return n}function iY(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function aY(e){return e instanceof HTMLInputElement&&"select"in e}function Va(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&aY(e)&&t&&e.select()}}var CE=oY();function oY(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=AE(e,t),e.unshift(t)},remove(t){var n;e=AE(e,t),(n=e[0])==null||n.resume()}}}function AE(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function lY(e){return e.filter(t=>t.tagName!=="A")}function Cp(e){const t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var cY=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},lc=new WeakMap,gm=new WeakMap,vm={},sb=0,zD=function(e){return e&&(e.host||zD(e.parentNode))},uY=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=zD(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},dY=function(e,t,n,r){var s=uY(t,Array.isArray(e)?e:[e]);vm[n]||(vm[n]=new WeakMap);var i=vm[n],o=[],l=new Set,c=new Set(s),u=function(f){!f||l.has(f)||(l.add(f),u(f.parentNode))};s.forEach(u);var d=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(h){if(l.has(h))d(h);else try{var p=h.getAttribute(r),g=p!==null&&p!=="false",m=(lc.get(h)||0)+1,x=(i.get(h)||0)+1;lc.set(h,m),i.set(h,x),o.push(h),m===1&&g&&gm.set(h,!0),x===1&&h.setAttribute(n,"true"),g||h.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",h,b)}})};return d(t),l.clear(),sb++,function(){o.forEach(function(f){var h=lc.get(f)-1,p=i.get(f)-1;lc.set(f,h),i.set(f,p),h||(gm.has(f)||f.removeAttribute(r),gm.delete(f)),p||f.removeAttribute(n)}),sb--,sb||(lc=new WeakMap,lc=new WeakMap,gm=new WeakMap,vm={})}},qN=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=cY(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live]"))),dY(r,s,n,"aria-hidden")):function(){return null}},Si=function(){return Si=Object.assign||function(t){for(var n,r=1,s=arguments.length;r"u")return AY;var t=EY(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},kY=HD(),Vc="data-scroll-locked",TY=function(e,t,n,r){var s=e.left,i=e.top,o=e.right,l=e.gap;return n===void 0&&(n="margin"),` + .`.concat(hY,` { + overflow: hidden `).concat(r,`; + padding-right: `).concat(l,"px ").concat(r,`; + } + body[`).concat(Vc,`] { + overflow: hidden `).concat(r,`; + overscroll-behavior: contain; + `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&` + padding-left: `.concat(s,`px; + padding-top: `).concat(i,`px; + padding-right: `).concat(o,`px; + margin-left:0; + margin-top:0; + margin-right: `).concat(l,"px ").concat(r,`; + `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),` + } + + .`).concat(Jm,` { + right: `).concat(l,"px ").concat(r,`; + } + + .`).concat(eg,` { + margin-right: `).concat(l,"px ").concat(r,`; + } + + .`).concat(Jm," .").concat(Jm,` { + right: 0 `).concat(r,`; + } + + .`).concat(eg," .").concat(eg,` { + margin-right: 0 `).concat(r,`; + } + + body[`).concat(Vc,`] { + `).concat(pY,": ").concat(l,`px; + } +`)},OE=function(){var e=parseInt(document.body.getAttribute(Vc)||"0",10);return isFinite(e)?e:0},$Y=function(){v.useEffect(function(){return document.body.setAttribute(Vc,(OE()+1).toString()),function(){var e=OE()-1;e<=0?document.body.removeAttribute(Vc):document.body.setAttribute(Vc,e.toString())}},[])},IY=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;$Y();var i=v.useMemo(function(){return OY(s)},[s]);return v.createElement(kY,{styles:TY(i,!t,s,n?"":"!important")})},f1=!1;if(typeof window<"u")try{var ym=Object.defineProperty({},"passive",{get:function(){return f1=!0,!0}});window.addEventListener("test",ym,ym),window.removeEventListener("test",ym,ym)}catch{f1=!1}var cc=f1?{passive:!1}:!1,MY=function(e){return e.tagName==="TEXTAREA"},GD=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!MY(e)&&n[t]==="visible")},RY=function(e){return GD(e,"overflowY")},DY=function(e){return GD(e,"overflowX")},kE=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=qD(e,r);if(s){var i=KD(e,r),o=i[1],l=i[2];if(o>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},LY=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},FY=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},qD=function(e,t){return e==="v"?RY(t):DY(t)},KD=function(e,t){return e==="v"?LY(t):FY(t)},BY=function(e,t){return e==="h"&&t==="rtl"?-1:1},zY=function(e,t,n,r,s){var i=BY(e,window.getComputedStyle(t).direction),o=i*r,l=n.target,c=t.contains(l),u=!1,d=o>0,f=0,h=0;do{var p=KD(e,l),g=p[0],m=p[1],x=p[2],b=m-x-i*g;(g||b)&&qD(e,l)&&(f+=b,h+=g),l instanceof ShadowRoot?l=l.host:l=l.parentNode}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&(Math.abs(f)<1||!s)||!d&&(Math.abs(h)<1||!s))&&(u=!0),u},xm=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},TE=function(e){return[e.deltaX,e.deltaY]},$E=function(e){return e&&"current"in e?e.current:e},UY=function(e,t){return e[0]===t[0]&&e[1]===t[1]},VY=function(e){return` + .block-interactivity-`.concat(e,` {pointer-events: none;} + .allow-interactivity-`).concat(e,` {pointer-events: all;} +`)},WY=0,uc=[];function HY(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),s=v.useState(WY++)[0],i=v.useState(HD)[0],o=v.useRef(e);v.useEffect(function(){o.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var m=fY([e.lockRef.current],(e.shards||[]).map($E),!0).filter(Boolean);return m.forEach(function(x){return x.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),m.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var l=v.useCallback(function(m,x){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!o.current.allowPinchZoom;var b=xm(m),y=n.current,w="deltaX"in m?m.deltaX:y[0]-b[0],j="deltaY"in m?m.deltaY:y[1]-b[1],S,N=m.target,P=Math.abs(w)>Math.abs(j)?"h":"v";if("touches"in m&&P==="h"&&N.type==="range")return!1;var _=kE(P,N);if(!_)return!0;if(_?S=P:(S=P==="v"?"h":"v",_=kE(P,N)),!_)return!1;if(!r.current&&"changedTouches"in m&&(w||j)&&(r.current=S),!S)return!0;var A=r.current||S;return zY(A,x,m,A==="h"?w:j,!0)},[]),c=v.useCallback(function(m){var x=m;if(!(!uc.length||uc[uc.length-1]!==i)){var b="deltaY"in x?TE(x):xm(x),y=t.current.filter(function(S){return S.name===x.type&&(S.target===x.target||x.target===S.shadowParent)&&UY(S.delta,b)})[0];if(y&&y.should){x.cancelable&&x.preventDefault();return}if(!y){var w=(o.current.shards||[]).map($E).filter(Boolean).filter(function(S){return S.contains(x.target)}),j=w.length>0?l(x,w[0]):!o.current.noIsolation;j&&x.cancelable&&x.preventDefault()}}},[]),u=v.useCallback(function(m,x,b,y){var w={name:m,delta:x,target:b,should:y,shadowParent:GY(b)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(j){return j!==w})},1)},[]),d=v.useCallback(function(m){n.current=xm(m),r.current=void 0},[]),f=v.useCallback(function(m){u(m.type,TE(m),m.target,l(m,e.lockRef.current))},[]),h=v.useCallback(function(m){u(m.type,xm(m),m.target,l(m,e.lockRef.current))},[]);v.useEffect(function(){return uc.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,cc),document.addEventListener("touchmove",c,cc),document.addEventListener("touchstart",d,cc),function(){uc=uc.filter(function(m){return m!==i}),document.removeEventListener("wheel",c,cc),document.removeEventListener("touchmove",c,cc),document.removeEventListener("touchstart",d,cc)}},[]);var p=e.removeScrollBar,g=e.inert;return v.createElement(v.Fragment,null,g?v.createElement(i,{styles:VY(s)}):null,p?v.createElement(IY,{gapMode:e.gapMode}):null)}function GY(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const qY=wY(WD,HY);var lx=v.forwardRef(function(e,t){return v.createElement(ox,Si({},e,{ref:t,sideCar:qY}))});lx.classNames=ox.classNames;var KY=[" ","Enter","ArrowUp","ArrowDown"],XY=[" ","Enter"],Ap="Select",[cx,ux,YY]=Pp(Ap),[rd,_Oe]=Ir(Ap,[YY,Yu]),dx=Yu(),[ZY,Vo]=rd(Ap),[QY,JY]=rd(Ap),XD=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:i,value:o,defaultValue:l,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:h,required:p,form:g}=e,m=dx(t),[x,b]=v.useState(null),[y,w]=v.useState(null),[j,S]=v.useState(!1),N=Uo(u),[P=!1,_]=us({prop:r,defaultProp:s,onChange:i}),[A,O]=us({prop:o,defaultProp:l,onChange:c}),T=v.useRef(null),k=x?g||!!x.closest("form"):!0,[M,R]=v.useState(new Set),H=Array.from(M).map(F=>F.props.value).join(";");return a.jsx(qM,{...m,children:a.jsxs(ZY,{required:p,scope:t,trigger:x,onTriggerChange:b,valueNode:y,onValueNodeChange:w,valueNodeHasChildren:j,onValueNodeHasChildrenChange:S,contentId:Cs(),value:A,onValueChange:O,open:P,onOpenChange:_,dir:N,triggerPointerDownPosRef:T,disabled:h,children:[a.jsx(cx.Provider,{scope:t,children:a.jsx(QY,{scope:e.__scopeSelect,onNativeOptionAdd:v.useCallback(F=>{R(V=>new Set(V).add(F))},[]),onNativeOptionRemove:v.useCallback(F=>{R(V=>{const $=new Set(V);return $.delete(F),$})},[]),children:n})}),k?a.jsxs(b4,{"aria-hidden":!0,required:p,tabIndex:-1,name:d,autoComplete:f,value:A,onChange:F=>O(F.target.value),disabled:h,form:g,children:[A===void 0?a.jsx("option",{value:""}):null,Array.from(M)]},H):null]})})};XD.displayName=Ap;var YD="SelectTrigger",ZD=v.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,i=dx(n),o=Vo(YD,n),l=o.disabled||r,c=pt(t,o.onTriggerChange),u=ux(n),d=v.useRef("touch"),[f,h,p]=w4(m=>{const x=u().filter(w=>!w.disabled),b=x.find(w=>w.value===o.value),y=j4(x,m,b);y!==void 0&&o.onValueChange(y.value)}),g=m=>{l||(o.onOpenChange(!0),p()),m&&(o.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return a.jsx(pN,{asChild:!0,...i,children:a.jsx(Xe.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":x4(o.value)?"":void 0,...s,ref:c,onClick:$e(s.onClick,m=>{m.currentTarget.focus(),d.current!=="mouse"&&g(m)}),onPointerDown:$e(s.onPointerDown,m=>{d.current=m.pointerType;const x=m.target;x.hasPointerCapture(m.pointerId)&&x.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(g(m),m.preventDefault())}),onKeyDown:$e(s.onKeyDown,m=>{const x=f.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&h(m.key),!(x&&m.key===" ")&&KY.includes(m.key)&&(g(),m.preventDefault())})})})});ZD.displayName=YD;var QD="SelectValue",JD=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:i,placeholder:o="",...l}=e,c=Vo(QD,n),{onValueNodeHasChildrenChange:u}=c,d=i!==void 0,f=pt(t,c.onValueNodeChange);return or(()=>{u(d)},[u,d]),a.jsx(Xe.span,{...l,ref:f,style:{pointerEvents:"none"},children:x4(c.value)?a.jsx(a.Fragment,{children:o}):i})});JD.displayName=QD;var eZ="SelectIcon",e4=v.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return a.jsx(Xe.span,{"aria-hidden":!0,...s,ref:t,children:r||"โ–ผ"})});e4.displayName=eZ;var tZ="SelectPortal",t4=e=>a.jsx(By,{asChild:!0,...e});t4.displayName=tZ;var zl="SelectContent",n4=v.forwardRef((e,t)=>{const n=Vo(zl,e.__scopeSelect),[r,s]=v.useState();if(or(()=>{s(new DocumentFragment)},[]),!n.open){const i=r;return i?Xs.createPortal(a.jsx(r4,{scope:e.__scopeSelect,children:a.jsx(cx.Slot,{scope:e.__scopeSelect,children:a.jsx("div",{children:e.children})})}),i):null}return a.jsx(s4,{...e,ref:t})});n4.displayName=zl;var Fs=10,[r4,Wo]=rd(zl),nZ="SelectContentImpl",s4=v.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:o,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:g,hideWhenDetached:m,avoidCollisions:x,...b}=e,y=Vo(zl,n),[w,j]=v.useState(null),[S,N]=v.useState(null),P=pt(t,ue=>j(ue)),[_,A]=v.useState(null),[O,T]=v.useState(null),k=ux(n),[M,R]=v.useState(!1),H=v.useRef(!1);v.useEffect(()=>{if(w)return qN(w)},[w]),GN();const F=v.useCallback(ue=>{const[Ae,...de]=k().map(te=>te.ref.current),[oe]=de.slice(-1),xe=document.activeElement;for(const te of ue)if(te===xe||(te==null||te.scrollIntoView({block:"nearest"}),te===Ae&&S&&(S.scrollTop=0),te===oe&&S&&(S.scrollTop=S.scrollHeight),te==null||te.focus(),document.activeElement!==xe))return},[k,S]),V=v.useCallback(()=>F([_,w]),[F,_,w]);v.useEffect(()=>{M&&V()},[M,V]);const{onOpenChange:$,triggerPointerDownPosRef:L}=y;v.useEffect(()=>{if(w){let ue={x:0,y:0};const Ae=oe=>{var xe,te;ue={x:Math.abs(Math.round(oe.pageX)-(((xe=L.current)==null?void 0:xe.x)??0)),y:Math.abs(Math.round(oe.pageY)-(((te=L.current)==null?void 0:te.y)??0))}},de=oe=>{ue.x<=10&&ue.y<=10?oe.preventDefault():w.contains(oe.target)||$(!1),document.removeEventListener("pointermove",Ae),L.current=null};return L.current!==null&&(document.addEventListener("pointermove",Ae),document.addEventListener("pointerup",de,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Ae),document.removeEventListener("pointerup",de,{capture:!0})}}},[w,$,L]),v.useEffect(()=>{const ue=()=>$(!1);return window.addEventListener("blur",ue),window.addEventListener("resize",ue),()=>{window.removeEventListener("blur",ue),window.removeEventListener("resize",ue)}},[$]);const[Y,Q]=w4(ue=>{const Ae=k().filter(xe=>!xe.disabled),de=Ae.find(xe=>xe.ref.current===document.activeElement),oe=j4(Ae,ue,de);oe&&setTimeout(()=>oe.ref.current.focus())}),ee=v.useCallback((ue,Ae,de)=>{const oe=!H.current&&!de;(y.value!==void 0&&y.value===Ae||oe)&&(A(ue),oe&&(H.current=!0))},[y.value]),fe=v.useCallback(()=>w==null?void 0:w.focus(),[w]),W=v.useCallback((ue,Ae,de)=>{const oe=!H.current&&!de;(y.value!==void 0&&y.value===Ae||oe)&&T(ue)},[y.value]),he=r==="popper"?h1:i4,pe=he===h1?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:g,hideWhenDetached:m,avoidCollisions:x}:{};return a.jsx(r4,{scope:n,content:w,viewport:S,onViewportChange:N,itemRefCallback:ee,selectedItem:_,onItemLeave:fe,itemTextRefCallback:W,focusSelectedItem:V,selectedItemText:O,position:r,isPositioned:M,searchRef:Y,children:a.jsx(lx,{as:xa,allowPinchZoom:!0,children:a.jsx(ax,{asChild:!0,trapped:y.open,onMountAutoFocus:ue=>{ue.preventDefault()},onUnmountAutoFocus:$e(s,ue=>{var Ae;(Ae=y.trigger)==null||Ae.focus({preventScroll:!0}),ue.preventDefault()}),children:a.jsx(yp,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:ue=>ue.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:a.jsx(he,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:ue=>ue.preventDefault(),...b,...pe,onPlaced:()=>R(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:$e(b.onKeyDown,ue=>{const Ae=ue.ctrlKey||ue.altKey||ue.metaKey;if(ue.key==="Tab"&&ue.preventDefault(),!Ae&&ue.key.length===1&&Q(ue.key),["ArrowUp","ArrowDown","Home","End"].includes(ue.key)){let oe=k().filter(xe=>!xe.disabled).map(xe=>xe.ref.current);if(["ArrowUp","End"].includes(ue.key)&&(oe=oe.slice().reverse()),["ArrowUp","ArrowDown"].includes(ue.key)){const xe=ue.target,te=oe.indexOf(xe);oe=oe.slice(te+1)}setTimeout(()=>F(oe)),ue.preventDefault()}})})})})})})});s4.displayName=nZ;var rZ="SelectItemAlignedPosition",i4=v.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,i=Vo(zl,n),o=Wo(zl,n),[l,c]=v.useState(null),[u,d]=v.useState(null),f=pt(t,P=>d(P)),h=ux(n),p=v.useRef(!1),g=v.useRef(!0),{viewport:m,selectedItem:x,selectedItemText:b,focusSelectedItem:y}=o,w=v.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&u&&m&&x&&b){const P=i.trigger.getBoundingClientRect(),_=u.getBoundingClientRect(),A=i.valueNode.getBoundingClientRect(),O=b.getBoundingClientRect();if(i.dir!=="rtl"){const xe=O.left-_.left,te=A.left-xe,Ye=P.left-te,G=P.width+Ye,ve=Math.max(G,_.width),Pe=window.innerWidth-Fs,Ie=xh(te,[Fs,Math.max(Fs,Pe-ve)]);l.style.minWidth=G+"px",l.style.left=Ie+"px"}else{const xe=_.right-O.right,te=window.innerWidth-A.right-xe,Ye=window.innerWidth-P.right-te,G=P.width+Ye,ve=Math.max(G,_.width),Pe=window.innerWidth-Fs,Ie=xh(te,[Fs,Math.max(Fs,Pe-ve)]);l.style.minWidth=G+"px",l.style.right=Ie+"px"}const T=h(),k=window.innerHeight-Fs*2,M=m.scrollHeight,R=window.getComputedStyle(u),H=parseInt(R.borderTopWidth,10),F=parseInt(R.paddingTop,10),V=parseInt(R.borderBottomWidth,10),$=parseInt(R.paddingBottom,10),L=H+F+M+$+V,Y=Math.min(x.offsetHeight*5,L),Q=window.getComputedStyle(m),ee=parseInt(Q.paddingTop,10),fe=parseInt(Q.paddingBottom,10),W=P.top+P.height/2-Fs,he=k-W,pe=x.offsetHeight/2,ue=x.offsetTop+pe,Ae=H+F+ue,de=L-Ae;if(Ae<=W){const xe=T.length>0&&x===T[T.length-1].ref.current;l.style.bottom="0px";const te=u.clientHeight-m.offsetTop-m.offsetHeight,Ye=Math.max(he,pe+(xe?fe:0)+te+V),G=Ae+Ye;l.style.height=G+"px"}else{const xe=T.length>0&&x===T[0].ref.current;l.style.top="0px";const Ye=Math.max(W,H+m.offsetTop+(xe?ee:0)+pe)+de;l.style.height=Ye+"px",m.scrollTop=Ae-W+m.offsetTop}l.style.margin=`${Fs}px 0`,l.style.minHeight=Y+"px",l.style.maxHeight=k+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[h,i.trigger,i.valueNode,l,u,m,x,b,i.dir,r]);or(()=>w(),[w]);const[j,S]=v.useState();or(()=>{u&&S(window.getComputedStyle(u).zIndex)},[u]);const N=v.useCallback(P=>{P&&g.current===!0&&(w(),y==null||y(),g.current=!1)},[w,y]);return a.jsx(iZ,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:p,onScrollButtonChange:N,children:a.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:j},children:a.jsx(Xe.div,{...s,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});i4.displayName=rZ;var sZ="SelectPopperPosition",h1=v.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=Fs,...i}=e,o=dx(n);return a.jsx(mN,{...o,...i,ref:t,align:r,collisionPadding:s,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});h1.displayName=sZ;var[iZ,KN]=rd(zl,{}),p1="SelectViewport",a4=v.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,i=Wo(p1,n),o=KN(p1,n),l=pt(t,i.onViewportChange),c=v.useRef(0);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),a.jsx(cx.Slot,{scope:n,children:a.jsx(Xe.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:$e(s.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:h}=o;if(h!=null&&h.current&&f){const p=Math.abs(c.current-d.scrollTop);if(p>0){const g=window.innerHeight-Fs*2,m=parseFloat(f.style.minHeight),x=parseFloat(f.style.height),b=Math.max(m,x);if(b0?j:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});a4.displayName=p1;var o4="SelectGroup",[aZ,oZ]=rd(o4),lZ=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Cs();return a.jsx(aZ,{scope:n,id:s,children:a.jsx(Xe.div,{role:"group","aria-labelledby":s,...r,ref:t})})});lZ.displayName=o4;var l4="SelectLabel",c4=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=oZ(l4,n);return a.jsx(Xe.div,{id:s.id,...r,ref:t})});c4.displayName=l4;var Qg="SelectItem",[cZ,u4]=rd(Qg),d4=v.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:i,...o}=e,l=Vo(Qg,n),c=Wo(Qg,n),u=l.value===r,[d,f]=v.useState(i??""),[h,p]=v.useState(!1),g=pt(t,y=>{var w;return(w=c.itemRefCallback)==null?void 0:w.call(c,y,r,s)}),m=Cs(),x=v.useRef("touch"),b=()=>{s||(l.onValueChange(r),l.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return a.jsx(cZ,{scope:n,value:r,disabled:s,textId:m,isSelected:u,onItemTextChange:v.useCallback(y=>{f(w=>w||((y==null?void 0:y.textContent)??"").trim())},[]),children:a.jsx(cx.ItemSlot,{scope:n,value:r,disabled:s,textValue:d,children:a.jsx(Xe.div,{role:"option","aria-labelledby":m,"data-highlighted":h?"":void 0,"aria-selected":u&&h,"data-state":u?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:g,onFocus:$e(o.onFocus,()=>p(!0)),onBlur:$e(o.onBlur,()=>p(!1)),onClick:$e(o.onClick,()=>{x.current!=="mouse"&&b()}),onPointerUp:$e(o.onPointerUp,()=>{x.current==="mouse"&&b()}),onPointerDown:$e(o.onPointerDown,y=>{x.current=y.pointerType}),onPointerMove:$e(o.onPointerMove,y=>{var w;x.current=y.pointerType,s?(w=c.onItemLeave)==null||w.call(c):x.current==="mouse"&&y.currentTarget.focus({preventScroll:!0})}),onPointerLeave:$e(o.onPointerLeave,y=>{var w;y.currentTarget===document.activeElement&&((w=c.onItemLeave)==null||w.call(c))}),onKeyDown:$e(o.onKeyDown,y=>{var j;((j=c.searchRef)==null?void 0:j.current)!==""&&y.key===" "||(XY.includes(y.key)&&b(),y.key===" "&&y.preventDefault())})})})})});d4.displayName=Qg;var of="SelectItemText",f4=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...i}=e,o=Vo(of,n),l=Wo(of,n),c=u4(of,n),u=JY(of,n),[d,f]=v.useState(null),h=pt(t,b=>f(b),c.onItemTextChange,b=>{var y;return(y=l.itemTextRefCallback)==null?void 0:y.call(l,b,c.value,c.disabled)}),p=d==null?void 0:d.textContent,g=v.useMemo(()=>a.jsx("option",{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:m,onNativeOptionRemove:x}=u;return or(()=>(m(g),()=>x(g)),[m,x,g]),a.jsxs(a.Fragment,{children:[a.jsx(Xe.span,{id:c.textId,...i,ref:h}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Xs.createPortal(i.children,o.valueNode):null]})});f4.displayName=of;var h4="SelectItemIndicator",p4=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return u4(h4,n).isSelected?a.jsx(Xe.span,{"aria-hidden":!0,...r,ref:t}):null});p4.displayName=h4;var m1="SelectScrollUpButton",m4=v.forwardRef((e,t)=>{const n=Wo(m1,e.__scopeSelect),r=KN(m1,e.__scopeSelect),[s,i]=v.useState(!1),o=pt(t,r.onScrollButtonChange);return or(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollTop>0;i(u)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),s?a.jsx(v4,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});m4.displayName=m1;var g1="SelectScrollDownButton",g4=v.forwardRef((e,t)=>{const n=Wo(g1,e.__scopeSelect),r=KN(g1,e.__scopeSelect),[s,i]=v.useState(!1),o=pt(t,r.onScrollButtonChange);return or(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),s?a.jsx(v4,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});g4.displayName=g1;var v4=v.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,i=Wo("SelectScrollButton",n),o=v.useRef(null),l=ux(n),c=v.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return v.useEffect(()=>()=>c(),[c]),or(()=>{var d;const u=l().find(f=>f.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[l]),a.jsx(Xe.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:$e(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:$e(s.onPointerMove,()=>{var u;(u=i.onItemLeave)==null||u.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:$e(s.onPointerLeave,()=>{c()})})}),uZ="SelectSeparator",y4=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return a.jsx(Xe.div,{"aria-hidden":!0,...r,ref:t})});y4.displayName=uZ;var v1="SelectArrow",dZ=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=dx(n),i=Vo(v1,n),o=Wo(v1,n);return i.open&&o.position==="popper"?a.jsx(gN,{...s,...r,ref:t}):null});dZ.displayName=v1;function x4(e){return e===""||e===void 0}var b4=v.forwardRef((e,t)=>{const{value:n,...r}=e,s=v.useRef(null),i=pt(t,s),o=Cp(n);return v.useEffect(()=>{const l=s.current,c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==n&&d){const f=new Event("change",{bubbles:!0});d.call(l,n),l.dispatchEvent(f)}},[o,n]),a.jsx(vN,{asChild:!0,children:a.jsx("select",{...r,ref:i,defaultValue:n})})});b4.displayName="BubbleSelect";function w4(e){const t=Vn(e),n=v.useRef(""),r=v.useRef(0),s=v.useCallback(o=>{const l=n.current+o;t(l),function c(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>c(""),1e3))}(l)},[t]),i=v.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,i]}function j4(e,t,n){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=fZ(e,Math.max(i,0));s.length===1&&(o=o.filter(u=>u!==n));const c=o.find(u=>u.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function fZ(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var hZ=XD,S4=ZD,pZ=JD,mZ=e4,gZ=t4,N4=n4,vZ=a4,_4=c4,P4=d4,yZ=f4,xZ=p4,C4=m4,A4=g4,E4=y4;const On=hZ,kn=pZ,jn=v.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(S4,{ref:r,className:Me("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,a.jsx(mZ,{asChild:!0,children:a.jsx(Ta,{className:"h-4 w-4 opacity-50"})})]}));jn.displayName=S4.displayName;const O4=v.forwardRef(({className:e,...t},n)=>a.jsx(C4,{ref:n,className:Me("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(wp,{className:"h-4 w-4"})}));O4.displayName=C4.displayName;const k4=v.forwardRef(({className:e,...t},n)=>a.jsx(A4,{ref:n,className:Me("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(Ta,{className:"h-4 w-4"})}));k4.displayName=A4.displayName;const Sn=v.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>a.jsx(gZ,{children:a.jsxs(N4,{ref:s,className:Me("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[a.jsx(O4,{}),a.jsx(vZ,{className:Me("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),a.jsx(k4,{})]})}));Sn.displayName=N4.displayName;const bZ=v.forwardRef(({className:e,...t},n)=>a.jsx(_4,{ref:n,className:Me("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));bZ.displayName=_4.displayName;const ye=v.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(P4,{ref:r,className:Me("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(xZ,{children:a.jsx(Sa,{className:"h-4 w-4"})})}),a.jsx(yZ,{children:t})]}));ye.displayName=P4.displayName;const wZ=v.forwardRef(({className:e,...t},n)=>a.jsx(E4,{ref:n,className:Me("-mx-1 my-1 h-px bg-muted",e),...t}));wZ.displayName=E4.displayName;const jZ=Re.object({audienceBrief:Re.string().min(10,{message:"Audience brief must be at least 10 characters."}),researchObjective:Re.string().optional(),personaCount:Re.string().min(1,{message:"Number of personas is required."}),dataFile:Re.instanceof(FileList).optional(),llm_model:Re.string().optional()});function SZ({onSubmit:e,isGenerating:t}){const[n,r]=v.useState(!1),[s,i]=v.useState(!1),[o,l]=v.useState({audience_brief:[],research_objective:[]}),[c,u]=v.useState(!1),[d,f]=v.useState(null),h=tx({resolver:nx(jZ),defaultValues:{audienceBrief:"",researchObjective:"",personaCount:"5",llm_model:"gemini-2.5-pro"}}),p=h.watch("audienceBrief"),g=h.watch("researchObjective"),m=async()=>{var w,j,S,N,P,_,A,O,T,k,M;const b=p==null?void 0:p.trim(),y=g==null?void 0:g.trim();if(!b||b.length<10){ce.error("Audience brief too short",{description:"Please enter at least 10 characters in the audience brief"});return}if(!y||y.length<10){ce.error("Research objective too short",{description:"Please enter at least 10 characters in the research objective"});return}u(!0),f(null);try{const R=await Xi.enhanceAudienceBrief(b,y);l(R.data.suggestions||{audience_brief:[],research_objective:[]}),r(!0),i(!1);const H=(((j=(w=R.data.suggestions)==null?void 0:w.audience_brief)==null?void 0:j.length)||0)+(((N=(S=R.data.suggestions)==null?void 0:S.research_objective)==null?void 0:N.length)||0);ce.success("Enhancement suggestions generated",{description:`Generated ${H} suggestions to improve your research inputs`})}catch(R){console.error("Error enhancing audience brief:",R);let H="Please try again or modify your brief",F="Failed to generate suggestions";if(R&&typeof R=="object"){const V=R;V.code==="ECONNABORTED"||(P=V.message)!=null&&P.includes("timeout")?(F="Request timeout",H="The AI took too long to analyze your brief. Please try again."):((_=V.response)==null?void 0:_.status)===500?(F="Server error",H=((O=(A=V.response)==null?void 0:A.data)==null?void 0:O.message)||"The server encountered an error. Please try again later."):((T=V.response)==null?void 0:T.status)===400?(F="Invalid brief",H=((M=(k=V.response)==null?void 0:k.data)==null?void 0:M.message)||"Please check your audience brief and try again."):V.message&&(H=V.message)}else R instanceof Error&&(H=R.message);f(H),ce.error(F,{description:H,duration:5e3})}finally{u(!1)}},x=()=>{i(!s)};return a.jsx(sx,{...h,children:a.jsxs("form",{onSubmit:h.handleSubmit(e),className:"space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-6",children:[a.jsx(ot,{control:h.control,name:"audienceBrief",render:({field:b})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Audience Brief"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Describe your target audience and research goals...",className:"h-40",...b})}),a.jsx(on,{children:"Provide details about the demographics, behaviors, and attitudes you want to explore"}),a.jsx(it,{})]})}),a.jsx(ot,{control:h.control,name:"researchObjective",render:({field:b})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Research Objective"}),a.jsx(st,{children:a.jsx(et,{placeholder:"What is the main research topic or objective you want to explore?",className:"h-32",...b})}),a.jsx(on,{children:"Specify your research focus to generate more targeted persona goals, frustrations, and scenarios"}),a.jsx(it,{})]})}),a.jsx("div",{className:"space-y-3",children:a.jsx(se,{type:"button",variant:"outline",size:"sm",onClick:m,disabled:!p||p.trim().length<10||!g||g.trim().length<10||c||t,className:"flex items-center gap-2 hover-transition",children:c?a.jsxs(a.Fragment,{children:[a.jsx(zc,{className:"h-4 w-4 animate-spin"}),"Analyzing Research Inputs..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Rl,{className:"h-4 w-4"}),"Enhance Brief"]})})})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsx(ot,{control:h.control,name:"dataFile",render:({field:{value:b,onChange:y,...w}})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Customer Data (Optional)"}),a.jsx(st,{children:a.jsxs("div",{className:"border-2 border-dashed border-slate-200 rounded-lg p-6 flex flex-col items-center justify-center bg-slate-50 hover:bg-slate-100 transition cursor-pointer",children:[a.jsx(CR,{className:"h-10 w-10 text-slate-400 mb-2"}),a.jsx("p",{className:"text-sm text-slate-600 mb-1",children:"Upload customer data for more accurate personas"}),a.jsx("p",{className:"text-xs text-slate-500 mb-3",children:"Supports PDF, Office docs, images, and more"}),a.jsx(_t,{...w,type:"file",multiple:!0,accept:".pdf,.docx,.pptx,.xlsx,.html,.xml,.rtf,.pages,.key,.epub,.txt,.csv,.jpg,.jpeg,.png",onChange:j=>{y(j.target.files)},className:"hidden",id:"data-file-input"}),a.jsxs(se,{type:"button",variant:"outline",size:"sm",onClick:()=>{var j;return(j=document.getElementById("data-file-input"))==null?void 0:j.click()},children:[a.jsx(kR,{className:"mr-2 h-4 w-4"}),"Select Files"]}),b&&b.length>0&&a.jsx("p",{className:"text-xs text-primary mt-2",children:b.length===1?b[0].name:`${b.length} files selected`})]})}),a.jsx(on,{children:"Upload existing customer data to create more realistic personas"}),a.jsx(it,{})]})}),a.jsxs("div",{className:"bg-muted/30 p-4 rounded-lg border border-border",children:[a.jsxs("div",{className:"flex items-center mb-2",children:[a.jsx(Yw,{className:"h-5 w-5 text-muted-foreground mr-2"}),a.jsx("h3",{className:"font-sf font-medium",children:"What's included?"})]}),a.jsxs("ul",{className:"space-y-2 text-sm text-muted-foreground",children:[a.jsxs("li",{className:"flex items-center",children:[a.jsx(rf,{className:"h-4 w-4 text-green-500 mr-2"}),"Demographic profiles based on your brief"]}),a.jsxs("li",{className:"flex items-center",children:[a.jsx(rf,{className:"h-4 w-4 text-green-500 mr-2"}),"Personality traits and behavioral patterns"]}),a.jsxs("li",{className:"flex items-center",children:[a.jsx(rf,{className:"h-4 w-4 text-green-500 mr-2"}),"Consumer preferences and interests"]}),a.jsxs("li",{className:"flex items-center",children:[a.jsx(rf,{className:"h-4 w-4 text-green-500 mr-2"}),"Review and refine capabilities"]})]})]})]})]}),n&&a.jsxs("div",{className:"glass-panel rounded-lg p-4 border border-border bg-muted/30",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("h3",{className:"font-sf font-medium text-sm flex items-center gap-2",children:[a.jsx(Rl,{className:"h-4 w-4 text-primary"}),"Enhancement Suggestions:"]}),a.jsx(se,{type:"button",variant:"ghost",size:"sm",onClick:x,className:"h-6 w-6 p-0 hover:bg-slate-200",title:s?"Expand suggestions":"Collapse suggestions",children:s?a.jsx(Ta,{className:"h-4 w-4"}):a.jsx(wp,{className:"h-4 w-4"})})]}),!s&&a.jsx(a.Fragment,{children:d?a.jsx("div",{className:"text-sm text-red-600 bg-red-50 p-3 rounded-md",children:d}):a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx("div",{children:o.audience_brief.length>0?a.jsxs("div",{children:[a.jsxs("h4",{className:"font-sf font-medium text-sm text-slate-800 mb-2 flex items-center gap-2",children:[a.jsx(er,{className:"h-4 w-4 text-blue-600"}),"Suggestions for your Audience Brief:"]}),a.jsx("ul",{className:"space-y-2 text-sm text-slate-700",children:o.audience_brief.map((b,y)=>a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"text-blue-600 mt-1.5 text-xs",children:"โ€ข"}),a.jsx("span",{className:"flex-1",children:b})]},y))})]}):a.jsx("div",{className:"text-sm text-muted-foreground",children:"No audience brief suggestions available"})}),a.jsx("div",{children:o.research_objective.length>0?a.jsxs("div",{children:[a.jsxs("h4",{className:"font-sf font-medium text-sm text-slate-800 mb-2 flex items-center gap-2",children:[a.jsx(Yw,{className:"h-4 w-4 text-green-600"}),"Suggestions for your Research Objective:"]}),a.jsx("ul",{className:"space-y-2 text-sm text-slate-700",children:o.research_objective.map((b,y)=>a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"text-green-600 mt-1.5 text-xs",children:"โ€ข"}),a.jsx("span",{className:"flex-1",children:b})]},y))})]}):a.jsx("div",{className:"text-sm text-muted-foreground",children:"No research objective suggestions available"})}),o.audience_brief.length===0&&o.research_objective.length===0&&a.jsx("div",{className:"col-span-full text-sm text-muted-foreground text-center",children:"No suggestions available"})]})})]}),a.jsx(ot,{control:h.control,name:"llm_model",render:({field:b})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"AI Model"}),a.jsxs(On,{onValueChange:b.onChange,defaultValue:b.value,children:[a.jsx(st,{children:a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select AI model"})})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"gemini-2.5-pro",children:"Gemini 2.5 Pro"}),a.jsx(ye,{value:"gpt-4.1",children:"GPT-4.1"})]})]}),a.jsx(on,{children:"Choose which AI model to use for generating personas"}),a.jsx(it,{})]})}),a.jsx(ot,{control:h.control,name:"personaCount",render:({field:b})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Number of Personas to Generate"}),a.jsx(st,{children:a.jsx(_t,{type:"number",min:"1",max:"20",...b})}),a.jsx(on,{children:"How many synthetic users do you need for your research?"}),a.jsx(it,{})]})}),a.jsxs("div",{className:"flex flex-col items-end",children:[a.jsx(se,{type:"submit",disabled:t,className:"min-w-36",children:t?a.jsxs(a.Fragment,{children:[a.jsx(zc,{className:"mr-2 h-4 w-4 animate-spin"}),"AI Generating..."]}):a.jsxs(a.Fragment,{children:[a.jsx(er,{className:"mr-2 h-4 w-4"}),"Generate Personas"]})}),t&&a.jsx("div",{className:"text-xs text-muted-foreground mt-2",children:"Generating multiple personas in parallel. This may take 1-2 minutes..."})]})]})})}const Ke=v.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:Me("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));Ke.displayName="Card";const Fr=v.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:Me("flex flex-col space-y-1.5 p-6",e),...t}));Fr.displayName="CardHeader";const ts=v.forwardRef(({className:e,...t},n)=>a.jsx("h3",{ref:n,className:Me("text-2xl font-semibold leading-none tracking-tight",e),...t}));ts.displayName="CardTitle";const XN=v.forwardRef(({className:e,...t},n)=>a.jsx("p",{ref:n,className:Me("text-sm text-muted-foreground",e),...t}));XN.displayName="CardDescription";const lt=v.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:Me("p-6 pt-0",e),...t}));lt.displayName="CardContent";const YN=v.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:Me("flex items-center p-6 pt-0",e),...t}));YN.displayName="CardFooter";const NZ=e=>{const t=e==null?void 0:e.toLowerCase(),n="/semblance/";switch(t){case"male":return`${n}male_avatar.png`;case"female":return`${n}female_avatar.png`;case"non-binary":case"nonbinary":case"non binary":return`${n}nonbinary_avatar.png`;default:return`${n}male_avatar.png`}},sd=e=>e.avatar||NZ(e.gender);function ZN({user:e,selected:t=!1,onClick:n,showDetailedDialog:r=!1,onSelectionToggle:s,showAddToFolderButton:i=!1,onAddToFolder:o,showModalInsteadOfNavigate:l=!1,onOpenPersonaModal:c}){const u=Rn();v.useState(!1);const[d,f]=v.useState(e),h=e._id||e.id,p=x=>{x.stopPropagation(),u(`/synthetic-users/${h}`)};d.oceanTraits&&(d.oceanTraits.openness,d.oceanTraits.conscientiousness,d.oceanTraits.extraversion,d.oceanTraits.agreeableness,d.oceanTraits.neuroticism);const g=x=>{var w,j;const b=x.target;b.closest("button")&&((j=(w=b.closest("button"))==null?void 0:w.textContent)!=null&&j.includes("View Details"))||(s?s(x):n&&n(x))},m=x=>{x.stopPropagation(),l&&c?c(d):p(x)};return a.jsxs("div",{className:Me("persona-card glass-card rounded-xl p-4 cursor-pointer hover:shadow-md button-transition",t&&"selected ring-2 ring-primary"),onClick:g,children:[a.jsx("div",{className:"persona-card-overlay"}),a.jsx("div",{className:"persona-card-checkmark",children:a.jsx(Sa,{className:"h-4 w-4 text-primary"})}),a.jsx("div",{className:"relative z-10",children:a.jsxs("div",{className:"flex items-start space-x-4",children:[a.jsx("div",{className:"h-12 w-12 rounded-full bg-muted flex items-center justify-center",children:a.jsx("img",{src:sd(d),alt:`${d.name} avatar`,className:"h-12 w-12 rounded-full object-cover"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"flex items-center justify-between gap-2",children:a.jsx("h3",{className:"text-sm font-medium truncate flex-1",children:d.name})}),a.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[d.age," โ€ข ",d.gender]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:d.occupation}),a.jsx("p",{className:"text-xs text-muted-foreground",children:d.location}),a.jsx("div",{className:"mt-2",children:d.aiSynthesizedBio?a.jsxs("p",{className:"text-xs text-slate-700 line-clamp-3 leading-relaxed",children:[d.aiSynthesizedBio,d.aiSynthesizedBio.length>150&&"..."]}):a.jsxs("p",{className:"text-xs text-muted-foreground italic line-clamp-3",children:['"',d.personality,'"']})}),d.qualitativeAttributes&&d.qualitativeAttributes.length>0&&a.jsx("div",{className:"mt-3",children:a.jsx("div",{className:"flex flex-wrap gap-1",children:d.qualitativeAttributes.slice(0,3).map((x,b)=>a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-blue-50 text-blue-700 text-xs rounded-full",children:[a.jsx(MG,{className:"h-3 w-3"}),x]},b))})}),d.topPersonalityTraits&&d.topPersonalityTraits.length>0&&a.jsx("div",{className:"mt-2",children:a.jsx("div",{className:"flex flex-wrap gap-1",children:d.topPersonalityTraits.slice(0,3).map((x,b)=>a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-purple-50 text-purple-700 text-xs rounded-full",children:[a.jsx(ja,{className:"h-3 w-3"}),x]},b))})}),a.jsx("div",{className:"mt-3 flex justify-end",children:a.jsx(se,{variant:"ghost",size:"sm",onClick:m,children:"View Details"})})]})]})})]})}var QN="Collapsible",[_Z,T4]=Ir(QN),[PZ,JN]=_Z(QN),$4=v.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:i,onOpenChange:o,...l}=e,[c=!1,u]=us({prop:r,defaultProp:s,onChange:o});return a.jsx(PZ,{scope:n,disabled:i,contentId:Cs(),open:c,onOpenToggle:v.useCallback(()=>u(d=>!d),[u]),children:a.jsx(Xe.div,{"data-state":r_(c),"data-disabled":i?"":void 0,...l,ref:t})})});$4.displayName=QN;var I4="CollapsibleTrigger",e_=v.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,s=JN(I4,n);return a.jsx(Xe.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":r_(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:t,onClick:$e(e.onClick,s.onOpenToggle)})});e_.displayName=I4;var t_="CollapsibleContent",n_=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=JN(t_,e.__scopeCollapsible);return a.jsx(lr,{present:n||s.open,children:({present:i})=>a.jsx(CZ,{...r,ref:t,present:i})})});n_.displayName=t_;var CZ=v.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:s,...i}=e,o=JN(t_,n),[l,c]=v.useState(r),u=v.useRef(null),d=pt(t,u),f=v.useRef(0),h=f.current,p=v.useRef(0),g=p.current,m=o.open||l,x=v.useRef(m),b=v.useRef();return v.useEffect(()=>{const y=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(y)},[]),or(()=>{const y=u.current;if(y){b.current=b.current||{transitionDuration:y.style.transitionDuration,animationName:y.style.animationName},y.style.transitionDuration="0s",y.style.animationName="none";const w=y.getBoundingClientRect();f.current=w.height,p.current=w.width,x.current||(y.style.transitionDuration=b.current.transitionDuration,y.style.animationName=b.current.animationName),c(r)}},[o.open,r]),a.jsx(Xe.div,{"data-state":r_(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!m,...i,ref:d,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:m&&s})});function r_(e){return e?"open":"closed"}var M4=$4,AZ=e_,EZ=n_;const Ep=M4,Op=e_,kp=n_;function OZ({generatedPersonas:e,selectedPersonas:t,isGenerating:n,onPersonaSelection:r,onRefinePersonas:s,onApprovePersonas:i,onBackToGenerator:o}){const l=Rn(),[c,u]=v.useState(""),[d,f]=v.useState(!1),h=p=>{l(`/synthetic-users/${p}?fromReview=true`)};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"font-sf text-lg font-medium",children:"Review Generated Personas"}),a.jsxs("div",{className:"text-sm text-muted-foreground",children:[t.length," of ",e.length," selected"]})]}),a.jsx("div",{className:"space-y-4",children:e.map(p=>a.jsx(Ke,{className:`border ${t.includes(p.id)?"border-primary/50 bg-primary/5":""} cursor-pointer`,onClick:()=>h(p.id),children:a.jsx(lt,{className:"p-4",children:a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsx("div",{className:"flex-1",children:a.jsxs("div",{className:"flex items-center",children:[a.jsx("input",{type:"checkbox",id:`persona-${p.id}`,checked:t.includes(p.id),onChange:g=>{g.stopPropagation(),r(p.id)},className:"mr-3 h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium",children:p.name}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:[p.age," โ€ข ",p.gender," โ€ข ",p.occupation]})]})]})}),a.jsx(ZN,{user:p,showDetailedDialog:!1,onClick:g=>{g.stopPropagation(),h(p.id)}})]})})},p.id))}),a.jsx("div",{className:"space-y-4 pt-4 border-t",children:a.jsxs("div",{children:[a.jsx("div",{className:"flex justify-between items-start mb-4",children:a.jsxs(se,{variant:"outline",onClick:o,children:[a.jsx(nh,{className:"mr-2 h-4 w-4"}),"Back to Generator"]})}),a.jsxs(Ep,{open:d,onOpenChange:f,className:"w-full space-y-4",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx(Op,{asChild:!0,children:a.jsxs(se,{variant:"outline",className:"flex items-center gap-2",children:[a.jsx(zc,{className:"h-4 w-4"}),"Refine Personas",a.jsx(Ta,{className:"h-4 w-4 ml-1 transition-transform duration-200",style:{transform:d?"rotate(180deg)":"rotate(0deg)"}})]})}),a.jsxs(se,{onClick:i,disabled:t.length===0,children:[a.jsx(rf,{className:"mr-2 h-4 w-4"}),"Approve Selected (",t.length,")"]})]}),a.jsx(kp,{children:a.jsx(Ke,{className:"border shadow-sm w-full mt-4",children:a.jsx(lt,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"refinement-prompt",className:"text-sm font-medium block mb-2",children:"Refinement Instructions"}),a.jsx(et,{id:"refinement-prompt",placeholder:"Example: Make all personas 5 years younger, or ensure everyone is from different locations...",value:c,onChange:p=>u(p.target.value),className:"min-h-[100px] w-full resize-y"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Use natural language to describe how you'd like to refine the selected personas."})]}),a.jsxs(se,{onClick:()=>s(c),disabled:n||c.trim()==="",className:"w-full",children:[n?a.jsx(zc,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(zc,{className:"mr-2 h-4 w-4"}),"Apply Refinements"]})]})})})})]})]})})]})}async function kZ(e,t,n,r,s,i){console.log(`generateSyntheticPersonas called with targetFolderId: ${s||"none"}`),console.log(`๐Ÿ”„ generateSyntheticPersonas using model: ${i||"gemini-2.5-pro"}`);try{if(console.log(`Generating ${n} synthetic personas using two-stage approach...`),e.trim().length<10)throw new Error("Audience brief is too short. Please provide more context for better persona generation.");let o;if(r&&r.length>0){console.log(`Uploading ${r.length} customer data files...`);try{o=(await Xi.uploadCustomerData(r)).data.session_id,console.log(`Customer data uploaded with session ID: ${o}`)}catch(c){throw console.error("Failed to upload customer data:",c),new Error("Failed to upload customer data files. Please try again.")}}const l=await Xi.batchGenerateWithStages(e,t,n,.8,o,i);if(l.data){const c=l.data.partial_success===!0,u=l.data.personas&&l.data.personas.length>0,d=l.data.errors&&l.data.errors.length>0;if(u){if(console.log(`Generated ${l.data.personas.length} personas with two-stage process${d?` (${l.data.errors.length} failed)`:""}`),s){const h=l.data.personas.map(p=>({...p,folderId:s}));try{const p=h.map(g=>{if(g.id||g._id){const m=g._id||g.id;return console.log(`Updating persona ${g.name||m} with folder ID: ${s}`),$n.update(m,{...g,folderId:s}).catch(x=>(console.error(`Error updating folder ID for persona ${g.name||m}:`,x),null))}return Promise.resolve(null)});await Promise.allSettled(p),console.log(`Added ${h.length} personas to folder ID: ${s}`)}catch(p){console.error("Error updating personas with folder ID:",p)}if(o)try{await Xi.cleanupCustomerData(o),console.log(`Cleaned up customer data for session: ${o}`)}catch(p){console.warn("Failed to cleanup customer data:",p)}return c||d?{...l.data,personas:h,length:h.length}:{...l.data,personas:h}}if(o)try{await Xi.cleanupCustomerData(o),console.log(`Cleaned up customer data for session: ${o}`)}catch(f){console.warn("Failed to cleanup customer data:",f)}if(c||d)return{...l.data.personas,length:l.data.personas.length,partial_success:c,errors:l.data.errors};if(o)try{await Xi.cleanupCustomerData(o),console.log(`Cleaned up customer data for session: ${o}`)}catch(f){console.warn("Failed to cleanup customer data:",f)}return l.data.personas}else if(d){if(o)try{await Xi.cleanupCustomerData(o),console.log(`Cleaned up customer data for session: ${o}`)}catch(f){console.warn("Failed to cleanup customer data:",f)}throw new Error(`Failed to generate personas: ${l.data.errors.length} generation attempts failed.`)}else throw new Error("No personas returned from API")}else throw new Error("Invalid response format from API")}catch(o){if(customerDataSessionId)try{await Xi.cleanupCustomerData(customerDataSessionId),console.log(`Cleaned up customer data for session: ${customerDataSessionId}`)}catch(l){console.warn("Failed to cleanup customer data:",l)}throw console.error("Error generating AI personas:",o),o}}function R4(){const[e,t]=v.useState([]),n=async i=>{const o=[];for(const l of i){const c={...l};c._id&&typeof c._id=="string"&&c._id.startsWith("local-")&&delete c._id;const u=await $n.create(c);console.log("Persona saved to database:",u.data),o.push({...l,id:u.data._id||u.data.id,_id:u.data._id||u.data.id,isDbPersona:!0})}t(o)},r=async()=>{const i=await $n.getAll();return i&&i.data&&Array.isArray(i.data)?(console.log("Personas loaded from database:",i.data.length),i.data.map(o=>({...o,id:o._id||o.id,isDbPersona:!0}))):[]};return v.useEffect(()=>{(async()=>{const o=await r();t(o)})()},[]),{storedPersonas:e,savePersonas:n,loadPersonas:r,clearPersonas:async()=>{const i=await r();for(const o of i)o._id&&await $n.delete(o._id);t([])}}}function TZ({targetFolderId:e,targetFolderName:t}){const n=ci(),r=Rn(),{loadPersonas:s,savePersonas:i}=R4(),[o,l]=v.useState(!1),[c,u]=v.useState([]),[d,f]=v.useState([]),[h,p]=v.useState(!1),[g,m]=v.useState(0);v.useEffect(()=>{const S=new URLSearchParams(n.search),N=S.get("mode"),P=S.get("tab"),_=S.get("step");if(N==="create"&&P==="ai"&&_==="review"){const A=s();A.length>0&&(u(A),f(A.map(O=>O.id)),p(!0))}},[n,s]);async function x(S){var N,P,_,A,O,T,k,M,R,H;try{l(!0),m(0);const F=parseInt(S.personaCount);if(isNaN(F)||F<1||F>10){ce.error("Invalid number of personas",{description:"Please enter a number between 1 and 10"}),l(!1);return}m(5);const V=setInterval(()=>{m(Q=>Q<90?Q+Math.random()*5:Q)},500),$=F<=2?"30-60 seconds":F<=4?"1-2 minutes":F<=6?"2-3 minutes":"3-5 minutes";F>4&&ce.info("Generation may take longer",{description:`Generating ${F} personas at once may result in some timeouts. If this happens, the successfully created personas will still be saved.`,duration:8e3}),ce.info("Generating AI personas in parallel",{description:`Creating ${F} synthetic personas based on your brief. This may take ${$}. Please be patient.`,duration:1e4}),e&&t?(console.log(`Target folder for new personas: ID=${e}, Name=${t}`),ce.info(`Creating personas in "${t}" folder`,{duration:3e3})):console.log("No target folder specified for new personas"),console.log(`๐Ÿค– Starting persona generation with model: ${S.llm_model||"gemini-2.5-pro"}`);const L=await kZ(S.audienceBrief,S.researchObjective,F,S.dataFile,e,S.llm_model),Y=L.personas||L;if(clearInterval(V),m(100),Y&&Y.length>0)console.log(`โœ… Successfully generated ${Y.length} personas using model: ${S.llm_model||"gemini-2.5-pro"}`),L.partial_success||L.errors&&L.errors.length>0?(ce.success("Some personas generated successfully",{description:`${Y.length} synthetic personas were created using ${S.llm_model||"Gemini 2.5 Pro"}. ${((N=L.errors)==null?void 0:N.length)||0} failed due to timeout or other errors.`,duration:8e3}),L.errors&&L.errors.length>0&&setTimeout(()=>{ce.error("Some personas failed to generate",{description:`${L.errors.length} personas timed out. The server took too long to generate them. The successfully generated personas have been saved${e?" in the selected folder":""}.`,duration:1e4})},1e3)):ce.success("Personas generated and saved successfully",{description:`${Y.length} synthetic personas have been created using ${S.llm_model||"Gemini 2.5 Pro"} and saved ${e?`to the "${t}" folder`:"to the database"}.`}),r("/synthetic-users");else throw new Error("No personas were generated")}catch(F){console.error(`โŒ Error generating personas using model: ${S.llm_model||"gemini-2.5-pro"}:`,F);let V="Please try again or adjust your parameters",$="Failed to generate personas";F.code==="ECONNABORTED"||(P=F.message)!=null&&P.includes("timeout")||((_=F.response)==null?void 0:_.status)===504?($="Generation timeout",V="AI persona generation timed out. This often happens when generating multiple complex personas. Try generating fewer personas (2-3) or try again later."):((A=F.response)==null?void 0:A.status)===500?($="Server error",(T=(O=F.response)==null?void 0:O.data)!=null&&T.message?V=F.response.data.message:(M=(k=F.response)==null?void 0:k.data)!=null&&M.error?V=F.response.data.error:V="The server encountered an error processing your request. Please try again later."):((R=F.response)==null?void 0:R.status)===401?($="Authentication required",V="Please log in to generate personas."):(H=F.message)!=null&&H.includes("504 Deadline Exceeded")?($="Generation timeout",V="The AI model took too long to generate personas. Try generating fewer personas or simplify your brief."):F instanceof Error&&(V=F.message),ce.error($,{description:V,duration:6e3})}finally{setTimeout(()=>{l(!1),m(0)},500)}}const b=S=>{f(N=>N.includes(S)?N.filter(P=>P!==S):[...N,S])},y=(S,N)=>{const P=N.toLowerCase();return S.map(_=>{const A={..._};if(P.includes("younger")){const O=parseInt(A.age);A.age=(O-5).toString()}else if(P.includes("older")){const O=parseInt(A.age);A.age=(O+5).toString()}if(P.includes("different locations")&&(A.location=`${A.location} (Diversified)`),P.includes("more extroverted")?A.personality=`Extroverted, ${A.personality.toLowerCase()}`:P.includes("more introverted")&&(A.personality=`Introverted, ${A.personality.toLowerCase()}`),P.includes("diverse")){const O=["tech-savvy","traditional","innovative","conservative","creative"],T=O[Math.floor(Math.random()*O.length)];A.personality=`${T}, ${A.personality}`}return A})},w=S=>{if(!S.trim()){ce.error("Please provide refinement instructions");return}l(!0),setTimeout(()=>{try{const N=c.filter(A=>d.includes(A.id)),P=y(N,S),_=c.map(A=>P.find(T=>T.id===A.id)||A);u(_),l(!1),i(_),ce.success("Personas refined based on your instructions",{description:"Review the updated profiles"})}catch(N){console.error("Error refining personas:",N),ce.error("Failed to refine personas",{description:"Please try different instructions"}),l(!1)}},1500)},j=()=>{const S=c.filter(N=>d.includes(N.id));ce.success(`${S.length} personas approved`,{description:"Added to your synthetic persona library"}),i(S),r("/synthetic-users")};return a.jsxs("div",{className:"glass-panel rounded-xl p-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[a.jsx(er,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"AI Persona Recruiter"})]}),o&&a.jsxs("div",{className:"mb-6",children:[a.jsxs("div",{className:"flex justify-between items-center mb-2",children:[a.jsx("span",{className:"text-sm font-medium",children:"Generating personas in parallel..."}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[Math.round(g),"%"]})]}),a.jsx(fl,{value:g,className:"h-2"})]}),h?a.jsx(OZ,{generatedPersonas:c,selectedPersonas:d,isGenerating:o,onPersonaSelection:b,onRefinePersonas:w,onApprovePersonas:j,onBackToGenerator:()=>p(!1)}):a.jsx(SZ,{onSubmit:x,isGenerating:o})]})}const Mo=new Map;function D4(e){const{id:t,title:n,description:r,type:s="default",duration:i}=e;let o;switch(s){case"success":o=ce.success(n,{description:r,duration:i});break;case"error":o=ce.error(n,{description:r,duration:i});break;case"warning":o=ce.warning(n,{description:r,duration:i});break;case"info":o=ce.info(n,{description:r,duration:i});break;default:o=ce(n,{description:r,duration:i});break}return Mo.set(t,o.toString()),t}function $Z(e,t){const n=Mo.get(e);if(!n)return console.warn(`Toast with ID "${e}" not found. Creating new toast instead.`),D4({id:e,...t,title:t.title||"Updated"}),!1;const{title:r,description:s,type:i="default",duration:o}=t;ce.dismiss(n);let l;switch(i){case"success":l=ce.success(r,{description:s,duration:o});break;case"error":l=ce.error(r,{description:s,duration:o});break;case"warning":l=ce.warning(r,{description:s,duration:o});break;case"info":l=ce.info(r,{description:s,duration:o});break;default:l=ce(r,{description:s,duration:o});break}return Mo.set(e,l.toString()),!0}function IZ(e){const t=Mo.get(e);return t?(ce.dismiss(t),Mo.delete(e),!0):(console.warn(`Toast with ID "${e}" not found.`),!1)}function MZ(e){return Mo.has(e)}function RZ(){Mo.forEach(e=>{ce.dismiss(e)}),Mo.clear()}const Qe={success:ce.success,error:ce.error,warning:ce.warning,info:ce.info,loading:ce.loading,dismiss:ce.dismiss,createPersistent:D4,updatePersistent:$Z,dismissPersistent:IZ,hasPersistent:MZ,dismissAllPersistent:RZ};var L4=["PageUp","PageDown"],F4=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],B4={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},id="Slider",[y1,DZ,LZ]=Pp(id),[z4,POe]=Ir(id,[LZ]),[FZ,fx]=z4(id),U4=v.forwardRef((e,t)=>{const{name:n,min:r=0,max:s=100,step:i=1,orientation:o="horizontal",disabled:l=!1,minStepsBetweenThumbs:c=0,defaultValue:u=[r],value:d,onValueChange:f=()=>{},onValueCommit:h=()=>{},inverted:p=!1,form:g,...m}=e,x=v.useRef(new Set),b=v.useRef(0),w=o==="horizontal"?BZ:zZ,[j=[],S]=us({prop:d,defaultProp:u,onChange:T=>{var M;(M=[...x.current][b.current])==null||M.focus(),f(T)}}),N=v.useRef(j);function P(T){const k=GZ(j,T);O(T,k)}function _(T){O(T,b.current)}function A(){const T=N.current[b.current];j[b.current]!==T&&h(j)}function O(T,k,{commit:M}={commit:!1}){const R=YZ(i),H=ZZ(Math.round((T-r)/i)*i+r,R),F=xh(H,[r,s]);S((V=[])=>{const $=WZ(V,F,k);if(XZ($,c*i)){b.current=$.indexOf(F);const L=String($)!==String(V);return L&&M&&h($),L?$:V}else return V})}return a.jsx(FZ,{scope:e.__scopeSlider,name:n,disabled:l,min:r,max:s,valueIndexToChangeRef:b,thumbs:x.current,values:j,orientation:o,form:g,children:a.jsx(y1.Provider,{scope:e.__scopeSlider,children:a.jsx(y1.Slot,{scope:e.__scopeSlider,children:a.jsx(w,{"aria-disabled":l,"data-disabled":l?"":void 0,...m,ref:t,onPointerDown:$e(m.onPointerDown,()=>{l||(N.current=j)}),min:r,max:s,inverted:p,onSlideStart:l?void 0:P,onSlideMove:l?void 0:_,onSlideEnd:l?void 0:A,onHomeKeyDown:()=>!l&&O(r,0,{commit:!0}),onEndKeyDown:()=>!l&&O(s,j.length-1,{commit:!0}),onStepKeyDown:({event:T,direction:k})=>{if(!l){const H=L4.includes(T.key)||T.shiftKey&&F4.includes(T.key)?10:1,F=b.current,V=j[F],$=i*H*k;O(V+$,F,{commit:!0})}}})})})})});U4.displayName=id;var[V4,W4]=z4(id,{startEdge:"left",endEdge:"right",size:"width",direction:1}),BZ=v.forwardRef((e,t)=>{const{min:n,max:r,dir:s,inverted:i,onSlideStart:o,onSlideMove:l,onSlideEnd:c,onStepKeyDown:u,...d}=e,[f,h]=v.useState(null),p=pt(t,w=>h(w)),g=v.useRef(),m=Uo(s),x=m==="ltr",b=x&&!i||!x&&i;function y(w){const j=g.current||f.getBoundingClientRect(),S=[0,j.width],P=s_(S,b?[n,r]:[r,n]);return g.current=j,P(w-j.left)}return a.jsx(V4,{scope:e.__scopeSlider,startEdge:b?"left":"right",endEdge:b?"right":"left",direction:b?1:-1,size:"width",children:a.jsx(H4,{dir:m,"data-orientation":"horizontal",...d,ref:p,style:{...d.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:w=>{const j=y(w.clientX);o==null||o(j)},onSlideMove:w=>{const j=y(w.clientX);l==null||l(j)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:w=>{const S=B4[b?"from-left":"from-right"].includes(w.key);u==null||u({event:w,direction:S?-1:1})}})})}),zZ=v.forwardRef((e,t)=>{const{min:n,max:r,inverted:s,onSlideStart:i,onSlideMove:o,onSlideEnd:l,onStepKeyDown:c,...u}=e,d=v.useRef(null),f=pt(t,d),h=v.useRef(),p=!s;function g(m){const x=h.current||d.current.getBoundingClientRect(),b=[0,x.height],w=s_(b,p?[r,n]:[n,r]);return h.current=x,w(m-x.top)}return a.jsx(V4,{scope:e.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:a.jsx(H4,{"data-orientation":"vertical",...u,ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:m=>{const x=g(m.clientY);i==null||i(x)},onSlideMove:m=>{const x=g(m.clientY);o==null||o(x)},onSlideEnd:()=>{h.current=void 0,l==null||l()},onStepKeyDown:m=>{const b=B4[p?"from-bottom":"from-top"].includes(m.key);c==null||c({event:m,direction:b?-1:1})}})})}),H4=v.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:s,onSlideEnd:i,onHomeKeyDown:o,onEndKeyDown:l,onStepKeyDown:c,...u}=e,d=fx(id,n);return a.jsx(Xe.span,{...u,ref:t,onKeyDown:$e(e.onKeyDown,f=>{f.key==="Home"?(o(f),f.preventDefault()):f.key==="End"?(l(f),f.preventDefault()):L4.concat(F4).includes(f.key)&&(c(f),f.preventDefault())}),onPointerDown:$e(e.onPointerDown,f=>{const h=f.target;h.setPointerCapture(f.pointerId),f.preventDefault(),d.thumbs.has(h)?h.focus():r(f)}),onPointerMove:$e(e.onPointerMove,f=>{f.target.hasPointerCapture(f.pointerId)&&s(f)}),onPointerUp:$e(e.onPointerUp,f=>{const h=f.target;h.hasPointerCapture(f.pointerId)&&(h.releasePointerCapture(f.pointerId),i(f))})})}),G4="SliderTrack",q4=v.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,s=fx(G4,n);return a.jsx(Xe.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:t})});q4.displayName=G4;var x1="SliderRange",K4=v.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,s=fx(x1,n),i=W4(x1,n),o=v.useRef(null),l=pt(t,o),c=s.values.length,u=s.values.map(h=>Y4(h,s.min,s.max)),d=c>1?Math.min(...u):0,f=100-Math.max(...u);return a.jsx(Xe.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:l,style:{...e.style,[i.startEdge]:d+"%",[i.endEdge]:f+"%"}})});K4.displayName=x1;var b1="SliderThumb",X4=v.forwardRef((e,t)=>{const n=DZ(e.__scopeSlider),[r,s]=v.useState(null),i=pt(t,l=>s(l)),o=v.useMemo(()=>r?n().findIndex(l=>l.ref.current===r):-1,[n,r]);return a.jsx(UZ,{...e,ref:i,index:o})}),UZ=v.forwardRef((e,t)=>{const{__scopeSlider:n,index:r,name:s,...i}=e,o=fx(b1,n),l=W4(b1,n),[c,u]=v.useState(null),d=pt(t,y=>u(y)),f=c?o.form||!!c.closest("form"):!0,h=bp(c),p=o.values[r],g=p===void 0?0:Y4(p,o.min,o.max),m=HZ(r,o.values.length),x=h==null?void 0:h[l.size],b=x?qZ(x,g,l.direction):0;return v.useEffect(()=>{if(c)return o.thumbs.add(c),()=>{o.thumbs.delete(c)}},[c,o.thumbs]),a.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[l.startEdge]:`calc(${g}% + ${b}px)`},children:[a.jsx(y1.ItemSlot,{scope:e.__scopeSlider,children:a.jsx(Xe.span,{role:"slider","aria-label":e["aria-label"]||m,"aria-valuemin":o.min,"aria-valuenow":p,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,tabIndex:o.disabled?void 0:0,...i,ref:d,style:p===void 0?{display:"none"}:e.style,onFocus:$e(e.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),f&&a.jsx(VZ,{name:s??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:p},r)]})});X4.displayName=b1;var VZ=e=>{const{value:t,...n}=e,r=v.useRef(null),s=Cp(t);return v.useEffect(()=>{const i=r.current,o=window.HTMLInputElement.prototype,c=Object.getOwnPropertyDescriptor(o,"value").set;if(s!==t&&c){const u=new Event("input",{bubbles:!0});c.call(i,t),i.dispatchEvent(u)}},[s,t]),a.jsx("input",{style:{display:"none"},...n,ref:r,defaultValue:t})};function WZ(e=[],t,n){const r=[...e];return r[n]=t,r.sort((s,i)=>s-i)}function Y4(e,t,n){const i=100/(n-t)*(e-t);return xh(i,[0,100])}function HZ(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function GZ(e,t){if(e.length===1)return 0;const n=e.map(s=>Math.abs(s-t)),r=Math.min(...n);return n.indexOf(r)}function qZ(e,t,n){const r=e/2,i=s_([0,50],[0,r]);return(r-i(t)*n)*n}function KZ(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function XZ(e,t){if(t>0){const n=KZ(e);return Math.min(...n)>=t}return!0}function s_(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function YZ(e){return(String(e).split(".")[1]||"").length}function ZZ(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var Z4=U4,QZ=q4,JZ=K4,eQ=X4;const Bn=v.forwardRef(({className:e,...t},n)=>a.jsxs(Z4,{ref:n,className:Me("relative flex w-full touch-none select-none items-center",e),...t,children:[a.jsx(QZ,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:a.jsx(JZ,{className:"absolute h-full bg-primary"})}),a.jsx(eQ,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));Bn.displayName=Z4.displayName;var i_="Switch",[tQ,COe]=Ir(i_),[nQ,rQ]=tQ(i_),Q4=v.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:i,required:o,disabled:l,value:c="on",onCheckedChange:u,form:d,...f}=e,[h,p]=v.useState(null),g=pt(t,w=>p(w)),m=v.useRef(!1),x=h?d||!!h.closest("form"):!0,[b=!1,y]=us({prop:s,defaultProp:i,onChange:u});return a.jsxs(nQ,{scope:n,checked:b,disabled:l,children:[a.jsx(Xe.button,{type:"button",role:"switch","aria-checked":b,"aria-required":o,"data-state":tL(b),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:g,onClick:$e(e.onClick,w=>{y(j=>!j),x&&(m.current=w.isPropagationStopped(),m.current||w.stopPropagation())})}),x&&a.jsx(sQ,{control:h,bubbles:!m.current,name:r,value:c,checked:b,required:o,disabled:l,form:d,style:{transform:"translateX(-100%)"}})]})});Q4.displayName=i_;var J4="SwitchThumb",eL=v.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,s=rQ(J4,n);return a.jsx(Xe.span,{"data-state":tL(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:t})});eL.displayName=J4;var sQ=e=>{const{control:t,checked:n,bubbles:r=!0,...s}=e,i=v.useRef(null),o=Cp(n),l=bp(t);return v.useEffect(()=>{const c=i.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(o!==n&&f){const h=new Event("click",{bubbles:r});f.call(c,n),c.dispatchEvent(h)}},[o,n,r]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:i,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function tL(e){return e?"checked":"unchecked"}var nL=Q4,iQ=eL;const bh=v.forwardRef(({className:e,...t},n)=>a.jsx(nL,{className:Me("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:a.jsx(iQ,{className:Me("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));bh.displayName=nL.displayName;function aQ(e,t=[]){let n=[];function r(i,o){const l=v.createContext(o),c=n.length;n=[...n,o];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[e][c])||l,x=v.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:x,children:p})}function d(f,h){const p=(h==null?void 0:h[e][c])||l,g=v.useContext(p);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${i}\``)}return u.displayName=i+"Provider",[u,d]}const s=()=>{const i=n.map(o=>v.createContext(o));return function(l){const c=(l==null?void 0:l[e])||i;return v.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[r,oQ(s,...t)]}function oQ(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(i)[`__scope${u}`];return{...l,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var lb="rovingFocusGroup.onEntryFocus",lQ={bubbles:!1,cancelable:!0},hx="RovingFocusGroup",[w1,rL,cQ]=Pp(hx),[uQ,ad]=aQ(hx,[cQ]),[dQ,fQ]=uQ(hx),sL=v.forwardRef((e,t)=>a.jsx(w1.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(w1.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(hQ,{...e,ref:t})})}));sL.displayName=hx;var hQ=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,h=v.useRef(null),p=pt(t,h),g=Uo(i),[m=null,x]=us({prop:o,defaultProp:l,onChange:c}),[b,y]=v.useState(!1),w=Vn(u),j=rL(n),S=v.useRef(!1),[N,P]=v.useState(0);return v.useEffect(()=>{const _=h.current;if(_)return _.addEventListener(lb,w),()=>_.removeEventListener(lb,w)},[w]),a.jsx(dQ,{scope:n,orientation:r,dir:g,loop:s,currentTabStopId:m,onItemFocus:v.useCallback(_=>x(_),[x]),onItemShiftTab:v.useCallback(()=>y(!0),[]),onFocusableItemAdd:v.useCallback(()=>P(_=>_+1),[]),onFocusableItemRemove:v.useCallback(()=>P(_=>_-1),[]),children:a.jsx(Xe.div,{tabIndex:b||N===0?-1:0,"data-orientation":r,...f,ref:p,style:{outline:"none",...e.style},onMouseDown:$e(e.onMouseDown,()=>{S.current=!0}),onFocus:$e(e.onFocus,_=>{const A=!S.current;if(_.target===_.currentTarget&&A&&!b){const O=new CustomEvent(lb,lQ);if(_.currentTarget.dispatchEvent(O),!O.defaultPrevented){const T=j().filter(F=>F.focusable),k=T.find(F=>F.active),M=T.find(F=>F.id===m),H=[k,M,...T].filter(Boolean).map(F=>F.ref.current);oL(H,d)}}S.current=!1}),onBlur:$e(e.onBlur,()=>y(!1))})})}),iL="RovingFocusGroupItem",aL=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:i,...o}=e,l=Cs(),c=i||l,u=fQ(iL,n),d=u.currentTabStopId===c,f=rL(n),{onFocusableItemAdd:h,onFocusableItemRemove:p}=u;return v.useEffect(()=>{if(r)return h(),()=>p()},[r,h,p]),a.jsx(w1.ItemSlot,{scope:n,id:c,focusable:r,active:s,children:a.jsx(Xe.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...o,ref:t,onMouseDown:$e(e.onMouseDown,g=>{r?u.onItemFocus(c):g.preventDefault()}),onFocus:$e(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:$e(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){u.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const m=gQ(g,u.orientation,u.dir);if(m!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let b=f().filter(y=>y.focusable).map(y=>y.ref.current);if(m==="last")b.reverse();else if(m==="prev"||m==="next"){m==="prev"&&b.reverse();const y=b.indexOf(g.currentTarget);b=u.loop?vQ(b,y+1):b.slice(y+1)}setTimeout(()=>oL(b))}})})})});aL.displayName=iL;var pQ={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function mQ(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function gQ(e,t,n){const r=mQ(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return pQ[r]}function oL(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function vQ(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var a_=sL,o_=aL,l_="Tabs",[yQ,AOe]=Ir(l_,[ad]),lL=ad(),[xQ,c_]=yQ(l_),cL=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:i,orientation:o="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=Uo(l),[f,h]=us({prop:r,onChange:s,defaultProp:i});return a.jsx(xQ,{scope:n,baseId:Cs(),value:f,onValueChange:h,orientation:o,dir:d,activationMode:c,children:a.jsx(Xe.div,{dir:d,"data-orientation":o,...u,ref:t})})});cL.displayName=l_;var uL="TabsList",dL=v.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...s}=e,i=c_(uL,n),o=lL(n);return a.jsx(a_,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:r,children:a.jsx(Xe.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:t})})});dL.displayName=uL;var fL="TabsTrigger",hL=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...i}=e,o=c_(fL,n),l=lL(n),c=gL(o.baseId,r),u=vL(o.baseId,r),d=r===o.value;return a.jsx(o_,{asChild:!0,...l,focusable:!s,active:d,children:a.jsx(Xe.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...i,ref:t,onMouseDown:$e(e.onMouseDown,f=>{!s&&f.button===0&&f.ctrlKey===!1?o.onValueChange(r):f.preventDefault()}),onKeyDown:$e(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&o.onValueChange(r)}),onFocus:$e(e.onFocus,()=>{const f=o.activationMode!=="manual";!d&&!s&&f&&o.onValueChange(r)})})})});hL.displayName=fL;var pL="TabsContent",mL=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:s,children:i,...o}=e,l=c_(pL,n),c=gL(l.baseId,r),u=vL(l.baseId,r),d=r===l.value,f=v.useRef(d);return v.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),a.jsx(lr,{present:s||d,children:({present:h})=>a.jsx(Xe.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!h,id:u,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:h&&i})})});mL.displayName=pL;function gL(e,t){return`${e}-trigger-${t}`}function vL(e,t){return`${e}-content-${t}`}var bQ=cL,yL=dL,xL=hL,bL=mL;const Ho=bQ,$a=v.forwardRef(({className:e,...t},n)=>a.jsx(yL,{ref:n,className:Me("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));$a.displayName=yL.displayName;const Wt=v.forwardRef(({className:e,...t},n)=>a.jsx(xL,{ref:n,className:Me("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));Wt.displayName=xL.displayName;const Ht=v.forwardRef(({className:e,...t},n)=>a.jsx(bL,{ref:n,className:Me("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Ht.displayName=bL.displayName;const wQ=Re.object({name:Re.string().min(2,{message:"Name must be at least 2 characters."}),age:Re.string().min(1,{message:"Age is required."}),gender:Re.string().min(1,{message:"Gender is required."}),occupation:Re.string().min(2,{message:"Occupation is required."}),education:Re.string().min(1,{message:"Education is required."}),location:Re.string().min(2,{message:"Location is required."}),ethnicity:Re.string().optional(),personality:Re.string(),interests:Re.string(),hasPurchasingPower:Re.boolean().optional(),hasChildren:Re.boolean().optional(),techSavviness:Re.number().min(0).max(100),brandLoyalty:Re.number().min(0).max(100),priceConsciousness:Re.number().min(0).max(100),environmentalConcern:Re.number().min(0).max(100),socialGrade:Re.string().optional(),householdIncome:Re.string().optional(),householdComposition:Re.string().optional(),livingSituation:Re.string().optional(),goals:Re.array(Re.string()).optional(),frustrations:Re.array(Re.string()).optional(),motivations:Re.array(Re.string()).optional(),scenarios:Re.array(Re.string()).optional(),scenarioType:Re.string().optional(),oceanTraits:Re.object({openness:Re.number().min(0).max(100),conscientiousness:Re.number().min(0).max(100),extraversion:Re.number().min(0).max(100),agreeableness:Re.number().min(0).max(100),neuroticism:Re.number().min(0).max(100)}).optional(),thinkFeelDo:Re.object({thinks:Re.array(Re.string()),feels:Re.array(Re.string()),does:Re.array(Re.string())}).optional(),mediaConsumption:Re.string().optional(),deviceUsage:Re.string().optional(),shoppingHabits:Re.string().optional(),brandPreferences:Re.string().optional(),communicationPreferences:Re.string().optional(),paymentMethods:Re.string().optional(),purchaseBehaviour:Re.string().optional(),coreValues:Re.string().optional(),lifestyleChoices:Re.string().optional(),socialActivities:Re.string().optional(),categoryKnowledge:Re.string().optional(),decisionInfluences:Re.string().optional(),painPoints:Re.string().optional(),journeyContext:Re.string().optional(),keyTouchpoints:Re.string().optional(),selfDeterminationNeeds:Re.object({autonomy:Re.string(),competence:Re.string(),relatedness:Re.string()}).optional(),fears:Re.array(Re.string()).optional(),narrative:Re.string().optional(),additionalInformation:Re.string().optional()});function jQ({targetFolderId:e,targetFolderName:t}){const[n,r]=v.useState(1),[s,i]=v.useState(!1),[o,l]=v.useState(!1),[c,u]=v.useState(0),d=Rn(),{isAuthenticated:f,login:h}=Zl();v.useEffect(()=>{u(0)},[]),v.useEffect(()=>{(async()=>{if(!f&&!o){l(!0);try{console.log("Attempting auto login with default credentials"),await h("user","pass"),console.log("Auto login successful");const P=localStorage.getItem("auth_token");P?(console.log("Token successfully stored:",P.substring(0,10)+"..."),Qe.success("Logged in automatically with default account")):(console.error("Token not stored after successful login"),Qe.error("Authentication problem, token not stored"))}catch(P){console.error("Auto login failed:",P)}finally{l(!1)}}})()},[]);const p=tx({resolver:nx(wQ),defaultValues:{name:"",age:"",gender:"",occupation:"",education:"",location:"",ethnicity:"",personality:"",interests:"",hasPurchasingPower:!1,hasChildren:!1,techSavviness:50,brandLoyalty:50,priceConsciousness:50,environmentalConcern:50,socialGrade:"",householdIncome:"",householdComposition:"",livingSituation:"",goals:[],frustrations:[],motivations:[],scenarios:[],scenarioType:"",oceanTraits:{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},thinkFeelDo:{thinks:[],feels:[],does:[]},mediaConsumption:"",deviceUsage:"",shoppingHabits:"",brandPreferences:"",communicationPreferences:"",paymentMethods:"",purchaseBehaviour:"",coreValues:"",lifestyleChoices:"",socialActivities:"",categoryKnowledge:"",decisionInfluences:"",painPoints:"",journeyContext:"",keyTouchpoints:"",selfDeterminationNeeds:{autonomy:"",competence:"",relatedness:""},fears:[],narrative:"",additionalInformation:""}}),g=N=>{const P=p.getValues(N)||[];p.setValue(N,[...P,""])},m=(N,P,_)=>{const O=[...p.getValues(N)||[]];O[P]=_,p.setValue(N,O)},x=(N,P)=>{const A=[...p.getValues(N)||[]];A.splice(P,1),p.setValue(N,A)},b=N=>{const P=p.getValues("thinkFeelDo")||{thinks:[],feels:[],does:[]},_={...P,[N]:[...P[N]||[],""]};p.setValue("thinkFeelDo",_)},y=(N,P,_)=>{const A=p.getValues("thinkFeelDo")||{thinks:[],feels:[],does:[]},O=[...A[N]||[]];O[P]=_;const T={...A,[N]:O};p.setValue("thinkFeelDo",T)},w=(N,P)=>{const _=p.getValues("thinkFeelDo")||{thinks:[],feels:[],does:[]},A=[..._[N]||[]];A.splice(P,1);const O={..._,[N]:A};p.setValue("thinkFeelDo",O)},j=(N,P)=>{const A={...p.getValues("oceanTraits")||{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},[N]:P};p.setValue("oceanTraits",A)};async function S(N,P=!1){var _,A,O,T,k;if(P&&c>=1){console.log("Max retry attempts reached, stopping retry loop"),Qe.error("Authentication failed after multiple attempts",{description:"Please try logging in manually (user/pass)"}),d("/login",{state:{from:"/synthetic-users"}}),i(!1);return}P?(u(M=>M+1),console.log(`Retry attempt ${c+1}`)):u(0),i(!0);try{if(!f)try{console.log("Not authenticated, attempting login with default credentials before submission"),await h("user","pass"),console.log("Login successful before persona creation")}catch(L){console.error("Login failed before persona creation:",L),Qe.error("Authentication required",{description:"Please log in before creating personas. Default: user/pass"}),d("/login",{state:{from:"/synthetic-users"}}),i(!1);return}const M=`persona-generation-${Date.now()}`,R=e&&t?` in "${t}" folder`:"",H=n>1?`${n} personas`:"persona";console.log(`UserCreator - Creating ${H}${R}`),Qe.createPersistent({id:M,title:`Generating ${H}...`,description:`Creating synthetic user profile${n>1?"s":""}${R}`,type:"info"});const F={...N,oceanTraits:N.oceanTraits||{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},thinkFeelDo:N.thinkFeelDo||{thinks:[],feels:[],does:[]},folderId:e||void 0},V={id:`temp-${Date.now()}`,...F},$=JSON.parse(localStorage.getItem("tempPersonas")||"[]");if($.push(V),localStorage.setItem("tempPersonas",JSON.stringify($)),n===1)try{if(!localStorage.getItem("auth_token")){console.error("No authentication token found"),Qe.error("Authentication required",{description:"No valid token found. Please log in again."});try{console.log("No token found, attempting new login"),await h("user","pass"),console.log("Login successful, token:",((_=localStorage.getItem("auth_token"))==null?void 0:_.substring(0,10))+"...")}catch(Q){throw console.error("Login retry failed:",Q),new Error("Authentication failed after retry")}}console.log("Sending persona creation request to API with auth token");const Y=await $n.create(F);console.log("Persona created successfully:",Y),Qe.updatePersistent(M,{title:"Synthetic user created successfully",description:`Created profile for ${N.name}`,type:"success"})}catch(L){throw console.error("Error creating persona via API:",L),L.response&&L.response.status===401&&Qe.error("Authentication error",{description:"Failed to authenticate with server. Please try again."}),L}else{const L=[];L.push(F);for(let Y=1;Y{d("/synthetic-users")},300)}catch(M){if(console.error("Error creating personas:",M),M.response&&M.response.status===401||M.message&&M.message.includes("Authentication failed")&&c<1)try{console.log("Got auth error, attempting login retry with default credentials"),localStorage.removeItem("auth_token");const R=await a1.login("user","pass");if((O=R==null?void 0:R.data)!=null&&O.access_token){localStorage.setItem("auth_token",R.data.access_token),localStorage.setItem("user",JSON.stringify(R.data.user)),console.log("Manual login successful, got new token:",R.data.access_token.substring(0,10)+"..."),Qe.info("Logged in with default account, retrying submission..."),setTimeout(()=>{S(N,!0)},500);return}else throw new Error("No access token received")}catch(R){console.error("Login retry failed:",R),Qe.error("Authentication error",{description:"Cannot authenticate with server. Please contact support."})}else Qe.updatePersistent(generationToastId,{title:"Failed to create synthetic users",description:((k=(T=M.response)==null?void 0:T.data)==null?void 0:k.message)||M.message||"An unexpected error occurred",type:"error"})}finally{i(!1)}}return a.jsxs("div",{className:"glass-panel rounded-xl p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsx("h2",{className:"text-2xl font-sf font-semibold",children:"Create Synthetic Users"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(se,{variant:"outline",size:"sm",onClick:()=>r(Math.max(1,n-1)),children:"-"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(er,{size:16,className:"text-muted-foreground"}),a.jsx("span",{className:"text-sm font-medium",children:n})]}),a.jsx(se,{variant:"outline",size:"sm",onClick:()=>r(n+1),children:"+"})]})]}),a.jsx(sx,{...p,children:a.jsxs("form",{onSubmit:p.handleSubmit(S),className:"space-y-6",children:[a.jsxs(Ho,{defaultValue:"basic",children:[a.jsxs($a,{className:"grid w-full grid-cols-6",children:[a.jsx(Wt,{value:"basic",children:"Basic"}),a.jsx(Wt,{value:"cooper",children:"Cooper"}),a.jsx(Wt,{value:"personality",children:"Personality"}),a.jsx(Wt,{value:"demographics",children:"Demographics"}),a.jsx(Wt,{value:"lifestyle",children:"Lifestyle"}),a.jsx(Wt,{value:"extended",children:"Extended"})]}),a.jsx(Ht,{value:"basic",className:"mt-6",children:a.jsx(Ke,{children:a.jsx(lt,{className:"p-6",children:a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx(ot,{control:p.control,name:"name",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Name"}),a.jsx(st,{children:a.jsx(_t,{placeholder:"Jane Smith",...N})}),a.jsx(it,{})]})}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(ot,{control:p.control,name:"age",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Age Range"}),a.jsxs(On,{onValueChange:N.onChange,defaultValue:N.value,children:[a.jsx(st,{children:a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select age range"})})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"18-24",children:"18-24"}),a.jsx(ye,{value:"25-34",children:"25-34"}),a.jsx(ye,{value:"35-44",children:"35-44"}),a.jsx(ye,{value:"45-54",children:"45-54"}),a.jsx(ye,{value:"55-64",children:"55-64"}),a.jsx(ye,{value:"65+",children:"65+"})]})]}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"gender",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Gender"}),a.jsxs(On,{onValueChange:N.onChange,defaultValue:N.value,children:[a.jsx(st,{children:a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select gender"})})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"Male",children:"Male"}),a.jsx(ye,{value:"Female",children:"Female"}),a.jsx(ye,{value:"Non-binary",children:"Non-binary"}),a.jsx(ye,{value:"Other",children:"Other"})]})]}),a.jsx(it,{})]})})]}),a.jsx(ot,{control:p.control,name:"occupation",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Occupation"}),a.jsx(st,{children:a.jsx(_t,{placeholder:"Software Engineer",...N})}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"education",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Education"}),a.jsxs(On,{onValueChange:N.onChange,defaultValue:N.value,children:[a.jsx(st,{children:a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select education level"})})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"High School",children:"High School"}),a.jsx(ye,{value:"Some College",children:"Some College"}),a.jsx(ye,{value:"Associate's Degree",children:"Associate's Degree"}),a.jsx(ye,{value:"Bachelor's Degree",children:"Bachelor's Degree"}),a.jsx(ye,{value:"Master's Degree",children:"Master's Degree"}),a.jsx(ye,{value:"PhD",children:"PhD"})]})]}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"location",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Location"}),a.jsx(st,{children:a.jsx(_t,{placeholder:"New York, USA",...N})}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"ethnicity",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Ethnicity (Optional)"}),a.jsxs(On,{onValueChange:N.onChange,defaultValue:N.value,children:[a.jsx(st,{children:a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select ethnicity"})})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"white",children:"White"}),a.jsx(ye,{value:"black",children:"Black"}),a.jsx(ye,{value:"asian",children:"Asian"}),a.jsx(ye,{value:"hispanic",children:"Hispanic/Latino"}),a.jsx(ye,{value:"native-american",children:"Native American"}),a.jsx(ye,{value:"middle-eastern",children:"Middle Eastern"}),a.jsx(ye,{value:"mixed",children:"Mixed"}),a.jsx(ye,{value:"other",children:"Other"}),a.jsx(ye,{value:"prefer-not-to-say",children:"Prefer not to say"})]})]}),a.jsx(it,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(ot,{control:p.control,name:"personality",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Personality Traits"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Curious, analytical, detail-oriented",...N,rows:3})}),a.jsx(on,{children:"Describe key personality traits that define this user"}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"interests",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Interests"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Technology, fitness, cooking, travel",...N,rows:3})}),a.jsx(on,{children:"List interests, hobbies and activities this user enjoys"}),a.jsx(it,{})]})}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h3",{className:"font-medium text-sm",children:"Behavioral Attributes"}),a.jsx(ot,{control:p.control,name:"techSavviness",render:({field:N})=>a.jsxs(nt,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(rt,{children:"Tech Savviness"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[N.value,"%"]})]}),a.jsx(st,{children:a.jsx(Bn,{min:0,max:100,step:1,value:[N.value],onValueChange:P=>N.onChange(P[0])})}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"brandLoyalty",render:({field:N})=>a.jsxs(nt,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(rt,{children:"Brand Loyalty"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[N.value,"%"]})]}),a.jsx(st,{children:a.jsx(Bn,{min:0,max:100,step:1,value:[N.value],onValueChange:P=>N.onChange(P[0])})}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"priceConsciousness",render:({field:N})=>a.jsxs(nt,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(rt,{children:"Price Consciousness"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[N.value,"%"]})]}),a.jsx(st,{children:a.jsx(Bn,{min:0,max:100,step:1,value:[N.value],onValueChange:P=>N.onChange(P[0])})}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"environmentalConcern",render:({field:N})=>a.jsxs(nt,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(rt,{children:"Environmental Concern"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[N.value,"%"]})]}),a.jsx(st,{children:a.jsx(Bn,{min:0,max:100,step:1,value:[N.value],onValueChange:P=>N.onChange(P[0])})}),a.jsx(it,{})]})}),a.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-2",children:[a.jsx(ot,{control:p.control,name:"hasPurchasingPower",render:({field:N})=>a.jsxs(nt,{className:"flex items-center justify-between",children:[a.jsx(rt,{children:"Purchasing Power"}),a.jsx(st,{children:a.jsx(bh,{checked:N.value,onCheckedChange:N.onChange})}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"hasChildren",render:({field:N})=>a.jsxs(nt,{className:"flex items-center justify-between",children:[a.jsx(rt,{children:"Has Children"}),a.jsx(st,{children:a.jsx(bh,{checked:N.value,onCheckedChange:N.onChange})}),a.jsx(it,{})]})})]})]})]})]})})})}),a.jsxs(Ht,{value:"cooper",className:"mt-6 space-y-6",children:[a.jsx(Ke,{children:a.jsxs(lt,{className:"p-6",children:[a.jsxs("div",{className:"mb-4",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Goals"}),(p.watch("goals")||[]).map((N,P)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(_t,{value:N,onChange:_=>m("goals",P,_.target.value),placeholder:"Enter a goal"}),a.jsx(se,{variant:"ghost",size:"icon",type:"button",onClick:()=>x("goals",P),children:a.jsx(wn,{className:"h-4 w-4 text-muted-foreground"})})]},P)),a.jsxs(se,{variant:"outline",size:"sm",type:"button",onClick:()=>g("goals"),className:"mt-2",children:[a.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Goal"]})]}),a.jsxs("div",{className:"mb-4 pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Frustrations"}),(p.watch("frustrations")||[]).map((N,P)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(_t,{value:N,onChange:_=>m("frustrations",P,_.target.value),placeholder:"Enter a frustration"}),a.jsx(se,{variant:"ghost",size:"icon",type:"button",onClick:()=>x("frustrations",P),children:a.jsx(wn,{className:"h-4 w-4 text-muted-foreground"})})]},P)),a.jsxs(se,{variant:"outline",size:"sm",type:"button",onClick:()=>g("frustrations"),className:"mt-2",children:[a.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Frustration"]})]}),a.jsxs("div",{className:"mb-4 pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Motivations"}),(p.watch("motivations")||[]).map((N,P)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(_t,{value:N,onChange:_=>m("motivations",P,_.target.value),placeholder:"Enter a motivation"}),a.jsx(se,{variant:"ghost",size:"icon",type:"button",onClick:()=>x("motivations",P),children:a.jsx(wn,{className:"h-4 w-4 text-muted-foreground"})})]},P)),a.jsxs(se,{variant:"outline",size:"sm",type:"button",onClick:()=>g("motivations"),className:"mt-2",children:[a.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Motivation"]})]})]})}),a.jsx(Ke,{children:a.jsxs(lt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Think, Feel, Do"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Thinks"}),((p.watch("thinkFeelDo")||{thinks:[],feels:[],does:[]}).thinks||[]).map((N,P)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(_t,{value:N,onChange:_=>y("thinks",P,_.target.value),placeholder:"What they think"}),a.jsx(se,{variant:"ghost",size:"icon",type:"button",onClick:()=>w("thinks",P),children:a.jsx(wn,{className:"h-4 w-4 text-muted-foreground"})})]},P)),a.jsxs(se,{variant:"outline",size:"sm",type:"button",onClick:()=>b("thinks"),className:"mt-2",children:[a.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Thought"]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Feels"}),((p.watch("thinkFeelDo")||{thinks:[],feels:[],does:[]}).feels||[]).map((N,P)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(_t,{value:N,onChange:_=>y("feels",P,_.target.value),placeholder:"What they feel"}),a.jsx(se,{variant:"ghost",size:"icon",type:"button",onClick:()=>w("feels",P),children:a.jsx(wn,{className:"h-4 w-4 text-muted-foreground"})})]},P)),a.jsxs(se,{variant:"outline",size:"sm",type:"button",onClick:()=>b("feels"),className:"mt-2",children:[a.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Feeling"]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Does"}),((p.watch("thinkFeelDo")||{thinks:[],feels:[],does:[]}).does||[]).map((N,P)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(_t,{value:N,onChange:_=>y("does",P,_.target.value),placeholder:"What they do"}),a.jsx(se,{variant:"ghost",size:"icon",type:"button",onClick:()=>w("does",P),children:a.jsx(wn,{className:"h-4 w-4 text-muted-foreground"})})]},P)),a.jsxs(se,{variant:"outline",size:"sm",type:"button",onClick:()=>b("does"),className:"mt-2",children:[a.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Action"]})]})]})]})}),a.jsx(Ke,{children:a.jsx(lt,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsx(ot,{control:p.control,name:"scenarioType",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Scenario Section Title"}),a.jsx(st,{children:a.jsx(_t,{placeholder:"Life Scenarios",...N})}),a.jsx(on,{children:'Custom title for the scenarios section (e.g., "Customer Journey", "Use Cases")'}),a.jsx(it,{})]})}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Usage Scenarios"}),(p.watch("scenarios")||[]).map((N,P)=>a.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[a.jsx(et,{value:N,onChange:_=>m("scenarios",P,_.target.value),rows:2,placeholder:"Describe a usage scenario"}),a.jsx(se,{variant:"ghost",size:"icon",type:"button",onClick:()=>x("scenarios",P),className:"mt-2",children:a.jsx(wn,{className:"h-4 w-4 text-muted-foreground"})})]},P)),a.jsxs(se,{variant:"outline",size:"sm",type:"button",onClick:()=>g("scenarios"),className:"mt-2",children:[a.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Scenario"]})]})]})})})]}),a.jsx(Ht,{value:"personality",className:"mt-6",children:a.jsx(Ke,{children:a.jsxs(lt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"OCEAN Personality Traits"}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Openness to Experience"}),a.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{openness:50}).openness||50,"%"]})]}),a.jsx(Bn,{value:[(p.watch("oceanTraits")||{openness:50}).openness||50],onValueChange:N=>j("openness",N[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Creativity, curiosity, and openness to new ideas"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Conscientiousness"}),a.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{conscientiousness:50}).conscientiousness||50,"%"]})]}),a.jsx(Bn,{value:[(p.watch("oceanTraits")||{conscientiousness:50}).conscientiousness||50],onValueChange:N=>j("conscientiousness",N[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Organization, responsibility, and self-discipline"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Extraversion"}),a.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{extraversion:50}).extraversion||50,"%"]})]}),a.jsx(Bn,{value:[(p.watch("oceanTraits")||{extraversion:50}).extraversion||50],onValueChange:N=>j("extraversion",N[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Sociability, assertiveness, and talkativeness"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Agreeableness"}),a.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{agreeableness:50}).agreeableness||50,"%"]})]}),a.jsx(Bn,{value:[(p.watch("oceanTraits")||{agreeableness:50}).agreeableness||50],onValueChange:N=>j("agreeableness",N[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Compassion, cooperation, and concern for others"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Neuroticism"}),a.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{neuroticism:50}).neuroticism||50,"%"]})]}),a.jsx(Bn,{value:[(p.watch("oceanTraits")||{neuroticism:50}).neuroticism||50],onValueChange:N=>j("neuroticism",N[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Emotional reactivity, anxiety, and sensitivity to stress"})]})]})]})})}),a.jsx(Ht,{value:"demographics",className:"mt-6",children:a.jsx(Ke,{children:a.jsxs(lt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Demographic Information"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx(ot,{control:p.control,name:"socialGrade",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Social Grade"}),a.jsxs(On,{onValueChange:N.onChange,defaultValue:N.value,children:[a.jsx(st,{children:a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select social grade"})})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"A",children:"A - Higher managerial"}),a.jsx(ye,{value:"B",children:"B - Intermediate managerial"}),a.jsx(ye,{value:"C1",children:"C1 - Supervisory or clerical"}),a.jsx(ye,{value:"C2",children:"C2 - Skilled manual workers"}),a.jsx(ye,{value:"D",children:"D - Semi and unskilled manual workers"}),a.jsx(ye,{value:"E",children:"E - State pensioners, unemployed"})]})]}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"householdIncome",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Household Income"}),a.jsxs(On,{onValueChange:N.onChange,defaultValue:N.value,children:[a.jsx(st,{children:a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select income range"})})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"Under $25k",children:"Under $25,000"}),a.jsx(ye,{value:"$25k-$50k",children:"$25,000 - $50,000"}),a.jsx(ye,{value:"$50k-$75k",children:"$50,000 - $75,000"}),a.jsx(ye,{value:"$75k-$100k",children:"$75,000 - $100,000"}),a.jsx(ye,{value:"$100k-$150k",children:"$100,000 - $150,000"}),a.jsx(ye,{value:"$150k-$250k",children:"$150,000 - $250,000"}),a.jsx(ye,{value:"Over $250k",children:"Over $250,000"}),a.jsx(ye,{value:"Prefer not to say",children:"Prefer not to say"})]})]}),a.jsx(it,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(ot,{control:p.control,name:"householdComposition",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Household Composition"}),a.jsxs(On,{onValueChange:N.onChange,defaultValue:N.value,children:[a.jsx(st,{children:a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select household type"})})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"Single person",children:"Single person"}),a.jsx(ye,{value:"Couple without children",children:"Couple without children"}),a.jsx(ye,{value:"Couple with children",children:"Couple with children"}),a.jsx(ye,{value:"Single parent",children:"Single parent"}),a.jsx(ye,{value:"Multi-generational",children:"Multi-generational"}),a.jsx(ye,{value:"Shared housing",children:"Shared housing"}),a.jsx(ye,{value:"Other",children:"Other"})]})]}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"livingSituation",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Living Situation"}),a.jsxs(On,{onValueChange:N.onChange,defaultValue:N.value,children:[a.jsx(st,{children:a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select living situation"})})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"Own home",children:"Own home"}),a.jsx(ye,{value:"Rent apartment",children:"Rent apartment"}),a.jsx(ye,{value:"Rent house",children:"Rent house"}),a.jsx(ye,{value:"Live with family",children:"Live with family"}),a.jsx(ye,{value:"Student housing",children:"Student housing"}),a.jsx(ye,{value:"Assisted living",children:"Assisted living"}),a.jsx(ye,{value:"Other",children:"Other"})]})]}),a.jsx(it,{})]})})]})]})]})})}),a.jsx(Ht,{value:"lifestyle",className:"mt-6",children:a.jsx(Ke,{children:a.jsxs(lt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Lifestyle & Behavior"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx(ot,{control:p.control,name:"mediaConsumption",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Media Consumption"}),a.jsx(st,{children:a.jsx(et,{placeholder:"TV shows, podcasts, news sources, social media platforms",...N,rows:3})}),a.jsx(on,{children:"Describe media consumption habits and preferences"}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"deviceUsage",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Device Usage"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Smartphone, laptop, tablet, smart TV, gaming console",...N,rows:3})}),a.jsx(on,{children:"Primary devices and usage patterns"}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"shoppingHabits",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Shopping Habits"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Online vs in-store, frequency, preferred retailers",...N,rows:3})}),a.jsx(on,{children:"Shopping behavior and preferences"}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"brandPreferences",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Brand Preferences"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Favorite brands, brand values alignment",...N,rows:3})}),a.jsx(on,{children:"Preferred brands and reasoning"}),a.jsx(it,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(ot,{control:p.control,name:"communicationPreferences",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Communication Preferences"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Email, phone, text, video calls, in-person",...N,rows:3})}),a.jsx(on,{children:"Preferred communication methods and channels"}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"paymentMethods",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Payment Methods"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Credit cards, digital wallets, cash, BNPL",...N,rows:3})}),a.jsx(on,{children:"Preferred payment methods and financial tools"}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"purchaseBehaviour",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Purchase Behavior"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Research habits, decision factors, impulse vs planned buying",...N,rows:3})}),a.jsx(on,{children:"How they approach making purchase decisions"}),a.jsx(it,{})]})})]})]})]})})}),a.jsxs(Ht,{value:"extended",className:"mt-6 space-y-6",children:[a.jsx(Ke,{children:a.jsxs(lt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Extended Profile"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx(ot,{control:p.control,name:"coreValues",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Core Values"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Key principles and values that guide decisions",...N,rows:3})}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"lifestyleChoices",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Lifestyle Choices"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Health, fitness, diet, work-life balance preferences",...N,rows:3})}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"socialActivities",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Social Activities"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Social hobbies, community involvement, networking",...N,rows:3})}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"categoryKnowledge",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Category Knowledge"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Expertise in specific product/service categories",...N,rows:3})}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"decisionInfluences",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Decision Influences"}),a.jsx(st,{children:a.jsx(et,{placeholder:"What factors most influence their decisions",...N,rows:3})}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"painPoints",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Pain Points"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Common challenges and friction points",...N,rows:3})}),a.jsx(it,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(ot,{control:p.control,name:"journeyContext",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Journey Context"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Current life stage and contextual factors",...N,rows:3})}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"keyTouchpoints",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Key Touchpoints"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Important interaction points and channels",...N,rows:3})}),a.jsx(it,{})]})}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h4",{className:"font-medium text-sm",children:"Self-Determination Needs"}),a.jsx(ot,{control:p.control,name:"selfDeterminationNeeds.autonomy",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Autonomy"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Need for independence and self-direction",...N,rows:2})}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"selfDeterminationNeeds.competence",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Competence"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Need to feel capable and effective",...N,rows:2})}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"selfDeterminationNeeds.relatedness",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Relatedness"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Need for connection and belonging",...N,rows:2})}),a.jsx(it,{})]})})]})]})]})]})}),a.jsx(Ke,{children:a.jsx(lt,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Fears & Concerns"}),(p.watch("fears")||[]).map((N,P)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(_t,{value:N,onChange:_=>m("fears",P,_.target.value),placeholder:"Enter a fear or concern"}),a.jsx(se,{variant:"ghost",size:"icon",type:"button",onClick:()=>x("fears",P),children:a.jsx(wn,{className:"h-4 w-4 text-muted-foreground"})})]},P)),a.jsxs(se,{variant:"outline",size:"sm",type:"button",onClick:()=>g("fears"),className:"mt-2",children:[a.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Fear/Concern"]})]}),a.jsx(ot,{control:p.control,name:"narrative",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Personal Narrative"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Personal story, background, key life experiences",...N,rows:4})}),a.jsx(on,{children:"A brief narrative that captures their personal story"}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"additionalInformation",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Additional Information"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Any other relevant details or context",...N,rows:4})}),a.jsx(on,{children:"Additional context or details not covered elsewhere"}),a.jsx(it,{})]})})]})})})]})]}),a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsx(se,{variant:"outline",type:"button",onClick:()=>p.reset(),children:"Reset"}),a.jsxs(se,{type:"submit",disabled:s,children:[s?a.jsx(NG,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(CN,{className:"mr-2 h-4 w-4"}),s?"Creating...":`Create ${n>1?`${n} Users`:"User"}`]})]})]})})]})}var j1=["Enter"," "],SQ=["ArrowDown","PageUp","Home"],wL=["ArrowUp","PageDown","End"],NQ=[...SQ,...wL],_Q={ltr:[...j1,"ArrowRight"],rtl:[...j1,"ArrowLeft"]},PQ={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Tp="Menu",[wh,CQ,AQ]=Pp(Tp),[Ql,jL]=Ir(Tp,[AQ,Yu,ad]),px=Yu(),SL=ad(),[EQ,Jl]=Ql(Tp),[OQ,$p]=Ql(Tp),NL=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:s,onOpenChange:i,modal:o=!0}=e,l=px(t),[c,u]=v.useState(null),d=v.useRef(!1),f=Vn(i),h=Uo(s);return v.useEffect(()=>{const p=()=>{d.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>d.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),a.jsx(qM,{...l,children:a.jsx(EQ,{scope:t,open:n,onOpenChange:f,content:c,onContentChange:u,children:a.jsx(OQ,{scope:t,onClose:v.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:h,modal:o,children:r})})})};NL.displayName=Tp;var kQ="MenuAnchor",u_=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=px(n);return a.jsx(pN,{...s,...r,ref:t})});u_.displayName=kQ;var d_="MenuPortal",[TQ,_L]=Ql(d_,{forceMount:void 0}),PL=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:s}=e,i=Jl(d_,t);return a.jsx(TQ,{scope:t,forceMount:n,children:a.jsx(lr,{present:n||i.open,children:a.jsx(By,{asChild:!0,container:s,children:r})})})};PL.displayName=d_;var As="MenuContent",[$Q,f_]=Ql(As),CL=v.forwardRef((e,t)=>{const n=_L(As,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,i=Jl(As,e.__scopeMenu),o=$p(As,e.__scopeMenu);return a.jsx(wh.Provider,{scope:e.__scopeMenu,children:a.jsx(lr,{present:r||i.open,children:a.jsx(wh.Slot,{scope:e.__scopeMenu,children:o.modal?a.jsx(IQ,{...s,ref:t}):a.jsx(MQ,{...s,ref:t})})})})}),IQ=v.forwardRef((e,t)=>{const n=Jl(As,e.__scopeMenu),r=v.useRef(null),s=pt(t,r);return v.useEffect(()=>{const i=r.current;if(i)return qN(i)},[]),a.jsx(h_,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:$e(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),MQ=v.forwardRef((e,t)=>{const n=Jl(As,e.__scopeMenu);return a.jsx(h_,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),h_=v.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:p,disableOutsideScroll:g,...m}=e,x=Jl(As,n),b=$p(As,n),y=px(n),w=SL(n),j=CQ(n),[S,N]=v.useState(null),P=v.useRef(null),_=pt(t,P,x.onContentChange),A=v.useRef(0),O=v.useRef(""),T=v.useRef(0),k=v.useRef(null),M=v.useRef("right"),R=v.useRef(0),H=g?lx:v.Fragment,F=g?{as:xa,allowPinchZoom:!0}:void 0,V=L=>{var ue,Ae;const Y=O.current+L,Q=j().filter(de=>!de.disabled),ee=document.activeElement,fe=(ue=Q.find(de=>de.ref.current===ee))==null?void 0:ue.textValue,W=Q.map(de=>de.textValue),he=qQ(W,Y,fe),pe=(Ae=Q.find(de=>de.textValue===he))==null?void 0:Ae.ref.current;(function de(oe){O.current=oe,window.clearTimeout(A.current),oe!==""&&(A.current=window.setTimeout(()=>de(""),1e3))})(Y),pe&&setTimeout(()=>pe.focus())};v.useEffect(()=>()=>window.clearTimeout(A.current),[]),GN();const $=v.useCallback(L=>{var Q,ee;return M.current===((Q=k.current)==null?void 0:Q.side)&&XQ(L,(ee=k.current)==null?void 0:ee.area)},[]);return a.jsx($Q,{scope:n,searchRef:O,onItemEnter:v.useCallback(L=>{$(L)&&L.preventDefault()},[$]),onItemLeave:v.useCallback(L=>{var Y;$(L)||((Y=P.current)==null||Y.focus(),N(null))},[$]),onTriggerLeave:v.useCallback(L=>{$(L)&&L.preventDefault()},[$]),pointerGraceTimerRef:T,onPointerGraceIntentChange:v.useCallback(L=>{k.current=L},[]),children:a.jsx(H,{...F,children:a.jsx(ax,{asChild:!0,trapped:s,onMountAutoFocus:$e(i,L=>{var Y;L.preventDefault(),(Y=P.current)==null||Y.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:a.jsx(yp,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:p,children:a.jsx(a_,{asChild:!0,...w,dir:b.dir,orientation:"vertical",loop:r,currentTabStopId:S,onCurrentTabStopIdChange:N,onEntryFocus:$e(c,L=>{b.isUsingKeyboardRef.current||L.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(mN,{role:"menu","aria-orientation":"vertical","data-state":VL(x.open),"data-radix-menu-content":"",dir:b.dir,...y,...m,ref:_,style:{outline:"none",...m.style},onKeyDown:$e(m.onKeyDown,L=>{const Q=L.target.closest("[data-radix-menu-content]")===L.currentTarget,ee=L.ctrlKey||L.altKey||L.metaKey,fe=L.key.length===1;Q&&(L.key==="Tab"&&L.preventDefault(),!ee&&fe&&V(L.key));const W=P.current;if(L.target!==W||!NQ.includes(L.key))return;L.preventDefault();const pe=j().filter(ue=>!ue.disabled).map(ue=>ue.ref.current);wL.includes(L.key)&&pe.reverse(),HQ(pe)}),onBlur:$e(e.onBlur,L=>{L.currentTarget.contains(L.target)||(window.clearTimeout(A.current),O.current="")}),onPointerMove:$e(e.onPointerMove,jh(L=>{const Y=L.target,Q=R.current!==L.clientX;if(L.currentTarget.contains(Y)&&Q){const ee=L.clientX>R.current?"right":"left";M.current=ee,R.current=L.clientX}}))})})})})})})});CL.displayName=As;var RQ="MenuGroup",p_=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return a.jsx(Xe.div,{role:"group",...r,ref:t})});p_.displayName=RQ;var DQ="MenuLabel",AL=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return a.jsx(Xe.div,{...r,ref:t})});AL.displayName=DQ;var Jg="MenuItem",IE="menu.itemSelect",mx=v.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...s}=e,i=v.useRef(null),o=$p(Jg,e.__scopeMenu),l=f_(Jg,e.__scopeMenu),c=pt(t,i),u=v.useRef(!1),d=()=>{const f=i.current;if(!n&&f){const h=new CustomEvent(IE,{bubbles:!0,cancelable:!0});f.addEventListener(IE,p=>r==null?void 0:r(p),{once:!0}),PM(f,h),h.defaultPrevented?u.current=!1:o.onClose()}};return a.jsx(EL,{...s,ref:c,disabled:n,onClick:$e(e.onClick,d),onPointerDown:f=>{var h;(h=e.onPointerDown)==null||h.call(e,f),u.current=!0},onPointerUp:$e(e.onPointerUp,f=>{var h;u.current||(h=f.currentTarget)==null||h.click()}),onKeyDown:$e(e.onKeyDown,f=>{const h=l.searchRef.current!=="";n||h&&f.key===" "||j1.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});mx.displayName=Jg;var EL=v.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...i}=e,o=f_(Jg,n),l=SL(n),c=v.useRef(null),u=pt(t,c),[d,f]=v.useState(!1),[h,p]=v.useState("");return v.useEffect(()=>{const g=c.current;g&&p((g.textContent??"").trim())},[i.children]),a.jsx(wh.ItemSlot,{scope:n,disabled:r,textValue:s??h,children:a.jsx(o_,{asChild:!0,...l,focusable:!r,children:a.jsx(Xe.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:u,onPointerMove:$e(e.onPointerMove,jh(g=>{r?o.onItemLeave(g):(o.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:$e(e.onPointerLeave,jh(g=>o.onItemLeave(g))),onFocus:$e(e.onFocus,()=>f(!0)),onBlur:$e(e.onBlur,()=>f(!1))})})})}),LQ="MenuCheckboxItem",OL=v.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...s}=e;return a.jsx(ML,{scope:e.__scopeMenu,checked:n,children:a.jsx(mx,{role:"menuitemcheckbox","aria-checked":ev(n)?"mixed":n,...s,ref:t,"data-state":g_(n),onSelect:$e(s.onSelect,()=>r==null?void 0:r(ev(n)?!0:!n),{checkForDefaultPrevented:!1})})})});OL.displayName=LQ;var kL="MenuRadioGroup",[FQ,BQ]=Ql(kL,{value:void 0,onValueChange:()=>{}}),TL=v.forwardRef((e,t)=>{const{value:n,onValueChange:r,...s}=e,i=Vn(r);return a.jsx(FQ,{scope:e.__scopeMenu,value:n,onValueChange:i,children:a.jsx(p_,{...s,ref:t})})});TL.displayName=kL;var $L="MenuRadioItem",IL=v.forwardRef((e,t)=>{const{value:n,...r}=e,s=BQ($L,e.__scopeMenu),i=n===s.value;return a.jsx(ML,{scope:e.__scopeMenu,checked:i,children:a.jsx(mx,{role:"menuitemradio","aria-checked":i,...r,ref:t,"data-state":g_(i),onSelect:$e(r.onSelect,()=>{var o;return(o=s.onValueChange)==null?void 0:o.call(s,n)},{checkForDefaultPrevented:!1})})})});IL.displayName=$L;var m_="MenuItemIndicator",[ML,zQ]=Ql(m_,{checked:!1}),RL=v.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...s}=e,i=zQ(m_,n);return a.jsx(lr,{present:r||ev(i.checked)||i.checked===!0,children:a.jsx(Xe.span,{...s,ref:t,"data-state":g_(i.checked)})})});RL.displayName=m_;var UQ="MenuSeparator",DL=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return a.jsx(Xe.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});DL.displayName=UQ;var VQ="MenuArrow",LL=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=px(n);return a.jsx(gN,{...s,...r,ref:t})});LL.displayName=VQ;var WQ="MenuSub",[EOe,FL]=Ql(WQ),lf="MenuSubTrigger",BL=v.forwardRef((e,t)=>{const n=Jl(lf,e.__scopeMenu),r=$p(lf,e.__scopeMenu),s=FL(lf,e.__scopeMenu),i=f_(lf,e.__scopeMenu),o=v.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=i,u={__scopeMenu:e.__scopeMenu},d=v.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return v.useEffect(()=>d,[d]),v.useEffect(()=>{const f=l.current;return()=>{window.clearTimeout(f),c(null)}},[l,c]),a.jsx(u_,{asChild:!0,...u,children:a.jsx(EL,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":VL(n.open),...e,ref:Ry(t,s.onTriggerChange),onClick:f=>{var h;(h=e.onClick)==null||h.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:$e(e.onPointerMove,jh(f=>{i.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(i.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:$e(e.onPointerLeave,jh(f=>{var p,g;d();const h=(p=n.content)==null?void 0:p.getBoundingClientRect();if(h){const m=(g=n.content)==null?void 0:g.dataset.side,x=m==="right",b=x?-5:5,y=h[x?"left":"right"],w=h[x?"right":"left"];i.onPointerGraceIntentChange({area:[{x:f.clientX+b,y:f.clientY},{x:y,y:h.top},{x:w,y:h.top},{x:w,y:h.bottom},{x:y,y:h.bottom}],side:m}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(f),f.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:$e(e.onKeyDown,f=>{var p;const h=i.searchRef.current!=="";e.disabled||h&&f.key===" "||_Q[r.dir].includes(f.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),f.preventDefault())})})})});BL.displayName=lf;var zL="MenuSubContent",UL=v.forwardRef((e,t)=>{const n=_L(As,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,i=Jl(As,e.__scopeMenu),o=$p(As,e.__scopeMenu),l=FL(zL,e.__scopeMenu),c=v.useRef(null),u=pt(t,c);return a.jsx(wh.Provider,{scope:e.__scopeMenu,children:a.jsx(lr,{present:r||i.open,children:a.jsx(wh.Slot,{scope:e.__scopeMenu,children:a.jsx(h_,{id:l.contentId,"aria-labelledby":l.triggerId,...s,ref:u,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var f;o.isUsingKeyboardRef.current&&((f=c.current)==null||f.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:$e(e.onFocusOutside,d=>{d.target!==l.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:$e(e.onEscapeKeyDown,d=>{o.onClose(),d.preventDefault()}),onKeyDown:$e(e.onKeyDown,d=>{var p;const f=d.currentTarget.contains(d.target),h=PQ[o.dir].includes(d.key);f&&h&&(i.onOpenChange(!1),(p=l.trigger)==null||p.focus(),d.preventDefault())})})})})})});UL.displayName=zL;function VL(e){return e?"open":"closed"}function ev(e){return e==="indeterminate"}function g_(e){return ev(e)?"indeterminate":e?"checked":"unchecked"}function HQ(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function GQ(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function qQ(e,t,n){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=GQ(e,Math.max(i,0));s.length===1&&(o=o.filter(u=>u!==n));const c=o.find(u=>u.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function KQ(e,t){const{x:n,y:r}=e;let s=!1;for(let i=0,o=t.length-1;ir!=d>r&&n<(u-l)*(r-c)/(d-c)+l&&(s=!s)}return s}function XQ(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return KQ(n,t)}function jh(e){return t=>t.pointerType==="mouse"?e(t):void 0}var YQ=NL,ZQ=u_,QQ=PL,JQ=CL,eJ=p_,tJ=AL,nJ=mx,rJ=OL,sJ=TL,iJ=IL,aJ=RL,oJ=DL,lJ=LL,cJ=BL,uJ=UL,v_="DropdownMenu",[dJ,OOe]=Ir(v_,[jL]),Mr=jL(),[fJ,WL]=dJ(v_),HL=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:s,defaultOpen:i,onOpenChange:o,modal:l=!0}=e,c=Mr(t),u=v.useRef(null),[d=!1,f]=us({prop:s,defaultProp:i,onChange:o});return a.jsx(fJ,{scope:t,triggerId:Cs(),triggerRef:u,contentId:Cs(),open:d,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(h=>!h),[f]),modal:l,children:a.jsx(YQ,{...c,open:d,onOpenChange:f,dir:r,modal:l,children:n})})};HL.displayName=v_;var GL="DropdownMenuTrigger",qL=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...s}=e,i=WL(GL,n),o=Mr(n);return a.jsx(ZQ,{asChild:!0,...o,children:a.jsx(Xe.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...s,ref:Ry(t,i.triggerRef),onPointerDown:$e(e.onPointerDown,l=>{!r&&l.button===0&&l.ctrlKey===!1&&(i.onOpenToggle(),i.open||l.preventDefault())}),onKeyDown:$e(e.onKeyDown,l=>{r||(["Enter"," "].includes(l.key)&&i.onOpenToggle(),l.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});qL.displayName=GL;var hJ="DropdownMenuPortal",KL=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Mr(t);return a.jsx(QQ,{...r,...n})};KL.displayName=hJ;var XL="DropdownMenuContent",YL=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=WL(XL,n),i=Mr(n),o=v.useRef(!1);return a.jsx(JQ,{id:s.contentId,"aria-labelledby":s.triggerId,...i,...r,ref:t,onCloseAutoFocus:$e(e.onCloseAutoFocus,l=>{var c;o.current||(c=s.triggerRef.current)==null||c.focus(),o.current=!1,l.preventDefault()}),onInteractOutside:$e(e.onInteractOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!s.modal||d)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});YL.displayName=XL;var pJ="DropdownMenuGroup",mJ=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Mr(n);return a.jsx(eJ,{...s,...r,ref:t})});mJ.displayName=pJ;var gJ="DropdownMenuLabel",ZL=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Mr(n);return a.jsx(tJ,{...s,...r,ref:t})});ZL.displayName=gJ;var vJ="DropdownMenuItem",QL=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Mr(n);return a.jsx(nJ,{...s,...r,ref:t})});QL.displayName=vJ;var yJ="DropdownMenuCheckboxItem",JL=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Mr(n);return a.jsx(rJ,{...s,...r,ref:t})});JL.displayName=yJ;var xJ="DropdownMenuRadioGroup",bJ=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Mr(n);return a.jsx(sJ,{...s,...r,ref:t})});bJ.displayName=xJ;var wJ="DropdownMenuRadioItem",e3=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Mr(n);return a.jsx(iJ,{...s,...r,ref:t})});e3.displayName=wJ;var jJ="DropdownMenuItemIndicator",t3=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Mr(n);return a.jsx(aJ,{...s,...r,ref:t})});t3.displayName=jJ;var SJ="DropdownMenuSeparator",n3=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Mr(n);return a.jsx(oJ,{...s,...r,ref:t})});n3.displayName=SJ;var NJ="DropdownMenuArrow",_J=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Mr(n);return a.jsx(lJ,{...s,...r,ref:t})});_J.displayName=NJ;var PJ="DropdownMenuSubTrigger",r3=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Mr(n);return a.jsx(cJ,{...s,...r,ref:t})});r3.displayName=PJ;var CJ="DropdownMenuSubContent",s3=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Mr(n);return a.jsx(uJ,{...s,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});s3.displayName=CJ;var AJ=HL,EJ=qL,OJ=KL,i3=YL,a3=ZL,o3=QL,l3=JL,c3=e3,u3=t3,d3=n3,f3=r3,h3=s3;const S1=AJ,N1=EJ,kJ=v.forwardRef(({className:e,inset:t,children:n,...r},s)=>a.jsxs(f3,{ref:s,className:Me("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...r,children:[n,a.jsx(vi,{className:"ml-auto h-4 w-4"})]}));kJ.displayName=f3.displayName;const TJ=v.forwardRef(({className:e,...t},n)=>a.jsx(h3,{ref:n,className:Me("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));TJ.displayName=h3.displayName;const tv=v.forwardRef(({className:e,sideOffset:t=4,...n},r)=>a.jsx(OJ,{children:a.jsx(i3,{ref:r,sideOffset:t,className:Me("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));tv.displayName=i3.displayName;const al=v.forwardRef(({className:e,inset:t,...n},r)=>a.jsx(o3,{ref:r,className:Me("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));al.displayName=o3.displayName;const $J=v.forwardRef(({className:e,children:t,checked:n,...r},s)=>a.jsxs(l3,{ref:s,className:Me("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(u3,{children:a.jsx(Sa,{className:"h-4 w-4"})})}),t]}));$J.displayName=l3.displayName;const IJ=v.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(c3,{ref:r,className:Me("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(u3,{children:a.jsx(bf,{className:"h-2 w-2 fill-current"})})}),t]}));IJ.displayName=c3.displayName;const MJ=v.forwardRef(({className:e,inset:t,...n},r)=>a.jsx(a3,{ref:r,className:Me("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));MJ.displayName=a3.displayName;const RJ=v.forwardRef(({className:e,...t},n)=>a.jsx(d3,{ref:n,className:Me("-mx-1 my-1 h-px bg-muted",e),...t}));RJ.displayName=d3.displayName;var y_="Dialog",[p3,m3]=Ir(y_),[DJ,di]=p3(y_),g3=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!0}=e,l=v.useRef(null),c=v.useRef(null),[u=!1,d]=us({prop:r,defaultProp:s,onChange:i});return a.jsx(DJ,{scope:t,triggerRef:l,contentRef:c,contentId:Cs(),titleId:Cs(),descriptionId:Cs(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(f=>!f),[d]),modal:o,children:n})};g3.displayName=y_;var v3="DialogTrigger",y3=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=di(v3,n),i=pt(t,s.triggerRef);return a.jsx(Xe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":w_(s.open),...r,ref:i,onClick:$e(e.onClick,s.onOpenToggle)})});y3.displayName=v3;var x_="DialogPortal",[LJ,x3]=p3(x_,{forceMount:void 0}),b3=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,i=di(x_,t);return a.jsx(LJ,{scope:t,forceMount:n,children:v.Children.map(r,o=>a.jsx(lr,{present:n||i.open,children:a.jsx(By,{asChild:!0,container:s,children:o})}))})};b3.displayName=x_;var nv="DialogOverlay",w3=v.forwardRef((e,t)=>{const n=x3(nv,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=di(nv,e.__scopeDialog);return i.modal?a.jsx(lr,{present:r||i.open,children:a.jsx(FJ,{...s,ref:t})}):null});w3.displayName=nv;var FJ=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=di(nv,n);return a.jsx(lx,{as:xa,allowPinchZoom:!0,shards:[s.contentRef],children:a.jsx(Xe.div,{"data-state":w_(s.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Ul="DialogContent",j3=v.forwardRef((e,t)=>{const n=x3(Ul,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=di(Ul,e.__scopeDialog);return a.jsx(lr,{present:r||i.open,children:i.modal?a.jsx(BJ,{...s,ref:t}):a.jsx(zJ,{...s,ref:t})})});j3.displayName=Ul;var BJ=v.forwardRef((e,t)=>{const n=di(Ul,e.__scopeDialog),r=v.useRef(null),s=pt(t,n.contentRef,r);return v.useEffect(()=>{const i=r.current;if(i)return qN(i)},[]),a.jsx(S3,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:$e(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:$e(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&i.preventDefault()}),onFocusOutside:$e(e.onFocusOutside,i=>i.preventDefault())})}),zJ=v.forwardRef((e,t)=>{const n=di(Ul,e.__scopeDialog),r=v.useRef(!1),s=v.useRef(!1);return a.jsx(S3,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),S3=v.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,...o}=e,l=di(Ul,n),c=v.useRef(null),u=pt(t,c);return GN(),a.jsxs(a.Fragment,{children:[a.jsx(ax,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:a.jsx(yp,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":w_(l.open),...o,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(VJ,{titleId:l.titleId}),a.jsx(HJ,{contentRef:c,descriptionId:l.descriptionId})]})]})}),b_="DialogTitle",N3=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=di(b_,n);return a.jsx(Xe.h2,{id:s.titleId,...r,ref:t})});N3.displayName=b_;var _3="DialogDescription",P3=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=di(_3,n);return a.jsx(Xe.p,{id:s.descriptionId,...r,ref:t})});P3.displayName=_3;var C3="DialogClose",A3=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=di(C3,n);return a.jsx(Xe.button,{type:"button",...r,ref:t,onClick:$e(e.onClick,()=>s.onOpenChange(!1))})});A3.displayName=C3;function w_(e){return e?"open":"closed"}var E3="DialogTitleWarning",[UJ,O3]=m7(E3,{contentName:Ul,titleName:b_,docsSlug:"dialog"}),VJ=({titleId:e})=>{const t=O3(E3),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. + +If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. + +For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return v.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},WJ="DialogDescriptionWarning",HJ=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${O3(WJ).contentName}}.`;return v.useEffect(()=>{var i;const s=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},k3=g3,GJ=y3,T3=b3,j_=w3,S_=j3,N_=N3,__=P3,P_=A3,$3="AlertDialog",[qJ,kOe]=Ir($3,[m3]),Ia=m3(),I3=e=>{const{__scopeAlertDialog:t,...n}=e,r=Ia(t);return a.jsx(k3,{...r,...n,modal:!0})};I3.displayName=$3;var KJ="AlertDialogTrigger",XJ=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Ia(n);return a.jsx(GJ,{...s,...r,ref:t})});XJ.displayName=KJ;var YJ="AlertDialogPortal",M3=e=>{const{__scopeAlertDialog:t,...n}=e,r=Ia(t);return a.jsx(T3,{...r,...n})};M3.displayName=YJ;var ZJ="AlertDialogOverlay",R3=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Ia(n);return a.jsx(j_,{...s,...r,ref:t})});R3.displayName=ZJ;var Wc="AlertDialogContent",[QJ,JJ]=qJ(Wc),D3=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...s}=e,i=Ia(n),o=v.useRef(null),l=pt(t,o),c=v.useRef(null);return a.jsx(UJ,{contentName:Wc,titleName:L3,docsSlug:"alert-dialog",children:a.jsx(QJ,{scope:n,cancelRef:c,children:a.jsxs(S_,{role:"alertdialog",...i,...s,ref:l,onOpenAutoFocus:$e(s.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=c.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:[a.jsx(iN,{children:r}),a.jsx(tee,{contentRef:o})]})})})});D3.displayName=Wc;var L3="AlertDialogTitle",F3=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Ia(n);return a.jsx(N_,{...s,...r,ref:t})});F3.displayName=L3;var B3="AlertDialogDescription",z3=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Ia(n);return a.jsx(__,{...s,...r,ref:t})});z3.displayName=B3;var eee="AlertDialogAction",U3=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Ia(n);return a.jsx(P_,{...s,...r,ref:t})});U3.displayName=eee;var V3="AlertDialogCancel",W3=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:s}=JJ(V3,n),i=Ia(n),o=pt(t,s);return a.jsx(P_,{...i,...r,ref:o})});W3.displayName=V3;var tee=({contentRef:e})=>{const t=`\`${Wc}\` requires a description for the component to be accessible for screen reader users. + +You can add a description to the \`${Wc}\` by passing a \`${B3}\` component as a child, which also benefits sighted users by adding visible context to the dialog. + +Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Wc}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. + +For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return v.useEffect(()=>{var r;document.getElementById((r=e.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},nee=I3,ree=M3,H3=R3,G3=D3,q3=U3,K3=W3,X3=F3,Y3=z3;const _1=nee,see=ree,Z3=v.forwardRef(({className:e,...t},n)=>a.jsx(H3,{className:Me("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));Z3.displayName=H3.displayName;const rv=v.forwardRef(({className:e,...t},n)=>a.jsxs(see,{children:[a.jsx(Z3,{}),a.jsx(G3,{ref:n,className:Me("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));rv.displayName=G3.displayName;const sv=({className:e,...t})=>a.jsx("div",{className:Me("flex flex-col space-y-2 text-center sm:text-left",e),...t});sv.displayName="AlertDialogHeader";const iv=({className:e,...t})=>a.jsx("div",{className:Me("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});iv.displayName="AlertDialogFooter";const av=v.forwardRef(({className:e,...t},n)=>a.jsx(X3,{ref:n,className:Me("text-lg font-semibold",e),...t}));av.displayName=X3.displayName;const ov=v.forwardRef(({className:e,...t},n)=>a.jsx(Y3,{ref:n,className:Me("text-sm text-muted-foreground",e),...t}));ov.displayName=Y3.displayName;const lv=v.forwardRef(({className:e,...t},n)=>a.jsx(q3,{ref:n,className:Me(DN(),e),...t}));lv.displayName=q3.displayName;const cv=v.forwardRef(({className:e,...t},n)=>a.jsx(K3,{ref:n,className:Me(DN({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));cv.displayName=K3.displayName;const wo=k3,iee=T3,Q3=v.forwardRef(({className:e,...t},n)=>a.jsx(j_,{ref:n,className:Me("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));Q3.displayName=j_.displayName;const la=v.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(iee,{children:[a.jsx(Q3,{}),a.jsxs(S_,{ref:r,className:Me("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,a.jsxs(P_,{className:"absolute right-4 top-4 z-[100] rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[a.jsx(Ei,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));la.displayName=S_.displayName;const ca=({className:e,...t})=>a.jsx("div",{className:Me("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});ca.displayName="DialogHeader";const jo=({className:e,...t})=>a.jsx("div",{className:Me("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});jo.displayName="DialogFooter";const ua=v.forwardRef(({className:e,...t},n)=>a.jsx(N_,{ref:n,className:Me("text-lg font-semibold leading-none tracking-tight",e),...t}));ua.displayName=N_.displayName;const Cl=v.forwardRef(({className:e,...t},n)=>a.jsx(__,{ref:n,className:Me("text-sm text-muted-foreground",e),...t}));Cl.displayName=__.displayName;var C_="Radio",[aee,J3]=Ir(C_),[oee,lee]=aee(C_),e5=v.forwardRef((e,t)=>{const{__scopeRadio:n,name:r,checked:s=!1,required:i,disabled:o,value:l="on",onCheck:c,form:u,...d}=e,[f,h]=v.useState(null),p=pt(t,x=>h(x)),g=v.useRef(!1),m=f?u||!!f.closest("form"):!0;return a.jsxs(oee,{scope:n,checked:s,disabled:o,children:[a.jsx(Xe.button,{type:"button",role:"radio","aria-checked":s,"data-state":r5(s),"data-disabled":o?"":void 0,disabled:o,value:l,...d,ref:p,onClick:$e(e.onClick,x=>{s||c==null||c(),m&&(g.current=x.isPropagationStopped(),g.current||x.stopPropagation())})}),m&&a.jsx(cee,{control:f,bubbles:!g.current,name:r,value:l,checked:s,required:i,disabled:o,form:u,style:{transform:"translateX(-100%)"}})]})});e5.displayName=C_;var t5="RadioIndicator",n5=v.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:r,...s}=e,i=lee(t5,n);return a.jsx(lr,{present:r||i.checked,children:a.jsx(Xe.span,{"data-state":r5(i.checked),"data-disabled":i.disabled?"":void 0,...s,ref:t})})});n5.displayName=t5;var cee=e=>{const{control:t,checked:n,bubbles:r=!0,...s}=e,i=v.useRef(null),o=Cp(n),l=bp(t);return v.useEffect(()=>{const c=i.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(o!==n&&f){const h=new Event("click",{bubbles:r});f.call(c,n),c.dispatchEvent(h)}},[o,n,r]),a.jsx("input",{type:"radio","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:i,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function r5(e){return e?"checked":"unchecked"}var uee=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],A_="RadioGroup",[dee,TOe]=Ir(A_,[ad,J3]),s5=ad(),i5=J3(),[fee,hee]=dee(A_),a5=v.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:r,defaultValue:s,value:i,required:o=!1,disabled:l=!1,orientation:c,dir:u,loop:d=!0,onValueChange:f,...h}=e,p=s5(n),g=Uo(u),[m,x]=us({prop:i,defaultProp:s,onChange:f});return a.jsx(fee,{scope:n,name:r,required:o,disabled:l,value:m,onValueChange:x,children:a.jsx(a_,{asChild:!0,...p,orientation:c,dir:g,loop:d,children:a.jsx(Xe.div,{role:"radiogroup","aria-required":o,"aria-orientation":c,"data-disabled":l?"":void 0,dir:g,...h,ref:t})})})});a5.displayName=A_;var o5="RadioGroupItem",l5=v.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:r,...s}=e,i=hee(o5,n),o=i.disabled||r,l=s5(n),c=i5(n),u=v.useRef(null),d=pt(t,u),f=i.value===s.value,h=v.useRef(!1);return v.useEffect(()=>{const p=m=>{uee.includes(m.key)&&(h.current=!0)},g=()=>h.current=!1;return document.addEventListener("keydown",p),document.addEventListener("keyup",g),()=>{document.removeEventListener("keydown",p),document.removeEventListener("keyup",g)}},[]),a.jsx(o_,{asChild:!0,...l,focusable:!o,active:f,children:a.jsx(e5,{disabled:o,required:i.required,checked:f,...c,...s,name:i.name,ref:d,onCheck:()=>i.onValueChange(s.value),onKeyDown:$e(p=>{p.key==="Enter"&&p.preventDefault()}),onFocus:$e(s.onFocus,()=>{var p;h.current&&((p=u.current)==null||p.click())})})})});l5.displayName=o5;var pee="RadioGroupIndicator",c5=v.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...r}=e,s=i5(n);return a.jsx(n5,{...s,...r,ref:t})});c5.displayName=pee;var u5=a5,d5=l5,mee=c5;const P1=v.forwardRef(({className:e,...t},n)=>a.jsx(u5,{className:Me("grid gap-2",e),...t,ref:n}));P1.displayName=u5.displayName;const cf=v.forwardRef(({className:e,...t},n)=>a.jsx(d5,{ref:n,className:Me("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:a.jsx(mee,{className:"flex items-center justify-center",children:a.jsx(bf,{className:"h-2.5 w-2.5 fill-current text-current"})})}));cf.displayName=d5.displayName;var E_="Checkbox",[gee,$Oe]=Ir(E_),[vee,yee]=gee(E_),f5=v.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:s,defaultChecked:i,required:o,disabled:l,value:c="on",onCheckedChange:u,form:d,...f}=e,[h,p]=v.useState(null),g=pt(t,j=>p(j)),m=v.useRef(!1),x=h?d||!!h.closest("form"):!0,[b=!1,y]=us({prop:s,defaultProp:i,onChange:u}),w=v.useRef(b);return v.useEffect(()=>{const j=h==null?void 0:h.form;if(j){const S=()=>y(w.current);return j.addEventListener("reset",S),()=>j.removeEventListener("reset",S)}},[h,y]),a.jsxs(vee,{scope:n,state:b,disabled:l,children:[a.jsx(Xe.button,{type:"button",role:"checkbox","aria-checked":So(b)?"mixed":b,"aria-required":o,"data-state":m5(b),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:g,onKeyDown:$e(e.onKeyDown,j=>{j.key==="Enter"&&j.preventDefault()}),onClick:$e(e.onClick,j=>{y(S=>So(S)?!0:!S),x&&(m.current=j.isPropagationStopped(),m.current||j.stopPropagation())})}),x&&a.jsx(xee,{control:h,bubbles:!m.current,name:r,value:c,checked:b,required:o,disabled:l,form:d,style:{transform:"translateX(-100%)"},defaultChecked:So(i)?!1:i})]})});f5.displayName=E_;var h5="CheckboxIndicator",p5=v.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...s}=e,i=yee(h5,n);return a.jsx(lr,{present:r||So(i.state)||i.state===!0,children:a.jsx(Xe.span,{"data-state":m5(i.state),"data-disabled":i.disabled?"":void 0,...s,ref:t,style:{pointerEvents:"none",...e.style}})})});p5.displayName=h5;var xee=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:s,...i}=e,o=v.useRef(null),l=Cp(n),c=bp(t);v.useEffect(()=>{const d=o.current,f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(l!==n&&p){const g=new Event("click",{bubbles:r});d.indeterminate=So(n),p.call(d,So(n)?!1:n),d.dispatchEvent(g)}},[l,n,r]);const u=v.useRef(So(n)?!1:n);return a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:s??u.current,...i,tabIndex:-1,ref:o,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function So(e){return e==="indeterminate"}function m5(e){return So(e)?"indeterminate":e?"checked":"unchecked"}var g5=f5,bee=p5;const Sh=v.forwardRef(({className:e,...t},n)=>a.jsx(g5,{ref:n,className:Me("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:a.jsx(bee,{className:Me("flex items-center justify-center text-current"),children:a.jsx(Sa,{className:"h-4 w-4"})})}));Sh.displayName=g5.displayName;const O_=({isActive:e,isComplete:t,hasError:n,label:r,onComplete:s,className:i})=>{const[o,l]=v.useState(0),[c,u]=v.useState("progressing"),[d,f]=v.useState(!1),h=v.useRef(null),p=v.useRef(null),g=()=>{h.current&&(clearInterval(h.current),h.current=null),p.current&&(clearTimeout(p.current),p.current=null)},m=()=>{g(),l(0),u("progressing"),f(!1)},x=j=>{g(),u("completing");const S=100-j,N=50,P=500/N,_=S/P;let A=0;h.current=setInterval(()=>{A++;const O=j+_*A;O>=100||A>=P?(l(100),u("completed"),g(),p.current=setTimeout(()=>{u("hiding"),setTimeout(()=>{m(),s==null||s()},300)},2e3)):l(O)},N)},b=()=>{c==="progressing"&&x(o)},y=()=>{c==="waiting"&&x(90)},w=()=>{g()};return v.useEffect(()=>{if(e&&!d){f(!0),l(0),u("progressing");const j=90/540;let S=0;h.current=setInterval(()=>{S+=j,S>=90?(l(90),u("waiting"),g()):l(S)},100)}return t&&c==="progressing"&&b(),t&&c==="waiting"&&y(),n&&(c==="progressing"||c==="waiting")&&w(),!e&&d&&m(),()=>{e||g()}},[e,t,n,c,d]),v.useEffect(()=>()=>{g()},[]),d?a.jsxs("div",{className:Me("w-full space-y-2",i),children:[r&&a.jsxs("div",{className:"flex justify-between items-center text-sm text-muted-foreground",children:[a.jsx("span",{children:c==="waiting"?`${r} - finalizing...`:r}),a.jsxs("span",{children:[Math.round(o),"%"]})]}),a.jsx(fl,{value:o,className:Me("w-full transition-all duration-200",n&&"opacity-75",c==="completed"&&"bg-green-100")}),n&&a.jsx("div",{className:"text-sm text-red-600",children:"Generation failed. Please try again."}),c==="completed"&&!n&&a.jsx("div",{className:"text-sm text-green-600",children:"Generation completed successfully!"})]}):null},An="all",wee=()=>{var kt,Dn,q,we;const e=v.useCallback(()=>{document.body.style.pointerEvents==="none"&&(console.log("ensureBodyInteractive: Fixing body pointer-events..."),document.body.style.pointerEvents="auto")},[]),t=Rn(),{loadPersonas:n}=R4(),[r,s]=v.useState("view"),[i,o]=v.useState("ai"),[l,c]=v.useState("");v.useState(null);const[u,d]=v.useState(An),[f,h]=v.useState(!1),[p,g]=v.useState(""),[m,x]=v.useState([]),[b,y]=v.useState([]),[w,j]=v.useState(!0);v.useState(null);const[S,N]=v.useState(new Set),[P,_]=v.useState(!1),[A,O]=v.useState(null),[T,k]=v.useState(""),[M,R]=v.useState(!1),[H,F]=v.useState(null),[V,$]=v.useState(!1),[L,Y]=v.useState(null),[Q,ee]=v.useState(!1),[fe,W]=v.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]}),[he,pe]=v.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]}),[ue,Ae]=v.useState(!1),[de,oe]=v.useState(!1),[xe,te]=v.useState(!1),[Ye,G]=v.useState(!1),[ve,Pe]=v.useState("gemini-2.5-pro"),Ie=()=>{Ae(!1),oe(!1),te(!1)},E=I=>{const Z={age:new Set,gender:new Set,occupation:new Set,location:new Set,techSavviness:new Set,ethnicity:new Set};return I.forEach(ne=>{if(ne.age&&Z.age.add(ne.age),ne.gender&&Z.gender.add(ne.gender),ne.occupation&&Z.occupation.add(ne.occupation),ne.location&&Z.location.add(ne.location),ne.techSavviness!==void 0){const B=ne.techSavviness<30?"Low (0-30)":ne.techSavviness<70?"Medium (31-70)":"High (71-100)";Z.techSavviness.add(B)}ne.ethnicity&&Z.ethnicity.add(ne.ethnicity)}),{age:Array.from(Z.age).sort(),gender:Array.from(Z.gender).sort(),occupation:Array.from(Z.occupation).sort(),location:Array.from(Z.location).sort(),techSavviness:Array.from(Z.techSavviness).sort((ne,B)=>{const z=["Low (0-30)","Medium (31-70)","High (71-100)"];return z.indexOf(ne)-z.indexOf(B)}),ethnicity:Array.from(Z.ethnicity).sort()}},D=()=>{ee(!1),setTimeout(()=>{W({...he})},0)},U=()=>{pe({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]})},K=(I,Z)=>{pe(ne=>{const B={...ne};return B[I].includes(Z)?B[I]=B[I].filter(z=>z!==Z):B[I]=[...B[I],Z],B})},J=async()=>{j(!0);try{const ne=(await $n.getAll()).data;{const z=[...ne.map(re=>({...re,id:re.id||re._id}))];try{(async()=>{const me=await n();console.log("Loaded stored personas (for debugging only):",me?me.length:0)})()}catch(re){console.warn("Error loading stored personas:",re)}x(z)}}catch(Z){console.error("Error fetching personas:",Z),Qe.error("Failed to load personas"),x([])}finally{j(!1)}},X=(I,Z)=>(I.forEach(ne=>{if(ne.folderId){const B=Z.find(z=>z.id===ne.folderId);B&&!B.personaIds.includes(ne.id)&&B.personaIds.push(ne.id)}}),Z.forEach(ne=>{ne.personaIds=ne.personaIds.filter(B=>{const z=I.find(re=>re.id===B);return z&&(!z.folderId||z.folderId===ne.id)})}),Z);v.useEffect(()=>{let I=!0;const Z=localStorage.getItem("persona-folders");let ne=[];if(Z)try{ne=JSON.parse(Z),y(ne)}catch(z){console.error("Failed to parse stored folders:",z)}return(async()=>{if(await J(),I&&m.length>0){const z=X(m,ne);y(z)}})(),()=>{I=!1}},[e]),v.useEffect(()=>{var I;if(r==="view")J();else if(r==="create"&&(console.log(`Switching to create mode with folder: ${u}, ${u!==An?"NOT default":"IS default"}`),u!==An)){const Z=(I=b.find(ne=>ne.id===u))==null?void 0:I.name;console.log(`Selected folder for creation: ${u} (${Z})`)}},[r]),v.useEffect(()=>{if(m.length>0){const I=b.map(ne=>({...ne,personaIds:[...ne.personaIds]})),Z=X(m,I);y(Z)}},[m]),v.useEffect(()=>{J();const I=()=>{window.location.pathname.includes("/synthetic-users")&&!window.location.pathname.includes("/synthetic-users/")&&(console.log("Navigation to synthetic users page detected, refreshing data"),J())},Z=()=>{console.log("Synthetic users navigation event detected, refreshing data"),J()};console.log("Setting up MutationObserver for body style");const ne=new MutationObserver(B=>{B.forEach(z=>{z.type==="attributes"&&z.attributeName==="style"&&document.body.style.pointerEvents==="none"&&(console.log("MutationObserver detected pointer-events: none, fixing..."),e())})});return ne.observe(document.body,{attributes:!0,attributeFilter:["style"]}),e(),window.addEventListener("popstate",I),window.addEventListener("syntheticUsersNavigation",Z),()=>{window.removeEventListener("popstate",I),window.removeEventListener("syntheticUsersNavigation",Z),console.log("Disconnecting MutationObserver"),ne.disconnect()}},[]),v.useEffect(()=>{b.length>0&&localStorage.setItem("persona-folders",JSON.stringify(b))},[b]),v.useEffect(()=>{if(m.length>0&&b.length>0){const I=X(m,[...b]);JSON.stringify(I)!==JSON.stringify(b)&&y(I)}},[m,b.length]);const be=()=>{if(!p.trim()){Qe.error("Please enter a folder name");return}const I={id:`folder-${Date.now()}`,name:p.trim(),personaIds:[]};y([...b,I]),g(""),h(!1),Qe.success(`Folder "${p}" created`)},_e=()=>{g(""),h(!1)},Fe=I=>{O(I),k(I.name)},ie=()=>{if(!A||!T.trim()){O(null);return}const I=b.map(Z=>Z.id===A.id?{...Z,name:T.trim()}:Z);y(I),O(null),Qe.success(`Folder renamed to "${T}"`)},Te=()=>{O(null),k("")},Be=I=>{F(I),R(!0)},gt=()=>{H&&(y(b.filter(I=>I.id!==H.id)),u===H.id&&d(An),R(!1),F(null),Qe.success(`Folder "${H.name}" deleted`))},At=async(I,Z)=>{var re;const ne=I||S,B=Z||L;if(!B||ne.size===0)return;const z=Array.from(ne);try{const me=b.map(Ce=>{if(Ce.id===B){const ut=[...Ce.personaIds];return z.forEach(Tt=>{ut.includes(Tt)||ut.push(Tt)}),{...Ce,personaIds:ut}}else return{...Ce,personaIds:Ce.personaIds.filter(ut=>!z.includes(ut))}});y(me),localStorage.setItem("persona-folders",JSON.stringify(me));const le=z.map(async Ce=>{try{const ut=m.find(Tt=>Tt.id===Ce);if(ut){const Tt={...ut,folderId:B===An?null:B},nr=ut._id||ut.id;return await $n.update(nr,Tt),{success:!0,id:Ce}}return{success:!1,id:Ce,error:"Persona not found locally"}}catch(ut){return console.error(`Failed to update folder for persona ${Ce}:`,ut),{success:!1,id:Ce,error:ut}}}),Ue=await Promise.all(le),Ne=Ue.filter(Ce=>Ce.success).map(Ce=>Ce.id),ze=Ue.filter(Ce=>!Ce.success),Se=m.map(Ce=>Ne.includes(Ce.id)?{...Ce,folderId:B===An?null:B}:Ce);x(Se);const at=B===An?"All Personas":((re=b.find(Ce=>Ce.id===B))==null?void 0:re.name)||"folder";return Ne.length>0&&Qe.success(`Moved ${Ne.length} persona${Ne.length!==1?"s":""} to ${at}`),ze.length>0&&(Qe.error(`Failed to move ${ze.length} persona${ze.length!==1?"s":""}.`),console.error("Failed updates:",ze)),I||N(new Set),{success:Ne.length>0,successCount:Ne.length,failureCount:ze.length}}catch(me){return console.error("Error moving personas to folder:",me),Qe.error("An unexpected error occurred while moving personas."),{success:!1,error:me}}},pn=async()=>{var re;if(S.size===0||u===An)return;const I=Array.from(S),Z=b.map(me=>me.id===u?{...me,personaIds:me.personaIds.filter(le=>!I.includes(le))}:me);y(Z);const ne=[],B=[];for(const me of I)try{const le=m.find(Ue=>Ue.id===me);if(le){const Ue={...le,folderId:null},Ne=le._id||le.id;await $n.update(Ne,Ue),ne.push(me)}}catch(le){console.error(`Failed to update persona ${me}:`,le),B.push(me)}x(me=>me.map(le=>ne.includes(le.id)?{...le,folderId:null}:le)),N(new Set);const z=((re=b.find(me=>me.id===u))==null?void 0:re.name)||"folder";ne.length>0&&Qe.success(`Removed ${ne.length} persona${ne.length!==1?"s":""} from ${z}`),B.length>0&&Qe.error(`Failed to remove ${B.length} persona${B.length!==1?"s":""} from ${z}`)},Zt=I=>{N(Z=>{const ne=new Set(Z);return ne.has(I)?ne.delete(I):ne.add(I),ne})},bn=()=>{S.size===yt.length?N(new Set):N(new Set(yt.map(I=>I.id)))},Xt=async()=>{if(S.size===0)return;const I=Array.from(S);N(new Set),_(!1),j(!0);const Z=[],ne=[];for(const B of I)try{const z=m.find(me=>me.id===B);if(!z){console.error(`Could not find persona with id: ${B}`),ne.push(B);continue}let re=B;z._id&&(re=z._id.toString()),console.log(`Attempting to delete persona: ${re}`),await $n.delete(re),Z.push(B)}catch(z){console.error(`Failed to delete persona ${B}:`,z),ne.push(B)}x(B=>B.filter(z=>!Z.includes(z.id))),y(B=>{const z=B.map(re=>({...re,personaIds:re.personaIds.filter(me=>!Z.includes(me))}));return localStorage.setItem("persona-folders",JSON.stringify(z)),z}),j(!1),setTimeout(()=>{Z.length>0&&Qe.success(`Successfully deleted ${Z.length} persona${Z.length!==1?"s":""}`),ne.length>0&&Qe.error(`Failed to delete ${ne.length} persona${ne.length!==1?"s":""}`),(Z.length>0||ne.length>0)&&J()},50)},yt=m.filter(I=>{const Z=I.name.toLowerCase().includes(l.toLowerCase())||I.occupation.toLowerCase().includes(l.toLowerCase())||I.location.toLowerCase().includes(l.toLowerCase()),ne=(fe.age.length===0||fe.age.includes(I.age))&&(fe.gender.length===0||fe.gender.includes(I.gender))&&(fe.occupation.length===0||fe.occupation.includes(I.occupation))&&(fe.location.length===0||fe.location.includes(I.location))&&(fe.ethnicity.length===0||I.ethnicity&&fe.ethnicity.includes(I.ethnicity))&&(fe.techSavviness.length===0||I.techSavviness!==void 0&&fe.techSavviness.includes(I.techSavviness<30?"Low (0-30)":I.techSavviness<70?"Medium (31-70)":"High (71-100)"))&&!0;if(u===An||I.folderId===u)return Z&≠const B=b.find(z=>z.id===u);return B&&B.personaIds.includes(I.id)&&Z&&ne}),Rr=(I,Z)=>{const ne=new Date().toISOString().split("T")[0],B=I.length;let z=`# Persona Summary Report + +`;return z+=`**Folder:** ${Z} +`,z+=`**Date:** ${ne} +`,z+=`**Total Personas:** ${B} + +`,B===0?(z+=`No personas found in this folder. +`,z):(I.forEach((re,me)=>{z+=`## ${re.name} + +`,z+=`### Demographics +`,z+=`- **Age:** ${re.age} +`,z+=`- **Gender:** ${re.gender} +`,z+=`- **Occupation:** ${re.occupation} +`,z+=`- **Location:** ${re.location} + +`,re.aiSynthesizedBio&&(z+=`### AI-Synthesized Bio +`,z+=`${re.aiSynthesizedBio} + +`),re.qualitativeAttributes&&re.qualitativeAttributes.length>0&&(z+=`### Key Attributes +`,re.qualitativeAttributes.forEach(le=>{z+=`- ๐Ÿท๏ธ ${le} +`}),z+=` +`),re.topPersonalityTraits&&re.topPersonalityTraits.length>0&&(z+=`### Top Personality Traits +`,re.topPersonalityTraits.forEach(le=>{z+=`- ๐Ÿง  ${le} +`}),z+=` +`),me{if(yt.length===0){Qe.error("No personas to download");return}G(!0)},It=async()=>{var ne,B,z,re,me;const I=u===An?"All Personas":((ne=b.find(le=>le.id===u))==null?void 0:ne.name)||"Unknown Folder",Z=yt.map(le=>le._id||le.id);console.log(`๐Ÿค– Frontend: User selected ${ve} for persona summary download`),G(!1),Ae(!0),oe(!1),te(!1),j(!0);try{Qe.info("Generating persona summaries...",{description:`Processing ${yt.length} persona${yt.length!==1?"s":""} with AI`});const le=await Xi.batchGenerateSummaries(Z,.7,ve),{summaries:Ue,summary_stats:Ne,errors:ze}=le.data,Se=new Date().toISOString().split("T")[0],at=`persona-summary-${I.toLowerCase().replace(/\s+/g,"-")}-${Se}.md`;let Ce=`# Persona Summary Report + +`;Ce+=`**Folder:** ${I} +`,Ce+=`**Date:** ${Se} +`,Ce+=`**Total Personas:** ${Ne.total_requested} +`,Ce+=`**Successfully Processed:** ${Ne.total_successful} +`,Ne.total_failed>0&&(Ce+=`**Failed to Process:** ${Ne.total_failed} +`),Ce+=` +--- + +`,Ue.length===0?Ce+=`No persona summaries could be generated. +`:Ue.forEach((Lt,zt)=>{Ce+=`# ${Lt.persona_name} + +`,Ce+=`${Lt.summary} + +`,zt0||((z=ze.missing_personas)==null?void 0:z.length)>0)&&(Ce+=` +--- + +## Processing Errors + +`,((re=ze.failed_summaries)==null?void 0:re.length)>0&&(Ce+=`### Failed to Generate Summaries +`,ze.failed_summaries.forEach(Lt=>{Ce+=`- **${Lt.persona_name}** (ID: ${Lt.persona_id}): ${Lt.error} +`}),Ce+=` +`),((me=ze.missing_personas)==null?void 0:me.length)>0&&(Ce+=`### Missing Personas +`,ze.missing_personas.forEach(Lt=>{Ce+=`- ID: ${Lt} +`})));const ut=document.createElement("a"),Tt=new Blob([Ce],{type:"text/markdown"});ut.href=URL.createObjectURL(Tt),ut.download=at,document.body.appendChild(ut),ut.click(),document.body.removeChild(ut),oe(!0);const nr=ve==="gpt-4.1"?"GPT-4.1":"Gemini 2.5 Pro";Ne.total_successful===Ne.total_requested?Qe.success("Persona summary downloaded",{description:`Successfully processed all ${Ne.total_successful} persona${Ne.total_successful!==1?"s":""} from "${I}" using ${nr}`}):Qe.success("Persona summary downloaded with warnings",{description:`Processed ${Ne.total_successful} of ${Ne.total_requested} personas from "${I}" using ${nr}`})}catch(le){console.error("Error generating persona summaries:",le),le.response?(console.error("Error response data:",le.response.data),console.error("Error response status:",le.response.status),console.error("Error response headers:",le.response.headers)):le.request?console.error("Error request:",le.request):console.error("Error message:",le.message),te(!0),Qe.error("AI summary generation failed, creating basic summary",{description:"Using simplified format due to processing error"});try{const Ue=new Date().toISOString().split("T")[0],Ne=`persona-summary-basic-${I.toLowerCase().replace(/\s+/g,"-")}-${Ue}.md`,ze=Rr(yt,I),Se=document.createElement("a"),at=new Blob([ze],{type:"text/markdown"});Se.href=URL.createObjectURL(at),Se.download=Ne,document.body.appendChild(Se),Se.click(),document.body.removeChild(Se)}catch{Qe.error("Failed to create persona summary",{description:"Unable to generate summary in any format"})}}finally{j(!1)}};return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(oa,{}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center mb-8",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"font-sf text-3xl font-bold text-slate-900",children:"Synthetic Personas"}),a.jsx("p",{className:"text-slate-600 mt-1",children:"Create and manage AI-generated research participants"})]}),a.jsx("div",{className:"mt-4 sm:mt-0 flex flex-col items-end gap-3",children:a.jsxs("div",{className:"flex items-center gap-3",children:[r==="view"&&yt.length>0&&a.jsxs(se,{variant:"outline",onClick:tt,disabled:ue,className:"flex items-center gap-2 hover-transition",children:[a.jsx(ed,{className:"h-4 w-4"}),ue?"Generating Summary...":"Download Persona Summary"]}),a.jsx(se,{onClick:()=>s(r==="view"?"create":"view"),className:"hover-transition",children:r==="view"?"Create New Personas":"View All Personas"})]})})]}),r==="view"&&yt.length>0&&ue&&a.jsx("div",{className:"mb-6",children:a.jsx(O_,{isActive:ue,isComplete:de,hasError:xe,label:"Generating comprehensive persona summaries",onComplete:Ie,className:"max-w-4xl mx-auto"})}),r==="view"?a.jsx(a.Fragment,{children:a.jsxs("div",{className:"flex flex-col md:flex-row gap-6 mb-6",children:[a.jsxs("div",{className:"w-full md:w-64 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"text-sm font-medium",children:"Folders"}),a.jsx(se,{variant:"ghost",size:"sm",onClick:()=>h(!0),className:"h-7 w-7 p-0",children:a.jsx(AR,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("button",{onClick:()=>d(An),className:`w-full flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${u===An?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(Ws,{className:"h-4 w-4"}),a.jsx("span",{children:"All Personas"})]}),b.map(I=>a.jsx("div",{className:"flex items-center justify-between group",children:A&&A.id===I.id?a.jsxs("div",{className:"flex-1 flex items-center px-3 py-2 space-x-2",children:[a.jsx(Ws,{className:"h-4 w-4"}),a.jsx(_t,{value:T,onChange:Z=>k(Z.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:Z=>{Z.key==="Enter"?ie():Z.key==="Escape"&&Te()}}),a.jsx(se,{size:"sm",variant:"ghost",onClick:ie,className:"h-7 w-7 p-0",children:a.jsx(Sa,{className:"h-4 w-4"})}),a.jsx(se,{size:"sm",variant:"ghost",onClick:Te,className:"h-7 w-7 p-0",children:a.jsx(Ei,{className:"h-4 w-4"})})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>d(I.id),className:`flex-1 flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${u===I.id?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(Ws,{className:"h-4 w-4"}),a.jsx("span",{children:I.name}),a.jsx("span",{className:"text-muted-foreground text-xs ml-auto",children:I.personaIds.length})]}),a.jsxs(S1,{children:[a.jsx(N1,{asChild:!0,children:a.jsx(se,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100",children:a.jsx(Xw,{className:"h-4 w-4"})})}),a.jsxs(tv,{align:"end",children:[a.jsx(al,{onClick:()=>Fe(I),children:"Rename"}),a.jsx(al,{className:"text-red-600",onClick:()=>Be(I),children:"Delete"})]})]})]})},I.id)),f&&a.jsxs("div",{className:"flex items-center px-3 py-2 space-x-2",children:[a.jsxs("div",{className:"flex-1 flex items-center space-x-2",children:[a.jsx(Ws,{className:"h-4 w-4"}),a.jsx(_t,{value:p,onChange:I=>g(I.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:I=>{I.key==="Enter"?be():I.key==="Escape"&&_e()}})]}),a.jsx(se,{size:"sm",variant:"ghost",onClick:be,className:"h-7 w-7 p-0",children:a.jsx(Sa,{className:"h-4 w-4"})}),a.jsx(se,{size:"sm",variant:"ghost",onClick:_e,className:"h-7 w-7 p-0",children:a.jsx(Ei,{className:"h-4 w-4"})})]})]})]}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-6",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx(AN,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(_t,{placeholder:"Search personas by name, occupation, or location...",className:"pl-10 bg-white",value:l,onChange:I=>c(I.target.value)})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[S.size>0&&a.jsxs(S1,{children:[a.jsx(N1,{asChild:!0,children:a.jsxs(se,{variant:"outline",size:"sm",className:"flex items-center gap-2",onClick:I=>{I.stopPropagation()},children:[a.jsxs("span",{children:["Actions (",S.size,")"]}),a.jsx(Xw,{className:"h-4 w-4"})]})}),a.jsxs(tv,{align:"end",onCloseAutoFocus:I=>{I.preventDefault()},children:[a.jsxs(al,{className:"flex items-center gap-2 cursor-pointer",onClick:I=>{I.preventDefault(),I.stopPropagation(),_(!0)},children:[a.jsx(wn,{className:"h-4 w-4"}),"Delete"]}),a.jsxs(al,{className:"flex items-center gap-2 cursor-pointer",onClick:I=>{I.preventDefault(),I.stopPropagation(),$(!0)},children:[a.jsx(Ws,{className:"h-4 w-4"}),"Move to folder"]}),u!==An&&a.jsxs(al,{className:"flex items-center gap-2 cursor-pointer",onClick:I=>{I.preventDefault(),I.stopPropagation(),pn()},children:[a.jsx(Ei,{className:"h-4 w-4"}),"Remove from ",((kt=b.find(I=>I.id===u))==null?void 0:kt.name)||"folder"]})]})]}),a.jsxs(se,{variant:"outline",className:"flex items-center gap-2",onClick:()=>ee(!0),children:[a.jsx(PN,{className:"h-4 w-4"}),a.jsxs("span",{children:["Filter",Object.values(fe).some(I=>I.length>0)?` (${Object.values(fe).reduce((I,Z)=>I+Z.length,0)})`:""]})]})]})]}),a.jsxs("div",{className:"glass-panel rounded-xl p-6 mb-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(er,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:u===An?"Your Synthetic Persona Library":((Dn=b.find(I=>I.id===u))==null?void 0:Dn.name)||"Personas"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:["(",yt.length,")"]})]}),yt.length>0&&a.jsxs("div",{className:"flex items-center",children:[a.jsx(Sh,{id:"select-all",checked:yt.length>0&&S.size===yt.length,onCheckedChange:bn,className:"mr-2"}),a.jsx("label",{htmlFor:"select-all",className:"text-sm cursor-pointer",children:"Select All"})]})]}),yt.length>0?a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-1 lg:grid-cols-2 xl:grid-cols-2 gap-4",children:yt.map(I=>a.jsx("div",{className:"relative group",children:a.jsx(ZN,{user:I,selected:S.has(I.id),onClick:()=>t(`/synthetic-users/${I._id||I.id}`),onSelectionToggle:Z=>{Z.stopPropagation(),Zt(I.id)},showAddToFolderButton:!1})},I.id))}):a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-muted-foreground",children:"No personas found matching your criteria."})})]}),a.jsx(_1,{open:P,onOpenChange:I=>{_(I||!1)},children:a.jsxs(rv,{onInteractOutside:I=>{I.preventDefault()},children:[a.jsxs(sv,{children:[a.jsx(av,{children:"Delete Personas"}),a.jsxs(ov,{children:["Are you sure you want to delete ",S.size," selected persona",S.size!==1?"s":"","? This action cannot be undone."]})]}),a.jsxs(iv,{children:[a.jsx(cv,{onClick:()=>{setTimeout(()=>N(new Set),50)},children:"Cancel"}),a.jsx(lv,{onClick:Xt,className:"bg-red-600 hover:bg-red-700",children:"Delete"})]})]})}),a.jsx(_1,{open:M,onOpenChange:I=>{R(I||!1)},children:a.jsxs(rv,{children:[a.jsxs(sv,{children:[a.jsx(av,{children:"Delete Folder"}),a.jsxs(ov,{children:['Are you sure you want to delete the folder "',H==null?void 0:H.name,'"?',a.jsx("br",{}),a.jsx("br",{}),a.jsx("strong",{children:"Note:"})," Any personas in this folder will not be deleted - they will still be available under 'All Personas' after folder deletion."]})]}),a.jsxs(iv,{children:[a.jsx(cv,{children:"Cancel"}),a.jsx(lv,{onClick:gt,className:"bg-red-600 hover:bg-red-700",children:"Delete"})]})]})}),a.jsx(wo,{open:V,onOpenChange:I=>{$(I||!1)},children:a.jsxs(la,{className:"z-50",children:[a.jsxs(ca,{children:[a.jsx(ua,{children:"Move to Folder"}),a.jsxs(Cl,{children:["Choose a folder to move ",S.size," selected persona",S.size!==1?"s":""," to."]})]}),a.jsx("div",{className:"py-4",children:a.jsxs(P1,{value:L||"",onValueChange:Y,className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(cf,{value:An,id:"folder-all"}),a.jsxs(ji,{htmlFor:"folder-all",className:"flex items-center gap-2",children:[a.jsx(Ws,{className:"h-4 w-4"}),a.jsx("span",{children:"All Personas (Remove from folders)"})]})]}),b.map(I=>a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(cf,{value:I.id,id:`folder-${I.id}`}),a.jsxs(ji,{htmlFor:`folder-${I.id}`,className:"flex items-center gap-2",children:[a.jsx(Ws,{className:"h-4 w-4"}),a.jsx("span",{children:I.name})]})]},I.id))]})}),a.jsxs(jo,{children:[a.jsx(se,{variant:"outline",onClick:I=>{I.preventDefault(),I.stopPropagation(),$(!1),Y(null)},children:"Cancel"}),a.jsx(se,{onClick:async I=>{if(I.preventDefault(),I.stopPropagation(),!L)return;const Z=new Set(S),ne=L;if($(!1),Y(null),ne&&Z.size>0){j(!0);try{await At(Z,ne)}finally{j(!1),N(new Set)}}},disabled:!L,children:"Move"})]})]})}),a.jsx(wo,{open:Q,onOpenChange:I=>{I?(ee(I),pe({...fe})):(S.size>0&&N(new Set),ee(!1))},children:a.jsxs(la,{className:"max-w-4xl max-h-[80vh] flex flex-col",onInteractOutside:I=>{I.preventDefault()},children:[a.jsx("div",{className:"sticky top-0 bg-background border-b shadow-sm pb-4 z-10",children:a.jsxs(ca,{children:[a.jsx(ua,{children:"Filter Personas"}),a.jsx(Cl,{children:"Select attributes to filter personas by. Multiple selections within a category use OR logic, different categories use AND logic. Filter options dynamically update to show only relevant values."})]})}),a.jsxs("div",{className:"flex-1 overflow-y-auto px-1 py-4 space-y-6",children:[Object.values(he).some(I=>I.length>0)&&a.jsx("div",{className:"bg-muted/30 p-3 rounded-md",children:a.jsxs("p",{className:"text-sm text-muted-foreground",children:[Object.values(he).reduce((I,Z)=>I+Z.length,0)," active filters"]})}),a.jsx("div",{className:"space-y-4",children:(()=>{const I=z=>{const re={...he};re[z]=[];const me=m.filter(le=>Object.entries(re).every(([Ue,Ne])=>{if(Ne.length===0)return!0;const ze=Ue;if(ze==="techSavviness"&&le.techSavviness!==void 0){const Se=le.techSavviness<30?"Low (0-30)":le.techSavviness<70?"Medium (31-70)":"High (71-100)";return Ne.includes(Se)}else{if(ze==="age"&&le.age)return Ne.includes(le.age);if(ze==="gender"&&le.gender)return Ne.includes(le.gender);if(ze==="occupation"&&le.occupation)return Ne.includes(le.occupation);if(ze==="location"&&le.location)return Ne.includes(le.location);if(ze==="ethnicity"&&le.ethnicity)return Ne.includes(le.ethnicity)}return!0}));return E(me)},Z=Object.values(he).every(z=>z.length===0),ne=E(m),B=(z,re,me,le=1)=>{const Ue=he[re],Ne=[...new Set([...me,...Ue])].sort();return Ne.length===0?null:a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium mb-3",children:z}),a.jsx("div",{className:`grid grid-cols-1 ${le===2?"sm:grid-cols-2":le===3?"sm:grid-cols-2 md:grid-cols-3":""} gap-2`,children:Ne.map(ze=>{const Se=he[re].includes(ze),at=me.includes(ze);return a.jsxs("div",{className:`flex items-center space-x-2 ${!at&&!Se?"opacity-50":""}`,children:[a.jsx(Sh,{id:`${re}-${ze}`,checked:Se,onCheckedChange:()=>K(re,ze),disabled:!at&&!Se}),a.jsxs(ji,{htmlFor:`${re}-${ze}`,className:"truncate overflow-hidden",children:[ze,Se&&!at&&a.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:"(no matches)"})]})]},ze)})})]})};return a.jsxs(a.Fragment,{children:[B("Gender","gender",Z?ne.gender:I("gender").gender,3),B("Age","age",Z?ne.age:I("age").age,3),B("Ethnicity","ethnicity",Z?ne.ethnicity:I("ethnicity").ethnicity,2),B("Location","location",Z?ne.location:I("location").location,2),B("Occupation","occupation",Z?ne.occupation:I("occupation").occupation,2),B("Tech Savviness","techSavviness",Z?ne.techSavviness:I("techSavviness").techSavviness,3),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-6"})]})})()})]}),a.jsx("div",{className:"sticky bottom-0 bg-background border-t shadow-[0_-2px_4px_rgba(0,0,0,0.05)] pt-4 z-10",children:a.jsxs(jo,{children:[a.jsx(se,{variant:"outline",onClick:U,children:"Reset"}),a.jsx(se,{onClick:D,children:"Apply Filters"})]})})]})}),a.jsx(wo,{open:Ye,onOpenChange:G,children:a.jsxs(la,{children:[a.jsxs(ca,{children:[a.jsx(ua,{children:"Select AI Model for Summary Generation"}),a.jsx(Cl,{children:"Choose which AI model to use for generating persona summaries"})]}),a.jsx("div",{className:"py-4",children:a.jsxs(P1,{value:ve,onValueChange:Pe,className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(cf,{value:"gemini-2.5-pro",id:"download-gemini"}),a.jsx(ji,{htmlFor:"download-gemini",className:"text-sm font-medium",children:"Gemini 2.5 Pro"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(cf,{value:"gpt-4.1",id:"download-gpt"}),a.jsx(ji,{htmlFor:"download-gpt",className:"text-sm font-medium",children:"GPT-4.1"})]})]})}),a.jsxs(jo,{children:[a.jsx(se,{variant:"outline",onClick:()=>G(!1),children:"Cancel"}),a.jsx(se,{onClick:It,children:"Generate Summary"})]})]})})]})]})}):a.jsxs(Ho,{defaultValue:"ai",onValueChange:I=>o(I),children:[a.jsxs($a,{className:"grid w-full grid-cols-2 mb-6",children:[a.jsx(Wt,{value:"ai",children:"AI Recruiter"}),a.jsx(Wt,{value:"manual",children:"Manual Creation"})]}),a.jsxs(Ht,{value:"ai",children:[console.log(`Rendering AIRecruiter with targetFolderId: ${u!==An?u:"null"}`),console.log("Current folders:",b.map(I=>({id:I.id,name:I.name}))),a.jsx(TZ,{targetFolderId:u!==An?u:null,targetFolderName:u!==An?(q=b.find(I=>I.id===u))==null?void 0:q.name:null})]}),a.jsx(Ht,{value:"manual",children:a.jsx(jQ,{targetFolderId:u!==An?u:null,targetFolderName:u!==An?(we=b.find(I=>I.id===u))==null?void 0:we.name:null})})]})]})]})},jee="modulepreload",See=function(e){return"/semblance/"+e},ME={},Nee=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(n.map(c=>{if(c=See(c),c in ME)return;ME[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":jee,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((h,p)=>{f.addEventListener("load",h),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return s.then(o=>{for(const l of o||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})};function _ee(){for(var e=arguments.length,t=new Array(e),n=0;nr=>{t.forEach(s=>s(r))},t)}const gx=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function od(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function k_(e){return"nodeType"in e}function Kr(e){var t,n;return e?od(e)?e:k_(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function T_(e){const{Document:t}=Kr(e);return e instanceof t}function Ip(e){return od(e)?!1:e instanceof Kr(e).HTMLElement}function v5(e){return e instanceof Kr(e).SVGElement}function ld(e){return e?od(e)?e.document:k_(e)?T_(e)?e:Ip(e)||v5(e)?e.ownerDocument:document:document:document}const Di=gx?v.useLayoutEffect:v.useEffect;function $_(e){const t=v.useRef(e);return Di(()=>{t.current=e}),v.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s{e.current=setInterval(r,s)},[]),n=v.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Nh(e,t){t===void 0&&(t=[e]);const n=v.useRef(e);return Di(()=>{n.current!==e&&(n.current=e)},t),n}function Mp(e,t){const n=v.useRef();return v.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function uv(e){const t=$_(e),n=v.useRef(null),r=v.useCallback(s=>{s!==n.current&&(t==null||t(s,n.current)),n.current=s},[]);return[n,r]}function C1(e){const t=v.useRef();return v.useEffect(()=>{t.current=e},[e]),t.current}let cb={};function Rp(e,t){return v.useMemo(()=>{if(t)return t;const n=cb[e]==null?0:cb[e]+1;return cb[e]=n,e+"-"+n},[e,t])}function y5(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s{const l=Object.entries(o);for(const[c,u]of l){const d=i[c];d!=null&&(i[c]=d+e*u)}return i},{...t})}}const Hc=y5(1),_h=y5(-1);function Cee(e){return"clientX"in e&&"clientY"in e}function I_(e){if(!e)return!1;const{KeyboardEvent:t}=Kr(e.target);return t&&e instanceof t}function Aee(e){if(!e)return!1;const{TouchEvent:t}=Kr(e.target);return t&&e instanceof t}function A1(e){if(Aee(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Cee(e)?{x:e.clientX,y:e.clientY}:null}const vu=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[vu.Translate.toString(e),vu.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),RE="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Eee(e){return e.matches(RE)?e:e.querySelector(RE)}const Oee={display:"none"};function kee(e){let{id:t,value:n}=e;return C.createElement("div",{id:t,style:Oee},n)}function Tee(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return C.createElement("div",{id:t,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function $ee(){const[e,t]=v.useState("");return{announce:v.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const x5=v.createContext(null);function Iee(e){const t=v.useContext(x5);v.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function Mee(){const[e]=v.useState(()=>new Set),t=v.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[v.useCallback(r=>{let{type:s,event:i}=r;e.forEach(o=>{var l;return(l=o[s])==null?void 0:l.call(o,i)})},[e]),t]}const Ree={draggable:` + To pick up a draggable item, press the space bar. + While dragging, use the arrow keys to move the item. + Press space again to drop the item in its new position, or press escape to cancel. + `},Dee={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Lee(e){let{announcements:t=Dee,container:n,hiddenTextDescribedById:r,screenReaderInstructions:s=Ree}=e;const{announce:i,announcement:o}=$ee(),l=Rp("DndLiveRegion"),[c,u]=v.useState(!1);if(v.useEffect(()=>{u(!0)},[]),Iee(v.useMemo(()=>({onDragStart(f){let{active:h}=f;i(t.onDragStart({active:h}))},onDragMove(f){let{active:h,over:p}=f;t.onDragMove&&i(t.onDragMove({active:h,over:p}))},onDragOver(f){let{active:h,over:p}=f;i(t.onDragOver({active:h,over:p}))},onDragEnd(f){let{active:h,over:p}=f;i(t.onDragEnd({active:h,over:p}))},onDragCancel(f){let{active:h,over:p}=f;i(t.onDragCancel({active:h,over:p}))}}),[i,t])),!c)return null;const d=C.createElement(C.Fragment,null,C.createElement(kee,{id:r,value:s.draggable}),C.createElement(Tee,{id:l,announcement:o}));return n?Xs.createPortal(d,n):d}var Un;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Un||(Un={}));function dv(){}function DE(e,t){return v.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Fee(){for(var e=arguments.length,t=new Array(e),n=0;n[...t].filter(r=>r!=null),[...t])}const oi=Object.freeze({x:0,y:0});function b5(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function w5(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Bee(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function LE(e){let{left:t,top:n,height:r,width:s}=e;return[{x:t,y:n},{x:t+s,y:n},{x:t,y:n+r},{x:t+s,y:n+r}]}function j5(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function FE(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const zee=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=FE(t,t.left,t.top),i=[];for(const o of r){const{id:l}=o,c=n.get(l);if(c){const u=b5(FE(c),s);i.push({id:l,data:{droppableContainer:o,value:u}})}}return i.sort(w5)},Uee=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=LE(t),i=[];for(const o of r){const{id:l}=o,c=n.get(l);if(c){const u=LE(c),d=s.reduce((h,p,g)=>h+b5(u[g],p),0),f=Number((d/4).toFixed(4));i.push({id:l,data:{droppableContainer:o,value:f}})}}return i.sort(w5)};function Vee(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),o=s-r,l=i-n;if(r{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=[];for(const i of r){const{id:o}=i,l=n.get(o);if(l){const c=Vee(l,t);c>0&&s.push({id:o,data:{droppableContainer:i,value:c}})}}return s.sort(Bee)};function Hee(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function S5(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:oi}function Gee(e){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),i=1;i({...o,top:o.top+e*l.y,bottom:o.bottom+e*l.y,left:o.left+e*l.x,right:o.right+e*l.x}),{...n})}}const qee=Gee(1);function Kee(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Xee(e,t,n){const r=Kee(t);if(!r)return e;const{scaleX:s,scaleY:i,x:o,y:l}=r,c=e.left-o-(1-s)*parseFloat(n),u=e.top-l-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),d=s?e.width/s:e.width,f=i?e.height/i:e.height;return{width:d,height:f,top:u,right:c+d,bottom:u+f,left:c}}const Yee={ignoreTransform:!1};function cd(e,t){t===void 0&&(t=Yee);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:d}=Kr(e).getComputedStyle(e);u&&(n=Xee(n,u,d))}const{top:r,left:s,width:i,height:o,bottom:l,right:c}=n;return{top:r,left:s,width:i,height:o,bottom:l,right:c}}function BE(e){return cd(e,{ignoreTransform:!0})}function Zee(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Qee(e,t){return t===void 0&&(t=Kr(e).getComputedStyle(e)),t.position==="fixed"}function Jee(e,t){t===void 0&&(t=Kr(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const i=t[s];return typeof i=="string"?n.test(i):!1})}function vx(e,t){const n=[];function r(s){if(t!=null&&n.length>=t||!s)return n;if(T_(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!Ip(s)||v5(s)||n.includes(s))return n;const i=Kr(e).getComputedStyle(s);return s!==e&&Jee(s,i)&&n.push(s),Qee(s,i)?n:r(s.parentNode)}return e?r(e):n}function N5(e){const[t]=vx(e,1);return t??null}function ub(e){return!gx||!e?null:od(e)?e:k_(e)?T_(e)||e===ld(e).scrollingElement?window:Ip(e)?e:null:null}function _5(e){return od(e)?e.scrollX:e.scrollLeft}function P5(e){return od(e)?e.scrollY:e.scrollTop}function E1(e){return{x:_5(e),y:P5(e)}}var Xn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Xn||(Xn={}));function C5(e){return!gx||!e?!1:e===document.scrollingElement}function A5(e){const t={x:0,y:0},n=C5(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},s=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,o=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:s,isLeft:i,isBottom:o,isRight:l,maxScroll:r,minScroll:t}}const ete={x:.2,y:.2};function tte(e,t,n,r,s){let{top:i,left:o,right:l,bottom:c}=n;r===void 0&&(r=10),s===void 0&&(s=ete);const{isTop:u,isBottom:d,isLeft:f,isRight:h}=A5(e),p={x:0,y:0},g={x:0,y:0},m={height:t.height*s.y,width:t.width*s.x};return!u&&i<=t.top+m.height?(p.y=Xn.Backward,g.y=r*Math.abs((t.top+m.height-i)/m.height)):!d&&c>=t.bottom-m.height&&(p.y=Xn.Forward,g.y=r*Math.abs((t.bottom-m.height-c)/m.height)),!h&&l>=t.right-m.width?(p.x=Xn.Forward,g.x=r*Math.abs((t.right-m.width-l)/m.width)):!f&&o<=t.left+m.width&&(p.x=Xn.Backward,g.x=r*Math.abs((t.left+m.width-o)/m.width)),{direction:p,speed:g}}function nte(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:o}=window;return{top:0,left:0,right:i,bottom:o,width:i,height:o}}const{top:t,left:n,right:r,bottom:s}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:s,width:e.clientWidth,height:e.clientHeight}}function E5(e){return e.reduce((t,n)=>Hc(t,E1(n)),oi)}function rte(e){return e.reduce((t,n)=>t+_5(n),0)}function ste(e){return e.reduce((t,n)=>t+P5(n),0)}function ite(e,t){if(t===void 0&&(t=cd),!e)return;const{top:n,left:r,bottom:s,right:i}=t(e);N5(e)&&(s<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const ate=[["x",["left","right"],rte],["y",["top","bottom"],ste]];class M_{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=vx(n),s=E5(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,o,l]of ate)for(const c of o)Object.defineProperty(this,c,{get:()=>{const u=l(r),d=s[i]-u;return this.rect[c]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Sf{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var s;(s=this.target)==null||s.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function ote(e){const{EventTarget:t}=Kr(e);return e instanceof t?e:ld(e)}function db(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var xs;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(xs||(xs={}));function zE(e){e.preventDefault()}function lte(e){e.stopPropagation()}var $t;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})($t||($t={}));const O5={start:[$t.Space,$t.Enter],cancel:[$t.Esc],end:[$t.Space,$t.Enter,$t.Tab]},cte=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case $t.Right:return{...n,x:n.x+25};case $t.Left:return{...n,x:n.x-25};case $t.Down:return{...n,y:n.y+25};case $t.Up:return{...n,y:n.y-25}}};class R_{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Sf(ld(n)),this.windowListeners=new Sf(Kr(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(xs.Resize,this.handleCancel),this.windowListeners.add(xs.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(xs.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&ite(r),n(oi)}handleKeyDown(t){if(I_(t)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:i=O5,coordinateGetter:o=cte,scrollBehavior:l="smooth"}=s,{code:c}=t;if(i.end.includes(c)){this.handleEnd(t);return}if(i.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:u}=r.current,d=u?{x:u.left,y:u.top}:oi;this.referenceCoordinates||(this.referenceCoordinates=d);const f=o(t,{active:n,context:r.current,currentCoordinates:d});if(f){const h=_h(f,d),p={x:0,y:0},{scrollableAncestors:g}=r.current;for(const m of g){const x=t.code,{isTop:b,isRight:y,isLeft:w,isBottom:j,maxScroll:S,minScroll:N}=A5(m),P=nte(m),_={x:Math.min(x===$t.Right?P.right-P.width/2:P.right,Math.max(x===$t.Right?P.left:P.left+P.width/2,f.x)),y:Math.min(x===$t.Down?P.bottom-P.height/2:P.bottom,Math.max(x===$t.Down?P.top:P.top+P.height/2,f.y))},A=x===$t.Right&&!y||x===$t.Left&&!w,O=x===$t.Down&&!j||x===$t.Up&&!b;if(A&&_.x!==f.x){const T=m.scrollLeft+h.x,k=x===$t.Right&&T<=S.x||x===$t.Left&&T>=N.x;if(k&&!h.y){m.scrollTo({left:T,behavior:l});return}k?p.x=m.scrollLeft-T:p.x=x===$t.Right?m.scrollLeft-S.x:m.scrollLeft-N.x,p.x&&m.scrollBy({left:-p.x,behavior:l});break}else if(O&&_.y!==f.y){const T=m.scrollTop+h.y,k=x===$t.Down&&T<=S.y||x===$t.Up&&T>=N.y;if(k&&!h.x){m.scrollTo({top:T,behavior:l});return}k?p.y=m.scrollTop-T:p.y=x===$t.Down?m.scrollTop-S.y:m.scrollTop-N.y,p.y&&m.scrollBy({top:-p.y,behavior:l});break}}this.handleMove(t,Hc(_h(f,this.referenceCoordinates),p))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}R_.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=O5,onActivation:s}=t,{active:i}=n;const{code:o}=e.nativeEvent;if(r.start.includes(o)){const l=i.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),s==null||s({event:e.nativeEvent}),!0)}return!1}}];function UE(e){return!!(e&&"distance"in e)}function VE(e){return!!(e&&"delay"in e)}class D_{constructor(t,n,r){var s;r===void 0&&(r=ote(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:o}=i;this.props=t,this.events=n,this.document=ld(o),this.documentListeners=new Sf(this.document),this.listeners=new Sf(r),this.windowListeners=new Sf(Kr(o)),this.initialCoordinates=(s=A1(i))!=null?s:oi,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(xs.Resize,this.handleCancel),this.windowListeners.add(xs.DragStart,zE),this.windowListeners.add(xs.VisibilityChange,this.handleCancel),this.windowListeners.add(xs.ContextMenu,zE),this.documentListeners.add(xs.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(VE(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(UE(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:s}=this.props;s(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(xs.Click,lte,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(xs.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:s,props:i}=this,{onMove:o,options:{activationConstraint:l}}=i;if(!s)return;const c=(n=A1(t))!=null?n:oi,u=_h(s,c);if(!r&&l){if(UE(l)){if(l.tolerance!=null&&db(u,l.tolerance))return this.handleCancel();if(db(u,l.distance))return this.handleStart()}if(VE(l)&&db(u,l.tolerance))return this.handleCancel();this.handlePending(l,u);return}t.cancelable&&t.preventDefault(),o(c)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===$t.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const ute={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class L_ extends D_{constructor(t){const{event:n}=t,r=ld(n.target);super(t,ute,r)}}L_.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const dte={move:{name:"mousemove"},end:{name:"mouseup"}};var O1;(function(e){e[e.RightClick=2]="RightClick"})(O1||(O1={}));class fte extends D_{constructor(t){super(t,dte,ld(t.event.target))}}fte.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===O1.RightClick?!1:(r==null||r({event:n}),!0)}}];const fb={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class hte extends D_{constructor(t){super(t,fb)}static setup(){return window.addEventListener(fb.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(fb.move.name,t)};function t(){}}}hte.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:s}=n;return s.length>1?!1:(r==null||r({event:n}),!0)}}];var Nf;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Nf||(Nf={}));var fv;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(fv||(fv={}));function pte(e){let{acceleration:t,activator:n=Nf.Pointer,canScroll:r,draggingRect:s,enabled:i,interval:o=5,order:l=fv.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:h}=e;const p=gte({delta:f,disabled:!i}),[g,m]=Pee(),x=v.useRef({x:0,y:0}),b=v.useRef({x:0,y:0}),y=v.useMemo(()=>{switch(n){case Nf.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Nf.DraggableRect:return s}},[n,s,c]),w=v.useRef(null),j=v.useCallback(()=>{const N=w.current;if(!N)return;const P=x.current.x*b.current.x,_=x.current.y*b.current.y;N.scrollBy(P,_)},[]),S=v.useMemo(()=>l===fv.TreeOrder?[...u].reverse():u,[l,u]);v.useEffect(()=>{if(!i||!u.length||!y){m();return}for(const N of S){if((r==null?void 0:r(N))===!1)continue;const P=u.indexOf(N),_=d[P];if(!_)continue;const{direction:A,speed:O}=tte(N,_,y,t,h);for(const T of["x","y"])p[T][A[T]]||(O[T]=0,A[T]=0);if(O.x>0||O.y>0){m(),w.current=N,g(j,o),x.current=O,b.current=A;return}}x.current={x:0,y:0},b.current={x:0,y:0},m()},[t,j,r,m,i,o,JSON.stringify(y),JSON.stringify(p),g,u,S,d,JSON.stringify(h)])}const mte={x:{[Xn.Backward]:!1,[Xn.Forward]:!1},y:{[Xn.Backward]:!1,[Xn.Forward]:!1}};function gte(e){let{delta:t,disabled:n}=e;const r=C1(t);return Mp(s=>{if(n||!r||!s)return mte;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Xn.Backward]:s.x[Xn.Backward]||i.x===-1,[Xn.Forward]:s.x[Xn.Forward]||i.x===1},y:{[Xn.Backward]:s.y[Xn.Backward]||i.y===-1,[Xn.Forward]:s.y[Xn.Forward]||i.y===1}}},[n,t,r])}function vte(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Mp(s=>{var i;return t==null?null:(i=r??s)!=null?i:null},[r,t])}function yte(e,t){return v.useMemo(()=>e.reduce((n,r)=>{const{sensor:s}=r,i=s.activators.map(o=>({eventName:o.eventName,handler:t(o.handler,r)}));return[...n,...i]},[]),[e,t])}var Ph;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Ph||(Ph={}));var k1;(function(e){e.Optimized="optimized"})(k1||(k1={}));const WE=new Map;function xte(e,t){let{dragging:n,dependencies:r,config:s}=t;const[i,o]=v.useState(null),{frequency:l,measure:c,strategy:u}=s,d=v.useRef(e),f=x(),h=Nh(f),p=v.useCallback(function(b){b===void 0&&(b=[]),!h.current&&o(y=>y===null?b:y.concat(b.filter(w=>!y.includes(w))))},[h]),g=v.useRef(null),m=Mp(b=>{if(f&&!n)return WE;if(!b||b===WE||d.current!==e||i!=null){const y=new Map;for(let w of e){if(!w)continue;if(i&&i.length>0&&!i.includes(w.id)&&w.rect.current){y.set(w.id,w.rect.current);continue}const j=w.node.current,S=j?new M_(c(j),j):null;w.rect.current=S,S&&y.set(w.id,S)}return y}return b},[e,i,n,f,c]);return v.useEffect(()=>{d.current=e},[e]),v.useEffect(()=>{f||p()},[n,f]),v.useEffect(()=>{i&&i.length>0&&o(null)},[JSON.stringify(i)]),v.useEffect(()=>{f||typeof l!="number"||g.current!==null||(g.current=setTimeout(()=>{p(),g.current=null},l))},[l,f,p,...r]),{droppableRects:m,measureDroppableContainers:p,measuringScheduled:i!=null};function x(){switch(u){case Ph.Always:return!1;case Ph.BeforeDragging:return n;default:return!n}}}function k5(e,t){return Mp(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function bte(e,t){return k5(e,t)}function wte(e){let{callback:t,disabled:n}=e;const r=$_(t),s=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return v.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function yx(e){let{callback:t,disabled:n}=e;const r=$_(t),s=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return v.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function jte(e){return new M_(cd(e),e)}function HE(e,t,n){t===void 0&&(t=jte);const[r,s]=v.useState(null);function i(){s(c=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=c??n)!=null?u:null}const d=t(e);return JSON.stringify(c)===JSON.stringify(d)?c:d})}const o=wte({callback(c){if(e)for(const u of c){const{type:d,target:f}=u;if(d==="childList"&&f instanceof HTMLElement&&f.contains(e)){i();break}}}}),l=yx({callback:i});return Di(()=>{i(),e?(l==null||l.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),o==null||o.disconnect())},[e]),r}function Ste(e){const t=k5(e);return S5(e,t)}const GE=[];function Nte(e){const t=v.useRef(e),n=Mp(r=>e?r&&r!==GE&&e&&t.current&&e.parentNode===t.current.parentNode?r:vx(e):GE,[e]);return v.useEffect(()=>{t.current=e},[e]),n}function _te(e){const[t,n]=v.useState(null),r=v.useRef(e),s=v.useCallback(i=>{const o=ub(i.target);o&&n(l=>l?(l.set(o,E1(o)),new Map(l)):null)},[]);return v.useEffect(()=>{const i=r.current;if(e!==i){o(i);const l=e.map(c=>{const u=ub(c);return u?(u.addEventListener("scroll",s,{passive:!0}),[u,E1(u)]):null}).filter(c=>c!=null);n(l.length?new Map(l):null),r.current=e}return()=>{o(e),o(i)};function o(l){l.forEach(c=>{const u=ub(c);u==null||u.removeEventListener("scroll",s)})}},[s,e]),v.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,o)=>Hc(i,o),oi):E5(e):oi,[e,t])}function qE(e,t){t===void 0&&(t=[]);const n=v.useRef(null);return v.useEffect(()=>{n.current=null},t),v.useEffect(()=>{const r=e!==oi;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?_h(e,n.current):oi}function Pte(e){v.useEffect(()=>{if(!gx)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function Cte(e,t){return v.useMemo(()=>e.reduce((n,r)=>{let{eventName:s,handler:i}=r;return n[s]=o=>{i(o,t)},n},{}),[e,t])}function T5(e){return v.useMemo(()=>e?Zee(e):null,[e])}const KE=[];function Ate(e,t){t===void 0&&(t=cd);const[n]=e,r=T5(n?Kr(n):null),[s,i]=v.useState(KE);function o(){i(()=>e.length?e.map(c=>C5(c)?r:new M_(t(c),c)):KE)}const l=yx({callback:o});return Di(()=>{l==null||l.disconnect(),o(),e.forEach(c=>l==null?void 0:l.observe(c))},[e]),s}function Ete(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ip(t)?t:e}function Ote(e){let{measure:t}=e;const[n,r]=v.useState(null),s=v.useCallback(u=>{for(const{target:d}of u)if(Ip(d)){r(f=>{const h=t(d);return f?{...f,width:h.width,height:h.height}:h});break}},[t]),i=yx({callback:s}),o=v.useCallback(u=>{const d=Ete(u);i==null||i.disconnect(),d&&(i==null||i.observe(d)),r(d?t(d):null)},[t,i]),[l,c]=uv(o);return v.useMemo(()=>({nodeRef:l,rect:n,setRef:c}),[n,l,c])}const kte=[{sensor:L_,options:{}},{sensor:R_,options:{}}],Tte={current:{}},tg={draggable:{measure:BE},droppable:{measure:BE,strategy:Ph.WhileDragging,frequency:k1.Optimized},dragOverlay:{measure:cd}};class _f extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const $te={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new _f,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:dv},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:tg,measureDroppableContainers:dv,windowRect:null,measuringScheduled:!1},Ite={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:dv,draggableNodes:new Map,over:null,measureDroppableContainers:dv},xx=v.createContext(Ite),$5=v.createContext($te);function Mte(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new _f}}}function Rte(e,t){switch(t.type){case Un.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Un.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Un.DragEnd:case Un.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Un.RegisterDroppable:{const{element:n}=t,{id:r}=n,s=new _f(e.droppable.containers);return s.set(r,n),{...e,droppable:{...e.droppable,containers:s}}}case Un.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new _f(e.droppable.containers);return o.set(n,{...i,disabled:s}),{...e,droppable:{...e.droppable,containers:o}}}case Un.UnregisterDroppable:{const{id:n,key:r}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const i=new _f(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Dte(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:s}=v.useContext(xx),i=C1(r),o=C1(n==null?void 0:n.id);return v.useEffect(()=>{if(!t&&!r&&i&&o!=null){if(!I_(i)||document.activeElement===i.target)return;const l=s.get(o);if(!l)return;const{activatorNode:c,node:u}=l;if(!c.current&&!u.current)return;requestAnimationFrame(()=>{for(const d of[c.current,u.current]){if(!d)continue;const f=Eee(d);if(f){f.focus();break}}})}},[r,t,s,o,i]),null}function Lte(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((s,i)=>i({transform:s,...r}),n):n}function Fte(e){return v.useMemo(()=>({draggable:{...tg.draggable,...e==null?void 0:e.draggable},droppable:{...tg.droppable,...e==null?void 0:e.droppable},dragOverlay:{...tg.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function Bte(e){let{activeNode:t,measure:n,initialRect:r,config:s=!0}=e;const i=v.useRef(!1),{x:o,y:l}=typeof s=="boolean"?{x:s,y:s}:s;Di(()=>{if(!o&&!l||!t){i.current=!1;return}if(i.current||!r)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const d=n(u),f=S5(d,r);if(o||(f.x=0),l||(f.y=0),i.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=N5(u);h&&h.scrollBy({top:f.y,left:f.x})}},[t,o,l,r,n])}const I5=v.createContext({...oi,scaleX:1,scaleY:1});var qa;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(qa||(qa={}));const zte=v.memo(function(t){var n,r,s,i;let{id:o,accessibility:l,autoScroll:c=!0,children:u,sensors:d=kte,collisionDetection:f=Wee,measuring:h,modifiers:p,...g}=t;const m=v.useReducer(Rte,void 0,Mte),[x,b]=m,[y,w]=Mee(),[j,S]=v.useState(qa.Uninitialized),N=j===qa.Initialized,{draggable:{active:P,nodes:_,translate:A},droppable:{containers:O}}=x,T=P!=null?_.get(P):null,k=v.useRef({initial:null,translated:null}),M=v.useMemo(()=>{var q;return P!=null?{id:P,data:(q=T==null?void 0:T.data)!=null?q:Tte,rect:k}:null},[P,T]),R=v.useRef(null),[H,F]=v.useState(null),[V,$]=v.useState(null),L=Nh(g,Object.values(g)),Y=Rp("DndDescribedBy",o),Q=v.useMemo(()=>O.getEnabled(),[O]),ee=Fte(h),{droppableRects:fe,measureDroppableContainers:W,measuringScheduled:he}=xte(Q,{dragging:N,dependencies:[A.x,A.y],config:ee.droppable}),pe=vte(_,P),ue=v.useMemo(()=>V?A1(V):null,[V]),Ae=Dn(),de=bte(pe,ee.draggable.measure);Bte({activeNode:P!=null?_.get(P):null,config:Ae.layoutShiftCompensation,initialRect:de,measure:ee.draggable.measure});const oe=HE(pe,ee.draggable.measure,de),xe=HE(pe?pe.parentElement:null),te=v.useRef({activatorEvent:null,active:null,activeNode:pe,collisionRect:null,collisions:null,droppableRects:fe,draggableNodes:_,draggingNode:null,draggingNodeRect:null,droppableContainers:O,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ye=O.getNodeFor((n=te.current.over)==null?void 0:n.id),G=Ote({measure:ee.dragOverlay.measure}),ve=(r=G.nodeRef.current)!=null?r:pe,Pe=N?(s=G.rect)!=null?s:oe:null,Ie=!!(G.nodeRef.current&&G.rect),E=Ste(Ie?null:oe),D=T5(ve?Kr(ve):null),U=Nte(N?Ye??pe:null),K=Ate(U),J=Lte(p,{transform:{x:A.x-E.x,y:A.y-E.y,scaleX:1,scaleY:1},activatorEvent:V,active:M,activeNodeRect:oe,containerNodeRect:xe,draggingNodeRect:Pe,over:te.current.over,overlayNodeRect:G.rect,scrollableAncestors:U,scrollableAncestorRects:K,windowRect:D}),X=ue?Hc(ue,A):null,be=_te(U),_e=qE(be),Fe=qE(be,[oe]),ie=Hc(J,_e),Te=Pe?qee(Pe,J):null,Be=M&&Te?f({active:M,collisionRect:Te,droppableRects:fe,droppableContainers:Q,pointerCoordinates:X}):null,gt=j5(Be,"id"),[At,pn]=v.useState(null),Zt=Ie?J:Hc(J,Fe),bn=Hee(Zt,(i=At==null?void 0:At.rect)!=null?i:null,oe),Xt=v.useRef(null),yt=v.useCallback((q,we)=>{let{sensor:I,options:Z}=we;if(R.current==null)return;const ne=_.get(R.current);if(!ne)return;const B=q.nativeEvent,z=new I({active:R.current,activeNode:ne,event:B,options:Z,context:te,onAbort(me){if(!_.get(me))return;const{onDragAbort:Ue}=L.current,Ne={id:me};Ue==null||Ue(Ne),y({type:"onDragAbort",event:Ne})},onPending(me,le,Ue,Ne){if(!_.get(me))return;const{onDragPending:Se}=L.current,at={id:me,constraint:le,initialCoordinates:Ue,offset:Ne};Se==null||Se(at),y({type:"onDragPending",event:at})},onStart(me){const le=R.current;if(le==null)return;const Ue=_.get(le);if(!Ue)return;const{onDragStart:Ne}=L.current,ze={activatorEvent:B,active:{id:le,data:Ue.data,rect:k}};Xs.unstable_batchedUpdates(()=>{Ne==null||Ne(ze),S(qa.Initializing),b({type:Un.DragStart,initialCoordinates:me,active:le}),y({type:"onDragStart",event:ze}),F(Xt.current),$(B)})},onMove(me){b({type:Un.DragMove,coordinates:me})},onEnd:re(Un.DragEnd),onCancel:re(Un.DragCancel)});Xt.current=z;function re(me){return async function(){const{active:Ue,collisions:Ne,over:ze,scrollAdjustedTranslate:Se}=te.current;let at=null;if(Ue&&Se){const{cancelDrop:Ce}=L.current;at={activatorEvent:B,active:Ue,collisions:Ne,delta:Se,over:ze},me===Un.DragEnd&&typeof Ce=="function"&&await Promise.resolve(Ce(at))&&(me=Un.DragCancel)}R.current=null,Xs.unstable_batchedUpdates(()=>{b({type:me}),S(qa.Uninitialized),pn(null),F(null),$(null),Xt.current=null;const Ce=me===Un.DragEnd?"onDragEnd":"onDragCancel";if(at){const ut=L.current[Ce];ut==null||ut(at),y({type:Ce,event:at})}})}}},[_]),Rr=v.useCallback((q,we)=>(I,Z)=>{const ne=I.nativeEvent,B=_.get(Z);if(R.current!==null||!B||ne.dndKit||ne.defaultPrevented)return;const z={active:B};q(I,we.options,z)===!0&&(ne.dndKit={capturedBy:we.sensor},R.current=Z,yt(I,we))},[_,yt]),tt=yte(d,Rr);Pte(d),Di(()=>{oe&&j===qa.Initializing&&S(qa.Initialized)},[oe,j]),v.useEffect(()=>{const{onDragMove:q}=L.current,{active:we,activatorEvent:I,collisions:Z,over:ne}=te.current;if(!we||!I)return;const B={active:we,activatorEvent:I,collisions:Z,delta:{x:ie.x,y:ie.y},over:ne};Xs.unstable_batchedUpdates(()=>{q==null||q(B),y({type:"onDragMove",event:B})})},[ie.x,ie.y]),v.useEffect(()=>{const{active:q,activatorEvent:we,collisions:I,droppableContainers:Z,scrollAdjustedTranslate:ne}=te.current;if(!q||R.current==null||!we||!ne)return;const{onDragOver:B}=L.current,z=Z.get(gt),re=z&&z.rect.current?{id:z.id,rect:z.rect.current,data:z.data,disabled:z.disabled}:null,me={active:q,activatorEvent:we,collisions:I,delta:{x:ne.x,y:ne.y},over:re};Xs.unstable_batchedUpdates(()=>{pn(re),B==null||B(me),y({type:"onDragOver",event:me})})},[gt]),Di(()=>{te.current={activatorEvent:V,active:M,activeNode:pe,collisionRect:Te,collisions:Be,droppableRects:fe,draggableNodes:_,draggingNode:ve,draggingNodeRect:Pe,droppableContainers:O,over:At,scrollableAncestors:U,scrollAdjustedTranslate:ie},k.current={initial:Pe,translated:Te}},[M,pe,Be,Te,_,ve,Pe,fe,O,At,U,ie]),pte({...Ae,delta:A,draggingRect:Te,pointerCoordinates:X,scrollableAncestors:U,scrollableAncestorRects:K});const It=v.useMemo(()=>({active:M,activeNode:pe,activeNodeRect:oe,activatorEvent:V,collisions:Be,containerNodeRect:xe,dragOverlay:G,draggableNodes:_,droppableContainers:O,droppableRects:fe,over:At,measureDroppableContainers:W,scrollableAncestors:U,scrollableAncestorRects:K,measuringConfiguration:ee,measuringScheduled:he,windowRect:D}),[M,pe,oe,V,Be,xe,G,_,O,fe,At,W,U,K,ee,he,D]),kt=v.useMemo(()=>({activatorEvent:V,activators:tt,active:M,activeNodeRect:oe,ariaDescribedById:{draggable:Y},dispatch:b,draggableNodes:_,over:At,measureDroppableContainers:W}),[V,tt,M,oe,b,Y,_,At,W]);return C.createElement(x5.Provider,{value:w},C.createElement(xx.Provider,{value:kt},C.createElement($5.Provider,{value:It},C.createElement(I5.Provider,{value:bn},u)),C.createElement(Dte,{disabled:(l==null?void 0:l.restoreFocus)===!1})),C.createElement(Lee,{...l,hiddenTextDescribedById:Y}));function Dn(){const q=(H==null?void 0:H.autoScrollEnabled)===!1,we=typeof c=="object"?c.enabled===!1:c===!1,I=N&&!q&&!we;return typeof c=="object"?{...c,enabled:I}:{enabled:I}}}),Ute=v.createContext(null),XE="button",Vte="Draggable";function Wte(e){let{id:t,data:n,disabled:r=!1,attributes:s}=e;const i=Rp(Vte),{activators:o,activatorEvent:l,active:c,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:h}=v.useContext(xx),{role:p=XE,roleDescription:g="draggable",tabIndex:m=0}=s??{},x=(c==null?void 0:c.id)===t,b=v.useContext(x?I5:Ute),[y,w]=uv(),[j,S]=uv(),N=Cte(o,t),P=Nh(n);Di(()=>(f.set(t,{id:t,key:i,node:y,activatorNode:j,data:P}),()=>{const A=f.get(t);A&&A.key===i&&f.delete(t)}),[f,t]);const _=v.useMemo(()=>({role:p,tabIndex:m,"aria-disabled":r,"aria-pressed":x&&p===XE?!0:void 0,"aria-roledescription":g,"aria-describedby":d.draggable}),[r,p,m,x,g,d.draggable]);return{active:c,activatorEvent:l,activeNodeRect:u,attributes:_,isDragging:x,listeners:r?void 0:N,node:y,over:h,setNodeRef:w,setActivatorNodeRef:S,transform:b}}function Hte(){return v.useContext($5)}const Gte="Droppable",qte={timeout:25};function Kte(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:s}=e;const i=Rp(Gte),{active:o,dispatch:l,over:c,measureDroppableContainers:u}=v.useContext(xx),d=v.useRef({disabled:n}),f=v.useRef(!1),h=v.useRef(null),p=v.useRef(null),{disabled:g,updateMeasurementsFor:m,timeout:x}={...qte,...s},b=Nh(m??r),y=v.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{u(Array.isArray(b.current)?b.current:[b.current]),p.current=null},x)},[x]),w=yx({callback:y,disabled:g||!o}),j=v.useCallback((_,A)=>{w&&(A&&(w.unobserve(A),f.current=!1),_&&w.observe(_))},[w]),[S,N]=uv(j),P=Nh(t);return v.useEffect(()=>{!w||!S.current||(w.disconnect(),f.current=!1,w.observe(S.current))},[S,w]),v.useEffect(()=>(l({type:Un.RegisterDroppable,element:{id:r,key:i,disabled:n,node:S,rect:h,data:P}}),()=>l({type:Un.UnregisterDroppable,key:i,id:r})),[r]),v.useEffect(()=>{n!==d.current.disabled&&(l({type:Un.SetDroppableDisabled,id:r,key:i,disabled:n}),d.current.disabled=n)},[r,i,n,l]),{active:o,rect:h,isOver:(c==null?void 0:c.id)===r,node:S,over:c,setNodeRef:N}}function hv(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Xte(e,t){return e.reduce((n,r,s)=>{const i=t.get(r);return i&&(n[s]=i),n},Array(e.length))}function bm(e){return e!==null&&e>=0}function Yte(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{let{rects:t,activeIndex:n,overIndex:r,index:s}=e;const i=hv(t,r,n),o=t[s],l=i[s];return!l||!o?null:{x:l.left-o.left,y:l.top-o.top,scaleX:l.width/o.width,scaleY:l.height/o.height}},wm={scaleX:1,scaleY:1},Bd=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:s,rects:i,overIndex:o}=e;const l=(t=i[n])!=null?t:r;if(!l)return null;if(s===n){const u=i[o];return u?{x:0,y:nn&&s<=o?{x:0,y:-l.height-c,...wm}:s=o?{x:0,y:l.height+c,...wm}:{x:0,y:0,...wm}};function Qte(e,t,n){const r=e[t],s=e[t-1],i=e[t+1];return r?nr.map(N=>typeof N=="object"&&"id"in N?N.id:N),[r]),g=o!=null,m=o?p.indexOf(o.id):-1,x=u?p.indexOf(u.id):-1,b=v.useRef(p),y=!Yte(p,b.current),w=x!==-1&&m===-1||y,j=Zte(i);Di(()=>{y&&g&&d(p)},[y,p,g,d]),v.useEffect(()=>{b.current=p},[p]);const S=v.useMemo(()=>({activeIndex:m,containerId:f,disabled:j,disableTransforms:w,items:p,overIndex:x,useDragOverlay:h,sortedRects:Xte(p,c),strategy:s}),[m,f,j.draggable,j.droppable,w,p,x,c,h,s]);return C.createElement(D5.Provider,{value:S},t)}const Jte=e=>{let{id:t,items:n,activeIndex:r,overIndex:s}=e;return hv(n,r,s).indexOf(t)},ene=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:s,items:i,newIndex:o,previousItems:l,previousContainerId:c,transition:u}=e;return!u||!r||l!==i&&s===o?!1:n?!0:o!==s&&t===c},tne={duration:200,easing:"ease"},L5="transform",nne=vu.Transition.toString({property:L5,duration:0,easing:"linear"}),rne={roleDescription:"sortable"};function sne(e){let{disabled:t,index:n,node:r,rect:s}=e;const[i,o]=v.useState(null),l=v.useRef(n);return Di(()=>{if(!t&&n!==l.current&&r.current){const c=s.current;if(c){const u=cd(r.current,{ignoreTransform:!0}),d={x:c.left-u.left,y:c.top-u.top,scaleX:c.width/u.width,scaleY:c.height/u.height};(d.x||d.y)&&o(d)}}n!==l.current&&(l.current=n)},[t,n,r,s]),v.useEffect(()=>{i&&o(null)},[i]),i}function YE(e){let{animateLayoutChanges:t=ene,attributes:n,disabled:r,data:s,getNewIndex:i=Jte,id:o,strategy:l,resizeObserverConfig:c,transition:u=tne}=e;const{items:d,containerId:f,activeIndex:h,disabled:p,disableTransforms:g,sortedRects:m,overIndex:x,useDragOverlay:b,strategy:y}=v.useContext(D5),w=ine(r,p),j=d.indexOf(o),S=v.useMemo(()=>({sortable:{containerId:f,index:j,items:d},...s}),[f,s,j,d]),N=v.useMemo(()=>d.slice(d.indexOf(o)),[d,o]),{rect:P,node:_,isOver:A,setNodeRef:O}=Kte({id:o,data:S,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:N,...c}}),{active:T,activatorEvent:k,activeNodeRect:M,attributes:R,setNodeRef:H,listeners:F,isDragging:V,over:$,setActivatorNodeRef:L,transform:Y}=Wte({id:o,data:S,attributes:{...rne,...n},disabled:w.draggable}),Q=_ee(O,H),ee=!!T,fe=ee&&!g&&bm(h)&&bm(x),W=!b&&V,he=W&&fe?Y:null,ue=fe?he??(l??y)({rects:m,activeNodeRect:M,activeIndex:h,overIndex:x,index:j}):null,Ae=bm(h)&&bm(x)?i({id:o,items:d,activeIndex:h,overIndex:x}):j,de=T==null?void 0:T.id,oe=v.useRef({activeId:de,items:d,newIndex:Ae,containerId:f}),xe=d!==oe.current.items,te=t({active:T,containerId:f,isDragging:V,isSorting:ee,id:o,index:j,items:d,newIndex:oe.current.newIndex,previousItems:oe.current.items,previousContainerId:oe.current.containerId,transition:u,wasDragging:oe.current.activeId!=null}),Ye=sne({disabled:!te,index:j,node:_,rect:P});return v.useEffect(()=>{ee&&oe.current.newIndex!==Ae&&(oe.current.newIndex=Ae),f!==oe.current.containerId&&(oe.current.containerId=f),d!==oe.current.items&&(oe.current.items=d)},[ee,Ae,f,d]),v.useEffect(()=>{if(de===oe.current.activeId)return;if(de!=null&&oe.current.activeId==null){oe.current.activeId=de;return}const ve=setTimeout(()=>{oe.current.activeId=de},50);return()=>clearTimeout(ve)},[de]),{active:T,activeIndex:h,attributes:R,data:S,rect:P,index:j,newIndex:Ae,items:d,isOver:A,isSorting:ee,isDragging:V,listeners:F,node:_,overIndex:x,over:$,setNodeRef:Q,setActivatorNodeRef:L,setDroppableNodeRef:O,setDraggableNodeRef:H,transform:Ye??ue,transition:G()};function G(){if(Ye||xe&&oe.current.newIndex===j)return nne;if(!(W&&!I_(k)||!u)&&(ee||te))return vu.Transition.toString({...u,property:L5})}}function ine(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}function pv(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const ane=[$t.Down,$t.Right,$t.Up,$t.Left],one=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:s,droppableContainers:i,over:o,scrollableAncestors:l}}=t;if(ane.includes(e.code)){if(e.preventDefault(),!n||!r)return;const c=[];i.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const h=s.get(f.id);if(h)switch(e.code){case $t.Down:r.toph.top&&c.push(f);break;case $t.Left:r.left>h.left&&c.push(f);break;case $t.Right:r.left1&&(d=u[1].id),d!=null){const f=i.get(n.id),h=i.get(d),p=h?s.get(h.id):null,g=h==null?void 0:h.node.current;if(g&&p&&f&&h){const x=vx(g).some((N,P)=>l[P]!==N),b=F5(f,h),y=lne(f,h),w=x||!b?{x:0,y:0}:{x:y?r.width-p.width:0,y:y?r.height-p.height:0},j={x:p.left,y:p.top};return w.x&&w.y?j:_h(j,w)}}}};function F5(e,t){return!pv(e)||!pv(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function lne(e,t){return!pv(e)||!pv(t)||!F5(e,t)?!1:e.data.current.sortable.index{const{discussionGuide:t,moderatorStatus:n,onSectionSelect:r,onSetPosition:s,onSave:i,showProgress:o=!0,collapsible:l=!0,defaultExpanded:c=!1,className:u,onDownload:d,isDownloading:f=!1,focusGroupId:h}=e;console.log("DiscussionGuideViewer props received ["+(e.key||"no-key")+"]:",{defaultExpanded:c,showProgress:o,collapsible:l,discussionGuideType:typeof t,propDefaultExpanded:e.defaultExpanded,allProps:e});const p=typeof t=="string",[g,m]=v.useState(null),[x,b]=v.useState(!1),y=v.useMemo(()=>p?null:x&&g?(console.log("๐Ÿ”„ Using pending updates for display"),g):t,[t,p,g,x]);v.useEffect(()=>{if(!x||!g)return;const G=t;G&&JSON.stringify(G)===JSON.stringify(g)&&(console.log("โœ… Props updated to match pending changes, clearing pending updates"),m(null),b(!1))},[t,g,x]);const[w,j]=v.useState(new Set),[S,N]=v.useState(null),[P,_]=v.useState(null),[A,O]=v.useState(!1),T=Fee(DE(L_,{activationConstraint:{distance:8}}),DE(R_,{coordinateGetter:one}));v.useEffect(()=>{var G,ve,Pe,Ie;if(S&&y){const E=y.sections.find(D=>D.id===S);if(E&&P){const D=((G=P.activities)==null?void 0:G.map(X=>X.id).join(","))||"",U=((ve=E.activities)==null?void 0:ve.map(X=>X.id).join(","))||"",K=((Pe=P.questions)==null?void 0:Pe.map(X=>X.id).join(","))||"",J=((Ie=E.questions)==null?void 0:Ie.map(X=>X.id).join(","))||"";(D!==U||K!==J)&&(console.log("๐Ÿ“ Syncing editing section with updated guide structure"),_({...E}))}}},[y,S,P]);const k=G=>{N(G.id),_({...G}),j(ve=>new Set(ve).add(G.id))},M=()=>{N(null),_(null)},R=G=>{P&&_({...P,...G})},H=(G,ve,Pe)=>{var D;if(!P)return;const Ie=Pe==="question"?"questions":"activities",E=((D=P[Ie])==null?void 0:D.map(U=>U.id===G?{...U,...ve}:U))||[];_({...P,[Ie]:E})},F=async(G,ve)=>{var D;if(!P||!y||!i)return;const Pe=ve==="question"?"questions":"activities",Ie=((D=P[Pe])==null?void 0:D.filter(U=>U.id!==G))||[],E={...P,[Pe]:Ie};_(E);try{const U={...y,sections:y.sections.map(K=>K.id===P.id?E:K)};await i(U),ce.success("Item deleted successfully")}catch(U){console.error("Error deleting item:",U),ce.error("Failed to delete item"),_(P)}},V=G=>{if(!P)return;const ve={id:`${G}_${Date.now()}`,type:G==="question"?"open_question":"moderator_statement",content:`New ${G}`,probes:G==="question"?[]:void 0},Pe=G==="question"?"questions":"activities",Ie=P[Pe]||[];_({...P,[Pe]:[...Ie,ve]})},$=async()=>{if(!(!P||!y||!i)){O(!0);try{const G={...y,sections:y.sections.map(ve=>ve.id===P.id?P:ve)};await i(G),N(null),_(null),ce.success("Section updated successfully")}catch(G){console.error("Failed to save section:",G),ce.error("Failed to save section changes")}finally{O(!1)}}},L=async G=>{if(!(!y||!i))try{const ve={...y,sections:y.sections.filter(Pe=>Pe.id!==G)};await i(ve),S===G&&(N(null),_(null)),ce.success("Section deleted successfully")}catch(ve){console.error("Failed to delete section:",ve),ce.error("Failed to delete section")}},Y=v.useCallback(async(G,ve)=>{if(!y||!i)return;const Pe=[...y.sections],[Ie]=Pe.splice(G,1);Pe.splice(ve,0,Ie);const E={...y,sections:Pe};m(E),b(!0),console.log("๐Ÿ’พ Calling onSave with updated guide (section move)..."),console.log("๐Ÿ“Š Section order before:",y.sections.map(D=>D.id)),console.log("๐Ÿ“Š Section order after:",E.sections.map(D=>D.id));try{await i(E),console.log("โœ… onSave completed successfully (section move)")}catch(D){console.error("โŒ onSave failed (section move), reverting:",D),m(null),b(!1)}},[y,i]),Q=v.useCallback(async(G,ve,Pe,Ie)=>{if(!y||!i)return;console.log("๐Ÿ’พ moveItem called:",{sectionId:G,itemType:ve,fromIndex:Pe,toIndex:Ie});const E={...y,sections:y.sections.map(D=>{if(D.id===G){const U=ve==="question"?"questions":"activities",K=D[U]||[],J=hv(K,Pe,Ie);return console.log("๐Ÿ“ Section items reordered:",{sectionId:G,itemsKey:U,beforeIds:K.map(X=>X.id),afterIds:J.map(X=>X.id)}),{...D,[U]:J}}return D})};m(E),b(!0),console.log("๐Ÿ’พ Calling onSave with updated guide..."),console.log("๐Ÿ“Š Passing guide to onSave:",E);try{await i(E),console.log("โœ… onSave completed successfully")}catch(D){console.error("โŒ onSave failed, reverting optimistic update:",D),m(null),b(!1)}},[y,i]),ee=v.useCallback(async(G,ve,Pe,Ie,E)=>{if(!y||!i)return;console.log("๐Ÿ’พ moveSubsectionItem called:",{sectionId:G,subsectionIndex:ve,itemType:Pe,fromIndex:Ie,toIndex:E});const D={...y,sections:y.sections.map(U=>{if(U.id===G&&U.subsections){const K=[...U.subsections],J=K[ve];if(J){const X=Pe==="question"?"questions":"activities",be=J[X]||[],_e=hv(be,Ie,E);console.log("๐Ÿ“ Subsection items reordered:",{sectionId:G,subsectionIndex:ve,itemsKey:X,beforeIds:be.map(Fe=>Fe.id),afterIds:_e.map(Fe=>Fe.id)}),K[ve]={...J,[X]:_e}}return{...U,subsections:K}}return U})};m(D),b(!0),console.log("๐Ÿ’พ Calling onSave with updated guide (subsection)...");try{await i(D),console.log("โœ… onSave completed successfully (subsection)")}catch(U){console.error("โŒ onSave failed (subsection), reverting:",U),m(null),b(!1)}},[y,i]),fe=v.useCallback(async G=>{var D,U,K,J;const{active:ve,over:Pe}=G;if(console.log("๐ŸŽฏ Drag END:",{activeId:ve.id,overId:Pe==null?void 0:Pe.id,hasOver:!!Pe,sameId:ve.id===(Pe==null?void 0:Pe.id),hasGuide:!!y,timestamp:new Date().toISOString()}),!Pe||ve.id===Pe.id||!y){console.log("โŒ Drag end early return");return}const Ie=String(ve.id),E=String(Pe.id);if(Ie.startsWith("section-")&&E.startsWith("section-")){const X=y.sections.findIndex(_e=>`section-${_e.id}`===Ie),be=y.sections.findIndex(_e=>`section-${_e.id}`===E);X!==-1&&be!==-1&&await Y(X,be)}else if(Ie.includes("-item-")&&E.includes("-item-")){const X=Ie.match(/^(.*?)-(subsection-\d+-)?(question|activity)-item-(.*)$/),be=E.match(/^(.*?)-(subsection-\d+-)?(question|activity)-item-(.*)$/);if(X&&be){const[,_e,Fe,ie]=X,[,Te,Be,gt]=be;if(console.log("๐Ÿ” Item drag match:",{activeId:Ie,overId:E,activeSectionId:_e,activeSubsection:Fe,activeItemType:ie,overSectionId:Te,overSubsection:Be,overItemType:gt}),_e===Te&&Fe===Be&&ie===gt){const At=y.sections.find(pn=>pn.id===_e);if(At){const pn=ie==="question"?"questions":"activities";if(Fe){const Zt=parseInt(((D=Fe.match(/subsection-(\d+)-/))==null?void 0:D[1])||"0"),bn=(U=At.subsections)==null?void 0:U[Zt];if(bn){const Xt=bn[pn]||[],yt=Xt.findIndex(tt=>Ie.endsWith(`-item-${tt.id}`)),Rr=Xt.findIndex(tt=>E.endsWith(`-item-${tt.id}`));console.log("๐Ÿ“ฆ Subsection item reorder:",{subsectionIndex:Zt,oldIndex:yt,newIndex:Rr,itemsLength:Xt.length}),yt!==-1&&Rr!==-1?(console.log("๐Ÿš€ About to call moveSubsectionItem..."),await ee(_e,Zt,ie,yt,Rr)):console.log("โŒ Not calling moveSubsectionItem - invalid indexes:",{oldIndex:yt,newIndex:Rr})}}else{const Zt=At[pn]||[],bn=Zt.findIndex(yt=>`${_e}-${ie}-item-${yt.id}`===Ie),Xt=Zt.findIndex(yt=>`${Te}-${gt}-item-${yt.id}`===E);console.log("๐Ÿ“ฆ Section item reorder:",{oldIndex:bn,newIndex:Xt,itemsLength:Zt.length,activeId:Ie,overId:E,itemIds:Zt.map(yt=>yt.id),expectedActiveId:`${_e}-${ie}-item-${(K=Zt[bn])==null?void 0:K.id}`,expectedOverId:`${Te}-${gt}-item-${(J=Zt[Xt])==null?void 0:J.id}`,oldIndexValid:bn!==-1,newIndexValid:Xt!==-1,willCallMoveItem:bn!==-1&&Xt!==-1}),bn!==-1&&Xt!==-1?(console.log("๐Ÿš€ About to call moveItem..."),await Q(_e,ie,bn,Xt)):console.log("โŒ Not calling moveItem - invalid indexes")}}}}}},[y,Y,Q,ee]);v.useEffect(()=>{var G;if(console.log("DiscussionGuideViewer useEffect:",{defaultExpanded:c,isLegacyFormat:p,hasStructuredGuide:!!y,sectionsCount:((G=y==null?void 0:y.sections)==null?void 0:G.length)||0,discussionGuideType:typeof t,discussionGuide:t}),c&&y&&y.sections){const ve=y.sections.map(Pe=>Pe.id);console.log("Pre-expanding sections:",ve),j(new Set(ve))}else c||j(new Set)},[c,y,t,p]);const W=G=>{const ve=new Set(w);ve.has(G)?ve.delete(G):ve.add(G),j(ve)},he=G=>{if(!n||n.legacy_format)return"pending";const ve=n.moderator_position.section_index;return(n.progress||0)>=100||G{if(!n||n.legacy_format)return"pending";const{section_index:E,subsection_index:D,item_index:U,item_type:K}=n.moderator_position;if(Ga.jsxs("div",{className:Me("space-y-4",u),children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(vs,{className:"h-5 w-5 text-slate-600"}),a.jsx("h3",{className:"font-semibold text-slate-900",children:"Discussion Guide"}),a.jsx(Yn,{variant:"outline",className:"text-xs",children:"Legacy Format"})]}),a.jsx("div",{className:"whitespace-pre-line bg-slate-50 p-4 rounded-lg text-sm border",children:t})]}),Ae=(G,ve)=>G===`New ${ve}`,de=({id:G,item:ve,sectionIndex:Pe,itemIndex:Ie,itemType:E,subsectionIndex:D,disabled:U=!1})=>{const{attributes:K,listeners:J,setNodeRef:X,transform:be,transition:_e,isDragging:Fe}=YE({id:G,disabled:U}),ie={transform:vu.Transform.toString(be),transition:_e,opacity:Fe?.5:1,zIndex:Fe?1e3:"auto"},Te=U?{}:{...K,...J};return a.jsx("div",{ref:X,style:ie,children:xe(ve,Pe,Ie,E,D,Te)})},oe=({id:G,section:ve,sectionIndex:Pe,disabled:Ie=!1})=>{const{attributes:E,listeners:D,setNodeRef:U,transform:K,transition:J,isDragging:X}=YE({id:G,disabled:Ie}),be={transform:vu.Transform.toString(K),transition:J,opacity:X?.5:1,zIndex:X?1e3:"auto"};return a.jsx("div",{ref:U,style:be,children:te(ve,Pe,Ie?{}:{...E,...D})})},xe=(G,ve,Pe,Ie,E,D)=>{var Fe;const U=y==null?void 0:y.sections[ve],K=S===(U==null?void 0:U.id),J=pe(ve,Pe,Ie,E),X=J==="current",be=J==="completed",_e=Ae(G.content,Ie);return K?a.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg border bg-white border-blue-200",children:[i&&a.jsx("div",{className:"flex-shrink-0 cursor-grab hover:cursor-grab active:cursor-grabbing hover:text-slate-700 transition-colors p-1.5 rounded hover:bg-slate-200 border border-transparent hover:border-slate-300",...D,title:"Drag to reorder this item",children:a.jsx(WA,{className:"h-4 w-4 text-slate-500 hover:text-slate-700"})}),a.jsx("div",{className:"flex-shrink-0 mt-1",children:a.jsx(bf,{className:"h-4 w-4 text-slate-400"})}),a.jsxs("div",{className:"flex-1 min-w-0 space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Yn,{variant:"outline",className:"text-xs",children:Ie==="activity"?a.jsxs(a.Fragment,{children:[a.jsx(Qi,{className:"h-3 w-3 mr-1"}),typeof G.type=="string"?G.type.replace("_"," "):String(G.type||"unknown")]}):a.jsxs(a.Fragment,{children:[a.jsx(vs,{className:"h-3 w-3 mr-1"}),typeof G.type=="string"?G.type.replace("_"," "):String(G.type||"unknown")]})}),G.time_limit&&a.jsxs("div",{className:"flex items-center gap-1 text-xs text-slate-500",children:[a.jsx(rh,{className:"h-3 w-3"}),a.jsx(_t,{type:"number",value:G.time_limit,onChange:ie=>H(G.id,{time_limit:parseInt(ie.target.value)||void 0},Ie),className:"w-16 h-6 text-xs",placeholder:"min"}),"min"]})]}),a.jsx(et,{value:_e?"":G.content,onChange:ie=>H(G.id,{content:ie.target.value},Ie),placeholder:_e?G.content:"Enter content...",className:"min-h-[60px]"}),Ie==="question"&&a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium text-slate-700 mb-1 block",children:"Probe Questions (one per line)"}),a.jsx(et,{value:((Fe=G.probes)==null?void 0:Fe.join(` +`))||"",onChange:ie=>{const Te=ie.target.value.trim()?ie.target.value.split(` +`).filter(Be=>Be.trim()):[];H(G.id,{probes:Te},Ie)},placeholder:"Enter probe questions, one per line...",className:"min-h-[40px]"})]})]}),a.jsx("div",{className:"flex-shrink-0",children:a.jsx(se,{size:"sm",variant:"ghost",onClick:()=>F(G.id,Ie),className:"h-8 w-8 p-0 text-red-600 hover:text-red-700",children:a.jsx(wn,{className:"h-3 w-3"})})})]},G.id):a.jsxs("div",{className:Me("flex items-start gap-3 p-3 rounded-lg border transition-colors",X&&"bg-blue-50 border-blue-200",be&&"bg-green-50 border-green-200",!X&&!be&&"bg-slate-50 border-slate-200",r&&"cursor-pointer hover:bg-slate-100"),onClick:()=>r==null?void 0:r(y.sections[ve].id,G.id),children:[a.jsx("div",{className:"flex-shrink-0 mt-1",children:be?a.jsx(Ig,{className:"h-4 w-4 text-green-600"}):X?a.jsx(Kw,{className:"h-4 w-4 text-blue-600"}):a.jsx(bf,{className:"h-4 w-4 text-slate-400"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[a.jsx(Yn,{variant:"outline",className:"text-xs whitespace-nowrap",children:Ie==="activity"?a.jsxs(a.Fragment,{children:[a.jsx(Qi,{className:"h-3 w-3 mr-1"}),typeof G.type=="string"?G.type.replace("_"," "):String(G.type||"unknown")]}):a.jsxs(a.Fragment,{children:[a.jsx(vs,{className:"h-3 w-3 mr-1"}),typeof G.type=="string"?G.type.replace("_"," "):String(G.type||"unknown")]})}),G.time_limit&&a.jsxs("div",{className:"flex items-center gap-1 text-xs text-slate-500 whitespace-nowrap",children:[a.jsx(rh,{className:"h-3 w-3"}),G.time_limit," min"]}),s&&a.jsxs(se,{size:"sm",variant:"ghost",onClick:ie=>{ie.stopPropagation(),s(y.sections[ve].id,G.id,G.content,y.sections[ve].title,`${Ie==="activity"?"Activity":"Question"}: ${G.type.replace("_"," ")}`,G.type)},className:"h-6 px-2 text-xs text-slate-600 hover:text-blue-600 hover:bg-blue-50",title:"Set moderator position to this item",children:[a.jsx(ON,{className:"h-3 w-3 mr-1"}),"Set Position"]})]}),a.jsxs("div",{className:"text-sm text-slate-700 mb-2 break-words",children:[a.jsx("p",{children:typeof G.content=="string"?G.content:String(G.content||"")}),G.type==="creative_review"&&h&&a.jsxs("div",{className:"mt-3 p-3 border rounded-lg bg-slate-50",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(ER,{className:"h-4 w-4 text-slate-600"}),a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Creative Asset"})]}),(()=>{const ie=typeof G.content=="string"?G.content:String(G.content||""),Te=ie.match(/(fg-[a-f0-9]+-[a-f0-9]{32}\.(jpg|jpeg|png))/i)||ie.match(/([a-f0-9]{32}\.(jpg|jpeg|png))/i);if(Te){const Be=Te[1],gt=Ct.getAssetUrl(h,Be);return a.jsx("img",{src:gt,alt:"Creative asset for review",className:"max-w-full h-auto rounded border shadow-sm",style:{maxHeight:"300px"},onError:At=>{console.error("Failed to load creative asset:",gt),At.currentTarget.style.display="none"}})}else return a.jsx("div",{className:"text-xs text-slate-500 italic",children:"Creative asset not found or filename not detected"})})()]})]}),G.probes&&G.probes.length>0&&a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-xs font-medium text-slate-600",children:"Probe Questions:"}),a.jsx("ul",{className:"text-xs text-slate-600 space-y-1",children:G.probes.map((ie,Te)=>a.jsxs("li",{className:"flex items-start gap-1",children:[a.jsx("span",{className:"text-slate-400",children:"โ€ข"}),a.jsx("span",{children:typeof ie=="string"?ie:String(ie||"")})]},Te))})]})]})]},G.id)},te=(G,ve,Pe)=>{var X,be,_e,Fe;const Ie=he(ve),E=w.has(G.id),D=Ie==="current",U=Ie==="completed",K=S===G.id,J=K?P:G;return console.log("renderSection:",{sectionId:G.id,sectionTitle:G.title,defaultExpanded:c,openSectionsHasId:w.has(G.id),finalIsOpen:E,openSectionsSize:w.size,isEditing:K}),a.jsx("div",{className:"border rounded-lg overflow-hidden",children:a.jsxs(Ep,{open:!l||E||K,onOpenChange:()=>l&&!K&&W(G.id),children:[a.jsx(Op,{asChild:!0,disabled:K,children:a.jsxs("div",{className:Me("w-full p-4 flex items-center justify-between transition-colors min-w-0",K&&"bg-blue-50 border-blue-200",!K&&D&&"bg-blue-50 border-blue-200",!K&&U&&"bg-green-50 border-green-200",!K&&!D&&!U&&"bg-slate-50",l&&!K&&"cursor-pointer hover:bg-slate-100"),children:[a.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[i&&a.jsx("div",{className:"cursor-grab hover:cursor-grab active:cursor-grabbing hover:text-slate-700 transition-colors p-1.5 rounded hover:bg-slate-200 border border-transparent hover:border-slate-300",...Pe,title:"Drag to reorder section",children:a.jsx(WA,{className:"h-5 w-5 text-slate-500 hover:text-slate-700"})}),a.jsx("div",{className:"flex-shrink-0",children:K?a.jsx(KA,{className:"h-5 w-5 text-blue-600"}):U?a.jsx(Ig,{className:"h-5 w-5 text-green-600"}):D?a.jsx(Kw,{className:"h-5 w-5 text-blue-600"}):a.jsx(bf,{className:"h-5 w-5 text-slate-400"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:K?a.jsx(_t,{value:J.title,onChange:ie=>R({title:ie.target.value}),className:"font-semibold",onClick:ie=>ie.stopPropagation()}):a.jsx("h4",{className:"font-semibold text-slate-900 break-words",children:typeof J.title=="string"?J.title:String(J.title||"")})}),a.jsxs("div",{className:"flex items-center gap-3 text-sm text-slate-600 flex-wrap",children:[J.questions&&a.jsxs("div",{className:"flex items-center gap-1 whitespace-nowrap",children:[a.jsx(vs,{className:"h-3 w-3"}),J.questions.length," questions"]}),J.activities&&a.jsxs("div",{className:"flex items-center gap-1 whitespace-nowrap",children:[a.jsx(Qi,{className:"h-3 w-3"}),J.activities.length," activities"]})]})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[K?a.jsxs("div",{className:"flex gap-2",onClick:ie=>ie.stopPropagation(),children:[a.jsxs(se,{size:"sm",onClick:$,disabled:A,className:"h-8",children:[a.jsx(CN,{className:"h-3 w-3 mr-1"}),A?"Saving...":"Save"]}),a.jsxs(se,{size:"sm",variant:"outline",onClick:M,disabled:A,className:"h-8",children:[a.jsx(Ei,{className:"h-3 w-3 mr-1"}),"Cancel"]})]}):i&&a.jsxs("div",{className:"flex gap-1",onClick:ie=>ie.stopPropagation(),children:[a.jsx(se,{size:"sm",variant:"ghost",onClick:()=>k(G),className:"h-8 w-8 p-0 text-slate-600 hover:text-blue-600",title:"Edit section",children:a.jsx(KA,{className:"h-3 w-3"})}),a.jsx(se,{size:"sm",variant:"ghost",onClick:()=>L(G.id),className:"h-8 w-8 p-0 text-slate-600 hover:text-red-600",title:"Delete section",children:a.jsx(wn,{className:"h-3 w-3"})})]}),l&&!K&&a.jsx("div",{className:"flex-shrink-0",children:E?a.jsx(Ta,{className:"h-4 w-4 text-slate-400"}):a.jsx(vi,{className:"h-4 w-4 text-slate-400"})})]})]})}),a.jsx(kp,{children:a.jsxs("div",{className:"p-4 border-t bg-white space-y-3",children:[(J.content||K)&&a.jsx("div",{children:K?a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium text-slate-700 mb-1 block",children:"Section Description"}),a.jsx(et,{value:J.content||"",onChange:ie=>R({content:ie.target.value}),placeholder:"Enter section description...",className:"min-h-[60px]"})]}):a.jsx("div",{className:"text-sm text-slate-600 p-3 bg-slate-50 rounded-lg",children:typeof J.content=="string"?J.content:String(J.content||"")})}),J.activities&&J.activities.length>0||K?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("h5",{className:"font-medium text-slate-700 flex items-center gap-2",children:[a.jsx(Qi,{className:"h-4 w-4"}),"Activities"]}),K&&a.jsxs(se,{size:"sm",variant:"outline",onClick:()=>V("activity"),className:"h-7",children:[a.jsx(Qi,{className:"h-3 w-3 mr-1"}),"Add Activity"]})]}),a.jsx(zd,{items:((X=J.activities)==null?void 0:X.map(ie=>`${G.id}-activity-item-${ie.id}`))||[],strategy:Bd,children:a.jsx("div",{className:"space-y-2",children:(be=J.activities)==null?void 0:be.map((ie,Te)=>a.jsx(de,{id:`${G.id}-activity-item-${ie.id}`,item:ie,sectionIndex:ve,itemIndex:Te,itemType:"activity",disabled:!K||!i},ie.id))})})]}):null,J.questions&&J.questions.length>0||K?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("h5",{className:"font-medium text-slate-700 flex items-center gap-2",children:[a.jsx(vs,{className:"h-4 w-4"}),"Questions"]}),K&&a.jsxs(se,{size:"sm",variant:"outline",onClick:()=>V("question"),className:"h-7",children:[a.jsx(vs,{className:"h-3 w-3 mr-1"}),"Add Question"]})]}),a.jsx(zd,{items:((_e=J.questions)==null?void 0:_e.map(ie=>`${G.id}-question-item-${ie.id}`))||[],strategy:Bd,children:a.jsx("div",{className:"space-y-2",children:(Fe=J.questions)==null?void 0:Fe.map((ie,Te)=>a.jsx(de,{id:`${G.id}-question-item-${ie.id}`,item:ie,sectionIndex:ve,itemIndex:Te,itemType:"question",disabled:!K||!i},ie.id))})})]}):null,G.subsections&&G.subsections.length>0&&a.jsxs("div",{className:"space-y-3",children:[a.jsx("h5",{className:"font-medium text-slate-700",children:"Subsections"}),a.jsx("div",{className:"space-y-3",children:G.subsections.map((ie,Te)=>{var Be,gt;return a.jsxs("div",{className:"border rounded-lg p-3 bg-slate-50",children:[a.jsx("div",{className:"flex items-center justify-between mb-2 gap-2",children:a.jsx("h6",{className:"font-medium text-slate-800 break-words min-w-0",children:typeof ie.title=="string"?ie.title:String(ie.title||"")})}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(zd,{items:((Be=ie.questions)==null?void 0:Be.map(At=>`${G.id}-subsection-${Te}-question-item-${At.id}`))||[],strategy:Bd,children:ie.questions.map((At,pn)=>a.jsx(de,{id:`${G.id}-subsection-${Te}-question-item-${At.id}`,item:At,sectionIndex:ve,itemIndex:pn,itemType:"question",subsectionIndex:Te,disabled:!K||!i},At.id))}),ie.activities&&a.jsx(zd,{items:((gt=ie.activities)==null?void 0:gt.map(At=>`${G.id}-subsection-${Te}-activity-item-${At.id}`))||[],strategy:Bd,children:ie.activities.map((At,pn)=>a.jsx(de,{id:`${G.id}-subsection-${Te}-activity-item-${At.id}`,item:At,sectionIndex:ve,itemIndex:pn,itemType:"activity",subsectionIndex:Te,disabled:!K||!i},At.id))})]})]},ie.id)})})]})]})})]})},G.id)},Ye=()=>{if(!o||!n||!y)return null;const G=n.legacy_format?0:n.progress;return a.jsxs("div",{className:"mb-4 p-3 bg-slate-50 rounded-lg",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Session Progress"}),a.jsxs("span",{className:"text-sm text-slate-600",children:[Math.round(G),"%"]})]}),a.jsx("div",{className:"w-full bg-slate-200 rounded-full h-2",children:a.jsx("div",{className:"bg-blue-600 h-2 rounded-full transition-all duration-300",style:{width:`${G}%`}})}),!n.legacy_format&&a.jsxs("div",{className:"mt-2 text-xs text-slate-600 break-words",children:["Currently in: ",a.jsx("span",{className:"font-medium",children:n.current_section})]})]})};return p?ue():y?a.jsxs("div",{className:Me("space-y-4",u),children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(vs,{className:"h-5 w-5 text-slate-600"}),a.jsx("h3",{className:"font-semibold text-slate-900",children:typeof y.title=="string"?y.title:String(y.title||"Discussion Guide")}),a.jsxs(Yn,{variant:"outline",className:"text-xs",children:[y.total_duration," min"]})]}),d&&a.jsx(se,{variant:"ghost",size:"sm",onClick:d,disabled:f,className:"h-8",title:"Download Discussion Guide",children:f?a.jsx(Dl,{className:"h-4 w-4 animate-spin"}):a.jsx(ed,{className:"h-4 w-4"})})]}),Ye(),a.jsx(zte,{sensors:T,collisionDetection:zee,onDragStart:G=>{console.log("๐Ÿš€ Drag START:",{activeId:G.active.id,timestamp:new Date().toISOString()})},onDragEnd:fe,children:a.jsx(zd,{items:y.sections.map(G=>`section-${G.id}`),strategy:Bd,children:a.jsx("div",{className:"space-y-3",children:y.sections.map((G,ve)=>a.jsx(oe,{id:`section-${G.id}`,section:G,sectionIndex:ve,disabled:!i},G.id))})})})]}):a.jsxs("div",{className:Me("space-y-4",u),children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(vs,{className:"h-5 w-5 text-slate-600"}),a.jsx("h3",{className:"font-semibold text-slate-900",children:"Discussion Guide"})]}),a.jsx("div",{className:"text-center py-8 text-slate-500",children:a.jsx("p",{children:"No discussion guide available"})})]})},(e,t)=>{if(e.defaultExpanded!==t.defaultExpanded||e.showProgress!==t.showProgress||e.collapsible!==t.collapsible||e.className!==t.className||e.isDownloading!==t.isDownloading)return console.log("๐Ÿ”„ DiscussionGuideViewer re-render: prop changes detected"),!1;if(e.onSectionSelect!==t.onSectionSelect)return console.log("๐Ÿ”„ DiscussionGuideViewer re-render: onSectionSelect changed"),!1;if(e.onSetPosition!==t.onSetPosition)return console.log("๐Ÿ”„ DiscussionGuideViewer re-render: onSetPosition changed"),!1;if(e.onSave!==t.onSave)return console.log("๐Ÿ”„ DiscussionGuideViewer re-render: onSave changed"),!1;if(e.onDownload!==t.onDownload)return console.log("๐Ÿ”„ DiscussionGuideViewer re-render: onDownload changed"),!1;const n=JSON.stringify(e.discussionGuide)!==JSON.stringify(t.discussionGuide),r=JSON.stringify(e.moderatorStatus)!==JSON.stringify(t.moderatorStatus);return n?(console.log("๐Ÿ”„ DiscussionGuideViewer re-render: discussionGuide content changed"),!1):r?(console.log("๐Ÿ”„ DiscussionGuideViewer re-render: moderatorStatus changed"),!1):(console.log("โญ๏ธ DiscussionGuideViewer skipping re-render: no meaningful changes"),!0)});var Ma="Accordion",une=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[F_,dne,fne]=Pp(Ma),[bx,IOe]=Ir(Ma,[fne,T4]),B_=T4(),z5=C.forwardRef((e,t)=>{const{type:n,...r}=e,s=r,i=r;return a.jsx(F_.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?a.jsx(gne,{...i,ref:t}):a.jsx(mne,{...s,ref:t})})});z5.displayName=Ma;var[U5,hne]=bx(Ma),[V5,pne]=bx(Ma,{collapsible:!1}),mne=C.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},collapsible:i=!1,...o}=e,[l,c]=us({prop:n,defaultProp:r,onChange:s});return a.jsx(U5,{scope:e.__scopeAccordion,value:l?[l]:[],onItemOpen:c,onItemClose:C.useCallback(()=>i&&c(""),[i,c]),children:a.jsx(V5,{scope:e.__scopeAccordion,collapsible:i,children:a.jsx(W5,{...o,ref:t})})})}),gne=C.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},...i}=e,[o=[],l]=us({prop:n,defaultProp:r,onChange:s}),c=C.useCallback(d=>l((f=[])=>[...f,d]),[l]),u=C.useCallback(d=>l((f=[])=>f.filter(h=>h!==d)),[l]);return a.jsx(U5,{scope:e.__scopeAccordion,value:o,onItemOpen:c,onItemClose:u,children:a.jsx(V5,{scope:e.__scopeAccordion,collapsible:!0,children:a.jsx(W5,{...i,ref:t})})})}),[vne,wx]=bx(Ma),W5=C.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:s,orientation:i="vertical",...o}=e,l=C.useRef(null),c=pt(l,t),u=dne(n),f=Uo(s)==="ltr",h=$e(e.onKeyDown,p=>{var _;if(!une.includes(p.key))return;const g=p.target,m=u().filter(A=>{var O;return!((O=A.ref.current)!=null&&O.disabled)}),x=m.findIndex(A=>A.ref.current===g),b=m.length;if(x===-1)return;p.preventDefault();let y=x;const w=0,j=b-1,S=()=>{y=x+1,y>j&&(y=w)},N=()=>{y=x-1,y{const{__scopeAccordion:n,value:r,...s}=e,i=wx(mv,n),o=hne(mv,n),l=B_(n),c=Cs(),u=r&&o.value.includes(r)||!1,d=i.disabled||e.disabled;return a.jsx(yne,{scope:n,open:u,disabled:d,triggerId:c,children:a.jsx(M4,{"data-orientation":i.orientation,"data-state":Z5(u),...l,...s,ref:t,disabled:d,open:u,onOpenChange:f=>{f?o.onItemOpen(r):o.onItemClose(r)}})})});H5.displayName=mv;var G5="AccordionHeader",q5=C.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=wx(Ma,n),i=z_(G5,n);return a.jsx(Xe.h3,{"data-orientation":s.orientation,"data-state":Z5(i.open),"data-disabled":i.disabled?"":void 0,...r,ref:t})});q5.displayName=G5;var T1="AccordionTrigger",K5=C.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=wx(Ma,n),i=z_(T1,n),o=pne(T1,n),l=B_(n);return a.jsx(F_.ItemSlot,{scope:n,children:a.jsx(AZ,{"aria-disabled":i.open&&!o.collapsible||void 0,"data-orientation":s.orientation,id:i.triggerId,...l,...r,ref:t})})});K5.displayName=T1;var X5="AccordionContent",Y5=C.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=wx(Ma,n),i=z_(X5,n),o=B_(n);return a.jsx(EZ,{role:"region","aria-labelledby":i.triggerId,"data-orientation":s.orientation,...o,...r,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});Y5.displayName=X5;function Z5(e){return e?"open":"closed"}var xne=z5,bne=H5,wne=q5,Q5=K5,J5=Y5;const jne=xne,$1=v.forwardRef(({className:e,...t},n)=>a.jsx(bne,{ref:n,className:Me("border-b",e),...t}));$1.displayName="AccordionItem";const I1=v.forwardRef(({className:e,children:t,...n},r)=>a.jsx(wne,{className:"flex",children:a.jsxs(Q5,{ref:r,className:Me("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,a.jsx(Ta,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));I1.displayName=Q5.displayName;const M1=v.forwardRef(({className:e,children:t,...n},r)=>a.jsx(J5,{ref:r,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:a.jsx("div",{className:Me("pb-4 pt-0",e),children:t})}));M1.displayName=J5.displayName;var Sne=Array.isArray,Xr=Sne,Nne=typeof qp=="object"&&qp&&qp.Object===Object&&qp,eF=Nne,_ne=eF,Pne=typeof self=="object"&&self&&self.Object===Object&&self,Cne=_ne||Pne||Function("return this")(),Bi=Cne,Ane=Bi,Ene=Ane.Symbol,Dp=Ene,ZE=Dp,tF=Object.prototype,One=tF.hasOwnProperty,kne=tF.toString,Ud=ZE?ZE.toStringTag:void 0;function Tne(e){var t=One.call(e,Ud),n=e[Ud];try{e[Ud]=void 0;var r=!0}catch{}var s=kne.call(e);return r&&(t?e[Ud]=n:delete e[Ud]),s}var $ne=Tne,Ine=Object.prototype,Mne=Ine.toString;function Rne(e){return Mne.call(e)}var Dne=Rne,QE=Dp,Lne=$ne,Fne=Dne,Bne="[object Null]",zne="[object Undefined]",JE=QE?QE.toStringTag:void 0;function Une(e){return e==null?e===void 0?zne:Bne:JE&&JE in Object(e)?Lne(e):Fne(e)}var Ra=Une;function Vne(e){return e!=null&&typeof e=="object"}var Da=Vne,Wne=Ra,Hne=Da,Gne="[object Symbol]";function qne(e){return typeof e=="symbol"||Hne(e)&&Wne(e)==Gne}var ud=qne,Kne=Xr,Xne=ud,Yne=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Zne=/^\w*$/;function Qne(e,t){if(Kne(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Xne(e)?!0:Zne.test(e)||!Yne.test(e)||t!=null&&e in Object(t)}var U_=Qne;function Jne(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Go=Jne;const dd=Bt(Go);var ere=Ra,tre=Go,nre="[object AsyncFunction]",rre="[object Function]",sre="[object GeneratorFunction]",ire="[object Proxy]";function are(e){if(!tre(e))return!1;var t=ere(e);return t==rre||t==sre||t==nre||t==ire}var V_=are;const ct=Bt(V_);var ore=Bi,lre=ore["__core-js_shared__"],cre=lre,hb=cre,eO=function(){var e=/[^.]+$/.exec(hb&&hb.keys&&hb.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function ure(e){return!!eO&&eO in e}var dre=ure,fre=Function.prototype,hre=fre.toString;function pre(e){if(e!=null){try{return hre.call(e)}catch{}try{return e+""}catch{}}return""}var nF=pre,mre=V_,gre=dre,vre=Go,yre=nF,xre=/[\\^$.*+?()[\]{}|]/g,bre=/^\[object .+?Constructor\]$/,wre=Function.prototype,jre=Object.prototype,Sre=wre.toString,Nre=jre.hasOwnProperty,_re=RegExp("^"+Sre.call(Nre).replace(xre,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Pre(e){if(!vre(e)||gre(e))return!1;var t=mre(e)?_re:bre;return t.test(yre(e))}var Cre=Pre;function Are(e,t){return e==null?void 0:e[t]}var Ere=Are,Ore=Cre,kre=Ere;function Tre(e,t){var n=kre(e,t);return Ore(n)?n:void 0}var ec=Tre,$re=ec,Ire=$re(Object,"create"),jx=Ire,tO=jx;function Mre(){this.__data__=tO?tO(null):{},this.size=0}var Rre=Mre;function Dre(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Lre=Dre,Fre=jx,Bre="__lodash_hash_undefined__",zre=Object.prototype,Ure=zre.hasOwnProperty;function Vre(e){var t=this.__data__;if(Fre){var n=t[e];return n===Bre?void 0:n}return Ure.call(t,e)?t[e]:void 0}var Wre=Vre,Hre=jx,Gre=Object.prototype,qre=Gre.hasOwnProperty;function Kre(e){var t=this.__data__;return Hre?t[e]!==void 0:qre.call(t,e)}var Xre=Kre,Yre=jx,Zre="__lodash_hash_undefined__";function Qre(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Yre&&t===void 0?Zre:t,this}var Jre=Qre,ese=Rre,tse=Lre,nse=Wre,rse=Xre,sse=Jre;function fd(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t-1}var wse=bse,jse=Sx;function Sse(e,t){var n=this.__data__,r=jse(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var Nse=Sse,_se=ose,Pse=mse,Cse=yse,Ase=wse,Ese=Nse;function hd(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t0?1:-1},pl=function(t){return Lp(t)&&t.indexOf("%")===t.length-1},ke=function(t){return Yie(t)&&!md(t)},Hn=function(t){return ke(t)||Lp(t)},eae=0,gd=function(t){var n=++eae;return"".concat(t||"").concat(n)},Ar=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!ke(t)&&!Lp(t))return r;var i;if(pl(t)){var o=t.indexOf("%");i=n*parseFloat(t.slice(0,o))/100}else i=+t;return md(i)&&(i=r),s&&i>n&&(i=n),i},Ja=function(t){if(!t)return null;var n=Object.keys(t);return n&&n.length?t[n[0]]:null},tae=function(t){if(!Array.isArray(t))return!1;for(var n=t.length,r={},s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function oae(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function D1(e){"@babel/helpers - typeof";return D1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},D1(e)}var lO={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart"},da=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},cO=null,mb=null,J_=function e(t){if(t===cO&&Array.isArray(mb))return mb;var n=[];return v.Children.forEach(t,function(r){vt(r)||(dF.isFragment(r)?n=n.concat(e(r.props.children)):n.push(r))}),mb=n,cO=t,n};function Es(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(function(s){return da(s)}):r=[da(t)],J_(e).forEach(function(s){var i=ls(s,"type.displayName")||ls(s,"type.name");r.indexOf(i)!==-1&&n.push(s)}),n}function es(e,t){var n=Es(e,t);return n&&n[0]}var uO=function(t){if(!t||!t.props)return!1;var n=t.props,r=n.width,s=n.height;return!(!ke(r)||r<=0||!ke(s)||s<=0)},lae=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],cae=function(t){return t&&t.type&&Lp(t.type)&&lae.indexOf(t.type)>=0},uae=function(t){return t&&D1(t)==="object"&&"clipDot"in t},dae=function(t,n,r,s){var i,o=(i=pb==null?void 0:pb[s])!==null&&i!==void 0?i:[];return!ct(t)&&(s&&o.includes(n)||rae.includes(n))||r&&Q_.includes(n)},Ze=function(t,n,r){if(!t||typeof t=="function"||typeof t=="boolean")return null;var s=t;if(v.isValidElement(t)&&(s=t.props),!dd(s))return null;var i={};return Object.keys(s).forEach(function(o){var l;dae((l=s)===null||l===void 0?void 0:l[o],o,n,r)&&(i[o]=s[o])}),i},L1=function e(t,n){if(t===n)return!0;var r=v.Children.count(t);if(r!==v.Children.count(n))return!1;if(r===0)return!0;if(r===1)return dO(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function gae(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function B1(e){var t=e.children,n=e.width,r=e.height,s=e.viewBox,i=e.className,o=e.style,l=e.title,c=e.desc,u=mae(e,pae),d=s||{width:n,height:r,x:0,y:0},f=mt("recharts-surface",i);return C.createElement("svg",F1({},Ze(u,!0,"svg"),{className:f,width:n,height:r,style:o,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height)}),C.createElement("title",null,l),C.createElement("desc",null,c),t)}var vae=["children","className"];function z1(){return z1=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function xae(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var Et=C.forwardRef(function(e,t){var n=e.children,r=e.className,s=yae(e,vae),i=mt("recharts-layer",r);return C.createElement("g",z1({className:i},Ze(s,!0),{ref:t}),n)}),ei=function(t,n){for(var r=arguments.length,s=new Array(r>2?r-2:0),i=2;is?0:s+t),n=n>s?s:n,n<0&&(n+=s),s=t>n?0:n-t>>>0,t>>>=0;for(var i=Array(s);++r=r?e:jae(e,t,n)}var Nae=Sae,_ae="\\ud800-\\udfff",Pae="\\u0300-\\u036f",Cae="\\ufe20-\\ufe2f",Aae="\\u20d0-\\u20ff",Eae=Pae+Cae+Aae,Oae="\\ufe0e\\ufe0f",kae="\\u200d",Tae=RegExp("["+kae+_ae+Eae+Oae+"]");function $ae(e){return Tae.test(e)}var hF=$ae;function Iae(e){return e.split("")}var Mae=Iae,pF="\\ud800-\\udfff",Rae="\\u0300-\\u036f",Dae="\\ufe20-\\ufe2f",Lae="\\u20d0-\\u20ff",Fae=Rae+Dae+Lae,Bae="\\ufe0e\\ufe0f",zae="["+pF+"]",U1="["+Fae+"]",V1="\\ud83c[\\udffb-\\udfff]",Uae="(?:"+U1+"|"+V1+")",mF="[^"+pF+"]",gF="(?:\\ud83c[\\udde6-\\uddff]){2}",vF="[\\ud800-\\udbff][\\udc00-\\udfff]",Vae="\\u200d",yF=Uae+"?",xF="["+Bae+"]?",Wae="(?:"+Vae+"(?:"+[mF,gF,vF].join("|")+")"+xF+yF+")*",Hae=xF+yF+Wae,Gae="(?:"+[mF+U1+"?",U1,gF,vF,zae].join("|")+")",qae=RegExp(V1+"(?="+V1+")|"+Gae+Hae,"g");function Kae(e){return e.match(qae)||[]}var Xae=Kae,Yae=Mae,Zae=hF,Qae=Xae;function Jae(e){return Zae(e)?Qae(e):Yae(e)}var eoe=Jae,toe=Nae,noe=hF,roe=eoe,soe=aF;function ioe(e){return function(t){t=soe(t);var n=noe(t)?roe(t):void 0,r=n?n[0]:t.charAt(0),s=n?toe(n,1).join(""):t.slice(1);return r[e]()+s}}var aoe=ioe,ooe=aoe,loe=ooe("toUpperCase"),coe=loe;const Dx=Bt(coe);function Jt(e){return function(){return e}}const bF=Math.cos,yv=Math.sin,fi=Math.sqrt,xv=Math.PI,Lx=2*xv,W1=Math.PI,H1=2*W1,rl=1e-6,uoe=H1-rl;function wF(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return wF;const n=10**t;return function(r){this._+=r[0];for(let s=1,i=r.length;srl)if(!(Math.abs(f*c-u*d)>rl)||!i)this._append`L${this._x1=t},${this._y1=n}`;else{let p=r-o,g=s-l,m=c*c+u*u,x=p*p+g*g,b=Math.sqrt(m),y=Math.sqrt(h),w=i*Math.tan((W1-Math.acos((m+h-x)/(2*b*y)))/2),j=w/y,S=w/b;Math.abs(j-1)>rl&&this._append`L${t+j*d},${n+j*f}`,this._append`A${i},${i},0,0,${+(f*p>d*g)},${this._x1=t+S*c},${this._y1=n+S*u}`}}arc(t,n,r,s,i,o){if(t=+t,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let l=r*Math.cos(s),c=r*Math.sin(s),u=t+l,d=n+c,f=1^o,h=o?s-i:i-s;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>rl||Math.abs(this._y1-d)>rl)&&this._append`L${u},${d}`,r&&(h<0&&(h=h%H1+H1),h>uoe?this._append`A${r},${r},0,1,${f},${t-l},${n-c}A${r},${r},0,1,${f},${this._x1=u},${this._y1=d}`:h>rl&&this._append`A${r},${r},0,${+(h>=W1)},${f},${this._x1=t+r*Math.cos(i)},${this._y1=n+r*Math.sin(i)}`)}rect(t,n,r,s){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+s}h${-r}Z`}toString(){return this._}}function eP(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new foe(t)}function tP(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function jF(e){this._context=e}jF.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Fx(e){return new jF(e)}function SF(e){return e[0]}function NF(e){return e[1]}function _F(e,t){var n=Jt(!0),r=null,s=Fx,i=null,o=eP(l);e=typeof e=="function"?e:e===void 0?SF:Jt(e),t=typeof t=="function"?t:t===void 0?NF:Jt(t);function l(c){var u,d=(c=tP(c)).length,f,h=!1,p;for(r==null&&(i=s(p=o())),u=0;u<=d;++u)!(u=p;--g)l.point(w[g],j[g]);l.lineEnd(),l.areaEnd()}b&&(w[h]=+e(x,h,f),j[h]=+t(x,h,f),l.point(r?+r(x,h,f):w[h],n?+n(x,h,f):j[h]))}if(y)return l=null,y+""||null}function d(){return _F().defined(s).curve(o).context(i)}return u.x=function(f){return arguments.length?(e=typeof f=="function"?f:Jt(+f),r=null,u):e},u.x0=function(f){return arguments.length?(e=typeof f=="function"?f:Jt(+f),u):e},u.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Jt(+f),u):r},u.y=function(f){return arguments.length?(t=typeof f=="function"?f:Jt(+f),n=null,u):t},u.y0=function(f){return arguments.length?(t=typeof f=="function"?f:Jt(+f),u):t},u.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Jt(+f),u):n},u.lineX0=u.lineY0=function(){return d().x(e).y(t)},u.lineY1=function(){return d().x(e).y(n)},u.lineX1=function(){return d().x(r).y(t)},u.defined=function(f){return arguments.length?(s=typeof f=="function"?f:Jt(!!f),u):s},u.curve=function(f){return arguments.length?(o=f,i!=null&&(l=o(i)),u):o},u.context=function(f){return arguments.length?(f==null?i=l=null:l=o(i=f),u):i},u}class PF{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function hoe(e){return new PF(e,!0)}function poe(e){return new PF(e,!1)}const nP={draw(e,t){const n=fi(t/xv);e.moveTo(n,0),e.arc(0,0,n,0,Lx)}},moe={draw(e,t){const n=fi(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},CF=fi(1/3),goe=CF*2,voe={draw(e,t){const n=fi(t/goe),r=n*CF;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},yoe={draw(e,t){const n=fi(t),r=-n/2;e.rect(r,r,n,n)}},xoe=.8908130915292852,AF=yv(xv/10)/yv(7*xv/10),boe=yv(Lx/10)*AF,woe=-bF(Lx/10)*AF,joe={draw(e,t){const n=fi(t*xoe),r=boe*n,s=woe*n;e.moveTo(0,-n),e.lineTo(r,s);for(let i=1;i<5;++i){const o=Lx*i/5,l=bF(o),c=yv(o);e.lineTo(c*n,-l*n),e.lineTo(l*r-c*s,c*r+l*s)}e.closePath()}},gb=fi(3),Soe={draw(e,t){const n=-fi(t/(gb*3));e.moveTo(0,n*2),e.lineTo(-gb*n,-n),e.lineTo(gb*n,-n),e.closePath()}},hs=-.5,ps=fi(3)/2,G1=1/fi(12),Noe=(G1/2+1)*3,_oe={draw(e,t){const n=fi(t/Noe),r=n/2,s=n*G1,i=r,o=n*G1+n,l=-i,c=o;e.moveTo(r,s),e.lineTo(i,o),e.lineTo(l,c),e.lineTo(hs*r-ps*s,ps*r+hs*s),e.lineTo(hs*i-ps*o,ps*i+hs*o),e.lineTo(hs*l-ps*c,ps*l+hs*c),e.lineTo(hs*r+ps*s,hs*s-ps*r),e.lineTo(hs*i+ps*o,hs*o-ps*i),e.lineTo(hs*l+ps*c,hs*c-ps*l),e.closePath()}};function Poe(e,t){let n=null,r=eP(s);e=typeof e=="function"?e:Jt(e||nP),t=typeof t=="function"?t:Jt(t===void 0?64:+t);function s(){let i;if(n||(n=i=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+""||null}return s.type=function(i){return arguments.length?(e=typeof i=="function"?i:Jt(i),s):e},s.size=function(i){return arguments.length?(t=typeof i=="function"?i:Jt(+i),s):t},s.context=function(i){return arguments.length?(n=i??null,s):n},s}function bv(){}function wv(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function EF(e){this._context=e}EF.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:wv(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:wv(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Coe(e){return new EF(e)}function OF(e){this._context=e}OF.prototype={areaStart:bv,areaEnd:bv,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:wv(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Aoe(e){return new OF(e)}function kF(e){this._context=e}kF.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:wv(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Eoe(e){return new kF(e)}function TF(e){this._context=e}TF.prototype={areaStart:bv,areaEnd:bv,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function Ooe(e){return new TF(e)}function hO(e){return e<0?-1:1}function pO(e,t,n){var r=e._x1-e._x0,s=t-e._x1,i=(e._y1-e._y0)/(r||s<0&&-0),o=(n-e._y1)/(s||r<0&&-0),l=(i*s+o*r)/(r+s);return(hO(i)+hO(o))*Math.min(Math.abs(i),Math.abs(o),.5*Math.abs(l))||0}function mO(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function vb(e,t,n){var r=e._x0,s=e._y0,i=e._x1,o=e._y1,l=(i-r)/3;e._context.bezierCurveTo(r+l,s+l*t,i-l,o-l*n,i,o)}function jv(e){this._context=e}jv.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:vb(this,this._t0,mO(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,vb(this,mO(this,n=pO(this,e,t)),n);break;default:vb(this,this._t0,n=pO(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function $F(e){this._context=new IF(e)}($F.prototype=Object.create(jv.prototype)).point=function(e,t){jv.prototype.point.call(this,t,e)};function IF(e){this._context=e}IF.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,s,i){this._context.bezierCurveTo(t,e,r,n,i,s)}};function koe(e){return new jv(e)}function Toe(e){return new $F(e)}function MF(e){this._context=e}MF.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=gO(e),s=gO(t),i=0,o=1;o=0;--t)s[t]=(o[t]-s[t+1])/i[t];for(i[n-1]=(e[n]+s[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function Ioe(e){return new Bx(e,.5)}function Moe(e){return new Bx(e,0)}function Roe(e){return new Bx(e,1)}function yu(e,t){if((o=e.length)>1)for(var n=1,r,s,i=e[t[0]],o,l=i.length;n=0;)n[t]=t;return n}function Doe(e,t){return e[t]}function Loe(e){const t=[];return t.key=e,t}function Foe(){var e=Jt([]),t=q1,n=yu,r=Doe;function s(i){var o=Array.from(e.apply(this,arguments),Loe),l,c=o.length,u=-1,d;for(const f of i)for(l=0,++u;l0){for(var n,r,s=0,i=e[0].length,o;s0){for(var n=0,r=e[t[0]],s,i=r.length;n0)||!((i=(s=e[t[0]]).length)>0))){for(var n=0,r=1,s,i,o;r=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Koe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var RF={symbolCircle:nP,symbolCross:moe,symbolDiamond:voe,symbolSquare:yoe,symbolStar:joe,symbolTriangle:Soe,symbolWye:_oe},Xoe=Math.PI/180,Yoe=function(t){var n="symbol".concat(Dx(t));return RF[n]||nP},Zoe=function(t,n,r){if(n==="area")return t;switch(r){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var s=18*Xoe;return 1.25*t*t*(Math.tan(s)-Math.tan(s*2)*Math.pow(Math.tan(s),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},Qoe=function(t,n){RF["symbol".concat(Dx(t))]=n},rP=function(t){var n=t.type,r=n===void 0?"circle":n,s=t.size,i=s===void 0?64:s,o=t.sizeType,l=o===void 0?"area":o,c=qoe(t,Voe),u=yO(yO({},c),{},{type:r,size:i,sizeType:l}),d=function(){var x=Yoe(r),b=Poe().type(x).size(Zoe(i,l,r));return b()},f=u.className,h=u.cx,p=u.cy,g=Ze(u,!0);return h===+h&&p===+p&&i===+i?C.createElement("path",K1({},g,{className:mt("recharts-symbols",f),transform:"translate(".concat(h,", ").concat(p,")"),d:d()})):null};rP.registerSymbol=Qoe;function xu(e){"@babel/helpers - typeof";return xu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xu(e)}function X1(){return X1=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);var y=p.inactive?u:p.color;return C.createElement("li",X1({className:x,style:f,key:"legend-item-".concat(g)},Vl(r.props,p,g)),C.createElement(B1,{width:o,height:o,viewBox:d,style:h},r.renderIcon(p)),C.createElement("span",{className:"recharts-legend-item-text",style:{color:y}},m?m(b,p,g):b))})}},{key:"render",value:function(){var r=this.props,s=r.payload,i=r.layout,o=r.align;if(!s||!s.length)return null;var l={padding:0,margin:0,textAlign:i==="horizontal"?o:"left"};return C.createElement("ul",{className:"recharts-default-legend",style:l},this.renderItems())}}])}(v.PureComponent);Ah(sP,"displayName","Legend");Ah(sP,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var lle=Nx;function cle(){this.__data__=new lle,this.size=0}var ule=cle;function dle(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}var fle=dle;function hle(e){return this.__data__.get(e)}var ple=hle;function mle(e){return this.__data__.has(e)}var gle=mle,vle=Nx,yle=H_,xle=G_,ble=200;function wle(e,t){var n=this.__data__;if(n instanceof vle){var r=n.__data__;if(!yle||r.lengthl))return!1;var u=i.get(e),d=i.get(t);if(u&&d)return u==t&&d==e;var f=-1,h=!0,p=n&Vle?new Fle:void 0;for(i.set(e,t),i.set(t,e);++f-1&&e%1==0&&e-1&&e%1==0&&e<=qce}var lP=Kce,Xce=Ra,Yce=lP,Zce=Da,Qce="[object Arguments]",Jce="[object Array]",eue="[object Boolean]",tue="[object Date]",nue="[object Error]",rue="[object Function]",sue="[object Map]",iue="[object Number]",aue="[object Object]",oue="[object RegExp]",lue="[object Set]",cue="[object String]",uue="[object WeakMap]",due="[object ArrayBuffer]",fue="[object DataView]",hue="[object Float32Array]",pue="[object Float64Array]",mue="[object Int8Array]",gue="[object Int16Array]",vue="[object Int32Array]",yue="[object Uint8Array]",xue="[object Uint8ClampedArray]",bue="[object Uint16Array]",wue="[object Uint32Array]",rn={};rn[hue]=rn[pue]=rn[mue]=rn[gue]=rn[vue]=rn[yue]=rn[xue]=rn[bue]=rn[wue]=!0;rn[Qce]=rn[Jce]=rn[due]=rn[eue]=rn[fue]=rn[tue]=rn[nue]=rn[rue]=rn[sue]=rn[iue]=rn[aue]=rn[oue]=rn[lue]=rn[cue]=rn[uue]=!1;function jue(e){return Zce(e)&&Yce(e.length)&&!!rn[Xce(e)]}var Sue=jue;function Nue(e){return function(t){return e(t)}}var qF=Nue,Pv={exports:{}};Pv.exports;(function(e,t){var n=eF,r=t&&!t.nodeType&&t,s=r&&!0&&e&&!e.nodeType&&e,i=s&&s.exports===r,o=i&&n.process,l=function(){try{var c=s&&s.require&&s.require("util").types;return c||o&&o.binding&&o.binding("util")}catch{}}();e.exports=l})(Pv,Pv.exports);var _ue=Pv.exports,Pue=Sue,Cue=qF,_O=_ue,PO=_O&&_O.isTypedArray,Aue=PO?Cue(PO):Pue,KF=Aue,Eue=Tce,Oue=aP,kue=Xr,Tue=GF,$ue=oP,Iue=KF,Mue=Object.prototype,Rue=Mue.hasOwnProperty;function Due(e,t){var n=kue(e),r=!n&&Oue(e),s=!n&&!r&&Tue(e),i=!n&&!r&&!s&&Iue(e),o=n||r||s||i,l=o?Eue(e.length,String):[],c=l.length;for(var u in e)(t||Rue.call(e,u))&&!(o&&(u=="length"||s&&(u=="offset"||u=="parent")||i&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||$ue(u,c)))&&l.push(u);return l}var Lue=Due,Fue=Object.prototype;function Bue(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||Fue;return e===n}var zue=Bue;function Uue(e,t){return function(n){return e(t(n))}}var XF=Uue,Vue=XF,Wue=Vue(Object.keys,Object),Hue=Wue,Gue=zue,que=Hue,Kue=Object.prototype,Xue=Kue.hasOwnProperty;function Yue(e){if(!Gue(e))return que(e);var t=[];for(var n in Object(e))Xue.call(e,n)&&n!="constructor"&&t.push(n);return t}var Zue=Yue,Que=V_,Jue=lP;function ede(e){return e!=null&&Jue(e.length)&&!Que(e)}var Fp=ede,tde=Lue,nde=Zue,rde=Fp;function sde(e){return rde(e)?tde(e):nde(e)}var zx=sde,ide=bce,ade=Oce,ode=zx;function lde(e){return ide(e,ode,ade)}var cde=lde,CO=cde,ude=1,dde=Object.prototype,fde=dde.hasOwnProperty;function hde(e,t,n,r,s,i){var o=n&ude,l=CO(e),c=l.length,u=CO(t),d=u.length;if(c!=d&&!o)return!1;for(var f=c;f--;){var h=l[f];if(!(o?h in t:fde.call(t,h)))return!1}var p=i.get(e),g=i.get(t);if(p&&g)return p==t&&g==e;var m=!0;i.set(e,t),i.set(t,e);for(var x=o;++f-1}var dhe=uhe;function fhe(e,t,n){for(var r=-1,s=e==null?0:e.length;++r=Che){var u=t?null:_he(e);if(u)return Phe(u);o=!1,s=Nhe,c=new whe}else c=t?[]:l;e:for(;++r=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Vhe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Whe(e){return e.value}function Hhe(e,t){if(C.isValidElement(e))return C.cloneElement(e,t);if(typeof e=="function")return C.createElement(e,t);t.ref;var n=Uhe(t,Ihe);return C.createElement(sP,n)}var VO=1,fa=function(e){function t(){var n;Mhe(this,t);for(var r=arguments.length,s=new Array(r),i=0;iVO||Math.abs(s.height-this.lastBoundingBox.height)>VO)&&(this.lastBoundingBox.width=s.width,this.lastBoundingBox.height=s.height,r&&r(s)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,r&&r(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?Hi({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(r){var s=this.props,i=s.layout,o=s.align,l=s.verticalAlign,c=s.margin,u=s.chartWidth,d=s.chartHeight,f,h;if(!r||(r.left===void 0||r.left===null)&&(r.right===void 0||r.right===null))if(o==="center"&&i==="vertical"){var p=this.getBBoxSnapshot();f={left:((u||0)-p.width)/2}}else f=o==="right"?{right:c&&c.right||0}:{left:c&&c.left||0};if(!r||(r.top===void 0||r.top===null)&&(r.bottom===void 0||r.bottom===null))if(l==="middle"){var g=this.getBBoxSnapshot();h={top:((d||0)-g.height)/2}}else h=l==="bottom"?{bottom:c&&c.bottom||0}:{top:c&&c.top||0};return Hi(Hi({},f),h)}},{key:"render",value:function(){var r=this,s=this.props,i=s.content,o=s.width,l=s.height,c=s.wrapperStyle,u=s.payloadUniqBy,d=s.payload,f=Hi(Hi({position:"absolute",width:o||"auto",height:l||"auto"},this.getDefaultPosition(c)),c);return C.createElement("div",{className:"recharts-legend-wrapper",style:f,ref:function(p){r.wrapperNode=p}},Hhe(i,Hi(Hi({},this.props),{},{payload:n6(d,u,Whe)})))}}],[{key:"getWithHeight",value:function(r,s){var i=Hi(Hi({},this.defaultProps),r.props),o=i.layout;return o==="vertical"&&ke(r.props.height)?{height:r.props.height}:o==="horizontal"?{width:r.props.width||s}:null}}])}(v.PureComponent);Ux(fa,"displayName","Legend");Ux(fa,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var WO=Dp,Ghe=aP,qhe=Xr,HO=WO?WO.isConcatSpreadable:void 0;function Khe(e){return qhe(e)||Ghe(e)||!!(HO&&e&&e[HO])}var Xhe=Khe,Yhe=WF,Zhe=Xhe;function i6(e,t,n,r,s){var i=-1,o=e.length;for(n||(n=Zhe),s||(s=[]);++i0&&n(l)?t>1?i6(l,t-1,n,r,s):Yhe(s,l):r||(s[s.length]=l)}return s}var a6=i6;function Qhe(e){return function(t,n,r){for(var s=-1,i=Object(t),o=r(t),l=o.length;l--;){var c=o[e?l:++s];if(n(i[c],c,i)===!1)break}return t}}var Jhe=Qhe,epe=Jhe,tpe=epe(),npe=tpe,rpe=npe,spe=zx;function ipe(e,t){return e&&rpe(e,t,spe)}var o6=ipe,ape=Fp;function ope(e,t){return function(n,r){if(n==null)return n;if(!ape(n))return e(n,r);for(var s=n.length,i=t?s:-1,o=Object(n);(t?i--:++it||i&&o&&c&&!l&&!u||r&&o&&c||!n&&c||!s)return 1;if(!r&&!i&&!u&&e=l)return c;var u=n[r];return c*(u=="desc"?-1:1)}}return e.index-t.index}var wpe=bpe,wb=K_,jpe=X_,Spe=zi,Npe=l6,_pe=gpe,Ppe=qF,Cpe=wpe,Ape=xd,Epe=Xr;function Ope(e,t,n){t.length?t=wb(t,function(i){return Epe(i)?function(o){return jpe(o,i.length===1?i[0]:i)}:i}):t=[Ape];var r=-1;t=wb(t,Ppe(Spe));var s=Npe(e,function(i,o,l){var c=wb(t,function(u){return u(i)});return{criteria:c,index:++r,value:i}});return _pe(s,function(i,o){return Cpe(i,o,n)})}var kpe=Ope;function Tpe(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var $pe=Tpe,Ipe=$pe,qO=Math.max;function Mpe(e,t,n){return t=qO(t===void 0?e.length-1:t,0),function(){for(var r=arguments,s=-1,i=qO(r.length-t,0),o=Array(i);++s0){if(++t>=Hpe)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Xpe=Kpe,Ype=Wpe,Zpe=Xpe,Qpe=Zpe(Ype),Jpe=Qpe,eme=xd,tme=Rpe,nme=Jpe;function rme(e,t){return nme(tme(e,t,eme),e+"")}var sme=rme,ime=W_,ame=Fp,ome=oP,lme=Go;function cme(e,t,n){if(!lme(n))return!1;var r=typeof t;return(r=="number"?ame(n)&&ome(t,n.length):r=="string"&&t in n)?ime(n[t],e):!1}var Vx=cme,ume=a6,dme=kpe,fme=sme,XO=Vx,hme=fme(function(e,t){if(e==null)return[];var n=t.length;return n>1&&XO(e,t[0],t[1])?t=[]:n>2&&XO(t[0],t[1],t[2])&&(t=[t[0]]),dme(e,ume(t,1),[])}),pme=hme;const dP=Bt(pme);function Eh(e){"@babel/helpers - typeof";return Eh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Eh(e)}function rj(){return rj=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=t.x),"".concat(Vd,"-left"),ke(n)&&t&&ke(t.x)&&n=t.y),"".concat(Vd,"-top"),ke(r)&&t&&ke(t.y)&&rm?Math.max(d,c[r]):Math.max(f,c[r])}function Eme(e){var t=e.translateX,n=e.translateY,r=e.useTranslate3d;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function Ome(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.offsetTopLeft,s=e.position,i=e.reverseDirection,o=e.tooltipBox,l=e.useTranslate3d,c=e.viewBox,u,d,f;return o.height>0&&o.width>0&&n?(d=QO({allowEscapeViewBox:t,coordinate:n,key:"x",offsetTopLeft:r,position:s,reverseDirection:i,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),f=QO({allowEscapeViewBox:t,coordinate:n,key:"y",offsetTopLeft:r,position:s,reverseDirection:i,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),u=Eme({translateX:d,translateY:f,useTranslate3d:l})):u=Cme,{cssProperties:u,cssClasses:Ame({translateX:d,translateY:f,coordinate:n})}}function wu(e){"@babel/helpers - typeof";return wu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wu(e)}function JO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function e2(e){for(var t=1;tt2||Math.abs(r.height-this.state.lastBoundingBox.height)>t2)&&this.setState({lastBoundingBox:{width:r.width,height:r.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var r,s;this.props.active&&this.updateBBox(),this.state.dismissed&&(((r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==this.state.dismissedAtCoordinate.x||((s=this.props.coordinate)===null||s===void 0?void 0:s.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var r=this,s=this.props,i=s.active,o=s.allowEscapeViewBox,l=s.animationDuration,c=s.animationEasing,u=s.children,d=s.coordinate,f=s.hasPayload,h=s.isAnimationActive,p=s.offset,g=s.position,m=s.reverseDirection,x=s.useTranslate3d,b=s.viewBox,y=s.wrapperStyle,w=Ome({allowEscapeViewBox:o,coordinate:d,offsetTopLeft:p,position:g,reverseDirection:m,tooltipBox:this.state.lastBoundingBox,useTranslate3d:x,viewBox:b}),j=w.cssClasses,S=w.cssProperties,N=e2(e2({transition:h&&i?"transform ".concat(l,"ms ").concat(c):void 0},S),{},{pointerEvents:"none",visibility:!this.state.dismissed&&i&&f?"visible":"hidden",position:"absolute",top:0,left:0},y);return C.createElement("div",{tabIndex:-1,className:j,style:N,ref:function(_){r.wrapperNode=_}},u)}}])}(v.PureComponent),Bme=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},ti={isSsr:Bme(),get:function(t){return ti[t]},set:function(t,n){if(typeof t=="string")ti[t]=n;else{var r=Object.keys(t);r&&r.length&&r.forEach(function(s){ti[s]=t[s]})}}};function ju(e){"@babel/helpers - typeof";return ju=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ju(e)}function n2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function r2(e){for(var t=1;t0;return C.createElement(Fme,{allowEscapeViewBox:o,animationDuration:l,animationEasing:c,isAnimationActive:h,active:i,coordinate:d,hasPayload:N,offset:p,position:x,reverseDirection:b,useTranslate3d:y,viewBox:w,wrapperStyle:j},Yme(u,r2(r2({},this.props),{},{payload:S})))}}])}(v.PureComponent);fP(mr,"displayName","Tooltip");fP(mr,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!ti.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var Zme=Bi,Qme=function(){return Zme.Date.now()},Jme=Qme,ege=/\s/;function tge(e){for(var t=e.length;t--&&ege.test(e.charAt(t)););return t}var nge=tge,rge=nge,sge=/^\s+/;function ige(e){return e&&e.slice(0,rge(e)+1).replace(sge,"")}var age=ige,oge=age,s2=Go,lge=ud,i2=NaN,cge=/^[-+]0x[0-9a-f]+$/i,uge=/^0b[01]+$/i,dge=/^0o[0-7]+$/i,fge=parseInt;function hge(e){if(typeof e=="number")return e;if(lge(e))return i2;if(s2(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=s2(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=oge(e);var n=uge.test(e);return n||dge.test(e)?fge(e.slice(2),n?2:8):cge.test(e)?i2:+e}var p6=hge,pge=Go,Sb=Jme,a2=p6,mge="Expected a function",gge=Math.max,vge=Math.min;function yge(e,t,n){var r,s,i,o,l,c,u=0,d=!1,f=!1,h=!0;if(typeof e!="function")throw new TypeError(mge);t=a2(t)||0,pge(n)&&(d=!!n.leading,f="maxWait"in n,i=f?gge(a2(n.maxWait)||0,t):i,h="trailing"in n?!!n.trailing:h);function p(N){var P=r,_=s;return r=s=void 0,u=N,o=e.apply(_,P),o}function g(N){return u=N,l=setTimeout(b,t),d?p(N):o}function m(N){var P=N-c,_=N-u,A=t-P;return f?vge(A,i-_):A}function x(N){var P=N-c,_=N-u;return c===void 0||P>=t||P<0||f&&_>=i}function b(){var N=Sb();if(x(N))return y(N);l=setTimeout(b,m(N))}function y(N){return l=void 0,h&&r?p(N):(r=s=void 0,o)}function w(){l!==void 0&&clearTimeout(l),u=0,r=c=s=l=void 0}function j(){return l===void 0?o:y(Sb())}function S(){var N=Sb(),P=x(N);if(r=arguments,s=this,c=N,P){if(l===void 0)return g(c);if(f)return clearTimeout(l),l=setTimeout(b,t),p(c)}return l===void 0&&(l=setTimeout(b,t)),o}return S.cancel=w,S.flush=j,S}var xge=yge,bge=xge,wge=Go,jge="Expected a function";function Sge(e,t,n){var r=!0,s=!0;if(typeof e!="function")throw new TypeError(jge);return wge(n)&&(r="leading"in n?!!n.leading:r,s="trailing"in n?!!n.trailing:s),bge(e,t,{leading:r,maxWait:t,trailing:s})}var Nge=Sge;const m6=Bt(Nge);function kh(e){"@babel/helpers - typeof";return kh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kh(e)}function o2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function _m(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(M=m6(M,m,{trailing:!0,leading:!1}));var R=new ResizeObserver(M),H=S.current.getBoundingClientRect(),F=H.width,V=H.height;return T(F,V),R.observe(S.current),function(){R.disconnect()}},[T,m]);var k=v.useMemo(function(){var M=A.containerWidth,R=A.containerHeight;if(M<0||R<0)return null;ei(pl(o)||pl(c),`The width(%s) and height(%s) are both fixed numbers, + maybe you don't need to use a ResponsiveContainer.`,o,c),ei(!n||n>0,"The aspect(%s) must be greater than zero.",n);var H=pl(o)?M:o,F=pl(c)?R:c;n&&n>0&&(H?F=H/n:F&&(H=F*n),h&&F>h&&(F=h)),ei(H>0||F>0,`The width(%s) and height(%s) of chart should be greater than 0, + please check the style of container, or the props width(%s) and height(%s), + or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the + height and width.`,H,F,o,c,d,f,n);var V=!Array.isArray(p)&&da(p.type).endsWith("Chart");return C.Children.map(p,function($){return dF.isElement($)?v.cloneElement($,_m({width:H,height:F},V?{style:_m({height:"100%",width:"100%",maxHeight:F,maxWidth:H},$.props.style)}:{})):$})},[n,p,c,h,f,d,A,o]);return C.createElement("div",{id:x?"".concat(x):void 0,className:mt("recharts-responsive-container",b),style:_m(_m({},j),{},{width:o,height:c,minWidth:d,minHeight:f,maxHeight:h}),ref:S},k)}),Bp=function(t){return null};Bp.displayName="Cell";function Th(e){"@babel/helpers - typeof";return Th=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Th(e)}function c2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function oj(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||ti.isSsr)return{width:0,height:0};var r=Lge(n),s=JSON.stringify({text:t,copyStyle:r});if(dc.widthCache[s])return dc.widthCache[s];try{var i=document.getElementById(u2);i||(i=document.createElement("span"),i.setAttribute("id",u2),i.setAttribute("aria-hidden","true"),document.body.appendChild(i));var o=oj(oj({},Dge),r);Object.assign(i.style,o),i.textContent="".concat(t);var l=i.getBoundingClientRect(),c={width:l.width,height:l.height};return dc.widthCache[s]=c,++dc.cacheCount>Rge&&(dc.cacheCount=0,dc.widthCache={}),c}catch{return{width:0,height:0}}},Fge=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function $h(e){"@babel/helpers - typeof";return $h=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$h(e)}function Ov(e,t){return Vge(e)||Uge(e,t)||zge(e,t)||Bge()}function Bge(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function zge(e,t){if(e){if(typeof e=="string")return d2(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d2(e,t)}}function d2(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function rve(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function v2(e,t){return ove(e)||ave(e,t)||ive(e,t)||sve()}function sve(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ive(e,t){if(e){if(typeof e=="string")return y2(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return y2(e,t)}}function y2(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:[];return H.reduce(function(F,V){var $=V.word,L=V.width,Y=F[F.length-1];if(Y&&(s==null||i||Y.width+L+rV.width?F:V})};if(!d)return p;for(var m="โ€ฆ",x=function(H){var F=f.slice(0,H),V=x6({breakAll:u,style:c,children:F+m}).wordsWithComputedWidth,$=h(V),L=$.length>o||g($).width>Number(s);return[L,$]},b=0,y=f.length-1,w=0,j;b<=y&&w<=f.length-1;){var S=Math.floor((b+y)/2),N=S-1,P=x(N),_=v2(P,2),A=_[0],O=_[1],T=x(S),k=v2(T,1),M=k[0];if(!A&&!M&&(b=S+1),A&&M&&(y=S-1),!A&&M){j=O;break}w++}return j||p},x2=function(t){var n=vt(t)?[]:t.toString().split(y6);return[{words:n}]},cve=function(t){var n=t.width,r=t.scaleToFit,s=t.children,i=t.style,o=t.breakAll,l=t.maxLines;if((n||r)&&!ti.isSsr){var c,u,d=x6({breakAll:o,children:s,style:i});if(d){var f=d.wordsWithComputedWidth,h=d.spaceWidth;c=f,u=h}else return x2(s);return lve({breakAll:o,children:s,maxLines:l,style:i},c,u,n,r)}return x2(s)},b2="#808080",Wl=function(t){var n=t.x,r=n===void 0?0:n,s=t.y,i=s===void 0?0:s,o=t.lineHeight,l=o===void 0?"1em":o,c=t.capHeight,u=c===void 0?"0.71em":c,d=t.scaleToFit,f=d===void 0?!1:d,h=t.textAnchor,p=h===void 0?"start":h,g=t.verticalAnchor,m=g===void 0?"end":g,x=t.fill,b=x===void 0?b2:x,y=g2(t,tve),w=v.useMemo(function(){return cve({breakAll:y.breakAll,children:y.children,maxLines:y.maxLines,scaleToFit:f,style:y.style,width:y.width})},[y.breakAll,y.children,y.maxLines,f,y.style,y.width]),j=y.dx,S=y.dy,N=y.angle,P=y.className,_=y.breakAll,A=g2(y,nve);if(!Hn(r)||!Hn(i))return null;var O=r+(ke(j)?j:0),T=i+(ke(S)?S:0),k;switch(m){case"start":k=Nb("calc(".concat(u,")"));break;case"middle":k=Nb("calc(".concat((w.length-1)/2," * -").concat(l," + (").concat(u," / 2))"));break;default:k=Nb("calc(".concat(w.length-1," * -").concat(l,")"));break}var M=[];if(f){var R=w[0].width,H=y.width;M.push("scale(".concat((ke(H)?H/R:1)/R,")"))}return N&&M.push("rotate(".concat(N,", ").concat(O,", ").concat(T,")")),M.length&&(A.transform=M.join(" ")),C.createElement("text",lj({},Ze(A,!0),{x:O,y:T,className:mt("recharts-text",P),textAnchor:p,fill:b.includes("url")?b2:b}),w.map(function(F,V){var $=F.words.join(_?"":" ");return C.createElement("tspan",{x:O,dy:V===0?k:l,key:"".concat($,"-").concat(V)},$)}))};function No(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function uve(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function hP(e){let t,n,r;e.length!==2?(t=No,n=(l,c)=>No(e(l),c),r=(l,c)=>e(l)-c):(t=e===No||e===uve?e:dve,n=e,r=e);function s(l,c,u=0,d=l.length){if(u>>1;n(l[f],c)<0?u=f+1:d=f}while(u>>1;n(l[f],c)<=0?u=f+1:d=f}while(uu&&r(l[f-1],c)>-r(l[f],c)?f-1:f}return{left:s,center:o,right:i}}function dve(){return 0}function b6(e){return e===null?NaN:+e}function*fve(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const hve=hP(No),zp=hve.right;hP(b6).center;class w2 extends Map{constructor(t,n=gve){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,s]of t)this.set(r,s)}get(t){return super.get(j2(this,t))}has(t){return super.has(j2(this,t))}set(t,n){return super.set(pve(this,t),n)}delete(t){return super.delete(mve(this,t))}}function j2({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function pve({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function mve({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function gve(e){return e!==null&&typeof e=="object"?e.valueOf():e}function vve(e=No){if(e===No)return w6;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function w6(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const yve=Math.sqrt(50),xve=Math.sqrt(10),bve=Math.sqrt(2);function kv(e,t,n){const r=(t-e)/Math.max(0,n),s=Math.floor(Math.log10(r)),i=r/Math.pow(10,s),o=i>=yve?10:i>=xve?5:i>=bve?2:1;let l,c,u;return s<0?(u=Math.pow(10,-s)/o,l=Math.round(e*u),c=Math.round(t*u),l/ut&&--c,u=-u):(u=Math.pow(10,s)*o,l=Math.round(e/u),c=Math.round(t/u),l*ut&&--c),c0))return[];if(e===t)return[e];const r=t=s))return[];const l=i-s+1,c=new Array(l);if(r)if(o<0)for(let u=0;u=r)&&(n=r);return n}function N2(e,t){let n;for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function j6(e,t,n=0,r=1/0,s){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(s=s===void 0?w6:vve(s);r>n;){if(r-n>600){const c=r-n+1,u=t-n+1,d=Math.log(c),f=.5*Math.exp(2*d/3),h=.5*Math.sqrt(d*f*(c-f)/c)*(u-c/2<0?-1:1),p=Math.max(n,Math.floor(t-u*f/c+h)),g=Math.min(r,Math.floor(t+(c-u)*f/c+h));j6(e,t,p,g,s)}const i=e[t];let o=n,l=r;for(Wd(e,n,t),s(e[r],i)>0&&Wd(e,n,r);o0;)--l}s(e[n],i)===0?Wd(e,n,l):(++l,Wd(e,l,r)),l<=t&&(n=l+1),t<=l&&(r=l-1)}return e}function Wd(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function wve(e,t,n){if(e=Float64Array.from(fve(e)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return N2(e);if(t>=1)return S2(e);var r,s=(r-1)*t,i=Math.floor(s),o=S2(j6(e,i).subarray(0,i+1)),l=N2(e.subarray(i+1));return o+(l-o)*(s-i)}}function jve(e,t,n=b6){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,s=(r-1)*t,i=Math.floor(s),o=+n(e[i],i,e),l=+n(e[i+1],i+1,e);return o+(l-o)*(s-i)}}function Sve(e,t,n){e=+e,t=+t,n=(s=arguments.length)<2?(t=e,e=0,1):s<3?1:+n;for(var r=-1,s=Math.max(0,Math.ceil((t-e)/n))|0,i=new Array(s);++r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Cm(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Cm(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=_ve.exec(e))?new Ur(t[1],t[2],t[3],1):(t=Pve.exec(e))?new Ur(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Cve.exec(e))?Cm(t[1],t[2],t[3],t[4]):(t=Ave.exec(e))?Cm(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Eve.exec(e))?k2(t[1],t[2]/100,t[3]/100,1):(t=Ove.exec(e))?k2(t[1],t[2]/100,t[3]/100,t[4]):_2.hasOwnProperty(e)?A2(_2[e]):e==="transparent"?new Ur(NaN,NaN,NaN,0):null}function A2(e){return new Ur(e>>16&255,e>>8&255,e&255,1)}function Cm(e,t,n,r){return r<=0&&(e=t=n=NaN),new Ur(e,t,n,r)}function $ve(e){return e instanceof Up||(e=Dh(e)),e?(e=e.rgb(),new Ur(e.r,e.g,e.b,e.opacity)):new Ur}function hj(e,t,n,r){return arguments.length===1?$ve(e):new Ur(e,t,n,r??1)}function Ur(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}mP(Ur,hj,N6(Up,{brighter(e){return e=e==null?Tv:Math.pow(Tv,e),new Ur(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Mh:Math.pow(Mh,e),new Ur(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ur(Al(this.r),Al(this.g),Al(this.b),$v(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:E2,formatHex:E2,formatHex8:Ive,formatRgb:O2,toString:O2}));function E2(){return`#${ml(this.r)}${ml(this.g)}${ml(this.b)}`}function Ive(){return`#${ml(this.r)}${ml(this.g)}${ml(this.b)}${ml((isNaN(this.opacity)?1:this.opacity)*255)}`}function O2(){const e=$v(this.opacity);return`${e===1?"rgb(":"rgba("}${Al(this.r)}, ${Al(this.g)}, ${Al(this.b)}${e===1?")":`, ${e})`}`}function $v(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Al(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ml(e){return e=Al(e),(e<16?"0":"")+e.toString(16)}function k2(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ks(e,t,n,r)}function _6(e){if(e instanceof Ks)return new Ks(e.h,e.s,e.l,e.opacity);if(e instanceof Up||(e=Dh(e)),!e)return new Ks;if(e instanceof Ks)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),i=Math.max(t,n,r),o=NaN,l=i-s,c=(i+s)/2;return l?(t===i?o=(n-r)/l+(n0&&c<1?0:o,new Ks(o,l,c,e.opacity)}function Mve(e,t,n,r){return arguments.length===1?_6(e):new Ks(e,t,n,r??1)}function Ks(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}mP(Ks,Mve,N6(Up,{brighter(e){return e=e==null?Tv:Math.pow(Tv,e),new Ks(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Mh:Math.pow(Mh,e),new Ks(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,s=2*n-r;return new Ur(_b(e>=240?e-240:e+120,s,r),_b(e,s,r),_b(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new Ks(T2(this.h),Am(this.s),Am(this.l),$v(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=$v(this.opacity);return`${e===1?"hsl(":"hsla("}${T2(this.h)}, ${Am(this.s)*100}%, ${Am(this.l)*100}%${e===1?")":`, ${e})`}`}}));function T2(e){return e=(e||0)%360,e<0?e+360:e}function Am(e){return Math.max(0,Math.min(1,e||0))}function _b(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const gP=e=>()=>e;function Rve(e,t){return function(n){return e+n*t}}function Dve(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Lve(e){return(e=+e)==1?P6:function(t,n){return n-t?Dve(t,n,e):gP(isNaN(t)?n:t)}}function P6(e,t){var n=t-e;return n?Rve(e,n):gP(isNaN(e)?t:e)}const $2=function e(t){var n=Lve(t);function r(s,i){var o=n((s=hj(s)).r,(i=hj(i)).r),l=n(s.g,i.g),c=n(s.b,i.b),u=P6(s.opacity,i.opacity);return function(d){return s.r=o(d),s.g=l(d),s.b=c(d),s.opacity=u(d),s+""}}return r.gamma=e,r}(1);function Fve(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),s;return function(i){for(s=0;sn&&(i=t.slice(n,i),l[o]?l[o]+=i:l[++o]=i),(r=r[0])===(s=s[0])?l[o]?l[o]+=s:l[++o]=s:(l[++o]=null,c.push({i:o,x:Iv(r,s)})),n=Pb.lastIndex;return nt&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function Yve(e,t,n){var r=e[0],s=e[1],i=t[0],o=t[1];return s2?Zve:Yve,c=u=null,f}function f(h){return h==null||isNaN(h=+h)?i:(c||(c=l(e.map(r),t,n)))(r(o(h)))}return f.invert=function(h){return o(s((u||(u=l(t,e.map(r),Iv)))(h)))},f.domain=function(h){return arguments.length?(e=Array.from(h,Mv),d()):e.slice()},f.range=function(h){return arguments.length?(t=Array.from(h),d()):t.slice()},f.rangeRound=function(h){return t=Array.from(h),n=vP,d()},f.clamp=function(h){return arguments.length?(o=h?!0:Er,d()):o!==Er},f.interpolate=function(h){return arguments.length?(n=h,d()):n},f.unknown=function(h){return arguments.length?(i=h,f):i},function(h,p){return r=h,s=p,d()}}function yP(){return Wx()(Er,Er)}function Qve(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Rv(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Su(e){return e=Rv(Math.abs(e)),e?e[1]:NaN}function Jve(e,t){return function(n,r){for(var s=n.length,i=[],o=0,l=e[0],c=0;s>0&&l>0&&(c+l+1>r&&(l=Math.max(1,r-c)),i.push(n.substring(s-=l,s+l)),!((c+=l+1)>r));)l=e[o=(o+1)%e.length];return i.reverse().join(t)}}function eye(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var tye=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Lh(e){if(!(t=tye.exec(e)))throw new Error("invalid format: "+e);var t;return new xP({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Lh.prototype=xP.prototype;function xP(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}xP.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function nye(e){e:for(var t=e.length,n=1,r=-1,s;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(s+1):e}var C6;function rye(e,t){var n=Rv(e,t);if(!n)return e+"";var r=n[0],s=n[1],i=s-(C6=Math.max(-8,Math.min(8,Math.floor(s/3)))*3)+1,o=r.length;return i===o?r:i>o?r+new Array(i-o+1).join("0"):i>0?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+Rv(e,Math.max(0,t+i-1))[0]}function M2(e,t){var n=Rv(e,t);if(!n)return e+"";var r=n[0],s=n[1];return s<0?"0."+new Array(-s).join("0")+r:r.length>s+1?r.slice(0,s+1)+"."+r.slice(s+1):r+new Array(s-r.length+2).join("0")}const R2={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:Qve,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>M2(e*100,t),r:M2,s:rye,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function D2(e){return e}var L2=Array.prototype.map,F2=["y","z","a","f","p","n","ยต","m","","k","M","G","T","P","E","Z","Y"];function sye(e){var t=e.grouping===void 0||e.thousands===void 0?D2:Jve(L2.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",s=e.decimal===void 0?".":e.decimal+"",i=e.numerals===void 0?D2:eye(L2.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",l=e.minus===void 0?"โˆ’":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function u(f){f=Lh(f);var h=f.fill,p=f.align,g=f.sign,m=f.symbol,x=f.zero,b=f.width,y=f.comma,w=f.precision,j=f.trim,S=f.type;S==="n"?(y=!0,S="g"):R2[S]||(w===void 0&&(w=12),j=!0,S="g"),(x||h==="0"&&p==="=")&&(x=!0,h="0",p="=");var N=m==="$"?n:m==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():"",P=m==="$"?r:/[%p]/.test(S)?o:"",_=R2[S],A=/[defgprs%]/.test(S);w=w===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,w)):Math.max(0,Math.min(20,w));function O(T){var k=N,M=P,R,H,F;if(S==="c")M=_(T)+M,T="";else{T=+T;var V=T<0||1/T<0;if(T=isNaN(T)?c:_(Math.abs(T),w),j&&(T=nye(T)),V&&+T==0&&g!=="+"&&(V=!1),k=(V?g==="("?g:l:g==="-"||g==="("?"":g)+k,M=(S==="s"?F2[8+C6/3]:"")+M+(V&&g==="("?")":""),A){for(R=-1,H=T.length;++RF||F>57){M=(F===46?s+T.slice(R+1):T.slice(R))+M,T=T.slice(0,R);break}}}y&&!x&&(T=t(T,1/0));var $=k.length+T.length+M.length,L=$>1)+k+T+M+L.slice($);break;default:T=L+k+T+M;break}return i(T)}return O.toString=function(){return f+""},O}function d(f,h){var p=u((f=Lh(f),f.type="f",f)),g=Math.max(-8,Math.min(8,Math.floor(Su(h)/3)))*3,m=Math.pow(10,-g),x=F2[8+g/3];return function(b){return p(m*b)+x}}return{format:u,formatPrefix:d}}var Em,bP,A6;iye({thousands:",",grouping:[3],currency:["$",""]});function iye(e){return Em=sye(e),bP=Em.format,A6=Em.formatPrefix,Em}function aye(e){return Math.max(0,-Su(Math.abs(e)))}function oye(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Su(t)/3)))*3-Su(Math.abs(e)))}function lye(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Su(t)-Su(e))+1}function E6(e,t,n,r){var s=dj(e,t,n),i;switch(r=Lh(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(i=oye(s,o))&&(r.precision=i),A6(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(i=lye(s,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=i-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(i=aye(s))&&(r.precision=i-(r.type==="%")*2);break}}return bP(r)}function qo(e){var t=e.domain;return e.ticks=function(n){var r=t();return cj(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var s=t();return E6(s[0],s[s.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),s=0,i=r.length-1,o=r[s],l=r[i],c,u,d=10;for(l0;){if(u=uj(o,l,n),u===c)return r[s]=o,r[i]=l,t(r);if(u>0)o=Math.floor(o/u)*u,l=Math.ceil(l/u)*u;else if(u<0)o=Math.ceil(o*u)/u,l=Math.floor(l*u)/u;else break;c=u}return e},e}function Dv(){var e=yP();return e.copy=function(){return Vp(e,Dv())},Is.apply(e,arguments),qo(e)}function O6(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,Mv),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return O6(e).unknown(t)},e=arguments.length?Array.from(e,Mv):[0,1],qo(n)}function k6(e,t){e=e.slice();var n=0,r=e.length-1,s=e[n],i=e[r],o;return iMath.pow(e,t)}function hye(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function U2(e){return(t,n)=>-e(-t,n)}function wP(e){const t=e(B2,z2),n=t.domain;let r=10,s,i;function o(){return s=hye(r),i=fye(r),n()[0]<0?(s=U2(s),i=U2(i),e(cye,uye)):e(B2,z2),t}return t.base=function(l){return arguments.length?(r=+l,o()):r},t.domain=function(l){return arguments.length?(n(l),o()):n()},t.ticks=l=>{const c=n();let u=c[0],d=c[c.length-1];const f=d0){for(;h<=p;++h)for(g=1;gd)break;b.push(m)}}else for(;h<=p;++h)for(g=r-1;g>=1;--g)if(m=h>0?g/i(-h):g*i(h),!(md)break;b.push(m)}b.length*2{if(l==null&&(l=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=Lh(c)).precision==null&&(c.trim=!0),c=bP(c)),l===1/0)return c;const u=Math.max(1,r*l/t.ticks().length);return d=>{let f=d/i(Math.round(s(d)));return f*rn(k6(n(),{floor:l=>i(Math.floor(s(l))),ceil:l=>i(Math.ceil(s(l)))})),t}function T6(){const e=wP(Wx()).domain([1,10]);return e.copy=()=>Vp(e,T6()).base(e.base()),Is.apply(e,arguments),e}function V2(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function W2(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function jP(e){var t=1,n=e(V2(t),W2(t));return n.constant=function(r){return arguments.length?e(V2(t=+r),W2(t)):t},qo(n)}function $6(){var e=jP(Wx());return e.copy=function(){return Vp(e,$6()).constant(e.constant())},Is.apply(e,arguments)}function H2(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function pye(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function mye(e){return e<0?-e*e:e*e}function SP(e){var t=e(Er,Er),n=1;function r(){return n===1?e(Er,Er):n===.5?e(pye,mye):e(H2(n),H2(1/n))}return t.exponent=function(s){return arguments.length?(n=+s,r()):n},qo(t)}function NP(){var e=SP(Wx());return e.copy=function(){return Vp(e,NP()).exponent(e.exponent())},Is.apply(e,arguments),e}function gye(){return NP.apply(null,arguments).exponent(.5)}function G2(e){return Math.sign(e)*e*e}function vye(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function I6(){var e=yP(),t=[0,1],n=!1,r;function s(i){var o=vye(e(i));return isNaN(o)?r:n?Math.round(o):o}return s.invert=function(i){return e.invert(G2(i))},s.domain=function(i){return arguments.length?(e.domain(i),s):e.domain()},s.range=function(i){return arguments.length?(e.range((t=Array.from(i,Mv)).map(G2)),s):t.slice()},s.rangeRound=function(i){return s.range(i).round(!0)},s.round=function(i){return arguments.length?(n=!!i,s):n},s.clamp=function(i){return arguments.length?(e.clamp(i),s):e.clamp()},s.unknown=function(i){return arguments.length?(r=i,s):r},s.copy=function(){return I6(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},Is.apply(s,arguments),qo(s)}function M6(){var e=[],t=[],n=[],r;function s(){var o=0,l=Math.max(1,t.length);for(n=new Array(l-1);++o0?n[l-1]:e[0],l=n?[r[n-1],t]:[r[u-1],r[u]]},o.unknown=function(c){return arguments.length&&(i=c),o},o.thresholds=function(){return r.slice()},o.copy=function(){return R6().domain([e,t]).range(s).unknown(i)},Is.apply(qo(o),arguments)}function D6(){var e=[.5],t=[0,1],n,r=1;function s(i){return i!=null&&i<=i?t[zp(e,i,0,r)]:n}return s.domain=function(i){return arguments.length?(e=Array.from(i),r=Math.min(e.length,t.length-1),s):e.slice()},s.range=function(i){return arguments.length?(t=Array.from(i),r=Math.min(e.length,t.length-1),s):t.slice()},s.invertExtent=function(i){var o=t.indexOf(i);return[e[o-1],e[o]]},s.unknown=function(i){return arguments.length?(n=i,s):n},s.copy=function(){return D6().domain(e).range(t).unknown(n)},Is.apply(s,arguments)}const Cb=new Date,Ab=new Date;function Gn(e,t,n,r){function s(i){return e(i=arguments.length===0?new Date:new Date(+i)),i}return s.floor=i=>(e(i=new Date(+i)),i),s.ceil=i=>(e(i=new Date(i-1)),t(i,1),e(i),i),s.round=i=>{const o=s(i),l=s.ceil(i);return i-o(t(i=new Date(+i),o==null?1:Math.floor(o)),i),s.range=(i,o,l)=>{const c=[];if(i=s.ceil(i),l=l==null?1:Math.floor(l),!(i0))return c;let u;do c.push(u=new Date(+i)),t(i,l),e(i);while(uGn(o=>{if(o>=o)for(;e(o),!i(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;t(o,-1),!i(o););else for(;--l>=0;)for(;t(o,1),!i(o););}),n&&(s.count=(i,o)=>(Cb.setTime(+i),Ab.setTime(+o),e(Cb),e(Ab),Math.floor(n(Cb,Ab))),s.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?s.filter(r?o=>r(o)%i===0:o=>s.count(0,o)%i===0):s)),s}const Lv=Gn(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Lv.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Gn(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Lv);Lv.range;const ra=1e3,_s=ra*60,sa=_s*60,Pa=sa*24,_P=Pa*7,q2=Pa*30,Eb=Pa*365,gl=Gn(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*ra)},(e,t)=>(t-e)/ra,e=>e.getUTCSeconds());gl.range;const PP=Gn(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*ra)},(e,t)=>{e.setTime(+e+t*_s)},(e,t)=>(t-e)/_s,e=>e.getMinutes());PP.range;const CP=Gn(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*_s)},(e,t)=>(t-e)/_s,e=>e.getUTCMinutes());CP.range;const AP=Gn(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*ra-e.getMinutes()*_s)},(e,t)=>{e.setTime(+e+t*sa)},(e,t)=>(t-e)/sa,e=>e.getHours());AP.range;const EP=Gn(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*sa)},(e,t)=>(t-e)/sa,e=>e.getUTCHours());EP.range;const Wp=Gn(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*_s)/Pa,e=>e.getDate()-1);Wp.range;const Hx=Gn(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Pa,e=>e.getUTCDate()-1);Hx.range;const L6=Gn(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Pa,e=>Math.floor(e/Pa));L6.range;function tc(e){return Gn(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*_s)/_P)}const Gx=tc(0),Fv=tc(1),yye=tc(2),xye=tc(3),Nu=tc(4),bye=tc(5),wye=tc(6);Gx.range;Fv.range;yye.range;xye.range;Nu.range;bye.range;wye.range;function nc(e){return Gn(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/_P)}const qx=nc(0),Bv=nc(1),jye=nc(2),Sye=nc(3),_u=nc(4),Nye=nc(5),_ye=nc(6);qx.range;Bv.range;jye.range;Sye.range;_u.range;Nye.range;_ye.range;const OP=Gn(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());OP.range;const kP=Gn(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());kP.range;const Ca=Gn(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Ca.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Gn(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});Ca.range;const Aa=Gn(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());Aa.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Gn(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});Aa.range;function F6(e,t,n,r,s,i){const o=[[gl,1,ra],[gl,5,5*ra],[gl,15,15*ra],[gl,30,30*ra],[i,1,_s],[i,5,5*_s],[i,15,15*_s],[i,30,30*_s],[s,1,sa],[s,3,3*sa],[s,6,6*sa],[s,12,12*sa],[r,1,Pa],[r,2,2*Pa],[n,1,_P],[t,1,q2],[t,3,3*q2],[e,1,Eb]];function l(u,d,f){const h=dx).right(o,h);if(p===o.length)return e.every(dj(u/Eb,d/Eb,f));if(p===0)return Lv.every(Math.max(dj(u,d,f),1));const[g,m]=o[h/o[p-1][2]53)return null;"w"in te||(te.w=1),"Z"in te?(G=kb(Hd(te.y,0,1)),ve=G.getUTCDay(),G=ve>4||ve===0?Bv.ceil(G):Bv(G),G=Hx.offset(G,(te.V-1)*7),te.y=G.getUTCFullYear(),te.m=G.getUTCMonth(),te.d=G.getUTCDate()+(te.w+6)%7):(G=Ob(Hd(te.y,0,1)),ve=G.getDay(),G=ve>4||ve===0?Fv.ceil(G):Fv(G),G=Wp.offset(G,(te.V-1)*7),te.y=G.getFullYear(),te.m=G.getMonth(),te.d=G.getDate()+(te.w+6)%7)}else("W"in te||"U"in te)&&("w"in te||(te.w="u"in te?te.u%7:"W"in te?1:0),ve="Z"in te?kb(Hd(te.y,0,1)).getUTCDay():Ob(Hd(te.y,0,1)).getDay(),te.m=0,te.d="W"in te?(te.w+6)%7+te.W*7-(ve+5)%7:te.w+te.U*7-(ve+6)%7);return"Z"in te?(te.H+=te.Z/100|0,te.M+=te.Z%100,kb(te)):Ob(te)}}function _(de,oe,xe,te){for(var Ye=0,G=oe.length,ve=xe.length,Pe,Ie;Ye=ve)return-1;if(Pe=oe.charCodeAt(Ye++),Pe===37){if(Pe=oe.charAt(Ye++),Ie=S[Pe in K2?oe.charAt(Ye++):Pe],!Ie||(te=Ie(de,xe,te))<0)return-1}else if(Pe!=xe.charCodeAt(te++))return-1}return te}function A(de,oe,xe){var te=u.exec(oe.slice(xe));return te?(de.p=d.get(te[0].toLowerCase()),xe+te[0].length):-1}function O(de,oe,xe){var te=p.exec(oe.slice(xe));return te?(de.w=g.get(te[0].toLowerCase()),xe+te[0].length):-1}function T(de,oe,xe){var te=f.exec(oe.slice(xe));return te?(de.w=h.get(te[0].toLowerCase()),xe+te[0].length):-1}function k(de,oe,xe){var te=b.exec(oe.slice(xe));return te?(de.m=y.get(te[0].toLowerCase()),xe+te[0].length):-1}function M(de,oe,xe){var te=m.exec(oe.slice(xe));return te?(de.m=x.get(te[0].toLowerCase()),xe+te[0].length):-1}function R(de,oe,xe){return _(de,t,oe,xe)}function H(de,oe,xe){return _(de,n,oe,xe)}function F(de,oe,xe){return _(de,r,oe,xe)}function V(de){return o[de.getDay()]}function $(de){return i[de.getDay()]}function L(de){return c[de.getMonth()]}function Y(de){return l[de.getMonth()]}function Q(de){return s[+(de.getHours()>=12)]}function ee(de){return 1+~~(de.getMonth()/3)}function fe(de){return o[de.getUTCDay()]}function W(de){return i[de.getUTCDay()]}function he(de){return c[de.getUTCMonth()]}function pe(de){return l[de.getUTCMonth()]}function ue(de){return s[+(de.getUTCHours()>=12)]}function Ae(de){return 1+~~(de.getUTCMonth()/3)}return{format:function(de){var oe=N(de+="",w);return oe.toString=function(){return de},oe},parse:function(de){var oe=P(de+="",!1);return oe.toString=function(){return de},oe},utcFormat:function(de){var oe=N(de+="",j);return oe.toString=function(){return de},oe},utcParse:function(de){var oe=P(de+="",!0);return oe.toString=function(){return de},oe}}}var K2={"-":"",_:" ",0:"0"},tr=/^\s*\d+/,kye=/^%/,Tye=/[\\^$*+?|[\]().{}]/g;function Dt(e,t,n){var r=e<0?"-":"",s=(r?-e:e)+"",i=s.length;return r+(i[t.toLowerCase(),n]))}function Iye(e,t,n){var r=tr.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function Mye(e,t,n){var r=tr.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function Rye(e,t,n){var r=tr.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function Dye(e,t,n){var r=tr.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function Lye(e,t,n){var r=tr.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function X2(e,t,n){var r=tr.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function Y2(e,t,n){var r=tr.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Fye(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Bye(e,t,n){var r=tr.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function zye(e,t,n){var r=tr.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function Z2(e,t,n){var r=tr.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Uye(e,t,n){var r=tr.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function Q2(e,t,n){var r=tr.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function Vye(e,t,n){var r=tr.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function Wye(e,t,n){var r=tr.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function Hye(e,t,n){var r=tr.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function Gye(e,t,n){var r=tr.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function qye(e,t,n){var r=kye.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function Kye(e,t,n){var r=tr.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function Xye(e,t,n){var r=tr.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function J2(e,t){return Dt(e.getDate(),t,2)}function Yye(e,t){return Dt(e.getHours(),t,2)}function Zye(e,t){return Dt(e.getHours()%12||12,t,2)}function Qye(e,t){return Dt(1+Wp.count(Ca(e),e),t,3)}function B6(e,t){return Dt(e.getMilliseconds(),t,3)}function Jye(e,t){return B6(e,t)+"000"}function exe(e,t){return Dt(e.getMonth()+1,t,2)}function txe(e,t){return Dt(e.getMinutes(),t,2)}function nxe(e,t){return Dt(e.getSeconds(),t,2)}function rxe(e){var t=e.getDay();return t===0?7:t}function sxe(e,t){return Dt(Gx.count(Ca(e)-1,e),t,2)}function z6(e){var t=e.getDay();return t>=4||t===0?Nu(e):Nu.ceil(e)}function ixe(e,t){return e=z6(e),Dt(Nu.count(Ca(e),e)+(Ca(e).getDay()===4),t,2)}function axe(e){return e.getDay()}function oxe(e,t){return Dt(Fv.count(Ca(e)-1,e),t,2)}function lxe(e,t){return Dt(e.getFullYear()%100,t,2)}function cxe(e,t){return e=z6(e),Dt(e.getFullYear()%100,t,2)}function uxe(e,t){return Dt(e.getFullYear()%1e4,t,4)}function dxe(e,t){var n=e.getDay();return e=n>=4||n===0?Nu(e):Nu.ceil(e),Dt(e.getFullYear()%1e4,t,4)}function fxe(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Dt(t/60|0,"0",2)+Dt(t%60,"0",2)}function ek(e,t){return Dt(e.getUTCDate(),t,2)}function hxe(e,t){return Dt(e.getUTCHours(),t,2)}function pxe(e,t){return Dt(e.getUTCHours()%12||12,t,2)}function mxe(e,t){return Dt(1+Hx.count(Aa(e),e),t,3)}function U6(e,t){return Dt(e.getUTCMilliseconds(),t,3)}function gxe(e,t){return U6(e,t)+"000"}function vxe(e,t){return Dt(e.getUTCMonth()+1,t,2)}function yxe(e,t){return Dt(e.getUTCMinutes(),t,2)}function xxe(e,t){return Dt(e.getUTCSeconds(),t,2)}function bxe(e){var t=e.getUTCDay();return t===0?7:t}function wxe(e,t){return Dt(qx.count(Aa(e)-1,e),t,2)}function V6(e){var t=e.getUTCDay();return t>=4||t===0?_u(e):_u.ceil(e)}function jxe(e,t){return e=V6(e),Dt(_u.count(Aa(e),e)+(Aa(e).getUTCDay()===4),t,2)}function Sxe(e){return e.getUTCDay()}function Nxe(e,t){return Dt(Bv.count(Aa(e)-1,e),t,2)}function _xe(e,t){return Dt(e.getUTCFullYear()%100,t,2)}function Pxe(e,t){return e=V6(e),Dt(e.getUTCFullYear()%100,t,2)}function Cxe(e,t){return Dt(e.getUTCFullYear()%1e4,t,4)}function Axe(e,t){var n=e.getUTCDay();return e=n>=4||n===0?_u(e):_u.ceil(e),Dt(e.getUTCFullYear()%1e4,t,4)}function Exe(){return"+0000"}function tk(){return"%"}function nk(e){return+e}function rk(e){return Math.floor(+e/1e3)}var fc,W6,H6;Oxe({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Oxe(e){return fc=Oye(e),W6=fc.format,fc.parse,H6=fc.utcFormat,fc.utcParse,fc}function kxe(e){return new Date(e)}function Txe(e){return e instanceof Date?+e:+new Date(+e)}function TP(e,t,n,r,s,i,o,l,c,u){var d=yP(),f=d.invert,h=d.domain,p=u(".%L"),g=u(":%S"),m=u("%I:%M"),x=u("%I %p"),b=u("%a %d"),y=u("%b %d"),w=u("%B"),j=u("%Y");function S(N){return(c(N)t(s/(e.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(s,i)=>wve(e,i/r))},n.copy=function(){return X6(t).domain(e)},La.apply(n,arguments)}function Xx(){var e=0,t=.5,n=1,r=1,s,i,o,l,c,u=Er,d,f=!1,h;function p(m){return isNaN(m=+m)?h:(m=.5+((m=+d(m))-i)*(r*mt}var J6=Fxe,Bxe=Yx,zxe=J6,Uxe=xd;function Vxe(e){return e&&e.length?Bxe(e,Uxe,zxe):void 0}var Wxe=Vxe;const lo=Bt(Wxe);function Hxe(e,t){return ee.e^i.s<0?1:-1;for(r=i.d.length,s=e.d.length,t=0,n=re.d[t]^i.s<0?1:-1;return r===s?0:r>s^i.s<0?1:-1};Ge.decimalPlaces=Ge.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*sn;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};Ge.dividedBy=Ge.div=function(e){return pa(this,new this.constructor(e))};Ge.dividedToIntegerBy=Ge.idiv=function(e){var t=this,n=t.constructor;return Yt(pa(t,new n(e),0,1),n.precision)};Ge.equals=Ge.eq=function(e){return!this.cmp(e)};Ge.exponent=function(){return In(this)};Ge.greaterThan=Ge.gt=function(e){return this.cmp(e)>0};Ge.greaterThanOrEqualTo=Ge.gte=function(e){return this.cmp(e)>=0};Ge.isInteger=Ge.isint=function(){return this.e>this.d.length-2};Ge.isNegative=Ge.isneg=function(){return this.s<0};Ge.isPositive=Ge.ispos=function(){return this.s>0};Ge.isZero=function(){return this.s===0};Ge.lessThan=Ge.lt=function(e){return this.cmp(e)<0};Ge.lessThanOrEqualTo=Ge.lte=function(e){return this.cmp(e)<1};Ge.logarithm=Ge.log=function(e){var t,n=this,r=n.constructor,s=r.precision,i=s+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(rs))throw Error(Ts+"NaN");if(n.s<1)throw Error(Ts+(n.s?"NaN":"-Infinity"));return n.eq(rs)?new r(0):(cn=!1,t=pa(Fh(n,i),Fh(e,i),i),cn=!0,Yt(t,s))};Ge.minus=Ge.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?sB(t,e):nB(t,(e.s=-e.s,e))};Ge.modulo=Ge.mod=function(e){var t,n=this,r=n.constructor,s=r.precision;if(e=new r(e),!e.s)throw Error(Ts+"NaN");return n.s?(cn=!1,t=pa(n,e,0,1).times(e),cn=!0,n.minus(t)):Yt(new r(n),s)};Ge.naturalExponential=Ge.exp=function(){return rB(this)};Ge.naturalLogarithm=Ge.ln=function(){return Fh(this)};Ge.negated=Ge.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};Ge.plus=Ge.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?nB(t,e):sB(t,(e.s=-e.s,e))};Ge.precision=Ge.sd=function(e){var t,n,r,s=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(El+e);if(t=In(s)+1,r=s.d.length-1,n=r*sn+1,r=s.d[r],r){for(;r%10==0;r/=10)n--;for(r=s.d[0];r>=10;r/=10)n++}return e&&t>n?t:n};Ge.squareRoot=Ge.sqrt=function(){var e,t,n,r,s,i,o,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(Ts+"NaN")}for(e=In(l),cn=!1,s=Math.sqrt(+l),s==0||s==1/0?(t=_i(l.d),(t.length+e)%2==0&&(t+="0"),s=Math.sqrt(t),e=jd((e+1)/2)-(e<0||e%2),s==1/0?t="5e"+e:(t=s.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),r=new c(t)):r=new c(s.toString()),n=c.precision,s=o=n+3;;)if(i=r,r=i.plus(pa(l,i,o+2)).times(.5),_i(i.d).slice(0,o)===(t=_i(r.d)).slice(0,o)){if(t=t.slice(o-3,o+1),s==o&&t=="4999"){if(Yt(i,n+1,0),i.times(i).eq(l)){r=i;break}}else if(t!="9999")break;o+=4}return cn=!0,Yt(r,n)};Ge.times=Ge.mul=function(e){var t,n,r,s,i,o,l,c,u,d=this,f=d.constructor,h=d.d,p=(e=new f(e)).d;if(!d.s||!e.s)return new f(0);for(e.s*=d.s,n=d.e+e.e,c=h.length,u=p.length,c=0;){for(t=0,s=c+r;s>r;)l=i[s]+p[r]*h[s-r-1]+t,i[s--]=l%qn|0,t=l/qn|0;i[s]=(i[s]+t)%qn|0}for(;!i[--o];)i.pop();return t?++n:i.shift(),e.d=i,e.e=n,cn?Yt(e,f.precision):e};Ge.toDecimalPlaces=Ge.todp=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(Li(e,0,wd),t===void 0?t=r.rounding:Li(t,0,8),Yt(n,e+In(n)+1,t))};Ge.toExponential=function(e,t){var n,r=this,s=r.constructor;return e===void 0?n=Gl(r,!0):(Li(e,0,wd),t===void 0?t=s.rounding:Li(t,0,8),r=Yt(new s(r),e+1,t),n=Gl(r,!0,e+1)),n};Ge.toFixed=function(e,t){var n,r,s=this,i=s.constructor;return e===void 0?Gl(s):(Li(e,0,wd),t===void 0?t=i.rounding:Li(t,0,8),r=Yt(new i(s),e+In(s)+1,t),n=Gl(r.abs(),!1,e+In(r)+1),s.isneg()&&!s.isZero()?"-"+n:n)};Ge.toInteger=Ge.toint=function(){var e=this,t=e.constructor;return Yt(new t(e),In(e)+1,t.rounding)};Ge.toNumber=function(){return+this};Ge.toPower=Ge.pow=function(e){var t,n,r,s,i,o,l=this,c=l.constructor,u=12,d=+(e=new c(e));if(!e.s)return new c(rs);if(l=new c(l),!l.s){if(e.s<1)throw Error(Ts+"Infinity");return l}if(l.eq(rs))return l;if(r=c.precision,e.eq(rs))return Yt(l,r);if(t=e.e,n=e.d.length-1,o=t>=n,i=l.s,o){if((n=d<0?-d:d)<=tB){for(s=new c(rs),t=Math.ceil(r/sn+4),cn=!1;n%2&&(s=s.times(l),ak(s.d,t)),n=jd(n/2),n!==0;)l=l.times(l),ak(l.d,t);return cn=!0,e.s<0?new c(rs).div(s):Yt(s,r)}}else if(i<0)throw Error(Ts+"NaN");return i=i<0&&e.d[Math.max(t,n)]&1?-1:1,l.s=1,cn=!1,s=e.times(Fh(l,r+u)),cn=!0,s=rB(s),s.s=i,s};Ge.toPrecision=function(e,t){var n,r,s=this,i=s.constructor;return e===void 0?(n=In(s),r=Gl(s,n<=i.toExpNeg||n>=i.toExpPos)):(Li(e,1,wd),t===void 0?t=i.rounding:Li(t,0,8),s=Yt(new i(s),e,t),n=In(s),r=Gl(s,e<=n||n<=i.toExpNeg,e)),r};Ge.toSignificantDigits=Ge.tosd=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(Li(e,1,wd),t===void 0?t=r.rounding:Li(t,0,8)),Yt(new r(n),e,t)};Ge.toString=Ge.valueOf=Ge.val=Ge.toJSON=Ge[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=In(e),n=e.constructor;return Gl(e,t<=n.toExpNeg||t>=n.toExpPos)};function nB(e,t){var n,r,s,i,o,l,c,u,d=e.constructor,f=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),cn?Yt(t,f):t;if(c=e.d,u=t.d,o=e.e,s=t.e,c=c.slice(),i=o-s,i){for(i<0?(r=c,i=-i,l=u.length):(r=u,s=o,l=c.length),o=Math.ceil(f/sn),l=o>l?o+1:l+1,i>l&&(i=l,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(l=c.length,i=u.length,l-i<0&&(i=l,r=u,u=c,c=r),n=0;i;)n=(c[--i]=c[i]+u[i]+n)/qn|0,c[i]%=qn;for(n&&(c.unshift(n),++s),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=s,cn?Yt(t,f):t}function Li(e,t,n){if(e!==~~e||en)throw Error(El+e)}function _i(e){var t,n,r,s=e.length-1,i="",o=e[0];if(s>0){for(i+=o,t=1;to?1:-1;else for(l=c=0;ls[l]?1:-1;break}return c}function n(r,s,i){for(var o=0;i--;)r[i]-=o,o=r[i]1;)r.shift()}return function(r,s,i,o){var l,c,u,d,f,h,p,g,m,x,b,y,w,j,S,N,P,_,A=r.constructor,O=r.s==s.s?1:-1,T=r.d,k=s.d;if(!r.s)return new A(r);if(!s.s)throw Error(Ts+"Division by zero");for(c=r.e-s.e,P=k.length,S=T.length,p=new A(O),g=p.d=[],u=0;k[u]==(T[u]||0);)++u;if(k[u]>(T[u]||0)&&--c,i==null?y=i=A.precision:o?y=i+(In(r)-In(s))+1:y=i,y<0)return new A(0);if(y=y/sn+2|0,u=0,P==1)for(d=0,k=k[0],y++;(u1&&(k=e(k,d),T=e(T,d),P=k.length,S=T.length),j=P,m=T.slice(0,P),x=m.length;x=qn/2&&++N;do d=0,l=t(k,m,P,x),l<0?(b=m[0],P!=x&&(b=b*qn+(m[1]||0)),d=b/N|0,d>1?(d>=qn&&(d=qn-1),f=e(k,d),h=f.length,x=m.length,l=t(f,m,h,x),l==1&&(d--,n(f,P16)throw Error(MP+In(e));if(!e.s)return new d(rs);for(t==null?(cn=!1,l=f):l=t,o=new d(.03125);e.abs().gte(.1);)e=e.times(o),u+=5;for(r=Math.log(il(2,u))/Math.LN10*2+5|0,l+=r,n=s=i=new d(rs),d.precision=l;;){if(s=Yt(s.times(e),l),n=n.times(++c),o=i.plus(pa(s,n,l)),_i(o.d).slice(0,l)===_i(i.d).slice(0,l)){for(;u--;)i=Yt(i.times(i),l);return d.precision=f,t==null?(cn=!0,Yt(i,f)):i}i=o}}function In(e){for(var t=e.e*sn,n=e.d[0];n>=10;n/=10)t++;return t}function Tb(e,t,n){if(t>e.LN10.sd())throw cn=!0,n&&(e.precision=n),Error(Ts+"LN10 precision limit exceeded");return Yt(new e(e.LN10),t)}function Ka(e){for(var t="";e--;)t+="0";return t}function Fh(e,t){var n,r,s,i,o,l,c,u,d,f=1,h=10,p=e,g=p.d,m=p.constructor,x=m.precision;if(p.s<1)throw Error(Ts+(p.s?"NaN":"-Infinity"));if(p.eq(rs))return new m(0);if(t==null?(cn=!1,u=x):u=t,p.eq(10))return t==null&&(cn=!0),Tb(m,u);if(u+=h,m.precision=u,n=_i(g),r=n.charAt(0),i=In(p),Math.abs(i)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)p=p.times(e),n=_i(p.d),r=n.charAt(0),f++;i=In(p),r>1?(p=new m("0."+n),i++):p=new m(r+"."+n.slice(1))}else return c=Tb(m,u+2,x).times(i+""),p=Fh(new m(r+"."+n.slice(1)),u-h).plus(c),m.precision=x,t==null?(cn=!0,Yt(p,x)):p;for(l=o=p=pa(p.minus(rs),p.plus(rs),u),d=Yt(p.times(p),u),s=3;;){if(o=Yt(o.times(d),u),c=l.plus(pa(o,new m(s),u)),_i(c.d).slice(0,u)===_i(l.d).slice(0,u))return l=l.times(2),i!==0&&(l=l.plus(Tb(m,u+2,x).times(i+""))),l=pa(l,new m(f),u),m.precision=x,t==null?(cn=!0,Yt(l,x)):l;l=c,s+=2}}function ik(e,t){var n,r,s;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(s=t.length;t.charCodeAt(s-1)===48;)--s;if(t=t.slice(r,s),t){if(s-=r,n=n-r-1,e.e=jd(n/sn),e.d=[],r=(n+1)%sn,n<0&&(r+=sn),rzv||e.e<-zv))throw Error(MP+n)}else e.s=0,e.e=0,e.d=[0];return e}function Yt(e,t,n){var r,s,i,o,l,c,u,d,f=e.d;for(o=1,i=f[0];i>=10;i/=10)o++;if(r=t-o,r<0)r+=sn,s=t,u=f[d=0];else{if(d=Math.ceil((r+1)/sn),i=f.length,d>=i)return e;for(u=i=f[d],o=1;i>=10;i/=10)o++;r%=sn,s=r-sn+o}if(n!==void 0&&(i=il(10,o-s-1),l=u/i%10|0,c=t<0||f[d+1]!==void 0||u%i,c=n<4?(l||c)&&(n==0||n==(e.s<0?3:2)):l>5||l==5&&(n==4||c||n==6&&(r>0?s>0?u/il(10,o-s):0:f[d-1])%10&1||n==(e.s<0?8:7))),t<1||!f[0])return c?(i=In(e),f.length=1,t=t-i-1,f[0]=il(10,(sn-t%sn)%sn),e.e=jd(-t/sn)||0):(f.length=1,f[0]=e.e=e.s=0),e;if(r==0?(f.length=d,i=1,d--):(f.length=d+1,i=il(10,sn-r),f[d]=s>0?(u/il(10,o-s)%il(10,s)|0)*i:0),c)for(;;)if(d==0){(f[0]+=i)==qn&&(f[0]=1,++e.e);break}else{if(f[d]+=i,f[d]!=qn)break;f[d--]=0,i=1}for(r=f.length;f[--r]===0;)f.pop();if(cn&&(e.e>zv||e.e<-zv))throw Error(MP+In(e));return e}function sB(e,t){var n,r,s,i,o,l,c,u,d,f,h=e.constructor,p=h.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new h(e),cn?Yt(t,p):t;if(c=e.d,f=t.d,r=t.e,u=e.e,c=c.slice(),o=u-r,o){for(d=o<0,d?(n=c,o=-o,l=f.length):(n=f,r=u,l=c.length),s=Math.max(Math.ceil(p/sn),l)+2,o>s&&(o=s,n.length=1),n.reverse(),s=o;s--;)n.push(0);n.reverse()}else{for(s=c.length,l=f.length,d=s0;--s)c[l++]=0;for(s=f.length;s>o;){if(c[--s]0?i=i.charAt(0)+"."+i.slice(1)+Ka(r):o>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(s<0?"e":"e+")+s):s<0?(i="0."+Ka(-s-1)+i,n&&(r=n-o)>0&&(i+=Ka(r))):s>=o?(i+=Ka(s+1-o),n&&(r=n-s-1)>0&&(i=i+"."+Ka(r))):((r=s+1)0&&(s+1===o&&(i+="."),i+=Ka(r))),e.s<0?"-"+i:i}function ak(e,t){if(e.length>t)return e.length=t,!0}function iB(e){var t,n,r;function s(i){var o=this;if(!(o instanceof s))return new s(i);if(o.constructor=s,i instanceof s){o.s=i.s,o.e=i.e,o.d=(i=i.d)?i.slice():i;return}if(typeof i=="number"){if(i*0!==0)throw Error(El+i);if(i>0)o.s=1;else if(i<0)i=-i,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(i===~~i&&i<1e7){o.e=0,o.d=[i];return}return ik(o,i.toString())}else if(typeof i!="string")throw Error(El+i);if(i.charCodeAt(0)===45?(i=i.slice(1),o.s=-1):o.s=1,f0e.test(i))ik(o,i);else throw Error(El+i)}if(s.prototype=Ge,s.ROUND_UP=0,s.ROUND_DOWN=1,s.ROUND_CEIL=2,s.ROUND_FLOOR=3,s.ROUND_HALF_UP=4,s.ROUND_HALF_DOWN=5,s.ROUND_HALF_EVEN=6,s.ROUND_HALF_CEIL=7,s.ROUND_HALF_FLOOR=8,s.clone=iB,s.config=s.set=h0e,e===void 0&&(e={}),e)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=s[t+1]&&r<=s[t+2])this[n]=r;else throw Error(El+n+": "+r);if((r=e[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(El+n+": "+r);return this}var RP=iB(d0e);rs=new RP(1);const Kt=RP;function p0e(e){return y0e(e)||v0e(e)||g0e(e)||m0e()}function m0e(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function g0e(e,t){if(e){if(typeof e=="string")return gj(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return gj(e,t)}}function v0e(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function y0e(e){if(Array.isArray(e))return gj(e)}function gj(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=t?n.apply(void 0,s):e(t-o,ok(function(){for(var l=arguments.length,c=new Array(l),u=0;ue.length)&&(t=e.length);for(var n=0,r=new Array(t);n"u"||!(Symbol.iterator in Object(e)))){var n=[],r=!0,s=!1,i=void 0;try{for(var o=e[Symbol.iterator](),l;!(r=(l=o.next()).done)&&(n.push(l.value),!(t&&n.length===t));r=!0);}catch(c){s=!0,i=c}finally{try{!r&&o.return!=null&&o.return()}finally{if(s)throw i}}return n}}function $0e(e){if(Array.isArray(e))return e}function uB(e){var t=Bh(e,2),n=t[0],r=t[1],s=n,i=r;return n>r&&(s=r,i=n),[s,i]}function dB(e,t,n){if(e.lte(0))return new Kt(0);var r=Jx.getDigitCount(e.toNumber()),s=new Kt(10).pow(r),i=e.div(s),o=r!==1?.05:.1,l=new Kt(Math.ceil(i.div(o).toNumber())).add(n).mul(o),c=l.mul(s);return t?c:new Kt(Math.ceil(c))}function I0e(e,t,n){var r=1,s=new Kt(e);if(!s.isint()&&n){var i=Math.abs(e);i<1?(r=new Kt(10).pow(Jx.getDigitCount(e)-1),s=new Kt(Math.floor(s.div(r).toNumber())).mul(r)):i>1&&(s=new Kt(Math.floor(e)))}else e===0?s=new Kt(Math.floor((t-1)/2)):n||(s=new Kt(Math.floor(e)));var o=Math.floor((t-1)/2),l=j0e(w0e(function(c){return s.add(new Kt(c-o).mul(r)).toNumber()}),vj);return l(0,t)}function fB(e,t,n,r){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new Kt(0),tickMin:new Kt(0),tickMax:new Kt(0)};var i=dB(new Kt(t).sub(e).div(n-1),r,s),o;e<=0&&t>=0?o=new Kt(0):(o=new Kt(e).add(t).div(2),o=o.sub(new Kt(o).mod(i)));var l=Math.ceil(o.sub(e).div(i).toNumber()),c=Math.ceil(new Kt(t).sub(o).div(i).toNumber()),u=l+c+1;return u>n?fB(e,t,n,r,s+1):(u0?c+(n-u):c,l=t>0?l:l+(n-u)),{step:i,tickMin:o.sub(new Kt(l).mul(i)),tickMax:o.add(new Kt(c).mul(i))})}function M0e(e){var t=Bh(e,2),n=t[0],r=t[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(s,2),l=uB([n,r]),c=Bh(l,2),u=c[0],d=c[1];if(u===-1/0||d===1/0){var f=d===1/0?[u].concat(xj(vj(0,s-1).map(function(){return 1/0}))):[].concat(xj(vj(0,s-1).map(function(){return-1/0})),[d]);return n>r?yj(f):f}if(u===d)return I0e(u,s,i);var h=fB(u,d,o,i),p=h.step,g=h.tickMin,m=h.tickMax,x=Jx.rangeStep(g,m.add(new Kt(.1).mul(p)),p);return n>r?yj(x):x}function R0e(e,t){var n=Bh(e,2),r=n[0],s=n[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=uB([r,s]),l=Bh(o,2),c=l[0],u=l[1];if(c===-1/0||u===1/0)return[r,s];if(c===u)return[c];var d=Math.max(t,2),f=dB(new Kt(u).sub(c).div(d-1),i,0),h=[].concat(xj(Jx.rangeStep(new Kt(c),new Kt(u).sub(new Kt(.99).mul(f)),f)),[u]);return r>s?yj(h):h}var D0e=lB(M0e),L0e=lB(R0e),F0e="Invariant failed";function ql(e,t){throw new Error(F0e)}var B0e=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function Pu(e){"@babel/helpers - typeof";return Pu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pu(e)}function Uv(){return Uv=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function q0e(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function K0e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function X0e(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n1&&arguments[1]!==void 0?arguments[1]:[],s=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,o=-1,l=(n=r==null?void 0:r.length)!==null&&n!==void 0?n:0;if(l<=1)return 0;if(i&&i.axisType==="angleAxis"&&Math.abs(Math.abs(i.range[1]-i.range[0])-360)<=1e-6)for(var c=i.range,u=0;u0?s[u-1].coordinate:s[l-1].coordinate,f=s[u].coordinate,h=u>=l-1?s[0].coordinate:s[u+1].coordinate,p=void 0;if(Cr(f-d)!==Cr(h-f)){var g=[];if(Cr(h-f)===Cr(c[1]-c[0])){p=h;var m=f+c[1]-c[0];g[0]=Math.min(m,(m+d)/2),g[1]=Math.max(m,(m+d)/2)}else{p=d;var x=h+c[1]-c[0];g[0]=Math.min(f,(x+f)/2),g[1]=Math.max(f,(x+f)/2)}var b=[Math.min(f,(p+f)/2),Math.max(f,(p+f)/2)];if(t>b[0]&&t<=b[1]||t>=g[0]&&t<=g[1]){o=s[u].index;break}}else{var y=Math.min(d,h),w=Math.max(d,h);if(t>(y+f)/2&&t<=(w+f)/2){o=s[u].index;break}}}else for(var j=0;j0&&j(r[j].coordinate+r[j-1].coordinate)/2&&t<=(r[j].coordinate+r[j+1].coordinate)/2||j===l-1&&t>(r[j].coordinate+r[j-1].coordinate)/2){o=r[j].index;break}return o},DP=function(t){var n,r=t,s=r.type.displayName,i=(n=t.type)!==null&&n!==void 0&&n.defaultProps?xn(xn({},t.type.defaultProps),t.props):t.props,o=i.stroke,l=i.fill,c;switch(s){case"Line":c=o;break;case"Area":case"Radar":c=o&&o!=="none"?o:l;break;default:c=l;break}return c},fbe=function(t){var n=t.barSize,r=t.totalSize,s=t.stackGroups,i=s===void 0?{}:s;if(!i)return{};for(var o={},l=Object.keys(i),c=0,u=l.length;c=0});if(b&&b.length){var y=b[0].type.defaultProps,w=y!==void 0?xn(xn({},y),b[0].props):b[0].props,j=w.barSize,S=w[x];o[S]||(o[S]=[]);var N=vt(j)?n:j;o[S].push({item:b[0],stackList:b.slice(1),barSize:vt(N)?void 0:Ar(N,r,0)})}}return o},hbe=function(t){var n=t.barGap,r=t.barCategoryGap,s=t.bandSize,i=t.sizeList,o=i===void 0?[]:i,l=t.maxBarSize,c=o.length;if(c<1)return null;var u=Ar(n,s,0,!0),d,f=[];if(o[0].barSize===+o[0].barSize){var h=!1,p=s/c,g=o.reduce(function(j,S){return j+S.barSize||0},0);g+=(c-1)*u,g>=s&&(g-=(c-1)*u,u=0),g>=s&&p>0&&(h=!0,p*=.9,g=c*p);var m=(s-g)/2>>0,x={offset:m-u,size:0};d=o.reduce(function(j,S){var N={item:S.item,position:{offset:x.offset+x.size+u,size:h?p:S.barSize}},P=[].concat(uk(j),[N]);return x=P[P.length-1].position,S.stackList&&S.stackList.length&&S.stackList.forEach(function(_){P.push({item:_,position:x})}),P},f)}else{var b=Ar(r,s,0,!0);s-2*b-(c-1)*u<=0&&(u=0);var y=(s-2*b-(c-1)*u)/c;y>1&&(y>>=0);var w=l===+l?Math.min(y,l):y;d=o.reduce(function(j,S,N){var P=[].concat(uk(j),[{item:S.item,position:{offset:b+(y+u)*N+(y-w)/2,size:w}}]);return S.stackList&&S.stackList.length&&S.stackList.forEach(function(_){P.push({item:_,position:P[P.length-1].position})}),P},f)}return d},pbe=function(t,n,r,s){var i=r.children,o=r.width,l=r.margin,c=o-(l.left||0)-(l.right||0),u=gB({children:i,legendWidth:c});if(u){var d=s||{},f=d.width,h=d.height,p=u.align,g=u.verticalAlign,m=u.layout;if((m==="vertical"||m==="horizontal"&&g==="middle")&&p!=="center"&&ke(t[p]))return xn(xn({},t),{},Kc({},p,t[p]+(f||0)));if((m==="horizontal"||m==="vertical"&&p==="center")&&g!=="middle"&&ke(t[g]))return xn(xn({},t),{},Kc({},g,t[g]+(h||0)))}return t},mbe=function(t,n,r){return vt(n)?!0:t==="horizontal"?n==="yAxis":t==="vertical"||r==="x"?n==="xAxis":r==="y"?n==="yAxis":!0},vB=function(t,n,r,s,i){var o=n.props.children,l=Es(o,e0).filter(function(u){return mbe(s,i,u.props.direction)});if(l&&l.length){var c=l.map(function(u){return u.props.dataKey});return t.reduce(function(u,d){var f=_n(d,r);if(vt(f))return u;var h=Array.isArray(f)?[Zx(f),lo(f)]:[f,f],p=c.reduce(function(g,m){var x=_n(d,m,0),b=h[0]-Math.abs(Array.isArray(x)?x[0]:x),y=h[1]+Math.abs(Array.isArray(x)?x[1]:x);return[Math.min(b,g[0]),Math.max(y,g[1])]},[1/0,-1/0]);return[Math.min(p[0],u[0]),Math.max(p[1],u[1])]},[1/0,-1/0])}return null},gbe=function(t,n,r,s,i){var o=n.map(function(l){return vB(t,l,r,i,s)}).filter(function(l){return!vt(l)});return o&&o.length?o.reduce(function(l,c){return[Math.min(l[0],c[0]),Math.max(l[1],c[1])]},[1/0,-1/0]):null},yB=function(t,n,r,s,i){var o=n.map(function(c){var u=c.props.dataKey;return r==="number"&&u&&vB(t,c,u,s)||Af(t,u,r,i)});if(r==="number")return o.reduce(function(c,u){return[Math.min(c[0],u[0]),Math.max(c[1],u[1])]},[1/0,-1/0]);var l={};return o.reduce(function(c,u){for(var d=0,f=u.length;d=2?Cr(l[0]-l[1])*2*u:u,n&&(t.ticks||t.niceTicks)){var d=(t.ticks||t.niceTicks).map(function(f){var h=i?i.indexOf(f):f;return{coordinate:s(h)+u,value:f,offset:u}});return d.filter(function(f){return!md(f.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(f,h){return{coordinate:s(f)+u,value:f,index:h,offset:u}}):s.ticks&&!r?s.ticks(t.tickCount).map(function(f){return{coordinate:s(f)+u,value:f,offset:u}}):s.domain().map(function(f,h){return{coordinate:s(f)+u,value:i?i[f]:f,index:h,offset:u}})},$b=new WeakMap,Om=function(t,n){if(typeof n!="function")return t;$b.has(t)||$b.set(t,new WeakMap);var r=$b.get(t);if(r.has(n))return r.get(n);var s=function(){t.apply(void 0,arguments),n.apply(void 0,arguments)};return r.set(n,s),s},wB=function(t,n,r){var s=t.scale,i=t.type,o=t.layout,l=t.axisType;if(s==="auto")return o==="radial"&&l==="radiusAxis"?{scale:Ih(),realScaleType:"band"}:o==="radial"&&l==="angleAxis"?{scale:Dv(),realScaleType:"linear"}:i==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!r)?{scale:Cf(),realScaleType:"point"}:i==="category"?{scale:Ih(),realScaleType:"band"}:{scale:Dv(),realScaleType:"linear"};if(Lp(s)){var c="scale".concat(Dx(s));return{scale:(sk[c]||Cf)(),realScaleType:sk[c]?c:"point"}}return ct(s)?{scale:s}:{scale:Cf(),realScaleType:"point"}},fk=1e-4,jB=function(t){var n=t.domain();if(!(!n||n.length<=2)){var r=n.length,s=t.range(),i=Math.min(s[0],s[1])-fk,o=Math.max(s[0],s[1])+fk,l=t(n[0]),c=t(n[r-1]);(lo||co)&&t.domain([n[0],n[r-1]])}},vbe=function(t,n){if(!t)return null;for(var r=0,s=t.length;rs)&&(i[1]=s),i[0]>s&&(i[0]=s),i[1]=0?(t[l][r][0]=i,t[l][r][1]=i+c,i=t[l][r][1]):(t[l][r][0]=o,t[l][r][1]=o+c,o=t[l][r][1])}},bbe=function(t){var n=t.length;if(!(n<=0))for(var r=0,s=t[0].length;r=0?(t[o][r][0]=i,t[o][r][1]=i+l,i=t[o][r][1]):(t[o][r][0]=0,t[o][r][1]=0)}},wbe={sign:xbe,expand:Boe,none:yu,silhouette:zoe,wiggle:Uoe,positive:bbe},jbe=function(t,n,r){var s=n.map(function(l){return l.props.dataKey}),i=wbe[r],o=Foe().keys(s).value(function(l,c){return+_n(l,c,0)}).order(q1).offset(i);return o(t)},Sbe=function(t,n,r,s,i,o){if(!t)return null;var l=o?n.reverse():n,c={},u=l.reduce(function(f,h){var p,g=(p=h.type)!==null&&p!==void 0&&p.defaultProps?xn(xn({},h.type.defaultProps),h.props):h.props,m=g.stackId,x=g.hide;if(x)return f;var b=g[r],y=f[b]||{hasStack:!1,stackGroups:{}};if(Hn(m)){var w=y.stackGroups[m]||{numericAxisId:r,cateAxisId:s,items:[]};w.items.push(h),y.hasStack=!0,y.stackGroups[m]=w}else y.stackGroups[gd("_stackId_")]={numericAxisId:r,cateAxisId:s,items:[h]};return xn(xn({},f),{},Kc({},b,y))},c),d={};return Object.keys(u).reduce(function(f,h){var p=u[h];if(p.hasStack){var g={};p.stackGroups=Object.keys(p.stackGroups).reduce(function(m,x){var b=p.stackGroups[x];return xn(xn({},m),{},Kc({},x,{numericAxisId:r,cateAxisId:s,items:b.items,stackedData:jbe(t,b.items,i)}))},g)}return xn(xn({},f),{},Kc({},h,p))},d)},SB=function(t,n){var r=n.realScaleType,s=n.type,i=n.tickCount,o=n.originalDomain,l=n.allowDecimals,c=r||n.scale;if(c!=="auto"&&c!=="linear")return null;if(i&&s==="number"&&o&&(o[0]==="auto"||o[1]==="auto")){var u=t.domain();if(!u.length)return null;var d=D0e(u,i,l);return t.domain([Zx(d),lo(d)]),{niceTicks:d}}if(i&&s==="number"){var f=t.domain(),h=L0e(f,i,l);return{niceTicks:h}}return null};function hk(e){var t=e.axis,n=e.ticks,r=e.bandSize,s=e.entry,i=e.index,o=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!vt(s[t.dataKey])){var l=gv(n,"value",s[t.dataKey]);if(l)return l.coordinate+r/2}return n[i]?n[i].coordinate+r/2:null}var c=_n(s,vt(o)?t.dataKey:o);return vt(c)?null:t.scale(c)}var pk=function(t){var n=t.axis,r=t.ticks,s=t.offset,i=t.bandSize,o=t.entry,l=t.index;if(n.type==="category")return r[l]?r[l].coordinate+s:null;var c=_n(o,n.dataKey,n.domain[l]);return vt(c)?null:n.scale(c)-i/2+s},Nbe=function(t){var n=t.numericAxis,r=n.scale.domain();if(n.type==="number"){var s=Math.min(r[0],r[1]),i=Math.max(r[0],r[1]);return s<=0&&i>=0?0:i<0?i:s}return r[0]},_be=function(t,n){var r,s=(r=t.type)!==null&&r!==void 0&&r.defaultProps?xn(xn({},t.type.defaultProps),t.props):t.props,i=s.stackId;if(Hn(i)){var o=n[i];if(o){var l=o.items.indexOf(t);return l>=0?o.stackedData[l]:null}}return null},Pbe=function(t){return t.reduce(function(n,r){return[Zx(r.concat([n[0]]).filter(ke)),lo(r.concat([n[1]]).filter(ke))]},[1/0,-1/0])},NB=function(t,n,r){return Object.keys(t).reduce(function(s,i){var o=t[i],l=o.stackedData,c=l.reduce(function(u,d){var f=Pbe(d.slice(n,r+1));return[Math.min(u[0],f[0]),Math.max(u[1],f[1])]},[1/0,-1/0]);return[Math.min(c[0],s[0]),Math.max(c[1],s[1])]},[1/0,-1/0]).map(function(s){return s===1/0||s===-1/0?0:s})},mk=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,gk=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Sj=function(t,n,r){if(ct(t))return t(n,r);if(!Array.isArray(t))return n;var s=[];if(ke(t[0]))s[0]=r?t[0]:Math.min(t[0],n[0]);else if(mk.test(t[0])){var i=+mk.exec(t[0])[1];s[0]=n[0]-i}else ct(t[0])?s[0]=t[0](n[0]):s[0]=n[0];if(ke(t[1]))s[1]=r?t[1]:Math.max(t[1],n[1]);else if(gk.test(t[1])){var o=+gk.exec(t[1])[1];s[1]=n[1]+o}else ct(t[1])?s[1]=t[1](n[1]):s[1]=n[1];return s},Wv=function(t,n,r){if(t&&t.scale&&t.scale.bandwidth){var s=t.scale.bandwidth();if(!r||s>0)return s}if(t&&n&&n.length>=2){for(var i=dP(n,function(f){return f.coordinate}),o=1/0,l=1,c=i.length;le.length)&&(t=e.length);for(var n=0,r=new Array(t);n2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},AB=function(t,n,r,s,i){var o=t.width,l=t.height,c=t.startAngle,u=t.endAngle,d=Ar(t.cx,o,o/2),f=Ar(t.cy,l,l/2),h=CB(o,l,r),p=Ar(t.innerRadius,h,0),g=Ar(t.outerRadius,h,h*.8),m=Object.keys(n);return m.reduce(function(x,b){var y=n[b],w=y.domain,j=y.reversed,S;if(vt(y.range))s==="angleAxis"?S=[c,u]:s==="radiusAxis"&&(S=[p,g]),j&&(S=[S[1],S[0]]);else{S=y.range;var N=S,P=Ebe(N,2);c=P[0],u=P[1]}var _=wB(y,i),A=_.realScaleType,O=_.scale;O.domain(w).range(S),jB(O);var T=SB(O,Yi(Yi({},y),{},{realScaleType:A})),k=Yi(Yi(Yi({},y),T),{},{range:S,radius:g,realScaleType:A,scale:O,cx:d,cy:f,innerRadius:p,outerRadius:g,startAngle:c,endAngle:u});return Yi(Yi({},x),{},PB({},b,k))},{})},Mbe=function(t,n){var r=t.x,s=t.y,i=n.x,o=n.y;return Math.sqrt(Math.pow(r-i,2)+Math.pow(s-o,2))},Rbe=function(t,n){var r=t.x,s=t.y,i=n.cx,o=n.cy,l=Mbe({x:r,y:s},{x:i,y:o});if(l<=0)return{radius:l};var c=(r-i)/l,u=Math.acos(c);return s>o&&(u=2*Math.PI-u),{radius:l,angle:Ibe(u),angleInRadian:u}},Dbe=function(t){var n=t.startAngle,r=t.endAngle,s=Math.floor(n/360),i=Math.floor(r/360),o=Math.min(s,i);return{startAngle:n-o*360,endAngle:r-o*360}},Lbe=function(t,n){var r=n.startAngle,s=n.endAngle,i=Math.floor(r/360),o=Math.floor(s/360),l=Math.min(i,o);return t+l*360},bk=function(t,n){var r=t.x,s=t.y,i=Rbe({x:r,y:s},n),o=i.radius,l=i.angle,c=n.innerRadius,u=n.outerRadius;if(ou)return!1;if(o===0)return!0;var d=Dbe(n),f=d.startAngle,h=d.endAngle,p=l,g;if(f<=h){for(;p>h;)p-=360;for(;p=f&&p<=h}else{for(;p>f;)p-=360;for(;p=h&&p<=f}return g?Yi(Yi({},n),{},{radius:o,angle:Lbe(p,n)}):null},EB=function(t){return!v.isValidElement(t)&&!ct(t)&&typeof t!="boolean"?t.className:""};function Wh(e){"@babel/helpers - typeof";return Wh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wh(e)}var Fbe=["offset"];function Bbe(e){return Wbe(e)||Vbe(e)||Ube(e)||zbe()}function zbe(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ube(e,t){if(e){if(typeof e=="string")return Nj(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Nj(e,t)}}function Vbe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Wbe(e){if(Array.isArray(e))return Nj(e)}function Nj(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Gbe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function wk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Ln(e){for(var t=1;t=0?1:-1,w,j;s==="insideStart"?(w=p+y*o,j=m):s==="insideEnd"?(w=g-y*o,j=!m):s==="end"&&(w=g+y*o,j=m),j=b<=0?j:!j;var S=Ft(u,d,x,w),N=Ft(u,d,x,w+(j?1:-1)*359),P="M".concat(S.x,",").concat(S.y,` + A`).concat(x,",").concat(x,",0,1,").concat(j?0:1,`, + `).concat(N.x,",").concat(N.y),_=vt(t.id)?gd("recharts-radial-line-"):t.id;return C.createElement("text",Hh({},r,{dominantBaseline:"central",className:mt("recharts-radial-bar-label",l)}),C.createElement("defs",null,C.createElement("path",{id:_,d:P})),C.createElement("textPath",{xlinkHref:"#".concat(_)},n))},Jbe=function(t){var n=t.viewBox,r=t.offset,s=t.position,i=n,o=i.cx,l=i.cy,c=i.innerRadius,u=i.outerRadius,d=i.startAngle,f=i.endAngle,h=(d+f)/2;if(s==="outside"){var p=Ft(o,l,u+r,h),g=p.x,m=p.y;return{x:g,y:m,textAnchor:g>=o?"start":"end",verticalAnchor:"middle"}}if(s==="center")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"middle"};if(s==="centerTop")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"start"};if(s==="centerBottom")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"end"};var x=(c+u)/2,b=Ft(o,l,x,h),y=b.x,w=b.y;return{x:y,y:w,textAnchor:"middle",verticalAnchor:"middle"}},ewe=function(t){var n=t.viewBox,r=t.parentViewBox,s=t.offset,i=t.position,o=n,l=o.x,c=o.y,u=o.width,d=o.height,f=d>=0?1:-1,h=f*s,p=f>0?"end":"start",g=f>0?"start":"end",m=u>=0?1:-1,x=m*s,b=m>0?"end":"start",y=m>0?"start":"end";if(i==="top"){var w={x:l+u/2,y:c-f*s,textAnchor:"middle",verticalAnchor:p};return Ln(Ln({},w),r?{height:Math.max(c-r.y,0),width:u}:{})}if(i==="bottom"){var j={x:l+u/2,y:c+d+h,textAnchor:"middle",verticalAnchor:g};return Ln(Ln({},j),r?{height:Math.max(r.y+r.height-(c+d),0),width:u}:{})}if(i==="left"){var S={x:l-x,y:c+d/2,textAnchor:b,verticalAnchor:"middle"};return Ln(Ln({},S),r?{width:Math.max(S.x-r.x,0),height:d}:{})}if(i==="right"){var N={x:l+u+x,y:c+d/2,textAnchor:y,verticalAnchor:"middle"};return Ln(Ln({},N),r?{width:Math.max(r.x+r.width-N.x,0),height:d}:{})}var P=r?{width:u,height:d}:{};return i==="insideLeft"?Ln({x:l+x,y:c+d/2,textAnchor:y,verticalAnchor:"middle"},P):i==="insideRight"?Ln({x:l+u-x,y:c+d/2,textAnchor:b,verticalAnchor:"middle"},P):i==="insideTop"?Ln({x:l+u/2,y:c+h,textAnchor:"middle",verticalAnchor:g},P):i==="insideBottom"?Ln({x:l+u/2,y:c+d-h,textAnchor:"middle",verticalAnchor:p},P):i==="insideTopLeft"?Ln({x:l+x,y:c+h,textAnchor:y,verticalAnchor:g},P):i==="insideTopRight"?Ln({x:l+u-x,y:c+h,textAnchor:b,verticalAnchor:g},P):i==="insideBottomLeft"?Ln({x:l+x,y:c+d-h,textAnchor:y,verticalAnchor:p},P):i==="insideBottomRight"?Ln({x:l+u-x,y:c+d-h,textAnchor:b,verticalAnchor:p},P):dd(i)&&(ke(i.x)||pl(i.x))&&(ke(i.y)||pl(i.y))?Ln({x:l+Ar(i.x,u),y:c+Ar(i.y,d),textAnchor:"end",verticalAnchor:"end"},P):Ln({x:l+u/2,y:c+d/2,textAnchor:"middle",verticalAnchor:"middle"},P)},twe=function(t){return"cx"in t&&ke(t.cx)};function Qn(e){var t=e.offset,n=t===void 0?5:t,r=Hbe(e,Fbe),s=Ln({offset:n},r),i=s.viewBox,o=s.position,l=s.value,c=s.children,u=s.content,d=s.className,f=d===void 0?"":d,h=s.textBreakAll;if(!i||vt(l)&&vt(c)&&!v.isValidElement(u)&&!ct(u))return null;if(v.isValidElement(u))return v.cloneElement(u,s);var p;if(ct(u)){if(p=v.createElement(u,s),v.isValidElement(p))return p}else p=Ybe(s);var g=twe(i),m=Ze(s,!0);if(g&&(o==="insideStart"||o==="insideEnd"||o==="end"))return Qbe(s,p,m);var x=g?Jbe(s):ewe(s);return C.createElement(Wl,Hh({className:mt("recharts-label",f)},m,x,{breakAll:h}),p)}Qn.displayName="Label";var OB=function(t){var n=t.cx,r=t.cy,s=t.angle,i=t.startAngle,o=t.endAngle,l=t.r,c=t.radius,u=t.innerRadius,d=t.outerRadius,f=t.x,h=t.y,p=t.top,g=t.left,m=t.width,x=t.height,b=t.clockWise,y=t.labelViewBox;if(y)return y;if(ke(m)&&ke(x)){if(ke(f)&&ke(h))return{x:f,y:h,width:m,height:x};if(ke(p)&&ke(g))return{x:p,y:g,width:m,height:x}}return ke(f)&&ke(h)?{x:f,y:h,width:0,height:0}:ke(n)&&ke(r)?{cx:n,cy:r,startAngle:i||s||0,endAngle:o||s||0,innerRadius:u||0,outerRadius:d||c||l||0,clockWise:b}:t.viewBox?t.viewBox:{}},nwe=function(t,n){return t?t===!0?C.createElement(Qn,{key:"label-implicit",viewBox:n}):Hn(t)?C.createElement(Qn,{key:"label-implicit",viewBox:n,value:t}):v.isValidElement(t)?t.type===Qn?v.cloneElement(t,{key:"label-implicit",viewBox:n}):C.createElement(Qn,{key:"label-implicit",content:t,viewBox:n}):ct(t)?C.createElement(Qn,{key:"label-implicit",content:t,viewBox:n}):dd(t)?C.createElement(Qn,Hh({viewBox:n},t,{key:"label-implicit"})):null:null},rwe=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&r&&!t.label)return null;var s=t.children,i=OB(t),o=Es(s,Qn).map(function(c,u){return v.cloneElement(c,{viewBox:n||i,key:"label-".concat(u)})});if(!r)return o;var l=nwe(t.label,n||i);return[l].concat(Bbe(o))};Qn.parseViewBox=OB;Qn.renderCallByParent=rwe;function swe(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var iwe=swe;const kB=Bt(iwe);function Gh(e){"@babel/helpers - typeof";return Gh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gh(e)}var awe=["valueAccessor"],owe=["data","dataKey","clockWise","id","textBreakAll"];function lwe(e){return fwe(e)||dwe(e)||uwe(e)||cwe()}function cwe(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function uwe(e,t){if(e){if(typeof e=="string")return _j(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _j(e,t)}}function dwe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function fwe(e){if(Array.isArray(e))return _j(e)}function _j(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function gwe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var vwe=function(t){return Array.isArray(t.value)?kB(t.value):t.value};function Ti(e){var t=e.valueAccessor,n=t===void 0?vwe:t,r=Nk(e,awe),s=r.data,i=r.dataKey,o=r.clockWise,l=r.id,c=r.textBreakAll,u=Nk(r,owe);return!s||!s.length?null:C.createElement(Et,{className:"recharts-label-list"},s.map(function(d,f){var h=vt(i)?n(d,f):_n(d&&d.payload,i),p=vt(l)?{}:{id:"".concat(l,"-").concat(f)};return C.createElement(Qn,Gv({},Ze(d,!0),u,p,{parentViewBox:d.parentViewBox,value:h,textBreakAll:c,viewBox:Qn.parseViewBox(vt(o)?d:Sk(Sk({},d),{},{clockWise:o})),key:"label-".concat(f),index:f}))}))}Ti.displayName="LabelList";function ywe(e,t){return e?e===!0?C.createElement(Ti,{key:"labelList-implicit",data:t}):C.isValidElement(e)||ct(e)?C.createElement(Ti,{key:"labelList-implicit",data:t,content:e}):dd(e)?C.createElement(Ti,Gv({data:t},e,{key:"labelList-implicit"})):null:null}function xwe(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var r=e.children,s=Es(r,Ti).map(function(o,l){return v.cloneElement(o,{data:t,key:"labelList-".concat(l)})});if(!n)return s;var i=ywe(e.label,t);return[i].concat(lwe(s))}Ti.renderCallByParent=xwe;function qh(e){"@babel/helpers - typeof";return qh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qh(e)}function Pj(){return Pj=Object.assign?Object.assign.bind():function(e){for(var t=1;t180),",").concat(+(o>u),`, + `).concat(f.x,",").concat(f.y,` + `);if(s>0){var p=Ft(n,r,s,o),g=Ft(n,r,s,u);h+="L ".concat(g.x,",").concat(g.y,` + A `).concat(s,",").concat(s,`,0, + `).concat(+(Math.abs(c)>180),",").concat(+(o<=u),`, + `).concat(p.x,",").concat(p.y," Z")}else h+="L ".concat(n,",").concat(r," Z");return h},Nwe=function(t){var n=t.cx,r=t.cy,s=t.innerRadius,i=t.outerRadius,o=t.cornerRadius,l=t.forceCornerRadius,c=t.cornerIsExternal,u=t.startAngle,d=t.endAngle,f=Cr(d-u),h=km({cx:n,cy:r,radius:i,angle:u,sign:f,cornerRadius:o,cornerIsExternal:c}),p=h.circleTangency,g=h.lineTangency,m=h.theta,x=km({cx:n,cy:r,radius:i,angle:d,sign:-f,cornerRadius:o,cornerIsExternal:c}),b=x.circleTangency,y=x.lineTangency,w=x.theta,j=c?Math.abs(u-d):Math.abs(u-d)-m-w;if(j<0)return l?"M ".concat(g.x,",").concat(g.y,` + a`).concat(o,",").concat(o,",0,0,1,").concat(o*2,`,0 + a`).concat(o,",").concat(o,",0,0,1,").concat(-o*2,`,0 + `):TB({cx:n,cy:r,innerRadius:s,outerRadius:i,startAngle:u,endAngle:d});var S="M ".concat(g.x,",").concat(g.y,` + A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(p.x,",").concat(p.y,` + A`).concat(i,",").concat(i,",0,").concat(+(j>180),",").concat(+(f<0),",").concat(b.x,",").concat(b.y,` + A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(y.x,",").concat(y.y,` + `);if(s>0){var N=km({cx:n,cy:r,radius:s,angle:u,sign:f,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),P=N.circleTangency,_=N.lineTangency,A=N.theta,O=km({cx:n,cy:r,radius:s,angle:d,sign:-f,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),T=O.circleTangency,k=O.lineTangency,M=O.theta,R=c?Math.abs(u-d):Math.abs(u-d)-A-M;if(R<0&&o===0)return"".concat(S,"L").concat(n,",").concat(r,"Z");S+="L".concat(k.x,",").concat(k.y,` + A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(T.x,",").concat(T.y,` + A`).concat(s,",").concat(s,",0,").concat(+(R>180),",").concat(+(f>0),",").concat(P.x,",").concat(P.y,` + A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(_.x,",").concat(_.y,"Z")}else S+="L".concat(n,",").concat(r,"Z");return S},_we={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},$B=function(t){var n=Pk(Pk({},_we),t),r=n.cx,s=n.cy,i=n.innerRadius,o=n.outerRadius,l=n.cornerRadius,c=n.forceCornerRadius,u=n.cornerIsExternal,d=n.startAngle,f=n.endAngle,h=n.className;if(o0&&Math.abs(d-f)<360?x=Nwe({cx:r,cy:s,innerRadius:i,outerRadius:o,cornerRadius:Math.min(m,g/2),forceCornerRadius:c,cornerIsExternal:u,startAngle:d,endAngle:f}):x=TB({cx:r,cy:s,innerRadius:i,outerRadius:o,startAngle:d,endAngle:f}),C.createElement("path",Pj({},Ze(n,!0),{className:p,d:x,role:"img"}))};function Kh(e){"@babel/helpers - typeof";return Kh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Kh(e)}function Cj(){return Cj=Object.assign?Object.assign.bind():function(e){for(var t=1;t0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function Bwe(e,t){return Sd(e.getTime(),t.getTime())}function Ik(e,t,n){if(e.size!==t.size)return!1;for(var r={},s=e.entries(),i=0,o,l;(o=s.next())&&!o.done;){for(var c=t.entries(),u=!1,d=0;(l=c.next())&&!l.done;){var f=o.value,h=f[0],p=f[1],g=l.value,m=g[0],x=g[1];!u&&!r[d]&&(u=n.equals(h,m,i,d,e,t,n)&&n.equals(p,x,h,m,e,t,n))&&(r[d]=!0),d++}if(!u)return!1;i++}return!0}function zwe(e,t,n){var r=$k(e),s=r.length;if($k(t).length!==s)return!1;for(var i;s-- >0;)if(i=r[s],i===LB&&(e.$$typeof||t.$$typeof)&&e.$$typeof!==t.$$typeof||!DB(t,i)||!n.equals(e[i],t[i],i,i,e,t,n))return!1;return!0}function Yd(e,t,n){var r=kk(e),s=r.length;if(kk(t).length!==s)return!1;for(var i,o,l;s-- >0;)if(i=r[s],i===LB&&(e.$$typeof||t.$$typeof)&&e.$$typeof!==t.$$typeof||!DB(t,i)||!n.equals(e[i],t[i],i,i,e,t,n)||(o=Tk(e,i),l=Tk(t,i),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function Uwe(e,t){return Sd(e.valueOf(),t.valueOf())}function Vwe(e,t){return e.source===t.source&&e.flags===t.flags}function Mk(e,t,n){if(e.size!==t.size)return!1;for(var r={},s=e.values(),i,o;(i=s.next())&&!i.done;){for(var l=t.values(),c=!1,u=0;(o=l.next())&&!o.done;)!c&&!r[u]&&(c=n.equals(i.value,o.value,i.value,o.value,e,t,n))&&(r[u]=!0),u++;if(!c)return!1}return!0}function Wwe(e,t){var n=e.length;if(t.length!==n)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}var Hwe="[object Arguments]",Gwe="[object Boolean]",qwe="[object Date]",Kwe="[object Map]",Xwe="[object Number]",Ywe="[object Object]",Zwe="[object RegExp]",Qwe="[object Set]",Jwe="[object String]",e1e=Array.isArray,Rk=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,Dk=Object.assign,t1e=Object.prototype.toString.call.bind(Object.prototype.toString);function n1e(e){var t=e.areArraysEqual,n=e.areDatesEqual,r=e.areMapsEqual,s=e.areObjectsEqual,i=e.arePrimitiveWrappersEqual,o=e.areRegExpsEqual,l=e.areSetsEqual,c=e.areTypedArraysEqual;return function(d,f,h){if(d===f)return!0;if(d==null||f==null||typeof d!="object"||typeof f!="object")return d!==d&&f!==f;var p=d.constructor;if(p!==f.constructor)return!1;if(p===Object)return s(d,f,h);if(e1e(d))return t(d,f,h);if(Rk!=null&&Rk(d))return c(d,f,h);if(p===Date)return n(d,f,h);if(p===RegExp)return o(d,f,h);if(p===Map)return r(d,f,h);if(p===Set)return l(d,f,h);var g=t1e(d);return g===qwe?n(d,f,h):g===Zwe?o(d,f,h):g===Kwe?r(d,f,h):g===Qwe?l(d,f,h):g===Ywe?typeof d.then!="function"&&typeof f.then!="function"&&s(d,f,h):g===Hwe?s(d,f,h):g===Gwe||g===Xwe||g===Jwe?i(d,f,h):!1}}function r1e(e){var t=e.circular,n=e.createCustomConfig,r=e.strict,s={areArraysEqual:r?Yd:Fwe,areDatesEqual:Bwe,areMapsEqual:r?Ok(Ik,Yd):Ik,areObjectsEqual:r?Yd:zwe,arePrimitiveWrappersEqual:Uwe,areRegExpsEqual:Vwe,areSetsEqual:r?Ok(Mk,Yd):Mk,areTypedArraysEqual:r?Yd:Wwe};if(n&&(s=Dk({},s,n(s))),t){var i=$m(s.areArraysEqual),o=$m(s.areMapsEqual),l=$m(s.areObjectsEqual),c=$m(s.areSetsEqual);s=Dk({},s,{areArraysEqual:i,areMapsEqual:o,areObjectsEqual:l,areSetsEqual:c})}return s}function s1e(e){return function(t,n,r,s,i,o,l){return e(t,n,l)}}function i1e(e){var t=e.circular,n=e.comparator,r=e.createState,s=e.equals,i=e.strict;if(r)return function(c,u){var d=r(),f=d.cache,h=f===void 0?t?new WeakMap:void 0:f,p=d.meta;return n(c,u,{cache:h,equals:s,meta:p,strict:i})};if(t)return function(c,u){return n(c,u,{cache:new WeakMap,equals:s,meta:void 0,strict:i})};var o={cache:void 0,equals:s,meta:void 0,strict:i};return function(c,u){return n(c,u,o)}}var a1e=Xo();Xo({strict:!0});Xo({circular:!0});Xo({circular:!0,strict:!0});Xo({createInternalComparator:function(){return Sd}});Xo({strict:!0,createInternalComparator:function(){return Sd}});Xo({circular:!0,createInternalComparator:function(){return Sd}});Xo({circular:!0,createInternalComparator:function(){return Sd},strict:!0});function Xo(e){e===void 0&&(e={});var t=e.circular,n=t===void 0?!1:t,r=e.createInternalComparator,s=e.createState,i=e.strict,o=i===void 0?!1:i,l=r1e(e),c=n1e(l),u=r?r(c):s1e(c);return i1e({circular:n,comparator:c,createState:s,equals:u,strict:o})}function o1e(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function Lk(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,r=function s(i){n<0&&(n=i),i-n>t?(e(i),n=-1):o1e(s)};requestAnimationFrame(r)}function Aj(e){"@babel/helpers - typeof";return Aj=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Aj(e)}function l1e(e){return f1e(e)||d1e(e)||u1e(e)||c1e()}function c1e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function u1e(e,t){if(e){if(typeof e=="string")return Fk(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Fk(e,t)}}function Fk(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n1?1:b<0?0:b},m=function(b){for(var y=b>1?1:b,w=y,j=0;j<8;++j){var S=f(w)-y,N=p(w);if(Math.abs(S-y)0&&arguments[0]!==void 0?arguments[0]:{},n=t.stiff,r=n===void 0?100:n,s=t.damping,i=s===void 0?8:s,o=t.dt,l=o===void 0?17:o,c=function(d,f,h){var p=-(d-f)*r,g=h*i,m=h+(p-g)*l/1e3,x=h*l/1e3+d;return Math.abs(x-f)e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function V1e(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,i;for(i=0;i=0)&&(n[s]=e[s]);return n}function Ib(e){return q1e(e)||G1e(e)||H1e(e)||W1e()}function W1e(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function H1e(e,t){if(e){if(typeof e=="string")return $j(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return $j(e,t)}}function G1e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function q1e(e){if(Array.isArray(e))return $j(e)}function $j(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Xv(e){return Xv=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Xv(e)}var li=function(e){Q1e(n,e);var t=J1e(n);function n(r,s){var i;K1e(this,n),i=t.call(this,r,s);var o=i.props,l=o.isActive,c=o.attributeName,u=o.from,d=o.to,f=o.steps,h=o.children,p=o.duration;if(i.handleStyleChange=i.handleStyleChange.bind(Rj(i)),i.changeStyle=i.changeStyle.bind(Rj(i)),!l||p<=0)return i.state={style:{}},typeof h=="function"&&(i.state={style:d}),Mj(i);if(f&&f.length)i.state={style:f[0].style};else if(u){if(typeof h=="function")return i.state={style:u},Mj(i);i.state={style:c?uf({},c,u):u}}else i.state={style:{}};return i}return Y1e(n,[{key:"componentDidMount",value:function(){var s=this.props,i=s.isActive,o=s.canBegin;this.mounted=!0,!(!i||!o)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(s){var i=this.props,o=i.isActive,l=i.canBegin,c=i.attributeName,u=i.shouldReAnimate,d=i.to,f=i.from,h=this.state.style;if(l){if(!o){var p={style:c?uf({},c,d):d};this.state&&h&&(c&&h[c]!==d||!c&&h!==d)&&this.setState(p);return}if(!(a1e(s.to,d)&&s.canBegin&&s.isActive)){var g=!s.canBegin||!s.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var m=g||u?f:s.to;if(this.state&&h){var x={style:c?uf({},c,m):m};(c&&h[c]!==m||!c&&h!==m)&&this.setState(x)}this.runAnimation(Ds(Ds({},this.props),{},{from:m,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var s=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),s&&s()}},{key:"handleStyleChange",value:function(s){this.changeStyle(s)}},{key:"changeStyle",value:function(s){this.mounted&&this.setState({style:s})}},{key:"runJSAnimation",value:function(s){var i=this,o=s.from,l=s.to,c=s.duration,u=s.easing,d=s.begin,f=s.onAnimationEnd,h=s.onAnimationStart,p=B1e(o,l,E1e(u),c,this.changeStyle),g=function(){i.stopJSAnimation=p()};this.manager.start([h,d,g,c,f])}},{key:"runStepAnimation",value:function(s){var i=this,o=s.steps,l=s.begin,c=s.onAnimationStart,u=o[0],d=u.style,f=u.duration,h=f===void 0?0:f,p=function(m,x,b){if(b===0)return m;var y=x.duration,w=x.easing,j=w===void 0?"ease":w,S=x.style,N=x.properties,P=x.onAnimationEnd,_=b>0?o[b-1]:x,A=N||Object.keys(S);if(typeof j=="function"||j==="spring")return[].concat(Ib(m),[i.runJSAnimation.bind(i,{from:_.style,to:S,duration:y,easing:j}),y]);var O=Uk(A,y,j),T=Ds(Ds(Ds({},_.style),S),{},{transition:O});return[].concat(Ib(m),[T,y,P]).filter(v1e)};return this.manager.start([c].concat(Ib(o.reduce(p,[d,Math.max(h,l)])),[s.onAnimationEnd]))}},{key:"runAnimation",value:function(s){this.manager||(this.manager=h1e());var i=s.begin,o=s.duration,l=s.attributeName,c=s.to,u=s.easing,d=s.onAnimationStart,f=s.onAnimationEnd,h=s.steps,p=s.children,g=this.manager;if(this.unSubscribe=g.subscribe(this.handleStyleChange),typeof u=="function"||typeof p=="function"||u==="spring"){this.runJSAnimation(s);return}if(h.length>1){this.runStepAnimation(s);return}var m=l?uf({},l,c):c,x=Uk(Object.keys(m),o,u);g.start([d,i,Ds(Ds({},m),{},{transition:x}),o,f])}},{key:"render",value:function(){var s=this.props,i=s.children;s.begin;var o=s.duration;s.attributeName,s.easing;var l=s.isActive;s.steps,s.from,s.to,s.canBegin,s.onAnimationEnd,s.shouldReAnimate,s.onAnimationReStart;var c=U1e(s,z1e),u=v.Children.count(i),d=this.state.style;if(typeof i=="function")return i(d);if(!l||u===0||o<=0)return i;var f=function(p){var g=p.props,m=g.style,x=m===void 0?{}:m,b=g.className,y=v.cloneElement(p,Ds(Ds({},c),{},{style:Ds(Ds({},x),d),className:b}));return y};return u===1?f(v.Children.only(i)):C.createElement("div",null,v.Children.map(i,function(h){return f(h)}))}}]),n}(v.PureComponent);li.displayName="Animate";li.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};li.propTypes={from:St.oneOfType([St.object,St.string]),to:St.oneOfType([St.object,St.string]),attributeName:St.string,duration:St.number,begin:St.number,easing:St.oneOfType([St.string,St.func]),steps:St.arrayOf(St.shape({duration:St.number.isRequired,style:St.object.isRequired,easing:St.oneOfType([St.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),St.func]),properties:St.arrayOf("string"),onAnimationEnd:St.func})),children:St.oneOfType([St.node,St.func]),isActive:St.bool,canBegin:St.bool,onAnimationEnd:St.func,shouldReAnimate:St.bool,onAnimationStart:St.func,onAnimationReStart:St.func};St.object,St.object,St.object,St.element;St.object,St.object,St.object,St.oneOfType([St.array,St.element]),St.any;function Zh(e){"@babel/helpers - typeof";return Zh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zh(e)}function Yv(){return Yv=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0?1:-1,c=r>=0?1:-1,u=s>=0&&r>=0||s<0&&r<0?1:0,d;if(o>0&&i instanceof Array){for(var f=[0,0,0,0],h=0,p=4;ho?o:i[h];d="M".concat(t,",").concat(n+l*f[0]),f[0]>0&&(d+="A ".concat(f[0],",").concat(f[0],",0,0,").concat(u,",").concat(t+c*f[0],",").concat(n)),d+="L ".concat(t+r-c*f[1],",").concat(n),f[1]>0&&(d+="A ".concat(f[1],",").concat(f[1],",0,0,").concat(u,`, + `).concat(t+r,",").concat(n+l*f[1])),d+="L ".concat(t+r,",").concat(n+s-l*f[2]),f[2]>0&&(d+="A ".concat(f[2],",").concat(f[2],",0,0,").concat(u,`, + `).concat(t+r-c*f[2],",").concat(n+s)),d+="L ".concat(t+c*f[3],",").concat(n+s),f[3]>0&&(d+="A ".concat(f[3],",").concat(f[3],",0,0,").concat(u,`, + `).concat(t,",").concat(n+s-l*f[3])),d+="Z"}else if(o>0&&i===+i&&i>0){var g=Math.min(o,i);d="M ".concat(t,",").concat(n+l*g,` + A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(t+c*g,",").concat(n,` + L `).concat(t+r-c*g,",").concat(n,` + A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(t+r,",").concat(n+l*g,` + L `).concat(t+r,",").concat(n+s-l*g,` + A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(t+r-c*g,",").concat(n+s,` + L `).concat(t+c*g,",").concat(n+s,` + A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(t,",").concat(n+s-l*g," Z")}else d="M ".concat(t,",").concat(n," h ").concat(r," v ").concat(s," h ").concat(-r," Z");return d},cje=function(t,n){if(!t||!n)return!1;var r=t.x,s=t.y,i=n.x,o=n.y,l=n.width,c=n.height;if(Math.abs(l)>0&&Math.abs(c)>0){var u=Math.min(i,i+l),d=Math.max(i,i+l),f=Math.min(o,o+c),h=Math.max(o,o+c);return r>=u&&r<=d&&s>=f&&s<=h}return!1},uje={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},LP=function(t){var n=Yk(Yk({},uje),t),r=v.useRef(),s=v.useState(-1),i=tje(s,2),o=i[0],l=i[1];v.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var j=r.current.getTotalLength();j&&l(j)}catch{}},[]);var c=n.x,u=n.y,d=n.width,f=n.height,h=n.radius,p=n.className,g=n.animationEasing,m=n.animationDuration,x=n.animationBegin,b=n.isAnimationActive,y=n.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||f!==+f||d===0||f===0)return null;var w=mt("recharts-rectangle",p);return y?C.createElement(li,{canBegin:o>0,from:{width:d,height:f,x:c,y:u},to:{width:d,height:f,x:c,y:u},duration:m,animationEasing:g,isActive:y},function(j){var S=j.width,N=j.height,P=j.x,_=j.y;return C.createElement(li,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:x,duration:m,isActive:b,easing:g},C.createElement("path",Yv({},Ze(n,!0),{className:w,d:Zk(P,_,S,N,h),ref:r})))}):C.createElement("path",Yv({},Ze(n,!0),{className:w,d:Zk(c,u,d,f,h)}))},dje=["points","className","baseLinePoints","connectNulls"];function Oc(){return Oc=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function hje(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Qk(e){return vje(e)||gje(e)||mje(e)||pje()}function pje(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mje(e,t){if(e){if(typeof e=="string")return Dj(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Dj(e,t)}}function gje(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function vje(e){if(Array.isArray(e))return Dj(e)}function Dj(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return t.forEach(function(r){Jk(r)?n[n.length-1].push(r):n[n.length-1].length>0&&n.push([])}),Jk(t[0])&&n[n.length-1].push(t[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},Of=function(t,n){var r=yje(t);n&&(r=[r.reduce(function(i,o){return[].concat(Qk(i),Qk(o))},[])]);var s=r.map(function(i){return i.reduce(function(o,l,c){return"".concat(o).concat(c===0?"M":"L").concat(l.x,",").concat(l.y)},"")}).join("");return r.length===1?"".concat(s,"Z"):s},xje=function(t,n,r){var s=Of(t,r);return"".concat(s.slice(-1)==="Z"?s.slice(0,-1):s,"L").concat(Of(n.reverse(),r).slice(1))},HB=function(t){var n=t.points,r=t.className,s=t.baseLinePoints,i=t.connectNulls,o=fje(t,dje);if(!n||!n.length)return null;var l=mt("recharts-polygon",r);if(s&&s.length){var c=o.stroke&&o.stroke!=="none",u=xje(n,s,i);return C.createElement("g",{className:l},C.createElement("path",Oc({},Ze(o,!0),{fill:u.slice(-1)==="Z"?o.fill:"none",stroke:"none",d:u})),c?C.createElement("path",Oc({},Ze(o,!0),{fill:"none",d:Of(n,i)})):null,c?C.createElement("path",Oc({},Ze(o,!0),{fill:"none",d:Of(s,i)})):null)}var d=Of(n,i);return C.createElement("path",Oc({},Ze(o,!0),{fill:d.slice(-1)==="Z"?o.fill:"none",className:l,d}))};function Lj(){return Lj=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Pje(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var Cje=function(t,n,r,s,i,o){return"M".concat(t,",").concat(i,"v").concat(s,"M").concat(o,",").concat(n,"h").concat(r)},Aje=function(t){var n=t.x,r=n===void 0?0:n,s=t.y,i=s===void 0?0:s,o=t.top,l=o===void 0?0:o,c=t.left,u=c===void 0?0:c,d=t.width,f=d===void 0?0:d,h=t.height,p=h===void 0?0:h,g=t.className,m=_je(t,bje),x=wje({x:r,y:i,top:l,left:u,width:f,height:p},m);return!ke(r)||!ke(i)||!ke(f)||!ke(p)||!ke(l)||!ke(u)?null:C.createElement("path",Fj({},Ze(x,!0),{className:mt("recharts-cross",g),d:Cje(r,i,f,p,l,u)}))},Eje=["cx","cy","innerRadius","outerRadius","gridType","radialLines"];function Jh(e){"@babel/helpers - typeof";return Jh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jh(e)}function Oje(e,t){if(e==null)return{};var n=kje(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function kje(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Ea(){return Ea=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function eSe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function tSe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function sT(e,t){for(var n=0;noT?o=s==="outer"?"start":"end":i<-oT?o=s==="outer"?"end":"start":o="middle",o}},{key:"renderAxisLine",value:function(){var r=this.props,s=r.cx,i=r.cy,o=r.radius,l=r.axisLine,c=r.axisLineType,u=Jo(Jo({},Ze(this.props,!1)),{},{fill:"none"},Ze(l,!1));if(c==="circle")return C.createElement(Hp,ol({className:"recharts-polar-angle-axis-line"},u,{cx:s,cy:i,r:o}));var d=this.props.ticks,f=d.map(function(h){return Ft(s,i,o,h.coordinate)});return C.createElement(HB,ol({className:"recharts-polar-angle-axis-line"},u,{points:f}))}},{key:"renderTicks",value:function(){var r=this,s=this.props,i=s.ticks,o=s.tick,l=s.tickLine,c=s.tickFormatter,u=s.stroke,d=Ze(this.props,!1),f=Ze(o,!1),h=Jo(Jo({},d),{},{fill:"none"},Ze(l,!1)),p=i.map(function(g,m){var x=r.getTickLineCoord(g),b=r.getTickTextAnchor(g),y=Jo(Jo(Jo({textAnchor:b},d),{},{stroke:"none",fill:u},f),{},{index:m,payload:g,x:x.x2,y:x.y2});return C.createElement(Et,ol({className:mt("recharts-polar-angle-axis-tick",EB(o)),key:"tick-".concat(g.coordinate)},Vl(r.props,g,m)),l&&C.createElement("line",ol({className:"recharts-polar-angle-axis-tick-line"},h,x)),o&&t.renderTickItem(o,y,c?c(g.value,m):g.value))});return C.createElement(Et,{className:"recharts-polar-angle-axis-ticks"},p)}},{key:"render",value:function(){var r=this.props,s=r.ticks,i=r.radius,o=r.axisLine;return i<=0||!s||!s.length?null:C.createElement(Et,{className:mt("recharts-polar-angle-axis",this.props.className)},o&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(r,s,i){var o;return C.isValidElement(r)?o=C.cloneElement(r,s):ct(r)?o=r(s):o=C.createElement(Wl,ol({},s,{className:"recharts-polar-angle-axis-tick-value"}),i),o}}])}(v.PureComponent);n0(sc,"displayName","PolarAngleAxis");n0(sc,"axisType","angleAxis");n0(sc,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var gSe=XF,vSe=gSe(Object.getPrototypeOf,Object),ySe=vSe,xSe=Ra,bSe=ySe,wSe=Da,jSe="[object Object]",SSe=Function.prototype,NSe=Object.prototype,YB=SSe.toString,_Se=NSe.hasOwnProperty,PSe=YB.call(Object);function CSe(e){if(!wSe(e)||xSe(e)!=jSe)return!1;var t=bSe(e);if(t===null)return!0;var n=_Se.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&YB.call(n)==PSe}var ASe=CSe;const ESe=Bt(ASe);var OSe=Ra,kSe=Da,TSe="[object Boolean]";function $Se(e){return e===!0||e===!1||kSe(e)&&OSe(e)==TSe}var ISe=$Se;const MSe=Bt(ISe);function tp(e){"@babel/helpers - typeof";return tp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tp(e)}function Jv(){return Jv=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n0,from:{upperWidth:0,lowerWidth:0,height:h,x:c,y:u},to:{upperWidth:d,lowerWidth:f,height:h,x:c,y:u},duration:m,animationEasing:g,isActive:b},function(w){var j=w.upperWidth,S=w.lowerWidth,N=w.height,P=w.x,_=w.y;return C.createElement(li,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:x,duration:m,easing:g},C.createElement("path",Jv({},Ze(n,!0),{className:y,d:dT(P,_,j,S,N),ref:r})))}):C.createElement("g",null,C.createElement("path",Jv({},Ze(n,!0),{className:y,d:dT(c,u,d,f,h)})))},GSe=["option","shapeType","propTransformer","activeClassName","isActive"];function np(e){"@babel/helpers - typeof";return np=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},np(e)}function qSe(e,t){if(e==null)return{};var n=KSe(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function KSe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function fT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function ey(e){for(var t=1;t0?ls(w,"paddingAngle",0):0;if(S){var P=Zn(S.endAngle-S.startAngle,w.endAngle-w.startAngle),_=Qt(Qt({},w),{},{startAngle:y+N,endAngle:y+P(m)+N});x.push(_),y=_.endAngle}else{var A=w.endAngle,O=w.startAngle,T=Zn(0,A-O),k=T(m),M=Qt(Qt({},w),{},{startAngle:y+N,endAngle:y+k+N});x.push(M),y=M.endAngle}}),C.createElement(Et,null,r.renderSectorsStatically(x))})}},{key:"attachKeyboardHandlers",value:function(r){var s=this;r.onkeydown=function(i){if(!i.altKey)switch(i.key){case"ArrowLeft":{var o=++s.state.sectorToFocus%s.sectorRefs.length;s.sectorRefs[o].focus(),s.setState({sectorToFocus:o});break}case"ArrowRight":{var l=--s.state.sectorToFocus<0?s.sectorRefs.length-1:s.state.sectorToFocus%s.sectorRefs.length;s.sectorRefs[l].focus(),s.setState({sectorToFocus:l});break}case"Escape":{s.sectorRefs[s.state.sectorToFocus].blur(),s.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var r=this.props,s=r.sectors,i=r.isAnimationActive,o=this.state.prevSectors;return i&&s&&s.length&&(!o||!Hl(o,s))?this.renderSectorsWithAnimation():this.renderSectorsStatically(s)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var r=this,s=this.props,i=s.hide,o=s.sectors,l=s.className,c=s.label,u=s.cx,d=s.cy,f=s.innerRadius,h=s.outerRadius,p=s.isAnimationActive,g=this.state.isAnimationFinished;if(i||!o||!o.length||!ke(u)||!ke(d)||!ke(f)||!ke(h))return null;var m=mt("recharts-pie",l);return C.createElement(Et,{tabIndex:this.props.rootTabIndex,className:m,ref:function(b){r.pieRef=b}},this.renderSectors(),c&&this.renderLabels(o),Qn.renderCallByParent(this.props,null,!1),(!p||g)&&Ti.renderCallByParent(this.props,o,!1))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return s.prevIsAnimationActive!==r.isAnimationActive?{prevIsAnimationActive:r.isAnimationActive,prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:[],isAnimationFinished:!0}:r.isAnimationActive&&r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:s.curSectors,isAnimationFinished:!0}:r.sectors!==s.curSectors?{curSectors:r.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(r,s){return r>s?"start":r=360?y:y-1)*c,j=x-y*p-w,S=s.reduce(function(_,A){var O=_n(A,b,0);return _+(ke(O)?O:0)},0),N;if(S>0){var P;N=s.map(function(_,A){var O=_n(_,b,0),T=_n(_,d,A),k=(ke(O)?O:0)/S,M;A?M=P.endAngle+Cr(m)*c*(O!==0?1:0):M=o;var R=M+Cr(m)*((O!==0?p:0)+k*j),H=(M+R)/2,F=(g.innerRadius+g.outerRadius)/2,V=[{name:T,value:O,payload:_,dataKey:b,type:h}],$=Ft(g.cx,g.cy,F,H);return P=Qt(Qt(Qt({percent:k,cornerRadius:i,name:T,tooltipPayload:V,midAngle:H,middleRadius:F,tooltipPosition:$},_),g),{},{value:_n(_,b),startAngle:M,endAngle:R,payload:_,paddingAngle:Cr(m)*c}),P})}return Qt(Qt({},g),{},{sectors:N,data:s})});function mNe(e){return e&&e.length?e[0]:void 0}var gNe=mNe,vNe=gNe;const yNe=Bt(vNe);var xNe=["key"];function ku(e){"@babel/helpers - typeof";return ku=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ku(e)}function bNe(e,t){if(e==null)return{};var n=wNe(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function wNe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function ny(){return ny=Object.assign?Object.assign.bind():function(e){for(var t=1;t=2&&(c=!0),u.push(Sr(Sr({},Ft(o,l,y,x)),{},{name:g,value:m,cx:o,cy:l,radius:y,angle:x,payload:h}))});var f=[];return c&&u.forEach(function(h){if(Array.isArray(h.value)){var p=yNe(h.value),g=vt(p)?void 0:t.scale(p);f.push(Sr(Sr({},h),{},{radius:g},Ft(o,l,g,h.angle)))}else f.push(h)}),{points:u,isRange:c,baseLinePoints:f}});var ENe=Math.ceil,ONe=Math.max;function kNe(e,t,n,r){for(var s=-1,i=ONe(ENe((t-e)/(n||1)),0),o=Array(i);i--;)o[r?i:++s]=e,e+=n;return o}var TNe=kNe,$Ne=p6,yT=1/0,INe=17976931348623157e292;function MNe(e){if(!e)return e===0?e:0;if(e=$Ne(e),e===yT||e===-yT){var t=e<0?-1:1;return t*INe}return e===e?e:0}var nz=MNe,RNe=TNe,DNe=Vx,Mb=nz;function LNe(e){return function(t,n,r){return r&&typeof r!="number"&&DNe(t,n,r)&&(n=r=void 0),t=Mb(t),n===void 0?(n=t,t=0):n=Mb(n),r=r===void 0?t0&&r.handleDrag(s.changedTouches[0])}),Yr(r,"handleDragEnd",function(){r.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var s=r.props,i=s.endIndex,o=s.onDragEnd,l=s.startIndex;o==null||o({endIndex:i,startIndex:l})}),r.detachDragEndListener()}),Yr(r,"handleLeaveWrapper",function(){(r.state.isTravellerMoving||r.state.isSlideMoving)&&(r.leaveTimer=window.setTimeout(r.handleDragEnd,r.props.leaveTimeOut))}),Yr(r,"handleEnterSlideOrTraveller",function(){r.setState({isTextActive:!0})}),Yr(r,"handleLeaveSlideOrTraveller",function(){r.setState({isTextActive:!1})}),Yr(r,"handleSlideDragStart",function(s){var i=ST(s)?s.changedTouches[0]:s;r.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:i.pageX}),r.attachDragEndListener()}),r.travellerDragStartHandlers={startX:r.handleTravellerDragStart.bind(r,"startX"),endX:r.handleTravellerDragStart.bind(r,"endX")},r.state={},r}return QNe(t,e),KNe(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(r){var s=r.startX,i=r.endX,o=this.state.scaleValues,l=this.props,c=l.gap,u=l.data,d=u.length-1,f=Math.min(s,i),h=Math.max(s,i),p=t.getIndexInRange(o,f),g=t.getIndexInRange(o,h);return{startIndex:p-p%c,endIndex:g===d?d:g-g%c}}},{key:"getTextOfTick",value:function(r){var s=this.props,i=s.data,o=s.tickFormatter,l=s.dataKey,c=_n(i[r],l,r);return ct(o)?o(c,r):c}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(r){var s=this.state,i=s.slideMoveStartX,o=s.startX,l=s.endX,c=this.props,u=c.x,d=c.width,f=c.travellerWidth,h=c.startIndex,p=c.endIndex,g=c.onChange,m=r.pageX-i;m>0?m=Math.min(m,u+d-f-l,u+d-f-o):m<0&&(m=Math.max(m,u-o,u-l));var x=this.getIndex({startX:o+m,endX:l+m});(x.startIndex!==h||x.endIndex!==p)&&g&&g(x),this.setState({startX:o+m,endX:l+m,slideMoveStartX:r.pageX})}},{key:"handleTravellerDragStart",value:function(r,s){var i=ST(s)?s.changedTouches[0]:s;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:r,brushMoveStartX:i.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(r){var s=this.state,i=s.brushMoveStartX,o=s.movingTravellerId,l=s.endX,c=s.startX,u=this.state[o],d=this.props,f=d.x,h=d.width,p=d.travellerWidth,g=d.onChange,m=d.gap,x=d.data,b={startX:this.state.startX,endX:this.state.endX},y=r.pageX-i;y>0?y=Math.min(y,f+h-p-u):y<0&&(y=Math.max(y,f-u)),b[o]=u+y;var w=this.getIndex(b),j=w.startIndex,S=w.endIndex,N=function(){var _=x.length-1;return o==="startX"&&(l>c?j%m===0:S%m===0)||lc?S%m===0:j%m===0)||l>c&&S===_};this.setState(Yr(Yr({},o,u+y),"brushMoveStartX",r.pageX),function(){g&&N()&&g(w)})}},{key:"handleTravellerMoveKeyboard",value:function(r,s){var i=this,o=this.state,l=o.scaleValues,c=o.startX,u=o.endX,d=this.state[s],f=l.indexOf(d);if(f!==-1){var h=f+r;if(!(h===-1||h>=l.length)){var p=l[h];s==="startX"&&p>=u||s==="endX"&&p<=c||this.setState(Yr({},s,p),function(){i.props.onChange(i.getIndex({startX:i.state.startX,endX:i.state.endX}))})}}}},{key:"renderBackground",value:function(){var r=this.props,s=r.x,i=r.y,o=r.width,l=r.height,c=r.fill,u=r.stroke;return C.createElement("rect",{stroke:u,fill:c,x:s,y:i,width:o,height:l})}},{key:"renderPanorama",value:function(){var r=this.props,s=r.x,i=r.y,o=r.width,l=r.height,c=r.data,u=r.children,d=r.padding,f=v.Children.only(u);return f?C.cloneElement(f,{x:s,y:i,width:o,height:l,margin:d,compact:!0,data:c}):null}},{key:"renderTravellerLayer",value:function(r,s){var i,o,l=this,c=this.props,u=c.y,d=c.travellerWidth,f=c.height,h=c.traveller,p=c.ariaLabel,g=c.data,m=c.startIndex,x=c.endIndex,b=Math.max(r,this.props.x),y=Rb(Rb({},Ze(this.props,!1)),{},{x:b,y:u,width:d,height:f}),w=p||"Min value: ".concat((i=g[m])===null||i===void 0?void 0:i.name,", Max value: ").concat((o=g[x])===null||o===void 0?void 0:o.name);return C.createElement(Et,{tabIndex:0,role:"slider","aria-label":w,"aria-valuenow":r,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[s],onTouchStart:this.travellerDragStartHandlers[s],onKeyDown:function(S){["ArrowLeft","ArrowRight"].includes(S.key)&&(S.preventDefault(),S.stopPropagation(),l.handleTravellerMoveKeyboard(S.key==="ArrowRight"?1:-1,s))},onFocus:function(){l.setState({isTravellerFocused:!0})},onBlur:function(){l.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(h,y))}},{key:"renderSlide",value:function(r,s){var i=this.props,o=i.y,l=i.height,c=i.stroke,u=i.travellerWidth,d=Math.min(r,s)+u,f=Math.max(Math.abs(s-r)-u,0);return C.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:c,fillOpacity:.2,x:d,y:o,width:f,height:l})}},{key:"renderText",value:function(){var r=this.props,s=r.startIndex,i=r.endIndex,o=r.y,l=r.height,c=r.travellerWidth,u=r.stroke,d=this.state,f=d.startX,h=d.endX,p=5,g={pointerEvents:"none",fill:u};return C.createElement(Et,{className:"recharts-brush-texts"},C.createElement(Wl,iy({textAnchor:"end",verticalAnchor:"middle",x:Math.min(f,h)-p,y:o+l/2},g),this.getTextOfTick(s)),C.createElement(Wl,iy({textAnchor:"start",verticalAnchor:"middle",x:Math.max(f,h)+c+p,y:o+l/2},g),this.getTextOfTick(i)))}},{key:"render",value:function(){var r=this.props,s=r.data,i=r.className,o=r.children,l=r.x,c=r.y,u=r.width,d=r.height,f=r.alwaysShowText,h=this.state,p=h.startX,g=h.endX,m=h.isTextActive,x=h.isSlideMoving,b=h.isTravellerMoving,y=h.isTravellerFocused;if(!s||!s.length||!ke(l)||!ke(c)||!ke(u)||!ke(d)||u<=0||d<=0)return null;var w=mt("recharts-brush",i),j=C.Children.count(o)===1,S=GNe("userSelect","none");return C.createElement(Et,{className:w,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:S},this.renderBackground(),j&&this.renderPanorama(),this.renderSlide(p,g),this.renderTravellerLayer(p,"startX"),this.renderTravellerLayer(g,"endX"),(m||x||b||y||f)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(r){var s=r.x,i=r.y,o=r.width,l=r.height,c=r.stroke,u=Math.floor(i+l/2)-1;return C.createElement(C.Fragment,null,C.createElement("rect",{x:s,y:i,width:o,height:l,fill:c,stroke:"none"}),C.createElement("line",{x1:s+1,y1:u,x2:s+o-1,y2:u,fill:"none",stroke:"#fff"}),C.createElement("line",{x1:s+1,y1:u+2,x2:s+o-1,y2:u+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(r,s){var i;return C.isValidElement(r)?i=C.cloneElement(r,s):ct(r)?i=r(s):i=t.renderDefaultTraveller(s),i}},{key:"getDerivedStateFromProps",value:function(r,s){var i=r.data,o=r.width,l=r.x,c=r.travellerWidth,u=r.updateId,d=r.startIndex,f=r.endIndex;if(i!==s.prevData||u!==s.prevUpdateId)return Rb({prevData:i,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:o},i&&i.length?e_e({data:i,width:o,x:l,travellerWidth:c,startIndex:d,endIndex:f}):{scale:null,scaleValues:null});if(s.scale&&(o!==s.prevWidth||l!==s.prevX||c!==s.prevTravellerWidth)){s.scale.range([l,l+o-c]);var h=s.scale.domain().map(function(p){return s.scale(p)});return{prevData:i,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:o,startX:s.scale(r.startIndex),endX:s.scale(r.endIndex),scaleValues:h}}return null}},{key:"getIndexInRange",value:function(r,s){for(var i=r.length,o=0,l=i-1;l-o>1;){var c=Math.floor((o+l)/2);r[c]>s?l=c:o=c}return s>=r[l]?l:o}}])}(v.PureComponent);Yr($u,"displayName","Brush");Yr($u,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var t_e=uP;function n_e(e,t){var n;return t_e(e,function(r,s,i){return n=t(r,s,i),!n}),!!n}var r_e=n_e,s_e=zF,i_e=zi,a_e=r_e,o_e=Xr,l_e=Vx;function c_e(e,t,n){var r=o_e(e)?s_e:a_e;return n&&l_e(e,t,n)&&(t=void 0),r(e,i_e(t))}var u_e=c_e;const d_e=Bt(u_e);var $i=function(t,n){var r=t.alwaysShow,s=t.ifOverflow;return r&&(s="extendDomain"),s===n},NT=c6;function f_e(e,t,n){t=="__proto__"&&NT?NT(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var h_e=f_e,p_e=h_e,m_e=o6,g_e=zi;function v_e(e,t){var n={};return t=g_e(t),m_e(e,function(r,s,i){p_e(n,s,t(r,s,i))}),n}var y_e=v_e;const x_e=Bt(y_e);function b_e(e,t){for(var n=-1,r=e==null?0:e.length;++n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function D_e(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function L_e(e,t){var n=e.x,r=e.y,s=R_e(e,T_e),i="".concat(n),o=parseInt(i,10),l="".concat(r),c=parseInt(l,10),u="".concat(t.height||s.height),d=parseInt(u,10),f="".concat(t.width||s.width),h=parseInt(f,10);return Zd(Zd(Zd(Zd(Zd({},t),s),o?{x:o}:{}),c?{y:c}:{}),{},{height:d,width:h,name:t.name,radius:t.radius})}function PT(e){return C.createElement(ZB,Hj({shapeType:"rectangle",propTransformer:L_e,activeClassName:"recharts-active-bar"},e))}var F_e=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(r,s){if(typeof t=="number")return t;var i=typeof r=="number";return i?t(r,s):(i||ql(),n)}},B_e=["value","background"],oz;function Iu(e){"@babel/helpers - typeof";return Iu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Iu(e)}function z_e(e,t){if(e==null)return{};var n=U_e(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function U_e(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function oy(){return oy=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs(H)0&&Math.abs(R)0&&(M=Math.min((W||0)-(R[he-1]||0),M))}),Number.isFinite(M)){var H=M/k,F=m.layout==="vertical"?r.height:r.width;if(m.padding==="gap"&&(P=H*F/2),m.padding==="no-gap"){var V=Ar(t.barCategoryGap,H*F),$=H*F/2;P=$-V-($-V)/F*V}}}s==="xAxis"?_=[r.left+(w.left||0)+(P||0),r.left+r.width-(w.right||0)-(P||0)]:s==="yAxis"?_=c==="horizontal"?[r.top+r.height-(w.bottom||0),r.top+(w.top||0)]:[r.top+(w.top||0)+(P||0),r.top+r.height-(w.bottom||0)-(P||0)]:_=m.range,S&&(_=[_[1],_[0]]);var L=wB(m,i,h),Y=L.scale,Q=L.realScaleType;Y.domain(b).range(_),jB(Y);var ee=SB(Y,Hs(Hs({},m),{},{realScaleType:Q}));s==="xAxis"?(T=x==="top"&&!j||x==="bottom"&&j,A=r.left,O=f[N]-T*m.height):s==="yAxis"&&(T=x==="left"&&!j||x==="right"&&j,A=f[N]-T*m.width,O=r.top);var fe=Hs(Hs(Hs({},m),ee),{},{realScaleType:Q,x:A,y:O,scale:Y,width:s==="xAxis"?r.width:m.width,height:s==="yAxis"?r.height:m.height});return fe.bandSize=Wv(fe,ee),!m.hide&&s==="xAxis"?f[N]+=(T?-1:1)*fe.height:m.hide||(f[N]+=(T?-1:1)*fe.width),Hs(Hs({},p),{},i0({},g,fe))},{})},fz=function(t,n){var r=t.x,s=t.y,i=n.x,o=n.y;return{x:Math.min(r,i),y:Math.min(s,o),width:Math.abs(i-r),height:Math.abs(o-s)}},J_e=function(t){var n=t.x1,r=t.y1,s=t.x2,i=t.y2;return fz({x:n,y:r},{x:s,y:i})},hz=function(){function e(t){Y_e(this,e),this.scale=t}return Z_e(e,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.bandAware,i=r.position;if(n!==void 0){if(i)switch(i){case"start":return this.scale(n);case"middle":{var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+o}case"end":{var l=this.bandwidth?this.bandwidth():0;return this.scale(n)+l}default:return this.scale(n)}if(s){var c=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+c}return this.scale(n)}}},{key:"isInRange",value:function(n){var r=this.range(),s=r[0],i=r[r.length-1];return s<=i?n>=s&&n<=i:n>=i&&n<=s}}],[{key:"create",value:function(n){return new e(n)}}])}();i0(hz,"EPS",1e-4);var BP=function(t){var n=Object.keys(t).reduce(function(r,s){return Hs(Hs({},r),{},i0({},s,hz.create(t[s])))},{});return Hs(Hs({},n),{},{apply:function(s){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=i.bandAware,l=i.position;return x_e(s,function(c,u){return n[u].apply(c,{bandAware:o,position:l})})},isInRange:function(s){return az(s,function(i,o){return n[o].isInRange(i)})}})};function ePe(e){return(e%180+180)%180}var tPe=function(t){var n=t.width,r=t.height,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=ePe(s),o=i*Math.PI/180,l=Math.atan(r/n),c=o>l&&o-1?s[i?t[o]:o]:void 0}}var aPe=iPe,oPe=nz;function lPe(e){var t=oPe(e),n=t%1;return t===t?n?t-n:t:0}var cPe=lPe,uPe=t6,dPe=zi,fPe=cPe,hPe=Math.max;function pPe(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var s=n==null?0:fPe(n);return s<0&&(s=hPe(r+s,0)),uPe(e,dPe(t),s)}var mPe=pPe,gPe=aPe,vPe=mPe,yPe=gPe(vPe),xPe=yPe;const bPe=Bt(xPe);var wPe=iie(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return["l",e.left,"t",e.top,"w",e.width,"h",e.height].join("")}),zP=v.createContext(void 0),UP=v.createContext(void 0),pz=v.createContext(void 0),mz=v.createContext({}),gz=v.createContext(void 0),vz=v.createContext(0),yz=v.createContext(0),kT=function(t){var n=t.state,r=n.xAxisMap,s=n.yAxisMap,i=n.offset,o=t.clipPathId,l=t.children,c=t.width,u=t.height,d=wPe(i);return C.createElement(zP.Provider,{value:r},C.createElement(UP.Provider,{value:s},C.createElement(mz.Provider,{value:i},C.createElement(pz.Provider,{value:d},C.createElement(gz.Provider,{value:o},C.createElement(vz.Provider,{value:u},C.createElement(yz.Provider,{value:c},l)))))))},jPe=function(){return v.useContext(gz)},xz=function(t){var n=v.useContext(zP);n==null&&ql();var r=n[t];return r==null&&ql(),r},SPe=function(){var t=v.useContext(zP);return Ja(t)},NPe=function(){var t=v.useContext(UP),n=bPe(t,function(r){return az(r.domain,Number.isFinite)});return n||Ja(t)},bz=function(t){var n=v.useContext(UP);n==null&&ql();var r=n[t];return r==null&&ql(),r},_Pe=function(){var t=v.useContext(pz);return t},PPe=function(){return v.useContext(mz)},VP=function(){return v.useContext(yz)},WP=function(){return v.useContext(vz)};function Mu(e){"@babel/helpers - typeof";return Mu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mu(e)}function CPe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function APe(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);ne*s)return!1;var i=n();return e*(t-e*i/2-r)>=0&&e*(t+e*i/2-s)<=0}function cCe(e,t){return Cz(e,t+1)}function uCe(e,t,n,r,s){for(var i=(r||[]).slice(),o=t.start,l=t.end,c=0,u=1,d=o,f=function(){var g=r==null?void 0:r[c];if(g===void 0)return{v:Cz(r,u)};var m=c,x,b=function(){return x===void 0&&(x=n(g,m)),x},y=g.coordinate,w=c===0||fy(e,y,b,d,l);w||(c=0,d=o,u+=1),w&&(d=y+e*(b()/2+s),c+=u)},h;u<=i.length;)if(h=f(),h)return h.v;return[]}function op(e){"@babel/helpers - typeof";return op=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},op(e)}function FT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function hr(e){for(var t=1;t0?p.coordinate-x*e:p.coordinate})}else i[h]=p=hr(hr({},p),{},{tickCoord:p.coordinate});var b=fy(e,p.tickCoord,m,l,c);b&&(c=p.tickCoord-e*(m()/2+s),i[h]=hr(hr({},p),{},{isShow:!0}))},d=o-1;d>=0;d--)u(d);return i}function mCe(e,t,n,r,s,i){var o=(r||[]).slice(),l=o.length,c=t.start,u=t.end;if(i){var d=r[l-1],f=n(d,l-1),h=e*(d.coordinate+e*f/2-u);o[l-1]=d=hr(hr({},d),{},{tickCoord:h>0?d.coordinate-h*e:d.coordinate});var p=fy(e,d.tickCoord,function(){return f},c,u);p&&(u=d.tickCoord-e*(f/2+s),o[l-1]=hr(hr({},d),{},{isShow:!0}))}for(var g=i?l-1:l,m=function(y){var w=o[y],j,S=function(){return j===void 0&&(j=n(w,y)),j};if(y===0){var N=e*(w.coordinate-e*S()/2-c);o[y]=w=hr(hr({},w),{},{tickCoord:N<0?w.coordinate-N*e:w.coordinate})}else o[y]=w=hr(hr({},w),{},{tickCoord:w.coordinate});var P=fy(e,w.tickCoord,S,c,u);P&&(c=w.tickCoord+e*(S()/2+s),o[y]=hr(hr({},w),{},{isShow:!0}))},x=0;x=2?Cr(s[1].coordinate-s[0].coordinate):1,b=lCe(i,x,p);return c==="equidistantPreserveStart"?uCe(x,b,m,s,o):(c==="preserveStart"||c==="preserveStartEnd"?h=mCe(x,b,m,s,o,c==="preserveStartEnd"):h=pCe(x,b,m,s,o),h.filter(function(y){return y.isShow}))}var gCe=["viewBox"],vCe=["viewBox"],yCe=["ticks"];function Lu(e){"@babel/helpers - typeof";return Lu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Lu(e)}function Tc(){return Tc=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function xCe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function bCe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function zT(e,t){for(var n=0;n0?c(this.props):c(p)),o<=0||l<=0||!g||!g.length?null:C.createElement(Et,{className:mt("recharts-cartesian-axis",u),ref:function(x){r.layerReference=x}},i&&this.renderAxisLine(),this.renderTicks(g,this.state.fontSize,this.state.letterSpacing),Qn.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(r,s,i){var o;return C.isValidElement(r)?o=C.cloneElement(r,s):ct(r)?o=r(s):o=C.createElement(Wl,Tc({},s,{className:"recharts-cartesian-axis-tick-value"}),i),o}}])}(v.Component);KP(_d,"displayName","CartesianAxis");KP(_d,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var CCe=["x1","y1","x2","y2","key"],ACe=["offset"];function Kl(e){"@babel/helpers - typeof";return Kl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Kl(e)}function UT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function vr(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function TCe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var $Ce=function(t){var n=t.fill;if(!n||n==="none")return null;var r=t.fillOpacity,s=t.x,i=t.y,o=t.width,l=t.height,c=t.ry;return C.createElement("rect",{x:s,y:i,ry:c,width:o,height:l,stroke:"none",fill:n,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function Oz(e,t){var n;if(C.isValidElement(e))n=C.cloneElement(e,t);else if(ct(e))n=e(t);else{var r=t.x1,s=t.y1,i=t.x2,o=t.y2,l=t.key,c=VT(t,CCe),u=Ze(c,!1);u.offset;var d=VT(u,ACe);n=C.createElement("line",vl({},d,{x1:r,y1:s,x2:i,y2:o,fill:"none",key:l}))}return n}function ICe(e){var t=e.x,n=e.width,r=e.horizontal,s=r===void 0?!0:r,i=e.horizontalPoints;if(!s||!i||!i.length)return null;var o=i.map(function(l,c){var u=vr(vr({},e),{},{x1:t,y1:l,x2:t+n,y2:l,key:"line-".concat(c),index:c});return Oz(s,u)});return C.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function MCe(e){var t=e.y,n=e.height,r=e.vertical,s=r===void 0?!0:r,i=e.verticalPoints;if(!s||!i||!i.length)return null;var o=i.map(function(l,c){var u=vr(vr({},e),{},{x1:l,y1:t,x2:l,y2:t+n,key:"line-".concat(c),index:c});return Oz(s,u)});return C.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function RCe(e){var t=e.horizontalFill,n=e.fillOpacity,r=e.x,s=e.y,i=e.width,o=e.height,l=e.horizontalPoints,c=e.horizontal,u=c===void 0?!0:c;if(!u||!t||!t.length)return null;var d=l.map(function(h){return Math.round(h+s-s)}).sort(function(h,p){return h-p});s!==d[0]&&d.unshift(0);var f=d.map(function(h,p){var g=!d[p+1],m=g?s+o-h:d[p+1]-h;if(m<=0)return null;var x=p%t.length;return C.createElement("rect",{key:"react-".concat(p),y:h,x:r,height:m,width:i,stroke:"none",fill:t[x],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return C.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function DCe(e){var t=e.vertical,n=t===void 0?!0:t,r=e.verticalFill,s=e.fillOpacity,i=e.x,o=e.y,l=e.width,c=e.height,u=e.verticalPoints;if(!n||!r||!r.length)return null;var d=u.map(function(h){return Math.round(h+i-i)}).sort(function(h,p){return h-p});i!==d[0]&&d.unshift(0);var f=d.map(function(h,p){var g=!d[p+1],m=g?i+l-h:d[p+1]-h;if(m<=0)return null;var x=p%r.length;return C.createElement("rect",{key:"react-".concat(p),x:h,y:o,width:m,height:c,stroke:"none",fill:r[x],fillOpacity:s,className:"recharts-cartesian-grid-bg"})});return C.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var LCe=function(t,n){var r=t.xAxis,s=t.width,i=t.height,o=t.offset;return bB(qP(vr(vr(vr({},_d.defaultProps),r),{},{ticks:ia(r,!0),viewBox:{x:0,y:0,width:s,height:i}})),o.left,o.left+o.width,n)},FCe=function(t,n){var r=t.yAxis,s=t.width,i=t.height,o=t.offset;return bB(qP(vr(vr(vr({},_d.defaultProps),r),{},{ticks:ia(r,!0),viewBox:{x:0,y:0,width:s,height:i}})),o.top,o.top+o.height,n)},hc={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function lp(e){var t,n,r,s,i,o,l=VP(),c=WP(),u=PPe(),d=vr(vr({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:hc.stroke,fill:(n=e.fill)!==null&&n!==void 0?n:hc.fill,horizontal:(r=e.horizontal)!==null&&r!==void 0?r:hc.horizontal,horizontalFill:(s=e.horizontalFill)!==null&&s!==void 0?s:hc.horizontalFill,vertical:(i=e.vertical)!==null&&i!==void 0?i:hc.vertical,verticalFill:(o=e.verticalFill)!==null&&o!==void 0?o:hc.verticalFill,x:ke(e.x)?e.x:u.left,y:ke(e.y)?e.y:u.top,width:ke(e.width)?e.width:u.width,height:ke(e.height)?e.height:u.height}),f=d.x,h=d.y,p=d.width,g=d.height,m=d.syncWithTicks,x=d.horizontalValues,b=d.verticalValues,y=SPe(),w=NPe();if(!ke(p)||p<=0||!ke(g)||g<=0||!ke(f)||f!==+f||!ke(h)||h!==+h)return null;var j=d.verticalCoordinatesGenerator||LCe,S=d.horizontalCoordinatesGenerator||FCe,N=d.horizontalPoints,P=d.verticalPoints;if((!N||!N.length)&&ct(S)){var _=x&&x.length,A=S({yAxis:w?vr(vr({},w),{},{ticks:_?x:w.ticks}):void 0,width:l,height:c,offset:u},_?!0:m);ei(Array.isArray(A),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(Kl(A),"]")),Array.isArray(A)&&(N=A)}if((!P||!P.length)&&ct(j)){var O=b&&b.length,T=j({xAxis:y?vr(vr({},y),{},{ticks:O?b:y.ticks}):void 0,width:l,height:c,offset:u},O?!0:m);ei(Array.isArray(T),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(Kl(T),"]")),Array.isArray(T)&&(P=T)}return C.createElement("g",{className:"recharts-cartesian-grid"},C.createElement($Ce,{fill:d.fill,fillOpacity:d.fillOpacity,x:d.x,y:d.y,width:d.width,height:d.height,ry:d.ry}),C.createElement(ICe,vl({},d,{offset:u,horizontalPoints:N,xAxis:y,yAxis:w})),C.createElement(MCe,vl({},d,{offset:u,verticalPoints:P,xAxis:y,yAxis:w})),C.createElement(RCe,vl({},d,{horizontalPoints:N})),C.createElement(DCe,vl({},d,{verticalPoints:P})))}lp.displayName="CartesianGrid";var BCe=["layout","type","stroke","connectNulls","isRange","ref"],zCe=["key"],kz;function Fu(e){"@babel/helpers - typeof";return Fu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fu(e)}function Tz(e,t){if(e==null)return{};var n=UCe(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function UCe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function yl(){return yl=Object.assign?Object.assign.bind():function(e){for(var t=1;t0||!Hl(d,o)||!Hl(f,l))?this.renderAreaWithAnimation(r,s):this.renderAreaStatically(o,l,r,s)}},{key:"render",value:function(){var r,s=this.props,i=s.hide,o=s.dot,l=s.points,c=s.className,u=s.top,d=s.left,f=s.xAxis,h=s.yAxis,p=s.width,g=s.height,m=s.isAnimationActive,x=s.id;if(i||!l||!l.length)return null;var b=this.state.isAnimationFinished,y=l.length===1,w=mt("recharts-area",c),j=f&&f.allowDataOverflow,S=h&&h.allowDataOverflow,N=j||S,P=vt(x)?this.id:x,_=(r=Ze(o,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},A=_.r,O=A===void 0?3:A,T=_.strokeWidth,k=T===void 0?2:T,M=uae(o)?o:{},R=M.clipDot,H=R===void 0?!0:R,F=O*2+k;return C.createElement(Et,{className:w},j||S?C.createElement("defs",null,C.createElement("clipPath",{id:"clipPath-".concat(P)},C.createElement("rect",{x:j?d:d-p/2,y:S?u:u-g/2,width:j?p:p*2,height:S?g:g*2})),!H&&C.createElement("clipPath",{id:"clipPath-dots-".concat(P)},C.createElement("rect",{x:d-F/2,y:u-F/2,width:p+F,height:g+F}))):null,y?null:this.renderArea(N,P),(o||y)&&this.renderDots(N,H,P),(!m||b)&&Ti.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,curBaseLine:r.baseLine,prevPoints:s.curPoints,prevBaseLine:s.curBaseLine}:r.points!==s.curPoints||r.baseLine!==s.curBaseLine?{curPoints:r.points,curBaseLine:r.baseLine}:null}}])}(v.PureComponent);kz=ni;Pi(ni,"displayName","Area");Pi(ni,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!ti.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});Pi(ni,"getBaseValue",function(e,t,n,r){var s=e.layout,i=e.baseValue,o=t.props.baseValue,l=o??i;if(ke(l)&&typeof l=="number")return l;var c=s==="horizontal"?r:n,u=c.scale.domain();if(c.type==="number"){var d=Math.max(u[0],u[1]),f=Math.min(u[0],u[1]);return l==="dataMin"?f:l==="dataMax"||d<0?d:Math.max(Math.min(u[0],u[1]),0)}return l==="dataMin"?u[0]:l==="dataMax"?u[1]:u[0]});Pi(ni,"getComposedData",function(e){var t=e.props,n=e.item,r=e.xAxis,s=e.yAxis,i=e.xAxisTicks,o=e.yAxisTicks,l=e.bandSize,c=e.dataKey,u=e.stackedData,d=e.dataStartIndex,f=e.displayedData,h=e.offset,p=t.layout,g=u&&u.length,m=kz.getBaseValue(t,n,r,s),x=p==="horizontal",b=!1,y=f.map(function(j,S){var N;g?N=u[d+S]:(N=_n(j,c),Array.isArray(N)?b=!0:N=[m,N]);var P=N[1]==null||g&&_n(j,c)==null;return x?{x:hk({axis:r,ticks:i,bandSize:l,entry:j,index:S}),y:P?null:s.scale(N[1]),value:N,payload:j}:{x:P?null:r.scale(N[1]),y:hk({axis:s,ticks:o,bandSize:l,entry:j,index:S}),value:N,payload:j}}),w;return g||b?w=y.map(function(j){var S=Array.isArray(j.value)?j.value[0]:null;return x?{x:j.x,y:S!=null&&j.y!=null?s.scale(S):null}:{x:S!=null?r.scale(S):null,y:j.y}}):w=x?s.scale(m):r.scale(m),Wa({points:y,baseLine:w,layout:p,isRange:b},h)});Pi(ni,"renderDotItem",function(e,t){var n;if(C.isValidElement(e))n=C.cloneElement(e,t);else if(ct(e))n=e(t);else{var r=mt("recharts-area-dot",typeof e!="boolean"?e.className:""),s=t.key,i=Tz(t,zCe);n=C.createElement(Hp,yl({},i,{key:s,className:r}))}return n});function Bu(e){"@babel/helpers - typeof";return Bu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bu(e)}function YCe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ZCe(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function DAe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function LAe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function FAe(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n0?o:t&&t.length&&ke(s)&&ke(i)?t.slice(s,i+1):[]};function Kz(e){return e==="number"?[0,"auto"]:void 0}var cS=function(t,n,r,s){var i=t.graphicalItems,o=t.tooltipAxis,l=u0(n,t);return r<0||!i||!i.length||r>=l.length?null:i.reduce(function(c,u){var d,f=(d=u.props.data)!==null&&d!==void 0?d:n;f&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(f=f.slice(t.dataStartIndex,t.dataEndIndex+1));var h;if(o.dataKey&&!o.allowDuplicatedCategory){var p=f===void 0?l:f;h=gv(p,o.dataKey,s)}else h=f&&f[r]||l[r];return h?[].concat(Vu(c),[_B(u,h)]):c},[])},ZT=function(t,n,r,s){var i=s||{x:t.chartX,y:t.chartY},o=ZAe(i,r),l=t.orderedTooltipTicks,c=t.tooltipAxis,u=t.tooltipTicks,d=dbe(o,l,u,c);if(d>=0&&u){var f=u[d]&&u[d].value,h=cS(t,n,d,f),p=QAe(r,l,d,i);return{activeTooltipIndex:d,activeLabel:f,activePayload:h,activeCoordinate:p}}return null},JAe=function(t,n){var r=n.axes,s=n.graphicalItems,i=n.axisType,o=n.axisIdKey,l=n.stackGroups,c=n.dataStartIndex,u=n.dataEndIndex,d=t.layout,f=t.children,h=t.stackOffset,p=xB(d,i);return r.reduce(function(g,m){var x,b=m.type.defaultProps!==void 0?ge(ge({},m.type.defaultProps),m.props):m.props,y=b.type,w=b.dataKey,j=b.allowDataOverflow,S=b.allowDuplicatedCategory,N=b.scale,P=b.ticks,_=b.includeHidden,A=b[o];if(g[A])return g;var O=u0(t.data,{graphicalItems:s.filter(function(ee){var fe,W=o in ee.props?ee.props[o]:(fe=ee.type.defaultProps)===null||fe===void 0?void 0:fe[o];return W===A}),dataStartIndex:c,dataEndIndex:u}),T=O.length,k,M,R;_Ae(b.domain,j,y)&&(k=Sj(b.domain,null,j),p&&(y==="number"||N!=="auto")&&(R=Af(O,w,"category")));var H=Kz(y);if(!k||k.length===0){var F,V=(F=b.domain)!==null&&F!==void 0?F:H;if(w){if(k=Af(O,w,y),y==="category"&&p){var $=tae(k);S&&$?(M=k,k=sy(0,T)):S||(k=vk(V,k,m).reduce(function(ee,fe){return ee.indexOf(fe)>=0?ee:[].concat(Vu(ee),[fe])},[]))}else if(y==="category")S?k=k.filter(function(ee){return ee!==""&&!vt(ee)}):k=vk(V,k,m).reduce(function(ee,fe){return ee.indexOf(fe)>=0||fe===""||vt(fe)?ee:[].concat(Vu(ee),[fe])},[]);else if(y==="number"){var L=gbe(O,s.filter(function(ee){var fe,W,he=o in ee.props?ee.props[o]:(fe=ee.type.defaultProps)===null||fe===void 0?void 0:fe[o],pe="hide"in ee.props?ee.props.hide:(W=ee.type.defaultProps)===null||W===void 0?void 0:W.hide;return he===A&&(_||!pe)}),w,i,d);L&&(k=L)}p&&(y==="number"||N!=="auto")&&(R=Af(O,w,"category"))}else p?k=sy(0,T):l&&l[A]&&l[A].hasStack&&y==="number"?k=h==="expand"?[0,1]:NB(l[A].stackGroups,c,u):k=yB(O,s.filter(function(ee){var fe=o in ee.props?ee.props[o]:ee.type.defaultProps[o],W="hide"in ee.props?ee.props.hide:ee.type.defaultProps.hide;return fe===A&&(_||!W)}),y,d,!0);if(y==="number")k=aS(f,k,A,i,P),V&&(k=Sj(V,k,j));else if(y==="category"&&V){var Y=V,Q=k.every(function(ee){return Y.indexOf(ee)>=0});Q&&(k=Y)}}return ge(ge({},g),{},ft({},A,ge(ge({},b),{},{axisType:i,domain:k,categoricalDomain:R,duplicateDomain:M,originalDomain:(x=b.domain)!==null&&x!==void 0?x:H,isCategorical:p,layout:d})))},{})},eEe=function(t,n){var r=n.graphicalItems,s=n.Axis,i=n.axisType,o=n.axisIdKey,l=n.stackGroups,c=n.dataStartIndex,u=n.dataEndIndex,d=t.layout,f=t.children,h=u0(t.data,{graphicalItems:r,dataStartIndex:c,dataEndIndex:u}),p=h.length,g=xB(d,i),m=-1;return r.reduce(function(x,b){var y=b.type.defaultProps!==void 0?ge(ge({},b.type.defaultProps),b.props):b.props,w=y[o],j=Kz("number");if(!x[w]){m++;var S;return g?S=sy(0,p):l&&l[w]&&l[w].hasStack?(S=NB(l[w].stackGroups,c,u),S=aS(f,S,w,i)):(S=Sj(j,yB(h,r.filter(function(N){var P,_,A=o in N.props?N.props[o]:(P=N.type.defaultProps)===null||P===void 0?void 0:P[o],O="hide"in N.props?N.props.hide:(_=N.type.defaultProps)===null||_===void 0?void 0:_.hide;return A===w&&!O}),"number",d),s.defaultProps.allowDataOverflow),S=aS(f,S,w,i)),ge(ge({},x),{},ft({},w,ge(ge({axisType:i},s.defaultProps),{},{hide:!0,orientation:ls(XAe,"".concat(i,".").concat(m%2),null),domain:S,originalDomain:j,isCategorical:g,layout:d})))}return x},{})},tEe=function(t,n){var r=n.axisType,s=r===void 0?"xAxis":r,i=n.AxisComp,o=n.graphicalItems,l=n.stackGroups,c=n.dataStartIndex,u=n.dataEndIndex,d=t.children,f="".concat(s,"Id"),h=Es(d,i),p={};return h&&h.length?p=JAe(t,{axes:h,graphicalItems:o,axisType:s,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u}):o&&o.length&&(p=eEe(t,{Axis:i,graphicalItems:o,axisType:s,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u})),p},nEe=function(t){var n=Ja(t),r=ia(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:dP(r,function(s){return s.coordinate}),tooltipAxis:n,tooltipAxisBandSize:Wv(n,r)}},QT=function(t){var n=t.children,r=t.defaultShowTooltip,s=es(n,$u),i=0,o=0;return t.data&&t.data.length!==0&&(o=t.data.length-1),s&&s.props&&(s.props.startIndex>=0&&(i=s.props.startIndex),s.props.endIndex>=0&&(o=s.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!r}},rEe=function(t){return!t||!t.length?!1:t.some(function(n){var r=da(n&&n.type);return r&&r.indexOf("Bar")>=0})},JT=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},sEe=function(t,n){var r=t.props,s=t.graphicalItems,i=t.xAxisMap,o=i===void 0?{}:i,l=t.yAxisMap,c=l===void 0?{}:l,u=r.width,d=r.height,f=r.children,h=r.margin||{},p=es(f,$u),g=es(f,fa),m=Object.keys(c).reduce(function(S,N){var P=c[N],_=P.orientation;return!P.mirror&&!P.hide?ge(ge({},S),{},ft({},_,S[_]+P.width)):S},{left:h.left||0,right:h.right||0}),x=Object.keys(o).reduce(function(S,N){var P=o[N],_=P.orientation;return!P.mirror&&!P.hide?ge(ge({},S),{},ft({},_,ls(S,"".concat(_))+P.height)):S},{top:h.top||0,bottom:h.bottom||0}),b=ge(ge({},x),m),y=b.bottom;p&&(b.bottom+=p.props.height||$u.defaultProps.height),g&&n&&(b=pbe(b,s,r,n));var w=u-b.left-b.right,j=d-b.top-b.bottom;return ge(ge({brushBottom:y},b),{},{width:Math.max(w,0),height:Math.max(j,0)})},iEe=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},d0=function(t){var n=t.chartName,r=t.GraphicalChild,s=t.defaultTooltipEventType,i=s===void 0?"axis":s,o=t.validateTooltipEventTypes,l=o===void 0?["axis"]:o,c=t.axisComponents,u=t.legendContent,d=t.formatAxisMap,f=t.defaultProps,h=function(x,b){var y=b.graphicalItems,w=b.stackGroups,j=b.offset,S=b.updateId,N=b.dataStartIndex,P=b.dataEndIndex,_=x.barSize,A=x.layout,O=x.barGap,T=x.barCategoryGap,k=x.maxBarSize,M=JT(A),R=M.numericAxisName,H=M.cateAxisName,F=rEe(y),V=[];return y.forEach(function($,L){var Y=u0(x.data,{graphicalItems:[$],dataStartIndex:N,dataEndIndex:P}),Q=$.type.defaultProps!==void 0?ge(ge({},$.type.defaultProps),$.props):$.props,ee=Q.dataKey,fe=Q.maxBarSize,W=Q["".concat(R,"Id")],he=Q["".concat(H,"Id")],pe={},ue=c.reduce(function(U,K){var J=b["".concat(K.axisType,"Map")],X=Q["".concat(K.axisType,"Id")];J&&J[X]||K.axisType==="zAxis"||ql();var be=J[X];return ge(ge({},U),{},ft(ft({},K.axisType,be),"".concat(K.axisType,"Ticks"),ia(be)))},pe),Ae=ue[H],de=ue["".concat(H,"Ticks")],oe=w&&w[W]&&w[W].hasStack&&_be($,w[W].stackGroups),xe=da($.type).indexOf("Bar")>=0,te=Wv(Ae,de),Ye=[],G=F&&fbe({barSize:_,stackGroups:w,totalSize:iEe(ue,H)});if(xe){var ve,Pe,Ie=vt(fe)?k:fe,E=(ve=(Pe=Wv(Ae,de,!0))!==null&&Pe!==void 0?Pe:Ie)!==null&&ve!==void 0?ve:0;Ye=hbe({barGap:O,barCategoryGap:T,bandSize:E!==te?E:te,sizeList:G[he],maxBarSize:Ie}),E!==te&&(Ye=Ye.map(function(U){return ge(ge({},U),{},{position:ge(ge({},U.position),{},{offset:U.position.offset-E/2})})}))}var D=$&&$.type&&$.type.getComposedData;D&&V.push({props:ge(ge({},D(ge(ge({},ue),{},{displayedData:Y,props:x,dataKey:ee,item:$,bandSize:te,barPosition:Ye,offset:j,stackedData:oe,layout:A,dataStartIndex:N,dataEndIndex:P}))),{},ft(ft(ft({key:$.key||"item-".concat(L)},R,ue[R]),H,ue[H]),"animationId",S)),childIndex:hae($,x.children),item:$})}),V},p=function(x,b){var y=x.props,w=x.dataStartIndex,j=x.dataEndIndex,S=x.updateId;if(!uO({props:y}))return null;var N=y.children,P=y.layout,_=y.stackOffset,A=y.data,O=y.reverseStackOrder,T=JT(P),k=T.numericAxisName,M=T.cateAxisName,R=Es(N,r),H=Sbe(A,R,"".concat(k,"Id"),"".concat(M,"Id"),_,O),F=c.reduce(function(Q,ee){var fe="".concat(ee.axisType,"Map");return ge(ge({},Q),{},ft({},fe,tEe(y,ge(ge({},ee),{},{graphicalItems:R,stackGroups:ee.axisType===k&&H,dataStartIndex:w,dataEndIndex:j}))))},{}),V=sEe(ge(ge({},F),{},{props:y,graphicalItems:R}),b==null?void 0:b.legendBBox);Object.keys(F).forEach(function(Q){F[Q]=d(y,F[Q],V,Q.replace("Map",""),n)});var $=F["".concat(M,"Map")],L=nEe($),Y=h(y,ge(ge({},F),{},{dataStartIndex:w,dataEndIndex:j,updateId:S,graphicalItems:R,stackGroups:H,offset:V}));return ge(ge({formattedGraphicalItems:Y,graphicalItems:R,offset:V,stackGroups:H},L),F)},g=function(m){function x(b){var y,w,j;return LAe(this,x),j=zAe(this,x,[b]),ft(j,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),ft(j,"accessibilityManager",new NAe),ft(j,"handleLegendBBoxUpdate",function(S){if(S){var N=j.state,P=N.dataStartIndex,_=N.dataEndIndex,A=N.updateId;j.setState(ge({legendBBox:S},p({props:j.props,dataStartIndex:P,dataEndIndex:_,updateId:A},ge(ge({},j.state),{},{legendBBox:S}))))}}),ft(j,"handleReceiveSyncEvent",function(S,N,P){if(j.props.syncId===S){if(P===j.eventEmitterSymbol&&typeof j.props.syncMethod!="function")return;j.applySyncEvent(N)}}),ft(j,"handleBrushChange",function(S){var N=S.startIndex,P=S.endIndex;if(N!==j.state.dataStartIndex||P!==j.state.dataEndIndex){var _=j.state.updateId;j.setState(function(){return ge({dataStartIndex:N,dataEndIndex:P},p({props:j.props,dataStartIndex:N,dataEndIndex:P,updateId:_},j.state))}),j.triggerSyncEvent({dataStartIndex:N,dataEndIndex:P})}}),ft(j,"handleMouseEnter",function(S){var N=j.getMouseInfo(S);if(N){var P=ge(ge({},N),{},{isTooltipActive:!0});j.setState(P),j.triggerSyncEvent(P);var _=j.props.onMouseEnter;ct(_)&&_(P,S)}}),ft(j,"triggeredAfterMouseMove",function(S){var N=j.getMouseInfo(S),P=N?ge(ge({},N),{},{isTooltipActive:!0}):{isTooltipActive:!1};j.setState(P),j.triggerSyncEvent(P);var _=j.props.onMouseMove;ct(_)&&_(P,S)}),ft(j,"handleItemMouseEnter",function(S){j.setState(function(){return{isTooltipActive:!0,activeItem:S,activePayload:S.tooltipPayload,activeCoordinate:S.tooltipPosition||{x:S.cx,y:S.cy}}})}),ft(j,"handleItemMouseLeave",function(){j.setState(function(){return{isTooltipActive:!1}})}),ft(j,"handleMouseMove",function(S){S.persist(),j.throttleTriggeredAfterMouseMove(S)}),ft(j,"handleMouseLeave",function(S){j.throttleTriggeredAfterMouseMove.cancel();var N={isTooltipActive:!1};j.setState(N),j.triggerSyncEvent(N);var P=j.props.onMouseLeave;ct(P)&&P(N,S)}),ft(j,"handleOuterEvent",function(S){var N=fae(S),P=ls(j.props,"".concat(N));if(N&&ct(P)){var _,A;/.*touch.*/i.test(N)?A=j.getMouseInfo(S.changedTouches[0]):A=j.getMouseInfo(S),P((_=A)!==null&&_!==void 0?_:{},S)}}),ft(j,"handleClick",function(S){var N=j.getMouseInfo(S);if(N){var P=ge(ge({},N),{},{isTooltipActive:!0});j.setState(P),j.triggerSyncEvent(P);var _=j.props.onClick;ct(_)&&_(P,S)}}),ft(j,"handleMouseDown",function(S){var N=j.props.onMouseDown;if(ct(N)){var P=j.getMouseInfo(S);N(P,S)}}),ft(j,"handleMouseUp",function(S){var N=j.props.onMouseUp;if(ct(N)){var P=j.getMouseInfo(S);N(P,S)}}),ft(j,"handleTouchMove",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&j.throttleTriggeredAfterMouseMove(S.changedTouches[0])}),ft(j,"handleTouchStart",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&j.handleMouseDown(S.changedTouches[0])}),ft(j,"handleTouchEnd",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&j.handleMouseUp(S.changedTouches[0])}),ft(j,"triggerSyncEvent",function(S){j.props.syncId!==void 0&&Lb.emit(Fb,j.props.syncId,S,j.eventEmitterSymbol)}),ft(j,"applySyncEvent",function(S){var N=j.props,P=N.layout,_=N.syncMethod,A=j.state.updateId,O=S.dataStartIndex,T=S.dataEndIndex;if(S.dataStartIndex!==void 0||S.dataEndIndex!==void 0)j.setState(ge({dataStartIndex:O,dataEndIndex:T},p({props:j.props,dataStartIndex:O,dataEndIndex:T,updateId:A},j.state)));else if(S.activeTooltipIndex!==void 0){var k=S.chartX,M=S.chartY,R=S.activeTooltipIndex,H=j.state,F=H.offset,V=H.tooltipTicks;if(!F)return;if(typeof _=="function")R=_(V,S);else if(_==="value"){R=-1;for(var $=0;$=0){var oe,xe;if(k.dataKey&&!k.allowDuplicatedCategory){var te=typeof k.dataKey=="function"?de:"payload.".concat(k.dataKey.toString());oe=gv($,te,R),xe=L&&Y&&gv(Y,te,R)}else oe=$==null?void 0:$[M],xe=L&&Y&&Y[M];if(he||W){var Ye=S.props.activeIndex!==void 0?S.props.activeIndex:M;return[v.cloneElement(S,ge(ge(ge({},_.props),ue),{},{activeIndex:Ye})),null,null]}if(!vt(oe))return[Ae].concat(Vu(j.renderActivePoints({item:_,activePoint:oe,basePoint:xe,childIndex:M,isRange:L})))}else{var G,ve=(G=j.getItemByXY(j.state.activeCoordinate))!==null&&G!==void 0?G:{graphicalItem:Ae},Pe=ve.graphicalItem,Ie=Pe.item,E=Ie===void 0?S:Ie,D=Pe.childIndex,U=ge(ge(ge({},_.props),ue),{},{activeIndex:D});return[v.cloneElement(E,U),null,null]}return L?[Ae,null,null]:[Ae,null]}),ft(j,"renderCustomized",function(S,N,P){return v.cloneElement(S,ge(ge({key:"recharts-customized-".concat(P)},j.props),j.state))}),ft(j,"renderMap",{CartesianGrid:{handler:Mm,once:!0},ReferenceArea:{handler:j.renderReferenceElement},ReferenceLine:{handler:Mm},ReferenceDot:{handler:j.renderReferenceElement},XAxis:{handler:Mm},YAxis:{handler:Mm},Brush:{handler:j.renderBrush,once:!0},Bar:{handler:j.renderGraphicChild},Line:{handler:j.renderGraphicChild},Area:{handler:j.renderGraphicChild},Radar:{handler:j.renderGraphicChild},RadialBar:{handler:j.renderGraphicChild},Scatter:{handler:j.renderGraphicChild},Pie:{handler:j.renderGraphicChild},Funnel:{handler:j.renderGraphicChild},Tooltip:{handler:j.renderCursor,once:!0},PolarGrid:{handler:j.renderPolarGrid,once:!0},PolarAngleAxis:{handler:j.renderPolarAxis},PolarRadiusAxis:{handler:j.renderPolarAxis},Customized:{handler:j.renderCustomized}}),j.clipPathId="".concat((y=b.id)!==null&&y!==void 0?y:gd("recharts"),"-clip"),j.throttleTriggeredAfterMouseMove=m6(j.triggeredAfterMouseMove,(w=b.throttleDelay)!==null&&w!==void 0?w:1e3/60),j.state={},j}return WAe(x,m),BAe(x,[{key:"componentDidMount",value:function(){var y,w;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(y=this.props.margin.left)!==null&&y!==void 0?y:0,top:(w=this.props.margin.top)!==null&&w!==void 0?w:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var y=this.props,w=y.children,j=y.data,S=y.height,N=y.layout,P=es(w,mr);if(P){var _=P.props.defaultIndex;if(!(typeof _!="number"||_<0||_>this.state.tooltipTicks.length-1)){var A=this.state.tooltipTicks[_]&&this.state.tooltipTicks[_].value,O=cS(this.state,j,_,A),T=this.state.tooltipTicks[_].coordinate,k=(this.state.offset.top+S)/2,M=N==="horizontal",R=M?{x:T,y:k}:{y:T,x:k},H=this.state.formattedGraphicalItems.find(function(V){var $=V.item;return $.type.name==="Scatter"});H&&(R=ge(ge({},R),H.props.points[_].tooltipPosition),O=H.props.points[_].tooltipPayload);var F={activeTooltipIndex:_,isTooltipActive:!0,activeLabel:A,activePayload:O,activeCoordinate:R};this.setState(F),this.renderCursor(P),this.accessibilityManager.setIndex(_)}}}},{key:"getSnapshotBeforeUpdate",value:function(y,w){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==w.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==y.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==y.margin){var j,S;this.accessibilityManager.setDetails({offset:{left:(j=this.props.margin.left)!==null&&j!==void 0?j:0,top:(S=this.props.margin.top)!==null&&S!==void 0?S:0}})}return null}},{key:"componentDidUpdate",value:function(y){L1([es(y.children,mr)],[es(this.props.children,mr)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var y=es(this.props.children,mr);if(y&&typeof y.props.shared=="boolean"){var w=y.props.shared?"axis":"item";return l.indexOf(w)>=0?w:i}return i}},{key:"getMouseInfo",value:function(y){if(!this.container)return null;var w=this.container,j=w.getBoundingClientRect(),S=Fge(j),N={chartX:Math.round(y.pageX-S.left),chartY:Math.round(y.pageY-S.top)},P=j.width/w.offsetWidth||1,_=this.inRange(N.chartX,N.chartY,P);if(!_)return null;var A=this.state,O=A.xAxisMap,T=A.yAxisMap,k=this.getTooltipEventType();if(k!=="axis"&&O&&T){var M=Ja(O).scale,R=Ja(T).scale,H=M&&M.invert?M.invert(N.chartX):null,F=R&&R.invert?R.invert(N.chartY):null;return ge(ge({},N),{},{xValue:H,yValue:F})}var V=ZT(this.state,this.props.data,this.props.layout,_);return V?ge(ge({},N),V):null}},{key:"inRange",value:function(y,w){var j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,S=this.props.layout,N=y/j,P=w/j;if(S==="horizontal"||S==="vertical"){var _=this.state.offset,A=N>=_.left&&N<=_.left+_.width&&P>=_.top&&P<=_.top+_.height;return A?{x:N,y:P}:null}var O=this.state,T=O.angleAxisMap,k=O.radiusAxisMap;if(T&&k){var M=Ja(T);return bk({x:N,y:P},M)}return null}},{key:"parseEventsOfWrapper",value:function(){var y=this.props.children,w=this.getTooltipEventType(),j=es(y,mr),S={};j&&w==="axis"&&(j.props.trigger==="click"?S={onClick:this.handleClick}:S={onMouseEnter:this.handleMouseEnter,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd});var N=vv(this.props,this.handleOuterEvent);return ge(ge({},N),S)}},{key:"addListener",value:function(){Lb.on(Fb,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){Lb.removeListener(Fb,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(y,w,j){for(var S=this.state.formattedGraphicalItems,N=0,P=S.length;Ni<30?"Low":i<70?"Medium":"High";return a.jsx(wo,{open:t,onOpenChange:n,children:a.jsxs(la,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[a.jsx(ca,{children:a.jsxs(ua,{className:"flex items-center gap-3",children:[a.jsx("img",{src:sd(e),alt:`${e.name} avatar`,className:"h-10 w-10 rounded-full object-cover"}),e.name]})}),a.jsxs("div",{className:"space-y-6",children:[a.jsx(Ke,{children:a.jsxs(lt,{className:"p-4",children:[a.jsxs("h3",{className:"font-medium mb-3 flex items-center gap-2",children:[a.jsx(er,{className:"h-4 w-4"}),"Demographics"]}),a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Age:"}),a.jsx("p",{className:"font-medium",children:e.age})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Gender:"}),a.jsx("p",{className:"font-medium",children:e.gender})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Occupation:"}),a.jsx("p",{className:"font-medium",children:e.occupation})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Location:"}),a.jsxs("p",{className:"font-medium flex items-center gap-1",children:[a.jsx(OR,{className:"h-3 w-3"}),e.location]})]})]})]})}),e.aiSynthesizedBio&&a.jsx(Ke,{children:a.jsxs(lt,{className:"p-4",children:[a.jsxs("h3",{className:"font-medium mb-3 flex items-center gap-2",children:[a.jsx(ja,{className:"h-4 w-4"}),"AI-Synthesized Bio"]}),a.jsx("p",{className:"text-sm leading-relaxed",children:e.aiSynthesizedBio})]})}),e.personality&&a.jsx(Ke,{children:a.jsxs(lt,{className:"p-4",children:[a.jsxs("h3",{className:"font-medium mb-3 flex items-center gap-2",children:[a.jsx(Mg,{className:"h-4 w-4"}),"Personality Overview"]}),a.jsxs("p",{className:"text-sm leading-relaxed italic",children:['"',e.personality,'"']})]})}),e.techSavviness!==void 0&&a.jsx(Ke,{children:a.jsxs(lt,{className:"p-4",children:[a.jsxs("h3",{className:"font-medium mb-3 flex items-center gap-2",children:[a.jsx(kN,{className:"h-4 w-4"}),"Tech Savviness"]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"flex-1 bg-slate-200 rounded-full h-2",children:a.jsx("div",{className:"bg-primary h-2 rounded-full transition-all duration-300",style:{width:`${e.techSavviness}%`}})}),a.jsxs("span",{className:"text-sm font-medium min-w-0",children:[s(e.techSavviness)," (",e.techSavviness,"/100)"]})]})]})}),e.qualitativeAttributes&&e.qualitativeAttributes.length>0&&a.jsx(Ke,{children:a.jsxs(lt,{className:"p-4",children:[a.jsxs("h3",{className:"font-medium mb-3 flex items-center gap-2",children:[a.jsx(ON,{className:"h-4 w-4"}),"Key Attributes"]}),a.jsx("div",{className:"flex flex-wrap gap-2",children:e.qualitativeAttributes.map((i,o)=>a.jsxs("span",{className:"inline-flex items-center gap-1 px-3 py-1 bg-blue-50 text-blue-700 text-sm rounded-full",children:["๐Ÿท๏ธ ",i]},o))})]})}),e.topPersonalityTraits&&e.topPersonalityTraits.length>0&&a.jsx(Ke,{children:a.jsxs(lt,{className:"p-4",children:[a.jsxs("h3",{className:"font-medium mb-3 flex items-center gap-2",children:[a.jsx(ja,{className:"h-4 w-4"}),"Top Personality Traits"]}),a.jsx("div",{className:"flex flex-wrap gap-2",children:e.topPersonalityTraits.map((i,o)=>a.jsxs("span",{className:"inline-flex items-center gap-1 px-3 py-1 bg-purple-50 text-purple-700 text-sm rounded-full",children:["๐Ÿง  ",i]},o))})]})}),r.length>0&&a.jsx(Ke,{children:a.jsxs(lt,{className:"p-4",children:[a.jsxs("h3",{className:"font-medium mb-3 flex items-center gap-2",children:[a.jsx(Qi,{className:"h-4 w-4"}),"OCEAN Personality Traits"]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsx("div",{className:"h-64",children:a.jsx(ha,{width:"100%",height:"100%",children:a.jsxs(Yz,{data:r,children:[a.jsx(FP,{stroke:"#e2e8f0"}),a.jsx(sc,{dataKey:"trait",tick:{fill:"#64748b",fontSize:12}}),a.jsx(rc,{angle:90,domain:[0,100],tick:{fill:"#64748b",fontSize:10}}),a.jsx(Nd,{name:"OCEAN Traits",dataKey:"value",stroke:"#3b82f6",fill:"#3b82f6",fillOpacity:.1,strokeWidth:2})]})})}),a.jsx("div",{className:"space-y-4",children:r.map(i=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between items-center mb-1",children:[a.jsx("span",{className:"text-sm font-medium",children:i.trait}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[i.value,"/100"]})]}),a.jsx("div",{className:"w-full bg-slate-200 rounded-full h-2",children:a.jsx("div",{className:"bg-primary h-2 rounded-full transition-all duration-300",style:{width:`${i.value}%`}})})]},i.trait))})]})]})}),(e.ethnicity||e.additionalNotes)&&a.jsxs(jne,{type:"single",collapsible:!0,className:"w-full",children:[e.ethnicity&&a.jsxs($1,{value:"demographics",children:[a.jsx(I1,{children:"Additional Demographics"}),a.jsx(M1,{children:a.jsx("div",{className:"space-y-2",children:a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Ethnicity:"}),a.jsx("p",{className:"font-medium",children:e.ethnicity})]})})})]}),e.additionalNotes&&a.jsxs($1,{value:"notes",children:[a.jsx(I1,{children:"Additional Notes"}),a.jsx(M1,{children:a.jsx("p",{className:"text-sm leading-relaxed",children:e.additionalNotes})})]})]})]})]})})}const el="all",oEe=Re.object({researchBrief:Re.string().min(10,{message:"Research brief must be at least 10 characters."}),focusGroupName:Re.string().min(3,{message:"Focus group name must be at least 3 characters."}),discussionTopics:Re.string().min(10,{message:"Discussion topics are required."}),creativeAssets:Re.instanceof(FileList).optional(),duration:Re.string().min(1,{message:"Duration is required."}),llm_model:Re.string().optional()}),Qd={introduction:"Welcome to our focus group discussion. Today we'll be exploring your experiences and opinions on [product/service]. There are no right or wrong answers, we're just interested in your honest thoughts.",warmup:"Let's start by introducing ourselves and sharing a bit about your background and daily routines relevant to this topic.",exploration:"Now, let's dive deeper into your experiences with similar products. What features do you find most valuable? What frustrations have you encountered?",creative:"We'll now show you some concepts and get your feedback. Please be honest and specific in your reactions.",conclusion:"To wrap up, I'd like to hear your final thoughts on what we've discussed today and any additional insights you'd like to share."};function lEe({draftToEdit:e,onDraftSaved:t}={}){console.log("FocusGroupModerator component rendering, draftToEdit:",e);const n=Rn(),[r,s]=v.useState("setup"),[i,o]=v.useState(!1),[l,c]=v.useState(!1),[u,d]=v.useState(!1),[f,h]=v.useState(null),[p,g]=v.useState(null),m=v.useRef(f);m.current=f;const x=v.useRef(!1),b=q=>q&&typeof q=="object"&&q.title&&q.sections,[y,w]=v.useState([]),[j,S]=v.useState([]),[N,P]=v.useState([]),[_,A]=v.useState(!1),[O,T]=v.useState(!1),[k,M]=v.useState([]),[R,H]=v.useState(el),[F,V]=v.useState(!1),[$,L]=v.useState(""),[Y,Q]=v.useState(null),[ee,fe]=v.useState(""),[W,he]=v.useState(""),[pe,ue]=v.useState(!1),[Ae,de]=v.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]}),[oe,xe]=v.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]}),[te,Ye]=v.useState(!1),[G,ve]=v.useState(null),Pe=q=>{ve(q),Ye(!0)},Ie=()=>{Ye(!1),ve(null)},E=q=>{const we={age:new Set,gender:new Set,occupation:new Set,location:new Set,techSavviness:new Set,ethnicity:new Set};return q.forEach(I=>{if(I.age&&we.age.add(I.age),I.gender&&we.gender.add(I.gender),I.occupation&&we.occupation.add(I.occupation),I.location&&we.location.add(I.location),I.techSavviness!==void 0){const Z=I.techSavviness<30?"Low (0-30)":I.techSavviness<70?"Medium (31-70)":"High (71-100)";we.techSavviness.add(Z)}I.ethnicity&&we.ethnicity.add(I.ethnicity)}),{age:Array.from(we.age).sort(),gender:Array.from(we.gender).sort(),occupation:Array.from(we.occupation).sort(),location:Array.from(we.location).sort(),techSavviness:Array.from(we.techSavviness).sort((I,Z)=>{const ne=["Low (0-30)","Medium (31-70)","High (71-100)"];return ne.indexOf(I)-ne.indexOf(Z)}),ethnicity:Array.from(we.ethnicity).sort()}},D=q=>{const we={...oe};we[q]=[];const I=N.filter(Z=>{let ne=!0;if(R!==el)if(ne=!1,Z.folderId===R)ne=!0;else{const B=k.find(z=>z.id===R);B&&B.personaIds.includes(Z.id)&&(ne=!0)}return ne?Object.entries(we).every(([B,z])=>{if(z.length===0)return!0;const re=B;if(re==="techSavviness"&&Z.techSavviness!==void 0){const me=Z.techSavviness<30?"Low (0-30)":Z.techSavviness<70?"Medium (31-70)":"High (71-100)";return z.includes(me)}else{if(re==="age"&&Z.age)return z.includes(Z.age);if(re==="gender"&&Z.gender)return z.includes(Z.gender);if(re==="occupation"&&Z.occupation)return z.includes(Z.occupation);if(re==="location"&&Z.location)return z.includes(Z.location);if(re==="ethnicity"&&Z.ethnicity)return z.includes(Z.ethnicity)}return!0}):!1});return E(I)},U=()=>{ue(!1),setTimeout(()=>{de({...oe})},0)},K=()=>{xe({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]})},J=(q,we)=>{xe(I=>{const Z={...I};return Z[q].includes(we)?Z[q]=Z[q].filter(ne=>ne!==we):Z[q]=[...Z[q],we],Z})},X=()=>{if(!$.trim()){ce.error("Please enter a folder name");return}const q={id:`folder-${Date.now()}`,name:$.trim(),personaIds:[]};M([...k,q]),L(""),V(!1),ce.success(`Folder "${$}" created`)},be=()=>{L(""),V(!1)},_e=q=>{Q(q),fe(q.name)},Fe=()=>{if(!Y||!ee.trim()){Q(null);return}const q=k.map(we=>we.id===Y.id?{...we,name:ee.trim()}:we);M(q),Q(null),ce.success(`Folder renamed to "${ee}"`)},ie=()=>{Q(null),fe("")},Te=(q,we)=>(q.forEach(I=>{if(I.folderId){const Z=we.find(ne=>ne.id===I.folderId);Z&&!Z.personaIds.includes(I.id)&&Z.personaIds.push(I.id)}}),we.forEach(I=>{I.personaIds=I.personaIds.filter(Z=>{if(!Z)return console.log(`Removing invalid personaId (${Z}) from folder ${I.name}`),!1;const ne=q.find(B=>B.id===Z||B._id===Z);return ne||console.log(`Removing non-existent personaId ${Z} from folder ${I.name}`),!!ne})}),we);v.useEffect(()=>{const q=async()=>{A(!0);try{const Z=await $n.getAll();console.log("Fetched personas for FocusGroupModerator:",Z.data),Array.isArray(Z.data)&&Z.data.length>0?P(Z.data):(console.warn("No personas returned from API or invalid format",Z.data),ce.warning("No participants available"))}catch(Z){console.error("Error fetching personas:",Z),ce.error("Failed to load participants")}finally{A(!1)}},we=localStorage.getItem("persona-folders");let I=[];if(we)try{I=JSON.parse(we),M(I)}catch(Z){console.error("Failed to parse stored folders:",Z)}q()},[]),v.useEffect(()=>{k.length>0&&(console.log("Saving folders to localStorage:",k),localStorage.setItem("persona-folders",JSON.stringify(k)))},[k]),v.useEffect(()=>{if(N.length>0&&k.length>0){console.log("Running folder sync with personas:",N.length,"and folders:",k.length);const q=Te(N,[...k]);JSON.stringify(q)!==JSON.stringify(k)?(console.log("Updating folders after sync"),M(q)):console.log("No folder changes after sync")}},[N,k.length]),console.log("About to initialize form with useForm hook");const Be=tx({resolver:nx(oEe),defaultValues:{researchBrief:"",focusGroupName:"",discussionTopics:"",duration:"60",llm_model:"gemini-2.5-pro"}});console.log("Form initialized successfully"),v.useEffect(()=>{e&&!x.current&&(console.log("Loading draft focus group:",e),x.current=!0,g(e.id||e._id),e.name&&Be.setValue("focusGroupName",e.name),(e.description||e.objective)&&Be.setValue("researchBrief",e.description||e.objective||""),e.topic&&Be.setValue("discussionTopics",e.topic),e.duration&&Be.setValue("duration",e.duration.toString()),e.discussionGuide&&(h(e.discussionGuide),s("review")),e.participants&&Array.isArray(e.participants)&&w(e.participants),ce.success("Draft focus group loaded",{description:"Continue editing your focus group setup"}))},[e,Be]);const gt=async(q,we)=>{var I,Z;o(!0),c(!1),d(!1);try{const ne={name:q.focusGroupName,description:q.researchBrief,objective:q.researchBrief,topic:q.discussionTopics,duration:parseInt(q.duration),llm_model:q.llm_model},B=we?await Ct.generateDiscussionGuideForGroup(we,ne):await Ct.generateDiscussionGuide(ne);if(B.data&&B.data.discussionGuide)return c(!0),B.data.discussionGuide;throw new Error("Failed to generate discussion guide")}catch(ne){console.error("Error generating discussion guide:",ne),d(!0);let B="Unknown error occurred";return(Z=(I=ne==null?void 0:ne.response)==null?void 0:I.data)!=null&&Z.error?B=ne.response.data.error:ne!=null&&ne.message&&(B=ne.message),B.includes("500")||B.includes("internal error")||B.includes("Internal Server Error")?ce.error("AI service temporarily unavailable",{description:"The discussion guide generator is experiencing issues. Please try again in a few minutes.",action:{label:"Retry",onClick:()=>gt(q)}}):ce.error("Failed to generate discussion guide",{description:B,action:{label:"Retry",onClick:()=>gt(q)}}),` +# Discussion Guide: ${q.focusGroupName} + +## Introduction (5 minutes) +${Qd.introduction} + +## Warm-up Questions (10 minutes) +${Qd.warmup} + +## ${q.discussionTopics.split(",")[0]} Exploration (15 minutes) +${Qd.exploration} + +## Creative Testing (20 minutes) +${Qd.creative} +${q.creativeAssets&&q.creativeAssets.length>0?`We'll be reviewing ${q.creativeAssets.length} creative assets.`:""} + +## Conclusion (10 minutes) +${Qd.conclusion} + +## Research Brief Context +${q.researchBrief} + `}},At=()=>{o(!1),c(!1),d(!1)};async function pn(q){var we;try{let I=p;if(!I){const ne={name:q.focusGroupName,status:"draft",participants:y,participants_count:y.length,date:new Date().toISOString(),duration:parseInt(q.duration),topic:q.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:q.researchBrief,objective:q.researchBrief,llm_model:q.llm_model},B=await Ct.create(ne);I=B.data.focus_group_id||B.data.id||B.data._id,g(I),console.log("Draft focus group created for asset upload:",B,"with ID:",I)}if(q.creativeAssets&&q.creativeAssets.length>0&&I)try{const ne=new FormData;Array.from(q.creativeAssets).forEach(me=>{ne.append("assets",me)});const z=(await Ct.uploadAssets(I,ne)).data;console.log("Assets uploaded successfully:",z),ce.success(`${z.uploaded_assets} asset(s) uploaded successfully`,{description:"Assets will be included in the discussion guide"});const re=Array.from(q.creativeAssets);S(re)}catch(ne){console.error("Asset upload failed:",ne);const B=(we=ne.response)==null?void 0:we.data;let z="Asset upload failed",re="Some assets could not be uploaded";(B==null?void 0:B.code)==="TEMP_DIR_ERROR"?(z="Upload temporarily unavailable",re="Server storage issue. Please try again in a moment."):(B==null?void 0:B.code)==="UPLOAD_SYSTEM_FAILURE"?(z="Upload system unavailable",re="Critical server issue. Please contact support."):B!=null&&B.can_retry&&(z="Upload failed - can retry",re=(B==null?void 0:B.details)||"Please try uploading again."),ce.error(z,{description:re}),console.log("Continuing without assets due to upload failure")}if(I)try{const ne={name:q.focusGroupName,participants:y,participants_count:y.length,duration:parseInt(q.duration),topic:q.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:q.researchBrief,objective:q.researchBrief,llm_model:q.llm_model};await Ct.update(I,ne),console.log("Focus group updated with latest form values before guide generation"),console.log(`๐Ÿ”„ Updated focus group ${I} with model: ${q.llm_model}`)}catch(ne){console.error("Failed to update focus group before guide generation:",ne)}const Z=await gt(q,I);h(Z);try{const ne={name:q.focusGroupName,status:"draft",participants:y,participants_count:y.length,date:new Date().toISOString(),duration:parseInt(q.duration),topic:q.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:q.researchBrief,objective:q.researchBrief,llm_model:q.llm_model,discussionGuide:Z};await Ct.update(I,ne),console.log("Focus group updated with discussion guide"),ce.success("Progress saved as draft",{description:"Your focus group setup has been automatically saved"})}catch(ne){console.error("Failed to update focus group with discussion guide:",ne),ce.error("Failed to save draft",{description:"Discussion guide generated, but draft save failed"})}s("review"),ce.success("Discussion guide generated",{description:"Review and edit before proceeding"})}catch(I){console.error("Error in focus group creation flow:",I),ce.error("Focus group creation failed",{description:I.message||"An unexpected error occurred"})}}const Zt=(()=>{var we;const q=N.filter(I=>{const Z=I.name.toLowerCase().includes(W.toLowerCase())||I.occupation&&I.occupation.toLowerCase().includes(W.toLowerCase())||I.location&&I.location.toLowerCase().includes(W.toLowerCase()),ne=(Ae.age.length===0||Ae.age.includes(I.age))&&(Ae.gender.length===0||Ae.gender.includes(I.gender))&&(Ae.occupation.length===0||Ae.occupation.includes(I.occupation))&&(Ae.location.length===0||Ae.location.includes(I.location))&&(Ae.ethnicity.length===0||I.ethnicity&&Ae.ethnicity.includes(I.ethnicity))&&(Ae.techSavviness.length===0||I.techSavviness!==void 0&&Ae.techSavviness.includes(I.techSavviness<30?"Low (0-30)":I.techSavviness<70?"Medium (31-70)":"High (71-100)"))&&!0;let B=!0;if(R!==el)if(B=!1,I.folderId===R)B=!0;else{const z=k.find(re=>re.id===R);if(z){const re=z.personaIds.filter(le=>!!le),me=I.id||I._id;re.includes(me)&&(B=!0)}}return Z&&ne&&B});if(console.log(`Filtered personas: ${q.length}/${N.length}`),console.log(`Selected folder: ${R===el?"All Personas":((we=k.find(I=>I.id===R))==null?void 0:we.name)||R}`),R!==el){const I=k.find(Z=>Z.id===R);if(I){const Z=I.personaIds.filter(z=>!!z);console.log(`Folder details: ${I.name}, ID: ${I.id}, Contains: ${Z.length} valid personas`),console.log("Folder personaIds (valid only):",Z);const ne=N.filter(z=>z.folderId===R);console.log(`Personas with folderId matching this folder: ${ne.length}`);const B=N.filter(z=>{const re=z.id||z._id;return I.personaIds.includes(re)});console.log(`Personas in folder's personaIds array: ${B.length}`)}}return q})(),bn=q=>{console.log("Toggling selection for participant ID:",q),w(we=>{const I=we.includes(q);console.log("Current selection:",{id:q,isCurrentlySelected:I,currentSelections:[...we]});const Z=I?we.filter(ne=>ne!==q):[...we,q];return console.log("New selection:",Z),p&&f&&Xt(Z),Z})},Xt=async q=>{if(p)try{const we=Be.getValues(),I={name:we.focusGroupName,status:"draft",participants:q,participants_count:q.length,date:new Date().toISOString(),duration:parseInt(we.duration),topic:we.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:we.researchBrief,objective:we.researchBrief,discussionGuide:f};await Ct.update(p,I),console.log("Participant selection auto-saved to draft")}catch(we){console.error("Failed to auto-save participant selection:",we)}},yt=async()=>{try{const q=Be.getValues(),we={name:q.focusGroupName,status:"in-progress",participants:y,participants_count:y.length,date:new Date().toISOString(),duration:parseInt(q.duration),topic:q.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),discussionGuide:f},Z=(await Ct.create(we)).data;return console.log("Focus group created successfully:",Z),Z.focus_group_id}catch(q){throw console.error("Error saving focus group:",q),q}},Rr=v.useCallback(async()=>{if(!m.current){ce.error("No discussion guide available",{description:"Please generate a discussion guide first"});return}T(!0);try{const{downloadDiscussionGuideAsMarkdown:q}=await Nee(async()=>{const{downloadDiscussionGuideAsMarkdown:I}=await import("./discussionGuideMarkdown-eMXneipz.js");return{downloadDiscussionGuideAsMarkdown:I}},[]),we=Be.getValues();q(m.current,we.focusGroupName),ce.success("Discussion guide downloaded",{description:"The guide has been saved to your downloads folder"})}catch(q){console.error("Error downloading discussion guide:",q),ce.error("Download failed",{description:"Unable to download the discussion guide. Please try again."})}finally{T(!1)}},[Be]),tt=v.useCallback(async q=>{console.log("๐Ÿ“ handleSaveDiscussionGuide called with:",q),h(q),ce.success("Discussion guide updated",{description:"Your changes have been saved."})},[]),It=v.useCallback(()=>{},[]),kt=v.useCallback(()=>{},[]),Dn=async()=>{if(!Be.getValues().focusGroupName){ce.error("Missing focus group name",{description:"Please provide a name for the focus group"});return}if(!f){ce.error("Missing discussion guide",{description:"Please generate a discussion guide first"});return}if(y.length<1){ce.error("Not enough participants",{description:"Please select at least one participant for the focus group"});return}console.log("Starting focus group with participants:",y);try{ce.loading("Creating focus group...");let q;if(p){const we=Be.getValues(),I={name:we.focusGroupName,status:"in-progress",participants:y,participants_count:y.length,date:new Date().toISOString(),duration:parseInt(we.duration),topic:we.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:we.researchBrief,objective:we.researchBrief,discussionGuide:f},Z=await Ct.update(p,I);q=p,console.log("Draft focus group updated to in-progress:",Z),t&&t()}else q=await yt();ce.dismiss(),ce.success("Focus group created successfully",{description:"The AI moderator is now running the session"}),n(`/focus-groups/${q}`)}catch(q){ce.dismiss(),q!=null&&q.message,console.error("Failed to start focus group:",q),ce.error("Failed to create focus group",{description:"Please try again or check your connection"})}};return a.jsxs("div",{className:"glass-panel rounded-xl p-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[a.jsx(Na,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"AI Focus Group Moderator"})]}),i&&a.jsx("div",{className:"mb-6",children:a.jsx(O_,{isActive:i,isComplete:l,hasError:u,label:"Generating discussion guide",onComplete:At})}),a.jsxs(Ho,{value:r,onValueChange:s,children:[a.jsxs($a,{className:"grid w-full grid-cols-3 mb-6",children:[a.jsx(Wt,{value:"setup",children:"Setup"}),a.jsx(Wt,{value:"review",children:"Review & Edit"}),a.jsx(Wt,{value:"participants",children:"Participants"})]}),a.jsx(Ht,{value:"setup",children:a.jsx(sx,{...Be,children:a.jsxs("form",{onSubmit:Be.handleSubmit(pn),className:"space-y-6",children:[a.jsx(ot,{control:Be.control,name:"focusGroupName",render:({field:q})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Focus Group Name"}),a.jsx(st,{children:a.jsx(_t,{placeholder:"e.g., Mobile App UX Evaluation",...q})}),a.jsx(on,{children:"Give your focus group a descriptive name"}),a.jsx(it,{})]})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx(ot,{control:Be.control,name:"researchBrief",render:({field:q})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Research Brief"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Describe your research objectives...",className:"h-36",...q})}),a.jsx(on,{children:"Provide context about what you want to learn"}),a.jsx(it,{})]})}),a.jsxs("div",{className:"space-y-6",children:[a.jsx(ot,{control:Be.control,name:"discussionTopics",render:({field:q})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Discussion Topics"}),a.jsx(st,{children:a.jsx(et,{placeholder:"List main topics to cover, separated by commas",className:"h-24",...q})}),a.jsx(on,{children:"E.g., User experience, feature preferences, pain points"}),a.jsx(it,{})]})}),a.jsx(ot,{control:Be.control,name:"duration",render:({field:q})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Duration (minutes)"}),a.jsxs(On,{onValueChange:q.onChange,defaultValue:q.value,children:[a.jsx(st,{children:a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select duration"})})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"30",children:"30 minutes"}),a.jsx(ye,{value:"45",children:"45 minutes"}),a.jsx(ye,{value:"60",children:"60 minutes"}),a.jsx(ye,{value:"90",children:"90 minutes"}),a.jsx(ye,{value:"120",children:"120 minutes"})]})]}),a.jsx(on,{children:"How long should the focus group session last?"}),a.jsx(it,{})]})}),a.jsx(ot,{control:Be.control,name:"llm_model",render:({field:q})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"AI Model"}),a.jsxs(On,{onValueChange:q.onChange,defaultValue:q.value,children:[a.jsx(st,{children:a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select AI model"})})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"gemini-2.5-pro",children:"Gemini 2.5 Pro"}),a.jsx(ye,{value:"gpt-4.1",children:"GPT-4.1"})]})]}),a.jsx(on,{children:"Choose which AI model to use for generating responses and discussion guides"}),a.jsx(it,{})]})})]})]}),a.jsx(ot,{control:Be.control,name:"creativeAssets",render:({field:{value:q,onChange:we,...I}})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Creative Assets (Optional)"}),a.jsx(st,{children:a.jsxs("div",{className:"border-2 border-dashed border-slate-200 rounded-lg p-6 flex flex-col items-center justify-center bg-slate-50 hover:bg-slate-100 transition cursor-pointer",children:[a.jsx(CR,{className:"h-10 w-10 text-slate-400 mb-2"}),a.jsx("p",{className:"text-sm text-slate-600 mb-1",children:"Upload creative assets for testing"}),a.jsx("p",{className:"text-xs text-slate-500 mb-3",children:"Images, mockups, or product designs"}),a.jsx(_t,{...I,type:"file",accept:"image/*,.pdf",multiple:!0,onChange:Z=>{we(Z.target.files)},className:"hidden",id:"assets-file-input"}),a.jsxs(se,{type:"button",variant:"outline",size:"sm",onClick:()=>{var Z;return(Z=document.getElementById("assets-file-input"))==null?void 0:Z.click()},children:[a.jsx(kR,{className:"mr-2 h-4 w-4"}),"Select Files"]}),q&&q.length>0&&a.jsxs("p",{className:"text-xs text-primary mt-2",children:[q.length," file(s) selected"]})]})}),a.jsx(on,{children:"Upload visuals that you want feedback on during the session"}),a.jsx(it,{})]})}),a.jsx("div",{className:"space-y-3",children:a.jsx("div",{className:"flex justify-end",children:a.jsxs(se,{type:"submit",disabled:i,className:"min-w-32",children:[a.jsx(Na,{className:"mr-2 h-4 w-4"}),i?"Generating...":"Generate Discussion Guide"]})})})]})})}),a.jsx(Ht,{value:"review",children:a.jsxs("div",{className:"space-y-6",children:[a.jsx(Ke,{children:a.jsxs(lt,{className:"p-6",children:[a.jsx("div",{className:"flex items-center justify-between mb-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("h3",{className:"font-sf text-lg font-medium",children:"AI-Generated Discussion Guide"}),f&&a.jsx(Yn,{variant:"outline",className:"text-xs",children:b(f)?"Structured JSON":"Legacy Text"})]})}),a.jsx("div",{className:"prose max-w-none",children:f?a.jsx(B5,{discussionGuide:f,showProgress:!1,collapsible:!0,defaultExpanded:!0,className:"border-0",onSave:tt,onDownload:Rr,onSectionSelect:It,onSetPosition:kt,isDownloading:O,focusGroupId:p}):a.jsx("div",{className:"bg-slate-50 p-4 rounded border text-center text-slate-600",children:'No discussion guide generated yet. Complete the setup and click "Generate Discussion Guide" to create one.'})})]})}),j.length>0&&a.jsx(Ke,{children:a.jsxs(lt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-medium mb-4",children:"Uploaded Creative Assets"}),a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-4",children:j.map((q,we)=>a.jsxs("div",{className:"border rounded-md p-2",children:[a.jsx("div",{className:"aspect-square bg-slate-100 rounded flex items-center justify-center mb-2",children:q.type.startsWith("image/")?a.jsx("img",{src:URL.createObjectURL(q),alt:`Asset ${we+1}`,className:"max-h-full max-w-full object-contain"}):a.jsx(Yw,{className:"h-10 w-10 text-slate-400"})}),a.jsx("p",{className:"text-xs truncate",children:q.name})]},we))})]})}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx(se,{variant:"outline",onClick:()=>s("setup"),children:"Back to Setup"}),a.jsxs(se,{onClick:()=>s("participants"),children:["Select Participants",a.jsx(er,{className:"ml-2 h-4 w-4"})]})]})]})}),a.jsxs(Ht,{value:"participants",children:[a.jsxs("div",{className:"flex flex-col md:flex-row gap-6",children:[a.jsxs("div",{className:"w-full md:w-64 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"text-sm font-medium",children:"Folders"}),a.jsx(se,{variant:"ghost",size:"sm",onClick:()=>{console.log("Clicked 'Create new folder' button"),V(!0)},className:"h-7 w-7 p-0",children:a.jsx(AR,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("button",{onClick:()=>{console.log("Clicked 'All Personas' folder"),console.log("All personas count:",N.length),H(el),setTimeout(()=>{console.log(`Will show all ${N.length} personas`)},0)},className:`w-full flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${R===el?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(Ws,{className:"h-4 w-4"}),a.jsx("span",{children:"All Personas"})]}),k.map(q=>a.jsx("div",{className:"flex items-center justify-between group",children:Y&&Y.id===q.id?a.jsxs("div",{className:"flex-1 flex items-center px-3 py-2 space-x-2",children:[a.jsx(Ws,{className:"h-4 w-4"}),a.jsx(_t,{value:ee,onChange:we=>fe(we.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:we=>{we.key==="Enter"?Fe():we.key==="Escape"&&ie()}}),a.jsx(se,{size:"sm",variant:"ghost",onClick:()=>{console.log(`Confirming folder rename: "${Y==null?void 0:Y.name}" to "${ee}"`),Fe()},className:"h-7 w-7 p-0",children:a.jsx(Sa,{className:"h-4 w-4"})}),a.jsx(se,{size:"sm",variant:"ghost",onClick:()=>{console.log(`Cancelling rename of folder: "${Y==null?void 0:Y.name}"`),ie()},className:"h-7 w-7 p-0",children:a.jsx(Ei,{className:"h-4 w-4"})})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>{console.log(`Clicked folder: ${q.name} (ID: ${q.id})`);const we=q.personaIds.filter(I=>!!I);console.log(`Current persona count in folder: ${we.length}`),console.log("Folder personaIds:",we),console.log("All personas count:",N.length),H(q.id),setTimeout(()=>{const I=N.filter(Z=>{if(Z.folderId===q.id)return!0;const ne=Z.id||Z._id;return we.includes(ne)});console.log(`Will show ${I.length} personas after filtering`),console.log("Filtered personas:",I.map(Z=>Z.name))},0)},className:`flex-1 flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${R===q.id?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(Ws,{className:"h-4 w-4"}),a.jsx("span",{children:q.name}),a.jsx("span",{className:"text-muted-foreground text-xs ml-auto",children:q.personaIds.filter(we=>!!we).length})]}),a.jsxs(S1,{children:[a.jsx(N1,{asChild:!0,children:a.jsx(se,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100",children:a.jsx(Xw,{className:"h-4 w-4"})})}),a.jsx(tv,{align:"end",children:a.jsx(al,{onClick:()=>{console.log(`Initiating rename for folder: ${q.name} (ID: ${q.id})`),_e(q)},children:"Rename"})})]})]})},q.id)),F&&a.jsxs("div",{className:"flex items-center px-3 py-2 space-x-2",children:[a.jsxs("div",{className:"flex-1 flex items-center space-x-2",children:[a.jsx(Ws,{className:"h-4 w-4"}),a.jsx(_t,{value:$,onChange:q=>L(q.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:q=>{q.key==="Enter"?X():q.key==="Escape"&&be()}})]}),a.jsx(se,{size:"sm",variant:"ghost",onClick:()=>{console.log(`Confirming creation of new folder: "${$}"`),X()},className:"h-7 w-7 p-0",children:a.jsx(Sa,{className:"h-4 w-4"})}),a.jsx(se,{size:"sm",variant:"ghost",onClick:()=>{console.log("Cancelling folder creation"),be()},className:"h-7 w-7 p-0",children:a.jsx(Ei,{className:"h-4 w-4"})})]})]})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Ke,{className:"mb-4",children:a.jsx(lt,{className:"p-6",children:a.jsxs("div",{className:"flex flex-col space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"font-sf text-lg font-medium",children:"Select Participants"}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(er,{className:"h-5 w-5 mr-2 text-muted-foreground"}),a.jsxs("span",{className:"text-sm font-medium",children:[y.length," of ",Zt.length," selected"]})]})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx(AN,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(_t,{placeholder:"Search personas by name, occupation, or location...",className:"pl-10 bg-white",value:W,onChange:q=>he(q.target.value)})]}),a.jsxs(se,{variant:"outline",className:"flex items-center gap-2",onClick:()=>ue(!0),children:[a.jsx(PN,{className:"h-4 w-4"}),a.jsxs("span",{children:["Filter",Object.values(Ae).some(q=>q.length>0)?` (${Object.values(Ae).reduce((q,we)=>q+we.length,0)})`:""]})]})]}),_?a.jsx("div",{className:"flex justify-center items-center py-12",children:a.jsx(Dl,{className:"h-8 w-8 animate-spin text-primary"})}):Zt.length>0?a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:Zt.map(q=>{const we=q._id||q.id;return a.jsx(ZN,{user:{id:we,_id:q._id,name:q.name,age:q.age,gender:q.gender,occupation:q.occupation,location:q.location||"Unknown",techSavviness:q.techSavviness||50,personality:q.personality||"No description available",oceanTraits:q.oceanTraits,qualitativeAttributes:q.qualitativeAttributes,topPersonalityTraits:q.topPersonalityTraits,aiSynthesizedBio:q.aiSynthesizedBio},selected:y.includes(we),onSelectionToggle:()=>bn(we),showModalInsteadOfNavigate:!0,onOpenPersonaModal:Pe},we)})}):a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-muted-foreground",children:"No personas available matching your criteria."})})]})})}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx(se,{variant:"outline",onClick:()=>s("review"),children:"Back to Review"}),a.jsxs(se,{onClick:Dn,disabled:y.length<1||!f,children:[a.jsx(AG,{className:"mr-2 h-4 w-4"}),"Start Focus Group Session"]})]})]})]}),a.jsx(wo,{open:pe,onOpenChange:q=>{q?(ue(q),xe({...Ae})):ue(!1)},children:a.jsxs(la,{className:"max-w-4xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(ca,{children:[a.jsx(ua,{children:"Filter Personas"}),a.jsx(Cl,{children:"Select attributes to filter personas by. Multiple selections within a category use OR logic, different categories use AND logic."})]}),a.jsxs("div",{className:"py-4 space-y-6",children:[Object.values(oe).some(q=>q.length>0)&&a.jsx("div",{className:"bg-muted/30 p-3 rounded-md",children:a.jsxs("p",{className:"text-sm text-muted-foreground",children:[Object.values(oe).reduce((q,we)=>q+we.length,0)," active filters"]})}),(()=>{const q=E(N),we=Object.values(oe).every(Z=>Z.length===0),I=(Z,ne,B=1)=>{const z=we?q[ne]:D(ne)[ne],re=oe[ne],me=[...new Set([...z,...re])].sort();return me.length===0?null:a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium mb-3",children:Z}),a.jsx("div",{className:`grid grid-cols-1 ${B===2?"sm:grid-cols-2":B===3?"sm:grid-cols-2 md:grid-cols-3":""} gap-2`,children:me.map(le=>{const Ue=oe[ne].includes(le),Ne=z.includes(le);return a.jsxs("div",{className:`flex items-center space-x-2 ${!Ne&&!Ue?"opacity-50":""}`,children:[a.jsx(Sh,{id:`${ne}-${le}`,checked:Ue,onCheckedChange:()=>J(ne,le),disabled:!Ne&&!Ue}),a.jsxs(ji,{htmlFor:`${ne}-${le}`,className:"truncate overflow-hidden",children:[le,Ue&&!Ne&&a.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:"(no matches)"})]})]},le)})})]})};return a.jsxs(a.Fragment,{children:[I("Gender","gender",3),I("Age","age",3),I("Ethnicity","ethnicity",2),I("Location","location",2),I("Occupation","occupation",2),I("Tech Savviness","techSavviness",3),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-6"})]})})()]}),a.jsxs(jo,{children:[a.jsx(se,{variant:"outline",onClick:K,children:"Reset"}),a.jsx(se,{onClick:U,children:"Apply Filters"})]})]})})]})]}),a.jsx(aEe,{persona:G,isOpen:te,onClose:Ie})]})}const cEe=[{id:"1",name:"Mobile App UX Evaluation",status:"completed",participants:6,date:"2023-06-10T14:00:00Z",duration:60,topic:"user-experience"},{id:"2",name:"Product Feature Feedback",status:"scheduled",participants:8,date:"2023-06-15T10:00:00Z",duration:90,topic:"product-feedback"},{id:"3",name:"Marketing Campaign Testing",status:"in-progress",participants:5,date:"2023-06-12T15:30:00Z",duration:45,topic:"creative-testing"},{id:"4",name:"Website Navigation Study",status:"scheduled",participants:7,date:"2023-06-18T13:00:00Z",duration:60,topic:"user-experience"}],uEe={completed:"bg-green-100 text-green-800 border-green-200",scheduled:"bg-blue-100 text-blue-800 border-blue-200","in-progress":"bg-amber-100 text-amber-800 border-amber-200",active:"bg-amber-100 text-amber-800 border-amber-200",paused:"bg-purple-100 text-purple-800 border-purple-200",new:"bg-slate-100 text-slate-800 border-slate-200",ai_mode:"bg-amber-100 text-amber-800 border-amber-200",draft:"bg-gray-100 text-gray-800 border-gray-200"},dEe=()=>{console.log("FocusGroups component rendering");const[e,t]=v.useState("view"),[n,r]=v.useState(""),[s,i]=v.useState([]),[o,l]=v.useState(!0),[c,u]=v.useState([]),[d,f]=v.useState(!1),[h,p]=v.useState(!1),[g,m]=v.useState(null),x=Rn(),b=v.useRef(!0),y=async(_=!0)=>{if(console.log("fetchFocusGroups called with isMountedCheck:",_),console.log("isMounted.current:",b.current),_&&!b.current){console.log("Exiting early: component not mounted");return}console.log("Setting loading to true and making API call"),l(!0);try{console.log("Calling focusGroupsApi.getAll()");const A=await Ct.getAll();if(console.log("API response received:",A),!_||b.current){const O=A.data.map(T=>({...T,id:T.id||T._id,participants_count:Array.isArray(T.participants)?T.participants.length:typeof T.participants=="number"?T.participants:0}));i(O)}}catch(A){console.error("Error fetching focus groups:",A),(!_||b.current)&&(Qe.error("Failed to load focus groups"),i(cEe))}finally{(!_||b.current)&&l(!1)}};v.useEffect(()=>(console.log("useEffect running - about to fetch focus groups"),y(),()=>{console.log("useEffect cleanup - setting isMounted to false"),b.current=!1}),[]),v.useEffect(()=>{console.log("Mode change useEffect running, mode:",e),e==="view"&&(console.log("Mode is view, calling fetchFocusGroups"),y())},[e]);const w=s.filter(_=>_.name.toLowerCase().includes(n.toLowerCase())||_.topic.toLowerCase().includes(n.toLowerCase())),j=_=>new Date(_).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),S=_=>new Date(_).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}),N=_=>{u(A=>A.includes(_)?A.filter(O=>O!==_):[...A,_])},P=async()=>{if(c.length!==0){p(!0);try{const _=c.map(A=>Ct.delete(A));await Promise.all(_),i(A=>A.filter(O=>!c.includes(O.id||O._id||""))),u([]),Qe.success(`${c.length} focus group${c.length>1?"s":""} deleted successfully`)}catch(_){console.error("Error deleting focus groups:",_),Qe.error("Failed to delete focus groups")}finally{p(!1),f(!1)}}};return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(oa,{}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center mb-8",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"font-sf text-3xl font-bold text-slate-900",children:"Focus Groups"}),a.jsx("p",{className:"text-slate-600 mt-1",children:"Set up and manage AI-moderated research sessions"})]}),a.jsx("div",{className:"mt-4 sm:mt-0",children:a.jsx(se,{onClick:()=>{console.log("Create New Focus Group button clicked, current mode:",e);try{e==="view"?(console.log("Setting draft to null and switching to create mode"),m(null),t("create")):(console.log("Switching back to view mode"),t("view"))}catch(_){console.error("Error in Create New Focus Group onClick:",_)}},className:"hover-transition",children:e==="view"?"Create New Focus Group":"View All Focus Groups"})})]}),e==="view"?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-6",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx(AN,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(_t,{placeholder:"Search focus groups by name or topic...",className:"pl-10 bg-white",value:n,onChange:_=>r(_.target.value)})]}),a.jsxs(se,{variant:"outline",className:"flex items-center gap-2",children:[a.jsx(PN,{className:"h-4 w-4"}),a.jsx("span",{children:"Filter"})]})]}),a.jsxs("div",{className:"glass-panel rounded-xl p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Na,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"Your Focus Groups"})]}),c.length>0&&a.jsxs(se,{variant:"destructive",size:"sm",onClick:()=>f(!0),disabled:h,className:"flex items-center gap-2",children:[a.jsx(wn,{className:"h-4 w-4"}),"Delete Selected (",c.length,")"]})]}),o?a.jsx("div",{className:"flex justify-center items-center py-12",children:a.jsx(Dl,{className:"h-8 w-8 animate-spin text-primary"})}):w.length>0?a.jsx("div",{className:"space-y-4",children:w.map(_=>a.jsx("div",{className:"glass-card rounded-xl overflow-hidden hover:shadow-md button-transition",children:a.jsxs("div",{className:"flex flex-col md:flex-row",children:[a.jsxs("div",{className:"flex-1 p-6",children:[a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Sh,{id:`select-${_.id||_._id}`,checked:c.includes(_.id||_._id||""),onCheckedChange:()=>N(_.id||_._id||""),className:"mt-1"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-sf text-lg font-semibold mb-2",children:_.name}),a.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(fG,{className:"h-4 w-4 mr-1"}),j(_.date)]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(rh,{className:"h-4 w-4 mr-1"}),S(_.date)]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(er,{className:"h-4 w-4 mr-1"}),_.participants_count||(Array.isArray(_.participants)?_.participants.length:0)," participant",_.participants_count>1||Array.isArray(_.participants)&&_.participants.length>1?"s":""]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(rh,{className:"h-4 w-4 mr-1"}),_.duration," min"]})]})]})]}),a.jsxs("div",{className:Me("px-3 py-1 rounded-full text-xs font-medium border",uEe[_.status]||"bg-gray-100 text-gray-800 border-gray-200"),children:[_.status==="completed"&&"Completed",_.status==="scheduled"&&"Scheduled",_.status==="in-progress"&&"In Progress",_.status==="active"&&"In Progress",_.status==="ai_mode"&&"In Progress",_.status==="paused"&&"Paused",_.status==="new"&&"Not Started",_.status==="draft"&&"Draft",!["completed","scheduled","in-progress","active","ai_mode","paused","new","draft"].includes(_.status)&&_.status]})]}),a.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[a.jsxs("div",{className:"px-3 py-1 bg-slate-100 rounded-full text-xs font-medium text-slate-800",children:[_.topic==="user-experience"&&"User Experience",_.topic==="product-feedback"&&"Product Feedback",_.topic==="creative-testing"&&"Creative Testing",_.topic==="messaging-evaluation"&&"Messaging Evaluation",_.topic&&!["user-experience","product-feedback","creative-testing","messaging-evaluation"].includes(_.topic)&&_.topic.charAt(0).toUpperCase()+_.topic.slice(1).replace(/-/g," ")]}),a.jsx("div",{className:"px-3 py-1 bg-slate-100 rounded-full text-xs font-medium text-slate-800",children:"AI Moderated"})]})]}),a.jsx("div",{className:"bg-slate-50 p-6 flex flex-col justify-center items-center md:border-l border-slate-100",children:a.jsx(se,{variant:_.status==="in-progress"||_.status==="active"||_.status==="ai_mode"?"default":_.status==="new"||_.status==="draft"?"outline":"default",className:Me("w-full hover-transition",_.status==="new"?"bg-slate-200 text-slate-700 hover:bg-slate-300 border-slate-300":"",_.status==="draft"?"bg-gray-200 text-gray-700 hover:bg-gray-300 border-gray-300":""),onClick:()=>{if(_.status==="draft")m(_),t("create");else{const A=_.id||_._id;console.log("Navigating to focus group:",A),x(`/focus-groups/${A}`)}},children:_.status==="completed"?a.jsxs(a.Fragment,{children:["View Session",a.jsx(vi,{className:"ml-2 h-4 w-4"})]}):_.status==="in-progress"||_.status==="active"||_.status==="ai_mode"?a.jsxs(a.Fragment,{children:["Join Session",a.jsx(vi,{className:"ml-2 h-4 w-4"})]}):_.status==="paused"?a.jsxs(a.Fragment,{children:["Session Details",a.jsx(vi,{className:"ml-2 h-4 w-4"})]}):_.status==="scheduled"?a.jsxs(a.Fragment,{children:["View Details",a.jsx(vi,{className:"ml-2 h-4 w-4"})]}):_.status==="new"?a.jsxs(a.Fragment,{children:["View Session",a.jsx(vi,{className:"ml-2 h-4 w-4"})]}):_.status==="draft"?a.jsxs(a.Fragment,{children:["Edit",a.jsx(vi,{className:"ml-2 h-4 w-4"})]}):a.jsxs(a.Fragment,{children:["View Session",a.jsx(vi,{className:"ml-2 h-4 w-4"})]})})})]})},_.id))}):a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-muted-foreground",children:"No focus groups found matching your search criteria."})})]})]}):a.jsx(lEe,{draftToEdit:g,onDraftSaved:()=>{m(null),t("view"),y()}})]}),a.jsx(_1,{open:d,onOpenChange:f,children:a.jsxs(rv,{children:[a.jsxs(sv,{children:[a.jsxs(av,{children:["Delete ",c.length," Focus Group",c.length!==1?"s":"","?"]}),a.jsxs(ov,{children:["This action cannot be undone. This will permanently delete the selected focus group",c.length!==1?"s":""," and remove all data associated with ",c.length!==1?"them":"it","."]})]}),a.jsxs(iv,{children:[a.jsx(cv,{disabled:h,children:"Cancel"}),a.jsx(lv,{onClick:_=>{_.preventDefault(),P()},disabled:h,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:h?a.jsxs(a.Fragment,{children:[a.jsx(Dl,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):a.jsx(a.Fragment,{children:"Delete"})})]})]})})]})},fEe=({participants:e,selectedParticipantIds:t,onToggleParticipantFilter:n})=>{const r=Rn(),s=o=>{const l=o.id||o._id;l&&r(`/personas/${l}`)},i=o=>{const l=o.id||o._id;l&&n(l)};return a.jsx("div",{className:"w-full lg:w-64 shrink-0",children:a.jsxs("div",{className:"glass-panel rounded-xl p-4",children:[a.jsxs("h2",{className:"font-sf text-lg font-semibold flex items-center mb-3",children:[a.jsx(er,{className:"h-5 w-5 text-primary mr-2"})," Participants"]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center p-2 bg-primary/5 rounded-lg",children:[a.jsx(bo,{className:"h-8 w-8 text-primary mr-3"}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-primary",children:"AI Moderator"}),a.jsx("p",{className:"text-xs text-slate-500",children:"Session facilitator"})]})]}),e.map(o=>{const l=o.id||o._id,c=t.includes(l);return a.jsxs("div",{className:`flex items-center p-2 rounded-lg transition-colors ${c?"bg-blue-50 border border-blue-200":"hover:bg-slate-100"}`,children:[a.jsx("div",{className:"cursor-pointer mr-3",onClick:()=>s(o),title:`View ${o.name}'s profile`,children:a.jsx("img",{src:sd(o),alt:o.name,className:"h-8 w-8 rounded-full object-cover"})}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx("p",{className:"font-medium cursor-pointer hover:text-blue-600 transition-colors",onClick:()=>i(o),title:`Filter to show only ${o.name}'s messages`,children:o.name}),c&&a.jsx(Sa,{className:"h-4 w-4 text-blue-600 ml-2"})]}),a.jsx("p",{className:"text-xs text-slate-500",children:o.occupation})]})]},o.id)})]})]})})};function hEe(e,t){return v.useReducer((n,r)=>t[n][r]??n,e)}var YP="ScrollArea",[Qz,MOe]=Ir(YP),[pEe,Ms]=Qz(YP),Jz=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:s,scrollHideDelay:i=600,...o}=e,[l,c]=v.useState(null),[u,d]=v.useState(null),[f,h]=v.useState(null),[p,g]=v.useState(null),[m,x]=v.useState(null),[b,y]=v.useState(0),[w,j]=v.useState(0),[S,N]=v.useState(!1),[P,_]=v.useState(!1),A=pt(t,T=>c(T)),O=Uo(s);return a.jsx(pEe,{scope:n,type:r,dir:O,scrollHideDelay:i,scrollArea:l,viewport:u,onViewportChange:d,content:f,onContentChange:h,scrollbarX:p,onScrollbarXChange:g,scrollbarXEnabled:S,onScrollbarXEnabledChange:N,scrollbarY:m,onScrollbarYChange:x,scrollbarYEnabled:P,onScrollbarYEnabledChange:_,onCornerWidthChange:y,onCornerHeightChange:j,children:a.jsx(Xe.div,{dir:O,...o,ref:A,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":w+"px",...e.style}})})});Jz.displayName=YP;var e8="ScrollAreaViewport",t8=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,asChild:s,nonce:i,...o}=e,l=Ms(e8,n),c=v.useRef(null),u=pt(t,c,l.onViewportChange);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:` +[data-radix-scroll-area-viewport] { + scrollbar-width: none; + -ms-overflow-style: none; + -webkit-overflow-scrolling: touch; +} +[data-radix-scroll-area-viewport]::-webkit-scrollbar { + display: none; +} +:where([data-radix-scroll-area-viewport]) { + display: flex; + flex-direction: column; + align-items: stretch; +} +:where([data-radix-scroll-area-content]) { + flex-grow: 1; +} +`},nonce:i}),a.jsx(Xe.div,{"data-radix-scroll-area-viewport":"",...o,asChild:s,ref:u,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...e.style},children:NEe({asChild:s,children:r},d=>a.jsx("div",{"data-radix-scroll-area-content":"",ref:l.onContentChange,style:{minWidth:l.scrollbarXEnabled?"fit-content":void 0},children:d}))})]})});t8.displayName=e8;var Ui="ScrollAreaScrollbar",ZP=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=Ms(Ui,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:o}=s,l=e.orientation==="horizontal";return v.useEffect(()=>(l?i(!0):o(!0),()=>{l?i(!1):o(!1)}),[l,i,o]),s.type==="hover"?a.jsx(mEe,{...r,ref:t,forceMount:n}):s.type==="scroll"?a.jsx(gEe,{...r,ref:t,forceMount:n}):s.type==="auto"?a.jsx(n8,{...r,ref:t,forceMount:n}):s.type==="always"?a.jsx(QP,{...r,ref:t}):null});ZP.displayName=Ui;var mEe=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=Ms(Ui,e.__scopeScrollArea),[i,o]=v.useState(!1);return v.useEffect(()=>{const l=s.scrollArea;let c=0;if(l){const u=()=>{window.clearTimeout(c),o(!0)},d=()=>{c=window.setTimeout(()=>o(!1),s.scrollHideDelay)};return l.addEventListener("pointerenter",u),l.addEventListener("pointerleave",d),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",u),l.removeEventListener("pointerleave",d)}}},[s.scrollArea,s.scrollHideDelay]),a.jsx(lr,{present:n||i,children:a.jsx(n8,{"data-state":i?"visible":"hidden",...r,ref:t})})}),gEe=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=Ms(Ui,e.__scopeScrollArea),i=e.orientation==="horizontal",o=h0(()=>c("SCROLL_END"),100),[l,c]=hEe("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return v.useEffect(()=>{if(l==="idle"){const u=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(u)}},[l,s.scrollHideDelay,c]),v.useEffect(()=>{const u=s.viewport,d=i?"scrollLeft":"scrollTop";if(u){let f=u[d];const h=()=>{const p=u[d];f!==p&&(c("SCROLL"),o()),f=p};return u.addEventListener("scroll",h),()=>u.removeEventListener("scroll",h)}},[s.viewport,i,c,o]),a.jsx(lr,{present:n||l!=="hidden",children:a.jsx(QP,{"data-state":l==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:$e(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:$e(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),n8=v.forwardRef((e,t)=>{const n=Ms(Ui,e.__scopeScrollArea),{forceMount:r,...s}=e,[i,o]=v.useState(!1),l=e.orientation==="horizontal",c=h0(()=>{if(n.viewport){const u=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=e,s=Ms(Ui,e.__scopeScrollArea),i=v.useRef(null),o=v.useRef(0),[l,c]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=o8(l.viewport,l.content),d={...r,sizes:l,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:h=>i.current=h,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:h=>o.current=h};function f(h,p){return jEe(h,o.current,l,p)}return n==="horizontal"?a.jsx(vEe,{...d,ref:t,onThumbPositionChange:()=>{if(s.viewport&&i.current){const h=s.viewport.scrollLeft,p=e$(h,l,s.dir);i.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:h=>{s.viewport&&(s.viewport.scrollLeft=h)},onDragScroll:h=>{s.viewport&&(s.viewport.scrollLeft=f(h,s.dir))}}):n==="vertical"?a.jsx(yEe,{...d,ref:t,onThumbPositionChange:()=>{if(s.viewport&&i.current){const h=s.viewport.scrollTop,p=e$(h,l);i.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:h=>{s.viewport&&(s.viewport.scrollTop=h)},onDragScroll:h=>{s.viewport&&(s.viewport.scrollTop=f(h))}}):null}),vEe=v.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...s}=e,i=Ms(Ui,e.__scopeScrollArea),[o,l]=v.useState(),c=v.useRef(null),u=pt(t,c,i.onScrollbarXChange);return v.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),a.jsx(s8,{"data-orientation":"horizontal",...s,ref:u,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":f0(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(i.viewport){const h=i.viewport.scrollLeft+d.deltaX;e.onWheelScroll(h),c8(h,f)&&d.preventDefault()}},onResize:()=>{c.current&&i.viewport&&o&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:xy(o.paddingLeft),paddingEnd:xy(o.paddingRight)}})}})}),yEe=v.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...s}=e,i=Ms(Ui,e.__scopeScrollArea),[o,l]=v.useState(),c=v.useRef(null),u=pt(t,c,i.onScrollbarYChange);return v.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),a.jsx(s8,{"data-orientation":"vertical",...s,ref:u,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":f0(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(i.viewport){const h=i.viewport.scrollTop+d.deltaY;e.onWheelScroll(h),c8(h,f)&&d.preventDefault()}},onResize:()=>{c.current&&i.viewport&&o&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:xy(o.paddingTop),paddingEnd:xy(o.paddingBottom)}})}})}),[xEe,r8]=Qz(Ui),s8=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:s,onThumbChange:i,onThumbPointerUp:o,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:f,...h}=e,p=Ms(Ui,n),[g,m]=v.useState(null),x=pt(t,A=>m(A)),b=v.useRef(null),y=v.useRef(""),w=p.viewport,j=r.content-r.viewport,S=Vn(d),N=Vn(c),P=h0(f,10);function _(A){if(b.current){const O=A.clientX-b.current.left,T=A.clientY-b.current.top;u({x:O,y:T})}}return v.useEffect(()=>{const A=O=>{const T=O.target;(g==null?void 0:g.contains(T))&&S(O,j)};return document.addEventListener("wheel",A,{passive:!1}),()=>document.removeEventListener("wheel",A,{passive:!1})},[w,g,j,S]),v.useEffect(N,[r,N]),Wu(g,P),Wu(p.content,P),a.jsx(xEe,{scope:n,scrollbar:g,hasThumb:s,onThumbChange:Vn(i),onThumbPointerUp:Vn(o),onThumbPositionChange:N,onThumbPointerDown:Vn(l),children:a.jsx(Xe.div,{...h,ref:x,style:{position:"absolute",...h.style},onPointerDown:$e(e.onPointerDown,A=>{A.button===0&&(A.target.setPointerCapture(A.pointerId),b.current=g.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),_(A))}),onPointerMove:$e(e.onPointerMove,_),onPointerUp:$e(e.onPointerUp,A=>{const O=A.target;O.hasPointerCapture(A.pointerId)&&O.releasePointerCapture(A.pointerId),document.body.style.webkitUserSelect=y.current,p.viewport&&(p.viewport.style.scrollBehavior=""),b.current=null})})})}),yy="ScrollAreaThumb",i8=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=r8(yy,e.__scopeScrollArea);return a.jsx(lr,{present:n||s.hasThumb,children:a.jsx(bEe,{ref:t,...r})})}),bEe=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...s}=e,i=Ms(yy,n),o=r8(yy,n),{onThumbPositionChange:l}=o,c=pt(t,f=>o.onThumbChange(f)),u=v.useRef(),d=h0(()=>{u.current&&(u.current(),u.current=void 0)},100);return v.useEffect(()=>{const f=i.viewport;if(f){const h=()=>{if(d(),!u.current){const p=SEe(f,l);u.current=p,l()}};return l(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[i.viewport,d,l]),a.jsx(Xe.div,{"data-state":o.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:$e(e.onPointerDownCapture,f=>{const p=f.target.getBoundingClientRect(),g=f.clientX-p.left,m=f.clientY-p.top;o.onThumbPointerDown({x:g,y:m})}),onPointerUp:$e(e.onPointerUp,o.onThumbPointerUp)})});i8.displayName=yy;var JP="ScrollAreaCorner",a8=v.forwardRef((e,t)=>{const n=Ms(JP,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?a.jsx(wEe,{...e,ref:t}):null});a8.displayName=JP;var wEe=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,s=Ms(JP,n),[i,o]=v.useState(0),[l,c]=v.useState(0),u=!!(i&&l);return Wu(s.scrollbarX,()=>{var f;const d=((f=s.scrollbarX)==null?void 0:f.offsetHeight)||0;s.onCornerHeightChange(d),c(d)}),Wu(s.scrollbarY,()=>{var f;const d=((f=s.scrollbarY)==null?void 0:f.offsetWidth)||0;s.onCornerWidthChange(d),o(d)}),u?a.jsx(Xe.div,{...r,ref:t,style:{width:i,height:l,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function xy(e){return e?parseInt(e,10):0}function o8(e,t){const n=e/t;return isNaN(n)?0:n}function f0(e){const t=o8(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function jEe(e,t,n,r="ltr"){const s=f0(n),i=s/2,o=t||i,l=s-o,c=n.scrollbar.paddingStart+o,u=n.scrollbar.size-n.scrollbar.paddingEnd-l,d=n.content-n.viewport,f=r==="ltr"?[0,d]:[d*-1,0];return l8([c,u],f)(e)}function e$(e,t,n="ltr"){const r=f0(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-s,o=t.content-t.viewport,l=i-r,c=n==="ltr"?[0,o]:[o*-1,0],u=xh(e,c);return l8([0,o],[0,l])(u)}function l8(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function c8(e,t){return e>0&&e{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function s(){const i={left:e.scrollLeft,top:e.scrollTop},o=n.left!==i.left,l=n.top!==i.top;(o||l)&&t(),n=i,r=window.requestAnimationFrame(s)}(),()=>window.cancelAnimationFrame(r)};function h0(e,t){const n=Vn(e),r=v.useRef(0);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),v.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Wu(e,t){const n=Vn(t);or(()=>{let r=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return s.observe(e),()=>{window.cancelAnimationFrame(r),s.unobserve(e)}}},[e,n])}function NEe(e,t){const{asChild:n,children:r}=e;if(!n)return typeof t=="function"?t(r):t;const s=v.Children.only(r);return v.cloneElement(s,{children:typeof t=="function"?t(s.props.children):t})}var u8=Jz,_Ee=t8,PEe=a8;const p0=v.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(u8,{ref:r,className:Me("relative overflow-hidden",e),...n,children:[a.jsx(_Ee,{className:"h-full w-full rounded-[inherit]",children:t}),a.jsx(d8,{}),a.jsx(PEe,{})]}));p0.displayName=u8.displayName;const d8=v.forwardRef(({className:e,orientation:t="vertical",...n},r)=>a.jsx(ZP,{ref:r,orientation:t,className:Me("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:a.jsx(i8,{className:"relative flex-1 rounded-full bg-border"})}));d8.displayName=ZP.displayName;const CEe=({participants:e,isVisible:t,selectedIndex:n,onSelect:r,onClose:s,position:i})=>{const o=v.useRef(null);return v.useEffect(()=>{const l=c=>{o.current&&!o.current.contains(c.target)&&s()};if(t)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[t,s]),v.useEffect(()=>{if(t&&n>=0&&o.current){const l=o.current.children[n];l&&l.scrollIntoView({block:"nearest",behavior:"smooth"})}},[n,t]),!t||e.length===0?null:a.jsxs("div",{ref:o,className:"absolute z-50 w-64 max-h-48 overflow-y-auto bg-white border border-slate-200 rounded-lg shadow-lg",style:{top:i.top,left:i.left},children:[e.map((l,c)=>{const u=l.id||l._id,d=c===n;return a.jsxs("div",{className:`flex items-center p-3 cursor-pointer transition-colors ${d?"bg-blue-50 border-l-4 border-blue-500":"hover:bg-slate-50"}`,onClick:()=>r(l),children:[a.jsx("img",{src:sd(l),alt:l.name,className:"h-8 w-8 rounded-full object-cover mr-3 flex-shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:`font-medium truncate ${d?"text-blue-900":"text-slate-900"}`,children:l.name}),a.jsx("p",{className:`text-sm truncate ${d?"text-blue-600":"text-slate-500"}`,children:l.occupation})]})]},u)}),e.length===0&&a.jsx("div",{className:"p-3 text-center text-slate-500 text-sm",children:"No participants found"})]})};function uS(e,t){const n=[],r=[],s=/@(\w+(?:\s+\w+)*)/g;let i;for(;(i=s.exec(e))!==null;){const o=i[1],l=i.index,c=i.index+i[0].length,u=t.find(d=>d.name.toLowerCase()===o.toLowerCase());if(u){const d=u.id||u._id;d&&(n.push({id:d,name:u.name,startIndex:l,endIndex:c}),r.includes(d)||r.push(d))}}return{text:e,mentions:n,mentionedParticipantIds:r}}function AEe(e,t){if(t.length===0)return[e];const n=[];let r=0;return[...t].sort((i,o)=>i.startIndex-o.startIndex).forEach((i,o)=>{i.startIndex>r&&n.push(e.slice(r,i.startIndex)),n.push(C.createElement("span",{key:`mention-${o}`,className:"text-blue-600 bg-blue-50 px-1 rounded font-medium"},`@${i.name}`)),r=i.endIndex}),r=0;n--){const r=e[n];if(r==="@"){if(n===0||/\s/.test(e[n-1]))return n}else if(/\s/.test(r))break}return null}function kEe(e,t,n){return e.slice(t+1,n).toLowerCase()}function TEe(e,t){return t?e.filter(n=>n.name.toLowerCase().includes(t)):e}const f8=v.forwardRef(({value:e,onChange:t,participants:n,placeholder:r="Ask a question or provide guidance...",className:s="",disabled:i=!1},o)=>{const[l,c]=v.useState(!1),[u,d]=v.useState(0),[f,h]=v.useState({top:0,left:0}),[p,g]=v.useState(null),[m,x]=v.useState([]),b=v.useRef(null),y=v.useRef(null);v.useEffect(()=>{o&&b.current&&(typeof o=="function"?o(b.current):o.current=b.current)},[o]);const w=()=>{if(b.current&&y.current&&p!==null){const _=b.current,A=y.current,O=document.createElement("div");O.style.position="absolute",O.style.visibility="hidden",O.style.whiteSpace="pre",O.style.font=window.getComputedStyle(_).font,O.textContent=e.slice(0,p),document.body.appendChild(O);const T=O.offsetWidth;document.body.removeChild(O);const k=A.getBoundingClientRect(),M=_.getBoundingClientRect();h({top:M.height+4,left:Math.min(T,k.width-280)})}},j=_=>{const A=_.target.value,O=_.target.selectionStart||0,T=OEe(A,O);if(T!==null&&n.length>0){const M=kEe(A,T,O),R=TEe(n,M);g(T),x(R),d(0),c(!0)}else c(!1),g(null);const k=uS(A,n);t(A,k)},S=_=>{if(l&&m.length>0)switch(_.key){case"ArrowDown":_.preventDefault(),d(A=>AA>0?A-1:m.length-1);break;case"Enter":case"Tab":_.preventDefault(),m[u]&&N(m[u]);break;case"Escape":_.preventDefault(),c(!1);break}},N=_=>{if(p!==null&&b.current){const A=b.current.selectionStart||0,{newText:O,newCursorPosition:T}=EEe(e,A,_,p),k=uS(O,n);t(O,k),setTimeout(()=>{b.current&&(b.current.focus(),b.current.setSelectionRange(T,T))},0),c(!1),g(null)}},P=()=>{c(!1),g(null)};return v.useEffect(()=>{l&&p!==null&&w()},[l,p,e]),a.jsxs("div",{ref:y,className:`relative ${s}`,children:[a.jsx("input",{ref:b,type:"text",value:e,onChange:j,onKeyDown:S,placeholder:r,disabled:i,className:"flex h-10 w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-sm ring-offset-white file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-slate-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-950 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"}),a.jsx(CEe,{participants:m,isVisible:l,selectedIndex:u,onSelect:N,onClose:P,position:f})]})});f8.displayName="MentionInput";const $Ee=({message:e,persona:t,toggleHighlight:n,participants:r=[],focusGroupId:s})=>{const[i,o]=v.useState(!1),l=e.senderId==="moderator",c=e.senderId==="facilitator",u=uS(e.text,r),d=AEe(e.text,u.mentions),h=(m=>{const x=[/titled\s+['"]([^'"]+\.(jpg|jpeg|png))['\"]/i,/asset\s+['"]([^'"]+\.(jpg|jpeg|png))['\"]/i,/image\s+['"]([^'"]+\.(jpg|jpeg|png))['\"]/i,/['"]([a-zA-Z0-9_\-]+\.(jpg|jpeg|png))['\"]/i,/(fg-[a-f0-9]+-[a-f0-9]{32}\.(jpg|jpeg|png))/i];for(const b of x){const y=m.match(b);if(y)return y[1]}return null})(e.text),p=(l||c)&&h&&s,g=()=>{n()};return a.jsxs("div",{id:`message-${e.id}`,className:Me("flex items-start p-3 rounded-lg transition-colors",e.highlighted?"bg-amber-50 border border-amber-200":"hover:bg-slate-50",l?"border-l-4 border-l-primary pl-4":"",c?"border-l-4 border-l-green-500 pl-4":""),onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),"data-highlighted":e.highlighted?"true":"false",children:[a.jsx("div",{className:"flex-shrink-0 mr-3",children:l?a.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:a.jsx(bo,{className:"h-6 w-6 text-primary"})}):c?a.jsx("div",{className:"bg-green-100 p-2 rounded-full",children:a.jsx(Dg,{className:"h-6 w-6 text-green-600"})}):t?a.jsx("div",{className:"bg-slate-100 p-2 rounded-full",children:a.jsx("img",{src:sd(t),alt:`${t.name} avatar`,className:"h-6 w-6 rounded-full object-cover"})}):a.jsx("div",{className:"bg-slate-100 p-2 rounded-full",children:a.jsx(gG,{className:"h-6 w-6 text-slate-600"})})}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center mb-1",children:[a.jsx("span",{className:"font-medium mr-2",children:l?"AI Moderator":c?"Human Facilitator":(t==null?void 0:t.name)||"Unknown"}),!l&&!c&&t&&a.jsx(Yn,{variant:"outline",className:"text-xs font-normal",children:t.occupation}),a.jsx("span",{className:"text-xs text-slate-500 ml-auto",children:e.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),a.jsx("p",{className:"text-slate-700",children:d}),p&&a.jsxs("div",{className:"mt-3 p-3 border rounded-lg bg-slate-50",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(ER,{className:"h-4 w-4 text-slate-600"}),a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Creative Asset"})]}),a.jsx("img",{src:Ct.getAssetUrl(s,h),alt:"Creative asset for review",className:"max-w-full h-auto rounded border shadow-sm",style:{maxHeight:"300px"},onError:m=>{var b;console.error("Failed to load creative asset:",Ct.getAssetUrl(s,h)),m.currentTarget.style.display="none";const x=document.createElement("div");x.className="text-xs text-slate-500 italic p-2 border rounded bg-slate-100",x.textContent=`Creative asset not found: ${h}`,(b=m.currentTarget.parentNode)==null||b.appendChild(x)}})]}),a.jsx("div",{className:Me("flex mt-2 space-x-2",!i&&!e.highlighted&&"hidden"),children:a.jsxs(se,{variant:"ghost",size:"sm",onClick:g,className:"h-8 px-2 text-xs",children:[a.jsx(IG,{className:Me("h-3 w-3 mr-1",e.highlighted?"fill-amber-400 text-amber-400":"text-slate-400")}),e.highlighted?"Highlighted":"Highlight"]})})]})]})},IEe=({action:e})=>{switch(e){case"moderator_speak":return a.jsx(Na,{className:"h-4 w-4 text-blue-500"});case"participant_respond":return a.jsx(er,{className:"h-4 w-4 text-green-500"});case"participant_interaction":return a.jsx(er,{className:"h-4 w-4 text-purple-500"});case"probe_trigger":return a.jsx(kN,{className:"h-4 w-4 text-orange-500"});case"end_session":return a.jsx(DG,{className:"h-4 w-4 text-red-500"});default:return a.jsx(ja,{className:"h-4 w-4 text-gray-500"})}},MEe=({status:e})=>{switch(e){case"success":return a.jsx(Ig,{className:"h-3 w-3 text-green-500"});case"error":return a.jsx(vG,{className:"h-3 w-3 text-red-500"});case"pending":return a.jsx(rh,{className:"h-3 w-3 text-yellow-500 animate-pulse"});default:return null}},REe=({action:e})=>({moderator_speak:"Moderator",participant_respond:"Participant Response",participant_interaction:"Participant Interaction",probe_trigger:"Probe Question",end_session:"End Session"})[e]||e,DEe=e=>{try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return e}},LEe=({entry:e,isLatest:t})=>{const[n,r]=v.useState(t);return a.jsx(Ke,{className:`mb-2 ${t?"ring-2 ring-blue-200 bg-blue-50/50":""}`,children:a.jsxs(Ep,{open:n,onOpenChange:r,children:[a.jsx(Op,{asChild:!0,children:a.jsx(Fr,{className:"pb-2 cursor-pointer hover:bg-gray-50/50 transition-colors",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(IEe,{action:e.action}),a.jsxs("div",{className:"flex flex-col",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-medium text-sm",children:a.jsx(REe,{action:e.action})}),a.jsx(MEe,{status:e.execution_status})]}),a.jsx("span",{className:"text-xs text-gray-500",children:DEe(e.timestamp)})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[t&&a.jsx(Yn,{variant:"secondary",className:"text-xs",children:"Latest"}),n?a.jsx(wp,{className:"h-4 w-4 text-gray-400"}):a.jsx(Ta,{className:"h-4 w-4 text-gray-400"})]})]})})}),a.jsx(kp,{children:a.jsx(lt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-1",children:"AI Reasoning:"}),a.jsxs("p",{className:"text-sm text-gray-600 bg-gray-50 p-2 rounded italic",children:['"',e.reasoning,'"']})]}),e.details&&Object.keys(e.details).length>0&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-1",children:"Details:"}),a.jsx("div",{className:"text-xs text-gray-600 bg-gray-50 p-2 rounded font-mono",children:JSON.stringify(e.details,null,2)})]}),e.execution_result&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-1",children:"Execution Result:"}),a.jsx("div",{className:"text-xs text-gray-600 bg-gray-50 p-2 rounded",children:e.execution_result.error?a.jsxs("span",{className:"text-red-600",children:["Error: ",e.execution_result.error]}):a.jsx("span",{className:"text-green-600",children:e.execution_result.message||"Success"})})]})]})})})]})})},FEe=({reasoningHistory:e,isVisible:t,onToggle:n,isAiMode:r=!1})=>{const[s,i]=v.useState(!0);return v.useEffect(()=>{if(s&&e.length>0){const o=document.getElementById("reasoning-panel-content");o&&(o.scrollTop=0)}},[e.length,s]),a.jsx("div",{className:"border-t border-gray-200 bg-white",children:a.jsxs(Ep,{open:t,onOpenChange:n,children:[a.jsx(Op,{asChild:!0,children:a.jsxs("div",{className:"flex items-center justify-between p-3 cursor-pointer hover:bg-gray-50 transition-colors",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ja,{className:"h-4 w-4 text-purple-600"}),a.jsx("span",{className:"font-medium text-sm",children:r?"AI Decision Reasoning":"AI Moderator Logic"}),r&&e.length>0&&a.jsx(Yn,{variant:"outline",className:"text-xs",children:e.length}),!r&&a.jsx(Yn,{variant:"secondary",className:"text-xs",children:"Manual Mode"})]}),t?a.jsx(wp,{className:"h-4 w-4 text-gray-400"}):a.jsx(Ta,{className:"h-4 w-4 text-gray-400"})]})}),a.jsx(kp,{children:a.jsx("div",{className:"border-t border-gray-100",children:r?e.length===0?a.jsxs("div",{className:"p-4 text-center text-gray-500",children:[a.jsx(ja,{className:"h-8 w-8 mx-auto mb-2 text-gray-300"}),a.jsx("p",{className:"text-sm",children:"No AI decisions yet"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Reasoning will appear here when the AI makes decisions"})]}):a.jsx(p0,{id:"reasoning-panel-content",className:"h-[25vh] p-3",children:a.jsx("div",{className:"space-y-2",children:e.map((o,l)=>a.jsx(LEe,{entry:o,isLatest:l===0},`${o.timestamp}-${l}`))})}):a.jsxs("div",{className:"p-4 text-center text-gray-500",children:[a.jsx(EN,{className:"h-8 w-8 mx-auto mb-2 text-gray-400"}),a.jsx("p",{className:"text-sm font-medium text-gray-700",children:"Manual Moderation Mode"}),a.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"You are currently moderating the discussion manually."}),a.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"Switch to AI Mode to see automated reasoning and decisions."})]})})})]})})},BEe=({modeEvent:e})=>{const t=s=>s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),n=s=>{switch(s){case"ai_mode_started":return"AI Mode Started";case"manual_mode_started":return"Manual Moderation Enabled";default:return"Mode Changed"}},r=s=>{switch(s){case"ai_mode_started":return"text-blue-600";case"manual_mode_started":return"text-slate-600";default:return"text-gray-600"}};return a.jsxs("div",{className:"flex items-center my-6 px-4",children:[a.jsx("div",{className:"flex-1 border-t border-gray-200"}),a.jsx("div",{className:`mx-4 px-3 py-1 bg-white border border-gray-200 rounded-full ${r(e.event_type)}`,children:a.jsxs("div",{className:"flex items-center space-x-2 text-xs font-medium",children:[a.jsx("span",{children:n(e.event_type)}),a.jsx("span",{className:"text-gray-400",children:"at"}),a.jsx("span",{children:t(e.timestamp)})]})}),a.jsx("div",{className:"flex-1 border-t border-gray-200"})]})},zEe=({messages:e,modeEvents:t,personas:n,isSpeaking:r,focusGroupId:s,isAiModeActive:i=!1,selectedParticipantIds:o,onToggleHighlight:l,onAdvanceDiscussion:c,onNewMessage:u,onStatusChange:d,isEditingDiscussionGuide:f=!1})=>{const[h,p]=v.useState(""),[g,m]=v.useState(null),[x,b]=v.useState(!1),[y,w]=v.useState(null),j=v.useRef(null),[S,N]=v.useState(-1),P=v.useRef(null),[_,A]=v.useState(!1),[O,T]=v.useState(!1),[k,M]=v.useState(!1),[R,H]=v.useState(null),F=R!==null?R:i,[V,$]=v.useState([]),[L,Y]=v.useState(!1),Q=L;v.useEffect(()=>{i&&s&&ee()},[i,s]);const ee=async()=>{if(s)try{i&&fe()}catch(E){console.error("Error checking autonomous status:",E)}},fe=async()=>{if(s)try{const E=await vn.getReasoningHistory(s);$(E.data.reasoning_history||[])}catch(E){console.error("Error fetching reasoning history:",E)}};v.useEffect(()=>{_&&ue()},[e,_]),v.useEffect(()=>{let E;return i&&s&&(E=setInterval(()=>{fe(),ee()},5e3)),()=>{E&&clearInterval(E)}},[i,s]);const W=E=>n.find(D=>D.id===E||D._id===E),he=o.length===0?e:e.filter(E=>E.senderId==="moderator"||E.senderId==="facilitator"||o.includes(E.senderId)),pe=()=>{const E=[];return he.forEach(D=>{E.push({type:"message",data:D,timestamp:D.timestamp})}),t.forEach(D=>{E.push({type:"mode_event",data:D,timestamp:D.timestamp})}),E.sort((D,U)=>D.timestamp.getTime()-U.timestamp.getTime())},ue=()=>{if(!f&&P.current){const E=P.current.closest("[data-radix-scroll-area-viewport]");if(E){const D=P.current.offsetTop-E.clientHeight+50,U=E.scrollTop,K=D-U,J=300;let X=null;const be=_e=>{X||(X=_e);const Fe=_e-X,ie=Math.min(Fe/J,1),Te=1-Math.pow(1-ie,3);E.scrollTop=U+K*Te,ie<1&&window.requestAnimationFrame(be)};window.requestAnimationFrame(be)}else P.current.scrollIntoView({behavior:"smooth",block:"end"})}},Ae=async E=>{var J,X;if(E.preventDefault(),!h.trim())return;let D=h,U=null;const K=g;p(""),m(null),b(!0);try{if(y){try{ce.info("Uploading creative asset...",{description:"Please wait while we upload your image."});const Fe=new FormData;Fe.append("assets",y);const ie=await Ct.uploadAssets(s,Fe);console.log("Upload response:",ie==null?void 0:ie.data);const Te=ie==null?void 0:ie.data;Te&&Te.assets&&Te.assets.length>0?(U=Te.assets[0].filename,console.log("Successfully got filename from upload response:",U)):console.error("Invalid upload response structure:",Te),U&&(D=`Please review this creative asset titled '${U}'. ${h}`,ce.success("Creative asset uploaded successfully",{description:"The image has been attached to your message."}))}catch(Fe){console.error("Error uploading file:",Fe),console.error("Upload error details:",(J=Fe.response)==null?void 0:J.data),ce.error("Failed to upload creative asset",{description:"Your message will be sent without the attachment."})}ve()}const be={id:`msg-${Date.now()}`,senderId:"facilitator",text:D,timestamp:new Date,type:"question"},_e=await Ct.sendMessage(s,{text:D,type:"question",senderId:"facilitator"});console.log("Message sent to API:",_e),(X=_e==null?void 0:_e.data)!=null&&X.message_id&&(be.id=_e.data.message_id),u(be),setTimeout(()=>{ue()},100),K&&K.mentionedParticipantIds.length>0?setTimeout(()=>{Pe(K.mentionedParticipantIds,be.text)},500):setTimeout(()=>{b(!1)},1e3)}catch(be){console.error("Error sending message:",be),b(!1);const _e={id:`msg-${Date.now()}`,senderId:"facilitator",text:h,timestamp:new Date,type:"question"};u(_e),setTimeout(()=>{ue()},100),ce.error("Failed to send message to server",{description:"Message will be shown locally but not saved."})}},de=()=>{for(let E=e.length-1;E>=0;E--)if(e[E].senderId==="moderator"&&e[E].type==="question")return e[E].text;for(let E=e.length-1;E>=0;E--)if(e[E].senderId==="moderator")return e[E].text;return"What are your thoughts on this topic?"},oe=(E,D)=>{if(!E||!E.sections||!D)return null;const{section_index:U,subsection_index:K,item_index:J,item_type:X}=D,be=E.sections,_e=ie=>{const Te=[];return ie.questions&&ie.questions.forEach((Be,gt)=>{Te.push({...Be,type:"question",index:gt})}),ie.activities&&ie.activities.forEach((Be,gt)=>{Te.push({...Be,type:"activity",index:gt})}),Te.sort((Be,gt)=>Be.type!==gt.type?Be.type==="question"?-1:1:Be.index-gt.index)};if(U>=be.length)return{completed:!0};const Fe=be[U];if(K!==void 0&&Fe.subsections){if(K>=Fe.subsections.length)return oe(E,{section_index:U+1,subsection_index:void 0,item_index:0,item_type:"question"});const ie=Fe.subsections[K],Te=_e(ie),Be=Te.findIndex(gt=>gt.type===X&>.index===J);if(Be0){const Te=ie.findIndex(Be=>Be.type===X&&Be.index===J);if(Te0?oe(E,{section_index:U,subsection_index:0,item_index:0,item_type:"question"}):oe(E,{section_index:U+1,subsection_index:void 0,item_index:0,item_type:"question"})}},xe=async()=>{var E,D,U;if(s)try{b(!0),ce.info("Advancing discussion...",{description:"Moving to the next question in the discussion guide."});const[K,J]=await Promise.all([vn.getModeratorStatus(s),Ct.getById(s)]);if(!((E=K==null?void 0:K.data)!=null&&E.status)||!((D=J==null?void 0:J.data)!=null&&D.discussionGuide))throw new Error("Could not fetch moderator status or discussion guide");const X=K.data.status,be=J.data.discussionGuide;if(!be.sections)throw new Error("Discussion guide does not have a structured format");const _e=oe(be,X.moderator_position);if(!_e)throw new Error("Could not determine next discussion item");if(_e.completed){ce.success("Discussion guide completed",{description:"All sections of the discussion guide have been covered."});const ie={id:`msg-${Date.now()}`,senderId:"moderator",text:"We have covered all the questions in our discussion guide. Thank you all for your valuable insights and participation in this focus group session.",timestamp:new Date,type:"system"};u(ie);return}await vn.setModeratorPosition(s,_e.sectionId,_e.itemId);const Fe={id:`msg-${Date.now()}`,senderId:"moderator",text:_e.content,timestamp:new Date,type:"question"};try{const ie=await Ct.sendMessage(s,{senderId:"moderator",text:Fe.text,type:"question"});(U=ie==null?void 0:ie.data)!=null&&U.message_id&&(Fe.id=ie.data.message_id)}catch(ie){console.warn("Failed to save message to API, showing locally:",ie)}u(Fe),setTimeout(()=>{ue()},100),ce.success("Discussion advanced",{description:`Moved to: ${_e.section.title}${_e.subsection?` > ${_e.subsection.title}`:""}`}),d&&setTimeout(()=>d(),500)}catch(K){console.error("Error advancing discussion:",K),ce.error("Failed to advance discussion",{description:K.message||"There was a problem advancing to the next question."})}finally{b(!1)}},te=async()=>{var E,D,U,K;if(s){console.log("Starting AI Mode: setting autonomousLoading to true"),M(!0);try{console.log("Starting AI Mode: calling API...");const X=await Promise.race([vn.startAutonomousConversation(s),new Promise((be,_e)=>setTimeout(()=>_e(new Error("API call timeout after 30 seconds")),3e4))]);if(console.log("Starting AI Mode: API response received:",X),X.data.error){ce.error("Failed to start autonomous conversation",{description:X.data.error}),M(!1);return}ce.success("Autonomous conversation started",{description:"The AI is now managing the focus group conversation"}),H(!0);try{console.log("Starting AI Mode: calling onStatusChange..."),d&&(await d(),console.log("Starting AI Mode: onStatusChange completed successfully"))}catch(be){console.error("Starting AI Mode: onStatusChange failed:",be)}console.log("Starting AI Mode: resetting autonomousLoading to false"),M(!1),setTimeout(()=>{console.log("Starting AI Mode: clearing local AI mode state"),H(null)},1e3),fe()}catch(J){console.error("Error starting autonomous conversation:",J),J.response&&J.response.data&&console.error("Backend error details:",J.response.data);const X=((D=(E=J.response)==null?void 0:E.data)==null?void 0:D.message)||((K=(U=J.response)==null?void 0:U.data)==null?void 0:K.error)||"Please check your connection and try again";ce.error("Failed to start autonomous conversation",{description:X}),M(!1)}}},Ye=async()=>{if(s){console.log("Stopping AI Mode: setting autonomousLoading to true"),M(!0);try{const E=await vn.stopAutonomousConversation(s,"manual_stop");if(E.data.error){ce.error("Failed to stop autonomous conversation",{description:E.data.error}),M(!1);return}$([]),ce.success("Autonomous conversation stopped",{description:"You can now moderate the discussion manually"}),H(!1);try{console.log("Stopping AI Mode: calling onStatusChange..."),d&&(await d(),console.log("Stopping AI Mode: onStatusChange completed successfully"))}catch(D){console.error("Stopping AI Mode: onStatusChange failed:",D)}console.log("Stopping AI Mode: resetting autonomousLoading to false"),M(!1),setTimeout(()=>{console.log("Stopping AI Mode: clearing local AI mode state"),H(null)},1e3)}catch(E){console.error("Error stopping autonomous conversation:",E),ce.error("Failed to stop autonomous conversation"),M(!1)}}},G=E=>{var U;const D=(U=E.target.files)==null?void 0:U[0];if(D){if(!D.type.startsWith("image/")){ce.error("Please select an image file",{description:"Only image files (JPG, PNG, etc.) are supported for creative review."});return}if(D.size>10*1024*1024){ce.error("File too large",{description:"Please select an image smaller than 10MB."});return}w(D),ce.success(`Image selected: ${D.name}`,{description:"The image will be attached to your next message."})}},ve=()=>{w(null),j.current&&(j.current.value="")},Pe=async(E,D)=>{var U;if(!(!s||E.length===0))try{b(!0),ce.info("Generating responses from mentioned participants...",{description:`Generating responses from ${E.length} mentioned participant(s).`});for(const K of E){const J=n.find(X=>(X._id||X.id)===K);if(!J){console.warn(`Mentioned participant ${K} not found in focus group`);continue}try{const X=await vn.generateResponse(s,K,D||"Continue the conversation based on the latest moderator message.");if((U=X==null?void 0:X.data)!=null&&U.response){console.log("Generated response from mentioned participant:",X.data);const be={id:X.data.message_id||`msg-${Date.now()}-${K}`,senderId:K,text:X.data.response,timestamp:new Date,type:"response"};u(be),ce.success(`Response generated from ${J.name}`,{description:X.data.response.substring(0,100)+"..."})}}catch(X){console.error(`Error generating response from ${J.name}:`,X),ce.error(`Failed to generate response from ${J.name}`)}}}catch(K){console.error("Error generating mentioned responses:",K),ce.error("Failed to generate responses from mentioned participants")}finally{b(!1)}},Ie=async()=>{var E,D,U,K;if(s){if(n.length===0){ce.error("No participants available",{description:"Add participants to the focus group before generating responses."});return}try{b(!0),ce.info("AI is selecting participant...",{description:"Analyzing the conversation to choose the best respondent."});const J=await vn.makeConversationDecision(s,.7,"manual");if(!J||!J.data||!J.data.decision)throw new Error("Empty decision response from AI");const X=J.data.decision;if(X.action==="participant_respond"){const be=X.details.participant_id,_e=X.details.topic_context,Fe=X.reasoning,ie=n.find(Be=>(Be._id||Be.id)===be);if(!ie)throw new Error(`Selected participant ${be} not found in focus group`);ce.info("Generating response...",{description:`AI selected ${ie.name}: ${Fe.substring(0,100)}${Fe.length>100?"...":""}`});const Te=await vn.generateResponse(s,be,_e);if(!Te||!Te.data)throw new Error("Empty response from API");if((E=Te==null?void 0:Te.data)!=null&&E.message_id&&((D=Te==null?void 0:Te.data)!=null&&D.response)){const Be={id:Te.data.message_id,senderId:be,text:Te.data.response,timestamp:new Date,type:"response",highlighted:!1};u(Be),setTimeout(()=>{ue()},100)}else throw new Error("Failed to generate or save AI response")}else{if(console.log("AI suggested different action:",X.action),X.action==="moderator_speak"){ce.info("AI suggests moderator intervention",{description:`AI reasoning: ${X.reasoning.substring(0,100)}${X.reasoning.length>100?"...":""}`});return}ce.warning("Using fallback participant selection",{description:`AI suggested "${X.action}" but generating participant response anyway.`});const be=(S+1)%n.length,_e=n[be],Fe=de(),ie=_e._id||_e.id,Te=await vn.generateResponse(s,ie,Fe);if((U=Te==null?void 0:Te.data)!=null&&U.message_id&&((K=Te==null?void 0:Te.data)!=null&&K.response)){const Be={id:Te.data.message_id,senderId:ie,text:Te.data.response,timestamp:new Date,type:"response",highlighted:!1};u(Be),setTimeout(()=>{ue()},100),N(be)}}}catch(J){console.error("Error generating AI response:",J),ce.error("Failed to generate AI response",{description:"There was a problem connecting to the server."})}finally{b(!1)}}};return a.jsxs("div",{className:"glass-panel rounded-xl p-4 flex flex-col h-full",children:[a.jsx("div",{className:"flex-1 min-h-0 mb-4",children:a.jsxs(p0,{className:"h-full pr-4",children:[a.jsxs("div",{className:"space-y-4",children:[pe().map(E=>E.type==="message"?a.jsx($Ee,{message:E.data,persona:E.data.senderId!=="moderator"&&E.data.senderId!=="facilitator"?W(E.data.senderId):null,toggleHighlight:()=>l(E.data.id),participants:n,focusGroupId:s},E.data.id):a.jsx(BEe,{modeEvent:E.data},E.data.id)),x&&a.jsxs("div",{className:"flex items-center space-x-2 text-sm text-slate-500 animate-pulse",children:[a.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:a.jsx(vs,{className:"h-4 w-4 text-primary"})}),a.jsx("span",{children:"Generating AI response..."})]}),a.jsx("div",{className:"h-8"}),a.jsx("div",{ref:P,className:"h-1"})]}),!_&&he.length>6&&a.jsx("div",{className:"sticky bottom-5 ml-auto mr-5 z-10 w-fit",children:a.jsx(se,{size:"sm",className:"rounded-full shadow-md h-10 w-10 p-0",onClick:ue,title:"Scroll to bottom",children:a.jsx(zA,{className:"h-4 w-4"})})})]})}),a.jsx(FEe,{reasoningHistory:V,isVisible:Q,onToggle:()=>Y(!L),isAiMode:i}),a.jsxs("div",{className:"pt-4 border-t border-slate-200 w-full",children:[y&&a.jsxs("div",{className:"mb-2 p-2 bg-blue-50 border border-blue-200 rounded-md flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(qA,{className:"h-4 w-4 text-blue-600"}),a.jsx("span",{className:"text-sm text-blue-700",children:y.name}),a.jsxs("span",{className:"text-xs text-blue-500",children:["(",(y.size/1024/1024).toFixed(1)," MB)"]})]}),a.jsx(se,{type:"button",variant:"ghost",size:"sm",onClick:ve,className:"h-6 w-6 p-0 text-blue-600 hover:text-blue-800",children:"ร—"})]}),a.jsxs("form",{onSubmit:Ae,className:"flex items-center gap-2 w-full",children:[a.jsx("input",{ref:j,type:"file",accept:"image/*",onChange:G,className:"hidden"}),a.jsx(f8,{value:h,onChange:(E,D)=>{p(E),m(D||null)},participants:n,placeholder:"Ask a question or provide guidance...",className:"flex-1 min-w-0",disabled:!1}),a.jsx(se,{type:"button",variant:"outline",size:"sm",onClick:()=>{var E;return(E=j.current)==null?void 0:E.click()},className:"hover-transition shrink-0 px-3",disabled:!1,title:"Attach image for creative review",children:a.jsx(qA,{className:"h-4 w-4"})}),a.jsxs(se,{type:"submit",variant:"default",className:"hover-transition shrink-0",disabled:!1,children:[a.jsx(Na,{className:"mr-2 h-4 w-4"}),"Send"]})]}),a.jsxs("div",{className:"flex justify-between items-center mt-3",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx("p",{className:"text-sm text-slate-500",children:r?"Speaking...":i?"AI mode active":"Manual moderation mode"}),a.jsx(se,{variant:"outline",size:"sm",onClick:F?Ye:te,disabled:k,className:`hover-transition ${F?"bg-red-50 text-red-600 hover:bg-red-100":"bg-blue-50 text-blue-600 hover:bg-blue-100"}`,title:F?"Stop AI mode and return to manual":"Start autonomous AI conversation",children:k?a.jsxs(a.Fragment,{children:[a.jsx(bo,{className:"mr-1 h-3 w-3 animate-spin"}),i?"Stopping...":"Starting..."]}):F?a.jsxs(a.Fragment,{children:[a.jsx(bo,{className:"mr-1 h-3 w-3"}),"Stop AI Mode"]}):a.jsxs(a.Fragment,{children:[a.jsx(bo,{className:"mr-1 h-3 w-3"}),"Start AI Mode"]})}),a.jsxs(se,{variant:"outline",size:"sm",onClick:()=>{A(!_),_||ue()},className:`hover-transition ${_?"bg-blue-50 text-blue-600 hover:bg-blue-100":""}`,title:_?"Disable auto-scroll":"Enable auto-scroll",children:[a.jsx(zA,{className:`h-3 w-3 ${_?"mr-1":""}`}),_&&"Auto-scroll"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[!i&&a.jsxs(a.Fragment,{children:[a.jsxs(se,{variant:"outline",onClick:xe,className:`hover-transition ${n.length===0?"bg-red-50":""}`,disabled:x,title:n.length===0?"Add participants to the focus group first":"Advance to the next part of the discussion guide",children:[a.jsx(Na,{className:"mr-2 h-4 w-4"}),n.length===0?"No Participants":"Advance Discussion"]}),a.jsxs(se,{variant:"ghost",size:"sm",onClick:Ie,className:`hover-transition ${n.length===0?"bg-red-50":""}`,disabled:x||n.length===0,title:"Generate a participant response to the current topic",children:[a.jsx(vs,{className:"mr-1 h-3 w-3"}),"Get Response"]})]}),i&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1 text-sm text-slate-600",children:[a.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full animate-pulse"}),a.jsx("span",{children:"AI Active"})]}),a.jsx(se,{variant:"outline",size:"sm",onClick:()=>T(!O),className:"hover-transition",title:"Show autonomous conversation controls",children:a.jsx(EN,{className:"h-3 w-3"})})]})]})]})]})]})},UEe=({themes:e,messages:t,personas:n=[],onThemeDelete:r,onQuoteClick:s})=>{const i=(d,f)=>{d.stopPropagation(),r&&(r(f),ce.success("Theme deleted successfully"))},o=d=>n.find(f=>f.id===d||f._id===d),l=d=>{let f=d;const h=d.match(/^\[MSG_ID:[^\]]+\]\s*(.*)$/);h&&(f=h[1]);const p=f.match(/^\[([^\]]+)\]:\s*(.*)$/);if(p)return{persona:p[1],text:p[2]};const g=f.match(/^([^:]+):\s*(.*)$/);return g&&g[1].trim()!==f.trim()?{persona:g[1].trim(),text:g[2]}:{persona:null,text:f}},c=e.filter(d=>"source"in d?d.source==="highlight":!0),u=e.filter(d=>"source"in d&&d.source==="generated");return a.jsxs("div",{className:"glass-panel rounded-xl p-6 h-[70vh] flex flex-col overflow-hidden",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(Rl,{className:"h-5 w-5 text-primary mr-2"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"Key Themes"})]}),a.jsxs("div",{className:"overflow-auto",children:[u.length>0&&a.jsxs("div",{className:"mb-8",children:[a.jsxs("div",{className:"flex items-center mb-3",children:[a.jsx(ja,{className:"h-4 w-4 text-primary mr-2"}),a.jsx("h3",{className:"font-medium",children:"AI-Generated Themes"})]}),a.jsx("div",{className:"grid grid-cols-1 gap-4 mb-4",children:u.map(d=>a.jsxs(Ke,{className:"hover:shadow-md transition-shadow relative group",children:[r&&a.jsx("button",{className:"absolute top-2 right-2 p-1 rounded-full bg-slate-200 opacity-0 group-hover:opacity-100 transition-opacity",onClick:f=>i(f,d.id),children:a.jsx(Ei,{className:"h-3 w-3 text-slate-700"})}),a.jsx(Fr,{className:"pb-2",children:a.jsx(ts,{className:"text-base",children:d.title})}),a.jsxs(lt,{children:[a.jsx("p",{className:"text-sm text-slate-600 mb-2",children:d.description}),d.quotes&&d.quotes.length>0&&a.jsxs("div",{className:"mt-3",children:[a.jsx("h4",{className:"text-xs font-medium text-slate-700 mb-2",children:"Supporting Quotes:"}),a.jsx("div",{className:"space-y-2",children:d.quotes.map((f,h)=>{const p=typeof f=="object"&&f!==null,g=p?f.text:f,m=p?f.speaker:l(f).persona,x=p?f.message_id:void 0,b=p?f.original:f;return a.jsxs("div",{className:"bg-slate-50 p-2 rounded text-xs text-slate-600 border-l-2 border-slate-200 cursor-pointer hover:bg-slate-100 transition-colors",onClick:y=>{y.stopPropagation(),s&&s(p?f:b,x)},title:x?`Message ID: ${x}`:"Click to find original message",children:[m&&a.jsxs("span",{className:"font-semibold text-slate-700 mr-1",children:[m,":"]}),'"',g,'"',x&&a.jsx("span",{className:"ml-2 text-xs text-green-600 opacity-70",children:"โœ“"})]},h)})})]})]})]},d.id))})]}),c.length>0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center mb-3",children:[a.jsx(CG,{className:"h-4 w-4 text-primary mr-2"}),a.jsx("h3",{className:"font-medium",children:"Highlighted Comments"})]}),a.jsx("div",{className:"grid grid-cols-1 gap-4 mb-4",children:c.map(d=>{const f=d.messages.length>0?t.find(x=>x.id===d.messages[0]):null,h=(f==null?void 0:f.text)||d.text,p=h.length>200?h.substring(0,200)+"...":h,g=f==null?void 0:f.senderId;let m="";if(g==="moderator")m="AI Moderator";else if(g==="facilitator")m="Human Facilitator";else if(g){const x=o(g);m=(x==null?void 0:x.name)||"Unknown Participant"}return a.jsxs(Ke,{className:"hover:shadow-md hover:bg-slate-50 transition-all cursor-pointer relative group",onClick:x=>{x.stopPropagation(),s&&f&&s(f.text,f.id)},title:"Click to view in discussion",children:[r&&a.jsx("button",{className:"absolute top-2 right-2 p-1 rounded-full bg-slate-200 opacity-0 group-hover:opacity-100 transition-opacity z-10",onClick:x=>i(x,d.id),children:a.jsx(Ei,{className:"h-3 w-3 text-slate-700"})}),a.jsx(Fr,{className:"pb-2",children:a.jsx(ts,{className:"text-sm font-medium text-slate-800 line-clamp-2",children:m&&a.jsx("span",{className:"text-primary font-semibold",children:m})})}),a.jsxs(lt,{className:"pt-0",children:[a.jsxs("p",{className:"text-sm text-slate-600 leading-relaxed",children:['"',p,'"']}),a.jsxs("div",{className:"mt-2 flex items-center text-xs text-slate-400",children:[a.jsx(vs,{className:"h-3 w-3 mr-1"}),"Click to view in discussion"]})]})]},d.id)})})]}),e.length===0&&a.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center bg-slate-50 rounded-lg",children:[a.jsx(Rl,{className:"h-8 w-8 text-slate-400 mb-3"}),a.jsx("p",{className:"text-slate-600",children:"No themes have been identified yet."}),a.jsx("p",{className:"text-sm text-slate-500 mt-2",children:"Highlight important messages in the discussion or generate themes automatically."})]})]})]})},VEe=({themes:e,messages:t,personas:n,focusGroupId:r,onThemesGenerated:s,onThemeDelete:i,onQuoteClick:o,onGenerateKeyThemes:l})=>{const c=()=>{if(!e||e.length===0){ce.warning("No themes to export",{description:"Generate some themes first before exporting."});return}let u=`# Key Themes Analysis + +`;const d=e.filter(g=>"source"in g&&g.source==="generated");if(d.length===0){ce.warning("No AI-generated themes to export",{description:"Only AI-generated themes are included in the export."});return}d.forEach((g,m)=>{u+=`## ${m+1}. ${g.title} + +`,u+=`${g.description} + +`,g.quotes&&g.quotes.length>0&&(u+=`**Supporting Quotes:** + +`,g.quotes.forEach(x=>{u+=`> ${x} + +`})),u+=`--- + +`});const f=new Blob([u],{type:"text/markdown"}),h=URL.createObjectURL(f),p=document.createElement("a");p.href=h,p.download=`key-themes-${new Date().toISOString().split("T")[0]}.md`,document.body.appendChild(p),p.click(),document.body.removeChild(p),URL.revokeObjectURL(h),ce.success("Themes exported successfully",{description:`Downloaded ${d.length} themes as markdown file.`})};return a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{className:"mb-4 space-y-2",children:[a.jsxs(se,{onClick:l,className:"w-full",children:[a.jsx(LG,{className:"mr-2 h-4 w-4"}),"Analyze Discussion for Key Themes"]}),a.jsxs(se,{onClick:c,disabled:!e||e.length===0,variant:"outline",className:"w-full",children:[a.jsx(ed,{className:"mr-2 h-4 w-4"}),"Export Themes"]})]}),a.jsx("div",{className:"flex-grow overflow-hidden",children:a.jsx(UEe,{themes:e,messages:t,personas:n,onThemeDelete:i,focusGroupId:r,onQuoteClick:o})})]})},WEe=({messages:e,themes:t,personas:n=[]})=>{var g;const[r,s]=v.useState([{name:"Very Positive",value:0,color:"#4ade80"},{name:"Positive",value:0,color:"#a3e635"},{name:"Neutral",value:0,color:"#93c5fd"},{name:"Negative",value:0,color:"#fb923c"},{name:"Very Negative",value:0,color:"#f87171"}]),[i,o]=v.useState([]),[l,c]=v.useState({}),[u,d]=v.useState({isBalanced:!1,score:0,reason:""}),f=m=>{const x=n.find(b=>b.id===m);return x?x.name:`Participant ${m}`};v.useEffect(()=>{if(e.length===0)return;const m={"Very Positive":0,Positive:0,Neutral:0,Negative:0,"Very Negative":0},x={},b={};e.forEach(j=>{if(j.senderId!=="moderator"&&j.senderId!=="facilitator"){const S=j.text.toLowerCase();let N="Neutral";S.includes("love")||S.includes("excellent")||S.includes("amazing")?N="Very Positive":S.includes("good")||S.includes("like")||S.includes("great")?N="Positive":S.includes("bad")||S.includes("issue")||S.includes("problem")?N="Negative":(S.includes("terrible")||S.includes("hate")||S.includes("awful"))&&(N="Very Negative"),m[N]++,b[j.senderId]||(b[j.senderId]={"Very Positive":0,Positive:0,Neutral:0,Negative:0,"Very Negative":0}),b[j.senderId][N]++,x[j.senderId]=(x[j.senderId]||0)+1}}),s(j=>j.map(S=>({...S,value:m[S.name]||0})));const y=Object.entries(x).map(([j,S])=>({name:f(j),messages:S}));o(y);const w={};Object.entries(b).forEach(([j,S])=>{w[j]={name:f(j),sentiments:S}}),c(w),h(x,b)},[e,n,f]);const h=(m,x)=>{if(Object.keys(m).length===0){d({isBalanced:!1,score:0,reason:"No participant data available"});return}const y=Object.values(m).reduce((V,$)=>V+$,0)/Object.keys(m).length,w=Object.values(m).map(V=>Math.abs(V-y)/y),j=w.reduce((V,$)=>V+$,0)/w.length,S=Object.values(x).map(V=>Object.values(V).filter($=>$>0).length),N=S.reduce((V,$)=>V+$,0)/S.length,P=["Very Positive","Positive","Neutral","Negative","Very Negative"],_=Object.values(x).map(V=>{const $=Math.max(...Object.values(V));return P.find(L=>V[L]===$)||"Neutral"}),A=new Set(_).size,O=A/P.length,T=Math.max(0,100-j*100),k=N/5*100,M=O*100,R=Math.round(T*.6+k*.2+M*.2);let H="";const F=R>=70;j>.3&&(H+="Participation is uneven among participants. "),N<2&&(H+="Limited range of sentiments expressed. "),A<=1?H+="Participants show similar sentiment patterns, suggesting potential group-think. ":A>=4&&(H+="Wide divergence in participant sentiments, showing healthy diversity of opinions. "),H===""&&(H=F?"Good mix of participation and diverse opinions.":"Multiple factors affecting balance."),d({isBalanced:F,score:R,reason:H})},p=m=>{const x=l[m];if(!x)return"N/A";const b=x.sentiments;let y=0,w="Neutral";return Object.entries(b).forEach(([j,S])=>{S>y&&(y=S,w=j)}),w};return a.jsx("div",{className:"glass-panel rounded-xl p-4",children:a.jsxs(Ho,{defaultValue:"sentiment",children:[a.jsxs($a,{className:"grid grid-cols-2 mb-4",children:[a.jsxs(Wt,{value:"sentiment",className:"flex items-center",children:[a.jsx(pG,{className:"h-4 w-4 mr-2"}),"Sentiment"]}),a.jsxs(Wt,{value:"participation",className:"flex items-center",children:[a.jsx(qw,{className:"h-4 w-4 mr-2"}),"Participation"]})]}),a.jsx(Ht,{value:"sentiment",children:a.jsx(Ke,{children:a.jsxs(lt,{className:"pt-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"Sentiment Analysis"}),a.jsxs("div",{className:`px-3 py-1 rounded-full text-sm ${u.isBalanced?"bg-green-100 text-green-800":"bg-amber-100 text-amber-800"}`,children:["Balance score: ",u.score,"/100"]})]}),a.jsx("div",{className:"h-60",children:a.jsx(ha,{width:"100%",height:"100%",children:a.jsxs(XP,{children:[a.jsx(mr,{}),a.jsx(hi,{data:r,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,label:({name:m,percent:x})=>x>0?`${m} ${(x*100).toFixed(0)}%`:"",children:r.map((m,x)=>a.jsx(Bp,{fill:m.color},`cell-${x}`))}),a.jsx(fa,{})]})})}),a.jsxs("div",{className:"mt-4",children:[a.jsx("h4",{className:"text-sm font-medium mb-2",children:"Sentiment by Participant"}),a.jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto pr-2",children:Object.entries(l).map(([m,x])=>{var w;const b=p(m),y=((w=r.find(j=>j.name===b))==null?void 0:w.color)||"#93c5fd";return a.jsxs("div",{className:"flex items-center justify-between p-2 bg-slate-50 rounded",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(Dg,{className:"h-4 w-4 text-slate-400 mr-2"}),a.jsx("span",{className:"text-sm",children:x.name})]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx("span",{className:"text-xs mr-2",children:"Predominant:"}),a.jsx("span",{className:"text-xs font-medium px-2 py-0.5 rounded",style:{backgroundColor:`${y}30`,color:y},children:b})]})]},m)})})]}),a.jsxs("div",{className:"mt-4 pt-4 border-t",children:[a.jsx("h4",{className:"text-sm font-medium mb-2",children:"Focus Group Balance Assessment"}),a.jsxs("div",{className:`p-3 rounded text-sm ${u.isBalanced?"bg-green-50 text-green-700":"bg-amber-50 text-amber-700"}`,children:[a.jsx("span",{className:"font-medium",children:u.isBalanced?"Balanced Focus Group":"Potential Balance Issues"}),a.jsx("p",{className:"mt-1 text-xs",children:u.reason})]})]})]})})}),a.jsx(Ht,{value:"participation",children:a.jsx(Ke,{children:a.jsxs(lt,{className:"pt-6",children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Participation Distribution"}),a.jsx("div",{className:"h-60",children:a.jsx(ha,{width:"100%",height:"100%",children:a.jsxs(Xz,{data:i,layout:"vertical",margin:{top:5,right:30,left:20,bottom:5},children:[a.jsx(lp,{strokeDasharray:"3 3"}),a.jsx(Ro,{type:"number"}),a.jsx(Do,{dataKey:"name",type:"category",width:100}),a.jsx(mr,{}),a.jsx(Yo,{dataKey:"messages",fill:"#8884d8",name:"Messages"})]})})}),a.jsx("p",{className:"text-sm text-muted-foreground mt-4",children:i.length>0?`Most active: ${(g=i.sort((m,x)=>x.messages-m.messages)[0])==null?void 0:g.name}`:"No participation data available"})]})})})]})})},HEe=({focusGroupId:e,personas:t,isVisible:n,onToggle:r})=>{const[s,i]=v.useState(null),[o,l]=v.useState(null),[c,u]=v.useState(null),[d,f]=v.useState(null),[h,p]=v.useState(!1),[g,m]=v.useState(null),[x,b]=v.useState(null);v.useEffect(()=>{if(n&&e){y();const P=setInterval(y,3e4);return()=>clearInterval(P)}},[n,e]);const y=async()=>{p(!0),m(null);try{const[P,_,A,O]=await Promise.allSettled([vn.getConversationAnalytics(e),vn.getConversationState(e),vn.getAutonomousConversationStatus(e),vn.getConversationInsights(e)]);P.status==="fulfilled"&&i(P.value.data.analytics),_.status==="fulfilled"&&l(_.value.data.state),A.status==="fulfilled"&&u(A.value.data.status),O.status==="fulfilled"&&f(O.value.data.insights),b(new Date)}catch(P){console.error("Error fetching dashboard data:",P),m("Failed to load dashboard data")}finally{p(!1)}},w=()=>{y()},j=P=>{switch(P){case"running":return"bg-green-500";case"paused":return"bg-amber-500";case"completed":return"bg-blue-500";case"error":return"bg-red-500";default:return"bg-gray-500"}},S=P=>{switch(P){case"positive":return"text-green-600";case"negative":return"text-red-600";default:return"text-gray-600"}},N=P=>{switch(P){case"excellent":return"text-green-600";case"good":return"text-blue-600";case"fair":return"text-amber-600";case"poor":return"text-red-600";default:return"text-gray-600"}};return n?a.jsxs("div",{className:"fixed right-4 top-4 bottom-4 w-80 bg-white rounded-lg shadow-lg border border-gray-200 flex flex-col overflow-hidden z-50",children:[a.jsxs("div",{className:"p-4 border-b border-gray-200 bg-gray-50",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(bo,{className:"h-5 w-5 text-blue-600"}),a.jsx("h3",{className:"font-semibold text-gray-900",children:"AI Dashboard"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(se,{variant:"ghost",size:"sm",onClick:w,disabled:h,className:"p-1",children:a.jsx(zc,{className:`h-4 w-4 ${h?"animate-spin":""}`})}),a.jsx(se,{variant:"ghost",size:"sm",onClick:r,className:"p-1",children:a.jsx(xG,{className:"h-4 w-4"})})]})]}),x&&a.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Last updated: ",x.toLocaleTimeString()]})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[g&&a.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(mG,{className:"h-4 w-4 text-red-600"}),a.jsx("span",{className:"text-sm text-red-800",children:g})]})}),c&&a.jsxs(Ke,{children:[a.jsx(Fr,{className:"pb-3",children:a.jsxs(ts,{className:"text-sm flex items-center gap-2",children:[a.jsx("div",{className:`w-3 h-3 rounded-full ${j(c.conversation_state)}`}),"Autonomous Status"]})}),a.jsx(lt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"State:"}),a.jsx(Yn,{variant:c.conversation_state==="running"?"default":"secondary",children:c.conversation_state})]}),a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Actions:"}),a.jsx("span",{className:"font-medium",children:c.action_count||0})]})]})})]}),o&&a.jsxs(Ke,{children:[a.jsx(Fr,{className:"pb-3",children:a.jsxs(ts,{className:"text-sm flex items-center gap-2",children:[a.jsx(Qi,{className:"h-4 w-4"}),"Conversation Health"]})}),a.jsx(lt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-sm",children:"Overall Health:"}),a.jsx(Yn,{className:N(o.conversation_health.status),children:o.conversation_health.status})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Score:"}),a.jsxs("span",{className:"font-medium",children:[o.conversation_health.score,"/100"]})]}),a.jsx(fl,{value:o.conversation_health.score,className:"h-2"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("span",{className:"text-xs text-gray-600",children:"Indicators:"}),a.jsx("div",{className:"flex flex-wrap gap-1",children:o.conversation_health.indicators.map((P,_)=>a.jsx(Yn,{variant:"outline",className:"text-xs",children:P.replace("_"," ")},_))})]})]})})]}),s&&a.jsxs(Ke,{children:[a.jsx(Fr,{className:"pb-3",children:a.jsxs(ts,{className:"text-sm flex items-center gap-2",children:[a.jsx(er,{className:"h-4 w-4"}),"Participation"]})}),a.jsx(lt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-lg font-semibold text-blue-600",children:s.overview.active_participants}),a.jsx("div",{className:"text-xs text-gray-600",children:"Active"})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-lg font-semibold text-green-600",children:s.overview.participant_messages}),a.jsx("div",{className:"text-xs text-gray-600",children:"Messages"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Balance:"}),a.jsx(Yn,{variant:s.participation.participation_balance==="balanced"?"default":"secondary",children:s.participation.participation_balance.replace("_"," ")})]}),s.participation.dominant_participants.length>0&&a.jsxs("div",{className:"text-xs text-amber-600",children:["Dominant: ",s.participation.dominant_participants.length," participant(s)"]}),s.participation.quiet_participants.length>0&&a.jsxs("div",{className:"text-xs text-blue-600",children:["Quiet: ",s.participation.quiet_participants.length," participant(s)"]})]})]})})]}),s&&a.jsxs(Ke,{children:[a.jsx(Fr,{className:"pb-3",children:a.jsxs(ts,{className:"text-sm flex items-center gap-2",children:[a.jsx(RG,{className:"h-4 w-4"}),"Sentiment"]})}),a.jsx(lt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-sm",children:"Overall:"}),a.jsx(Yn,{className:S(s.sentiment_analysis.overall_sentiment),children:s.sentiment_analysis.overall_sentiment})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-xs",children:[a.jsxs("span",{children:["Positive: ",s.sentiment_analysis.sentiment_distribution.positive]}),a.jsxs("span",{children:["Neutral: ",s.sentiment_analysis.sentiment_distribution.neutral]}),a.jsxs("span",{children:["Negative: ",s.sentiment_analysis.sentiment_distribution.negative]})]}),a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Trend:"}),a.jsx("span",{className:"font-medium",children:s.sentiment_analysis.sentiment_trend})]})]})]})})]}),s&&a.jsxs(Ke,{children:[a.jsx(Fr,{className:"pb-3",children:a.jsxs(ts,{className:"text-sm flex items-center gap-2",children:[a.jsx(hG,{className:"h-4 w-4"}),"Quality Metrics"]})}),a.jsx(lt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Engagement:"}),a.jsxs("span",{className:"font-medium",children:[Math.round(s.quality_metrics.engagement_score),"/100"]})]}),a.jsx(fl,{value:s.quality_metrics.engagement_score,className:"h-2"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Depth:"}),a.jsxs("span",{className:"font-medium",children:[Math.round(s.quality_metrics.depth_score),"/100"]})]}),a.jsx(fl,{value:s.quality_metrics.depth_score,className:"h-2"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Overall:"}),a.jsxs("span",{className:"font-medium",children:[Math.round(s.quality_metrics.quality_score),"/100"]})]}),a.jsx(fl,{value:s.quality_metrics.quality_score,className:"h-2"})]})]})})]}),d&&a.jsxs(Ke,{children:[a.jsx(Fr,{className:"pb-3",children:a.jsxs(ts,{className:"text-sm flex items-center gap-2",children:[a.jsx(Rl,{className:"h-4 w-4"}),"AI Insights"]})}),a.jsx(lt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Energy:"}),a.jsx(Yn,{variant:d.conversation_energy==="high"?"default":"secondary",children:d.conversation_energy})]}),a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Engagement:"}),a.jsx(Yn,{variant:d.topic_engagement==="high"?"default":"secondary",children:d.topic_engagement})]}),d.next_suggested_action&&a.jsx("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-2 mt-2",children:a.jsxs("div",{className:"text-xs text-blue-800",children:[a.jsx("strong",{children:"Suggestion:"})," ",d.next_suggested_action]})})]})})]}),s&&s.recommendations.length>0&&a.jsxs(Ke,{children:[a.jsx(Fr,{className:"pb-3",children:a.jsxs(ts,{className:"text-sm flex items-center gap-2",children:[a.jsx(Ig,{className:"h-4 w-4"}),"Recommendations"]})}),a.jsx(lt,{className:"pt-0",children:a.jsx("div",{className:"space-y-2",children:s.recommendations.map((P,_)=>a.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-2",children:a.jsx("div",{className:"text-xs text-amber-800",children:P})},_))})})]})]})]}):null},GEe=({discussionGuide:e,moderatorStatus:t,onSectionSelect:n,onSetPosition:r,onSave:s,focusGroupId:i,isOpen:o,onToggle:l,className:c,onEditingChange:u})=>{console.log("๐Ÿ“‹ CollapsibleDiscussionGuide render",{isOpen:o,hasModerator:!!t,guideTitle:e==null?void 0:e.title,timestamp:new Date().toISOString()});const[d,f]=v.useState(!1),h=async()=>{if(!e){ce.error("No discussion guide available",{description:"The discussion guide is not available for download"});return}f(!0);try{await Ct.downloadDiscussionGuide(i),ce.success("Discussion guide downloaded",{description:"The guide has been saved to your downloads folder"})}catch(g){console.error("Error downloading discussion guide:",g),ce.error("Download failed",{description:"Unable to download the discussion guide. Please try again."})}finally{f(!1)}},p=e&&typeof e=="object"&&e.sections;return a.jsx("div",{className:Me("w-full border-b bg-white shadow-sm",c),children:a.jsxs(Ep,{open:o,onOpenChange:l,children:[a.jsx(Op,{asChild:!0,children:a.jsxs("div",{className:"w-full px-4 py-3 flex items-center justify-between hover:bg-slate-50 transition-colors cursor-pointer",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(yG,{className:"h-5 w-5 text-slate-600"}),a.jsxs("div",{children:[a.jsx("h2",{className:"font-semibold text-slate-900",children:"Discussion Guide"}),p&&a.jsxs("p",{className:"text-xs text-slate-500",children:[e.title," โ€ข ",e.total_duration," minutes"]})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(se,{variant:"ghost",size:"sm",onClick:g=>{g.stopPropagation(),h()},disabled:!e||d,className:"h-8",children:d?a.jsx(Dl,{className:"h-4 w-4 animate-spin"}):a.jsx(ed,{className:"h-4 w-4"})}),o?a.jsx(wp,{className:"h-4 w-4 text-slate-500"}):a.jsx(Ta,{className:"h-4 w-4 text-slate-500"})]})]})}),a.jsx(kp,{children:a.jsx("div",{className:"border-t bg-slate-50",children:a.jsx(Ke,{className:"mx-4 mb-4 mt-2",children:a.jsx(lt,{className:"p-4",children:a.jsx("div",{className:"max-h-[70vh] overflow-y-auto",children:a.jsx(B5,{discussionGuide:e,moderatorStatus:t,onSectionSelect:n,onSetPosition:r,onSave:s,showProgress:!0,collapsible:!0,focusGroupId:i})})})})})})]})})},qEe=C.memo(GEe,(e,t)=>{const n=["discussionGuide","onSectionSelect","onSave","focusGroupId","isOpen","onToggle","className"];let r=!1;for(const s of n)if(e[s]!==t[s]){r=!0;break}return e.moderatorStatus!==t.moderatorStatus&&!r||!r&&e.moderatorStatus===t.moderatorStatus?!0:(console.log("๐Ÿ”„ Will re-render (props changed)",{changedProps:n.filter(s=>e[s]!==t[s]),timestamp:new Date().toISOString()}),!1)}),KEe=({focusGroupId:e,focusGroupName:t="Focus Group",onNoteClick:n})=>{const[r,s]=v.useState([]),[i,o]=v.useState(!0),[l,c]=v.useState(null);v.useEffect(()=>{u()},[e]);const u=async()=>{try{o(!0);const y=await Ct.getNotes(e);if(y.data&&Array.isArray(y.data)){const w=y.data.map(j=>({...j,timestamp:new Date(j.timestamp),createdAt:new Date(j.createdAt)}));s(x(w))}}catch(y){console.error("Error fetching notes:",y),ce.error("Failed to load notes",{description:"Please refresh the page to try again."})}finally{o(!1)}},d=async y=>{c(y);try{await Ct.deleteNote(e,y),s(r.filter(w=>w.id!==y)),ce.success("Note deleted successfully")}catch(w){console.error("Error deleting note:",w),ce.error("Failed to delete note",{description:"Please try again."})}finally{c(null)}},f=y=>{y.associatedMessageId&&n?n(y.associatedMessageId):ce.info("No associated message",{description:"This note is not linked to a specific discussion point."})},h=()=>{if(r.length===0){ce.warning("No notes to export",{description:"Create some notes first before exporting."});return}const y=p(),w=document.createElement("a"),j=new Blob([y],{type:"text/markdown"});w.href=URL.createObjectURL(j),w.download=`${t.replace(/[^a-z0-9]/gi,"_").toLowerCase()}_notes.md`,document.body.appendChild(w),w.click(),document.body.removeChild(w),ce.success("Notes exported successfully",{description:`Downloaded ${r.length} notes as Markdown file.`})},p=()=>{const y=[`# Notes: ${t}`,"",`Exported on: ${new Date().toLocaleString()}`,`Total notes: ${r.length}`,"","---",""];return r.forEach((w,j)=>{var S;y.push(`## Note ${j+1}`),y.push(""),y.push(`**Created:** ${w.createdAt.toLocaleString()}`),(S=w.sectionInfo)!=null&&S.sectionTitle&&y.push(`**Section:** ${w.sectionInfo.sectionTitle}`),y.push(`**Elapsed Time:** ${g(w.elapsedTime)}`),y.push(""),y.push("**Content:**"),y.push(w.content),y.push(""),y.push("---"),y.push("")}),y.join(` +`)},g=y=>{const w=Math.floor(y/1e3),j=Math.floor(w/60),S=w%60;return`${j}:${S.toString().padStart(2,"0")}`},m=y=>y.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),x=y=>[...y].sort((w,j)=>j.createdAt.getTime()-w.createdAt.getTime()),b=y=>{s(w=>x([...w,y]))};return v.useEffect(()=>(window.notesPanelAddNote=b,()=>{delete window.notesPanelAddNote}),[]),i?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(Rg,{className:"h-5 w-5 text-primary mr-2"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"Notes"}),r.length>0&&a.jsxs("span",{className:"ml-2 text-sm text-slate-500",children:["(",r.length,")"]})]}),a.jsxs(se,{variant:"outline",size:"sm",onClick:h,disabled:r.length===0,children:[a.jsx(ed,{className:"mr-2 h-4 w-4"}),"Export Notes"]})]}),a.jsx(p0,{className:"flex-1",children:r.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center bg-slate-50 rounded-lg",children:[a.jsx(Rg,{className:"h-8 w-8 text-slate-400 mb-3"}),a.jsx("p",{className:"text-slate-600",children:"No notes yet."}),a.jsx("p",{className:"text-sm text-slate-500 mt-2",children:'Click the "Note" button during the session to add contextual notes.'})]}):a.jsx("div",{className:"space-y-4",children:r.map(y=>{var w;return a.jsxs(Ke,{className:"hover:shadow-md transition-shadow cursor-pointer group",onClick:()=>f(y),children:[a.jsx(Fr,{className:"pb-2",children:a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(ts,{className:"text-sm font-medium text-slate-600",children:m(y.createdAt)}),((w=y.sectionInfo)==null?void 0:w.sectionTitle)&&a.jsx("div",{className:"text-xs text-slate-500 mt-1",children:a.jsx("span",{children:y.sectionInfo.sectionTitle})})]}),a.jsxs("div",{className:"flex items-center space-x-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[y.associatedMessageId&&a.jsx(se,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:j=>{j.stopPropagation(),f(y)},title:"Go to discussion point",children:a.jsx(EG,{className:"h-3 w-3"})}),a.jsx(se,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-red-600 hover:text-red-700",onClick:j=>{j.stopPropagation(),d(y.id)},disabled:l===y.id,title:"Delete note",children:a.jsx(wn,{className:"h-3 w-3"})})]})]})}),a.jsx(lt,{className:"pt-0",children:a.jsx("p",{className:"text-sm text-slate-700 whitespace-pre-wrap",children:y.content})})]},y.id)})})})]})},XEe=({isOpen:e,onClose:t,focusGroupId:n,associatedMessageId:r,sectionInfo:s,messageTimestamp:i,onNoteSaved:o})=>{const[l,c]=v.useState(""),[u,d]=v.useState(!1),f=async()=>{if(!l.trim()){ce.error("Note content cannot be empty");return}d(!0);try{const p={content:l.trim(),associatedMessageId:r,sectionInfo:s,elapsedTime:0,timestamp:i.toISOString(),createdAt:new Date().toISOString()},g=await Ct.createNote(n,p);if(g.data){const m={...g.data,timestamp:new Date(g.data.timestamp),createdAt:new Date(g.data.createdAt)},x=s!=null&&s.sectionTitle?`'${s.sectionTitle}'`:"current section",b=i.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});ce.success("Quick note saved",{description:`Note linked to ${x} at ${b}`}),o&&o(m),c(""),t()}}catch(p){console.error("Error saving note:",p),ce.error("Failed to save note",{description:"Please try again or check your connection."})}finally{d(!1)}},h=()=>{c(""),t()};return a.jsx(wo,{open:e,onOpenChange:h,children:a.jsxs(la,{className:"sm:max-w-md",children:[a.jsx(ca,{children:a.jsx(ua,{children:"Quick Note"})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"text-sm text-slate-600",children:[a.jsxs("div",{children:[a.jsx("strong",{children:"Section:"})," ",(s==null?void 0:s.sectionTitle)||"Unknown section"]}),a.jsxs("div",{children:[a.jsx("strong",{children:"Time:"})," ",i.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),a.jsx(et,{placeholder:"Enter your note here...",value:l,onChange:p=>c(p.target.value),className:"min-h-[100px] resize-none",autoFocus:!0})]}),a.jsxs(jo,{children:[a.jsx(se,{variant:"outline",onClick:h,disabled:u,children:"Cancel"}),a.jsx(se,{onClick:f,disabled:u,children:u?"Saving...":"Save Note"})]})]})})},YEe=()=>{const{id:e}=wR(),t=Rn(),[n,r]=v.useState([]),[s,i]=v.useState([]),[o,l]=v.useState([]),[c,u]=v.useState(null),[d,f]=v.useState([]),[h,p]=v.useState("chat"),[g,m]=v.useState(null),[x,b]=v.useState(!1),[y,w]=v.useState(!1),[j,S]=v.useState(!0),[N,P]=v.useState(!1),[_,A]=v.useState(!1),O=v.useRef(!1),[T,k]=v.useState([]),[M,R]=v.useState(!1),[H,F]=v.useState(""),[V,$]=v.useState(!1),[L,Y]=v.useState(!1),[Q,ee]=v.useState(null),[fe,W]=v.useState([]),[he,pe]=v.useState(!1),[ue,Ae]=v.useState(!1),[de,oe]=v.useState(!1),[xe,te]=v.useState({isOpen:!1}),Ye=v.useRef(!1),[G,ve]=v.useState(""),Pe=v.useRef(""),Ie=v.useRef(!1),E=async()=>{var B;if(e)try{const z=await vn.getModeratorStatus(e);if((B=z==null?void 0:z.data)!=null&&B.status){const re=z.data.status;if(g){const me=g.current_section_id!==re.current_section_id||g.current_item_id!==re.current_item_id||g.progress!==re.progress}O.current||m(re)}}catch(z){console.error("Error fetching moderator status:",z)}},D=async()=>{if(!e)return{aiActive:!1,sessionStatus:""};try{if(typeof(Ct==null?void 0:Ct.getById)!="function")return console.error("focusGroupsApi.getById is not a function:",typeof(Ct==null?void 0:Ct.getById)),{aiActive:y,sessionStatus:G};const B=await Ct.getById(e);if(!B||typeof B!="object")return console.error("Invalid response object received:",B),{aiActive:y,sessionStatus:G};if(!B.data||typeof B.data!="object")return console.warn("Focus group response missing data property:",B),{aiActive:y,sessionStatus:G};const z=B.data.status;if(typeof z>"u")return console.warn("Focus group response missing status field:",B.data),{aiActive:y,sessionStatus:G};const re=z==="ai_mode";return z==="autonomous_active"?console.warn('Detected legacy "autonomous_active" status - backend may need updating to "ai_mode"'):["ai_mode","active","completed","paused","draft","in-progress"].includes(z)||console.warn("Unexpected focus group status value:",z),{aiActive:re,sessionStatus:z}}catch(B){console.error("Error checking AI mode status:",B);const z={focusGroupId:e,currentAiModeStatus:y,errorType:"unknown",timestamp:new Date().toISOString()};return B.response?(z.errorType="api_error",z.status=B.response.status,z.data=B.response.data,console.error("API error response:",B.response.status,B.response.data),B.response.status===404?console.warn("Focus group not found - may have been deleted"):B.response.status===500&&console.error("Server error during status check - backend issue")):B.request?(z.errorType="network_error",console.error("Network error - no response received, check connectivity")):(z.errorType="request_setup",z.message=B.message,console.error("Request setup error:",B.message)),console.debug("Status check error details:",z),{aiActive:y,sessionStatus:G}}},U=async(B,z)=>{if(!e||Ie.current)return;const re=["completed","paused"],le=["ai_mode","autonomous_active","active","in-progress"].includes(z),Ue=re.includes(B);if(le&&Ue){Ie.current=!0;try{let Ne="session_ended";B==="completed"?Ne="auto_complete":B==="paused"&&(Ne="manual_stop");const ze=await vn.endSession(e,Ne);ze!=null&&ze.data&&(Qe.success("Session concluded",{description:"The focus group session has ended with a concluding statement from the moderator."}),setTimeout(()=>{K()},1e3))}catch(Ne){console.error("โŒ Error ending session with concluding statement:",Ne),Qe.error("Error ending session",{description:"Failed to add concluding statement, but the session has ended."})}}},K=async()=>{var B;if(e)try{const z=await Ct.getMessages(e);let re=[],me=[];z&&z.data&&(Array.isArray(z.data)?(re=z.data,me=[]):z.data.messages||z.data.mode_events?(re=z.data.messages||[],me=z.data.mode_events||[]):(re=Array.isArray(z.data)?z.data:[],me=[]));const le=re.map(Se=>({id:Se._id||Se.id||`msg-${Date.now()}`,senderId:Se.senderId,text:Se.text,timestamp:new Date(Se.timestamp||Se.created_at||new Date),type:Se.type||"response",highlighted:Se.highlighted||!1})),Ue=me.map(Se=>({id:Se._id||Se.id||`event-${Date.now()}`,focus_group_id:Se.focus_group_id,event_type:Se.event_type,timestamp:new Date(Se.timestamp||Se.created_at||new Date),user_id:Se.user_id,created_at:new Date(Se.created_at||new Date)}));i(Ue),le.length>0?r(Se=>{if(Se.length===0)return le;{const at=new Map;Se.forEach(Lt=>at.set(Lt.id,Lt));const Ce=le.map(Lt=>{if(at.has(Lt.id)){const zt=at.get(Lt.id);return{...Lt,highlighted:zt.highlighted}}return Lt}),ut=new Set(Ce.map(Lt=>Lt.id)),Tt=Se.filter(Lt=>!ut.has(Lt.id));return[...Ce,...Tt].sort((Lt,zt)=>Lt.timestamp.getTime()-zt.timestamp.getTime())}}):le.length===0&&r(Se=>Se.length===0?[]:Se);const Ne=le.filter(Se=>Se.highlighted),ze=Ne.length>0?Ne.map(Se=>({id:`theme-${Se.id}`,text:Se.text.substring(0,40)+(Se.text.length>40?"...":""),count:1,messages:[Se.id],source:"highlight"})):[];try{const Se=await vn.getKeyThemes(e);if((B=Se==null?void 0:Se.data)!=null&&B.themes&&Array.isArray(Se.data.themes)){const at=Se.data.themes;l([...ze,...at])}else l(ze)}catch(Se){console.error("Error fetching AI-generated themes:",Se),l(ze)}}catch(z){console.error("Error fetching messages:",z),n.length===0&&Qe.error("Failed to fetch messages",{description:"Please try again later or restart the session."})}},J=async()=>{if(!e)return!1;try{const z=(await $n.getAll()).data||[],re=await Ct.getById(e);if(re&&re.data){const me=re.data;console.log("Focus group data from API:",me);const le={id:me._id||me.id,name:me.name,status:me.status||"in-progress",participants:me.participants||[],date:me.date||new Date().toISOString(),duration:me.duration||60,topic:me.topic||"general",discussionGuide:me.discussionGuide||"",llm_model:me.llm_model||"gemini-2.5-pro"};if(u(le),F(le.llm_model||"gemini-2.5-pro"),me.participants_data&&Array.isArray(me.participants_data))f(me.participants_data.map(Ne=>({...Ne,id:Ne._id||Ne.id})));else if(le.participants&&Array.isArray(le.participants)){console.log("Matching participants from DB:",{focusGroupParticipants:le.participants,allPersonas:z.map(ze=>({id:ze._id||ze.id,name:ze.name}))});const Ne=z.filter(ze=>{const Se=ze._id||ze.id;return le.participants.includes(Se)});console.log("Matched participants:",Ne.map(ze=>ze.name)),f(Ne)}await K(),await E();const Ue=await D();return w(Ue.aiActive),ve(Ue.sessionStatus),Ye.current=Ue.aiActive,Pe.current=Ue.sessionStatus,!0}return!1}catch(B){return console.error("Error fetching focus group:",B),!1}},X=async B=>{if(console.log("๐Ÿ”ง updateFocusGroupModel called with:",{id:e,focusGroup:!!c,newModel:B}),!e||!c){console.log("โŒ updateFocusGroupModel: Missing id or focusGroup",{id:e,focusGroup:!!c});return}$(!0);try{console.log("๐Ÿ”ง Making API call to update focus group model:",{id:e,newModel:B});const z=await Ct.update(e,{llm_model:B});console.log("๐Ÿ”ง API response:",z),z&&z.data?(u(re=>re?{...re,llm_model:B}:null),Qe.success("AI Model Updated",{description:`Focus group will now use ${B==="gemini-2.5-pro"?"Gemini 2.5 Pro":"GPT-4.1"} for AI responses`}),R(!1),console.log("โœ… Model update successful")):console.log("โŒ API response missing data:",z)}catch(z){console.error("โŒ Error updating focus group model:",z),Qe.error("Failed to update AI model",{description:"There was an error updating the AI model. Please try again."})}finally{$(!1)}};v.useEffect(()=>{console.log("Looking for focus group with ID:",e);const B=async()=>{try{return(await $n.getAll()).data||[]}catch(le){return console.error("Error fetching personas:",le),[]}},z=async le=>{try{const Ue=await Ct.getById(e);if(Ue&&Ue.data){const Ne=Ue.data;console.log("Focus group data from API:",Ne);const ze={id:Ne._id||Ne.id,name:Ne.name,status:Ne.status||"in-progress",participants:Ne.participants||[],date:Ne.date||new Date().toISOString(),duration:Ne.duration||60,topic:Ne.topic||"general",discussionGuide:Ne.discussionGuide||"",llm_model:Ne.llm_model||"gemini-2.5-pro"};if(u(ze),F(ze.llm_model||"gemini-2.5-pro"),Ne.participants_data&&Array.isArray(Ne.participants_data))f(Ne.participants_data.map(Se=>({...Se,id:Se._id||Se.id})));else if(ze.participants&&Array.isArray(ze.participants)){console.log("Matching participants from DB:",{focusGroupParticipants:ze.participants,allPersonas:le.map(at=>({id:at._id||at.id,name:at.name}))});const Se=le.filter(at=>{const Ce=at._id||at.id;return ze.participants.includes(Ce)});console.log("Matched participants:",Se.map(at=>at.name)),f(Se)}return K(),E(),S(!1),!0}return!1}catch(Ue){return console.error("Error fetching focus group:",Ue),!1}};let re,me;return B().then(le=>{z(le).then(Ue=>{Ue?((()=>{K(),E(),re&&window.clearInterval(re);const Se=y?3e3:1e4;console.log("๐Ÿ“ก Setting up message polling:",{aiModeActive:y,pollInterval:Se,timestamp:new Date().toISOString()}),re=window.setInterval(()=>{O.current?console.log("๐Ÿ“ก Skipping poll - editing discussion guide"):(console.log("๐Ÿ“ก Polling for messages...",new Date().toISOString()),K(),E())},Se)})(),me=window.setInterval(async()=>{const Se=Ye.current,at=Pe.current,Ce=await D();if(Ye.current=Ce.aiActive,Pe.current=Ce.sessionStatus,w(Ce.aiActive),ve(Ce.sessionStatus),at&&at!==Ce.sessionStatus&&await U(Ce.sessionStatus,at),Se!==Ce.aiActive&&re){window.clearInterval(re);const ut=Ce.aiActive?3e3:1e4;re=window.setInterval(()=>{O.current||(K(),E())},ut)}},15e3)):(console.error("Focus group not found with ID:",e),S(!1),Qe.error("Focus group not found",{description:`Could not find focus group with ID: ${e}`}))})}),()=>{re&&window.clearInterval(re),me&&window.clearInterval(me)}},[e,t]);const be=B=>{if(!B||!B.sections||!Array.isArray(B.sections))return{content:"Welcome to our focus group session! Let's begin our discussion.",sectionId:"welcome",itemId:"welcome-message"};const z=B.sections[0];if(!z)return{content:"Welcome to our focus group session! Let's begin our discussion.",sectionId:"welcome",itemId:"welcome-message"};const re=le=>le.questions&&Array.isArray(le.questions)&&le.questions.length>0?{content:le.questions[0].content,itemId:le.questions[0].id,type:"question"}:le.activities&&Array.isArray(le.activities)&&le.activities.length>0?{content:le.activities[0].content,itemId:le.activities[0].id,type:"activity"}:null;let me=re(z);if(!me&&z.subsections&&Array.isArray(z.subsections)){for(const le of z.subsections)if(me=re(le),me)break}return me?{content:me.content,sectionId:z.id,itemId:me.itemId}:{content:`Welcome to our focus group session on "${z.title||"our topic"}". Let's begin our discussion.`,sectionId:z.id,itemId:"section-intro"}},_e=async()=>{var B,z,re,me,le,Ue;if(e)try{Qe.info("Starting focus group session...",{description:"The session is now ready for AI moderation."});try{const Ne=await vn.getModeratorStatus(e),ze=(z=(B=Ne==null?void 0:Ne.data)==null?void 0:B.status)==null?void 0:z.moderator_position;ze?console.log("๐Ÿ“ Preserving existing moderator position:",ze):(await vn.setModeratorPosition(e,((le=(me=(re=c==null?void 0:c.discussionGuide)==null?void 0:re.sections)==null?void 0:me[0])==null?void 0:le.id)||"welcome"),console.log("๐Ÿš€ Moderator position initialized to start of discussion guide (first time)"))}catch(Ne){console.warn("Failed to check/initialize moderator position:",Ne)}await Ct.update(e,{status:"active"});try{const Ne=be(c==null?void 0:c.discussionGuide),ze={id:`msg-${Date.now()}`,senderId:"moderator",text:Ne.content,timestamp:new Date,type:"question"},Se=await Ct.sendMessage(e,{senderId:"moderator",text:ze.text,type:"question"});(Ue=Se==null?void 0:Se.data)!=null&&Ue.message_id&&(ze.id=Se.data.message_id),Fe(ze),console.log("๐Ÿš€ Initial moderator message created:",{content:Ne.content,sectionId:Ne.sectionId,itemId:Ne.itemId})}catch(Ne){console.warn("Failed to create initial moderator message:",Ne)}Qe.success("Focus group session started",{description:"The discussion has begun. Use the control panel below to moderate."})}catch(Ne){console.error("Error starting session:",Ne),Qe.error("Error starting session",{description:"There was a problem connecting to the server."})}},Fe=B=>{r(z=>[...z,B])},ie=async B=>{const z=[...n],re=z.findIndex(me=>me.id===B);if(re!==-1){const me=z[re],le=!me.highlighted;if(z[re]={...me,highlighted:le},r(z),e)try{!B.startsWith("local-")&&!B.startsWith("msg-")?await Ct.updateMessageHighlight(e,B,le):console.log("Skipping database update for local message:",B)}catch(Ue){console.error("Error updating message highlight state:",Ue),Qe.error("Failed to save highlight state",{description:"The highlight may not persist if the page is refreshed."})}}},Te=B=>d.find(z=>z.id===B||z._id===B),Be=()=>{const B=n.map(me=>{var Ne;let le;return me.senderId==="moderator"?le="AI Moderator":me.senderId==="facilitator"?le="Human Facilitator":le=((Ne=Te(me.senderId))==null?void 0:Ne.name)||"Unknown",`[${me.timestamp.toLocaleTimeString()}] ${le}: ${me.text}`}).join(` + +`),z=document.createElement("a"),re=new Blob([B],{type:"text/plain"});z.href=URL.createObjectURL(re),z.download=`focus-group-${e}-transcript.txt`,document.body.appendChild(z),z.click(),document.body.removeChild(z),Qe.success("Transcript downloaded",{description:"The focus group transcript has been saved to your device."})},gt=(B,z)=>{const re=Ce=>{const ut=Ce.match(/^\[([^\]]+)\]:\s*(.*)$/);return ut?ut[2].trim():Ce.trim()},me=Ce=>Ce.toLowerCase().replace(/[^\w\s]/g," ").replace(/\s+/g," ").trim(),le=(Ce,ut)=>{const Tt=me(Ce),nr=me(ut);if(Tt===nr)return 1;if(Tt.includes(nr)||nr.includes(Tt))return Math.min(Tt.length,nr.length)/Math.max(Tt.length,nr.length);const Lt=Tt.split(" "),zt=nr.split(" "),Pd=Lt.filter(eC=>zt.includes(eC)&&eC.length>2);return Lt.length===0||zt.length===0?0:Pd.length/Math.max(Lt.length,zt.length)},Ue=typeof B=="object"&&B!==null,Ne=Ue?B.text:re(B),ze=Ue?B.original:B;let Se=null,at="";if(z&&(Se=n.find(Ce=>Ce.id===z),Se?at="direct_message_id_match":console.warn(`Message ID ${z} not found in current messages array`)),Se||(Se=n.find(Ce=>Ce.text.includes(ze)),Se&&(at="exact_full_match")),Se||(Se=n.find(Ce=>Ce.text.includes(Ne)),Se&&(at="exact_text_match")),Se||(Se=n.find(Ce=>Ne.includes(Ce.text.trim())),Se&&(at="reverse_exact_match")),!Se){const Ce=Ne.toLowerCase();Se=n.find(ut=>ut.text.toLowerCase().includes(Ce)||Ce.includes(ut.text.toLowerCase())),Se&&(at="case_insensitive_match")}if(!Se){const Ce=n.map(ut=>({message:ut,similarity:le(Ne,ut.text)})).filter(ut=>ut.similarity>.7).sort((ut,Tt)=>Tt.similarity-ut.similarity);Ce.length>0&&(Se=Ce[0].message,at=`fuzzy_match_${Math.round(Ce[0].similarity*100)}%`)}if(!Se){const ut=me(Ne).split(" ").filter(Tt=>Tt.length>3);ut.length>0&&(Se=n.find(Tt=>{const nr=me(Tt.text);return ut.every(Lt=>nr.includes(Lt))}),Se&&(at="partial_word_match"))}Se?(console.log(`Quote match found using strategy: ${at}`,{quoteType:Ue?"QuoteData":"string",providedMessageId:z,extractedText:Ne,matchedMessage:Se.text.substring(0,100),matchedMessageId:Se.id,originalQuote:ze.substring(0,100)}),p("chat"),setTimeout(()=>{const Ce=document.getElementById(`message-${Se.id}`);Ce&&(_||Ce.scrollIntoView({behavior:"smooth",block:"center"}),Ce.style.backgroundColor="#fbbf24",Ce.style.transition="background-color 0.3s ease",setTimeout(()=>{Ce.style.backgroundColor=""},2e3))},100)):(console.warn("Quote match failed",{quoteType:Ue?"QuoteData":"string",providedMessageId:z,originalQuote:ze.substring(0,100),extractedText:Ne.substring(0,100),totalMessages:n.length,messageSample:n.slice(0,3).map(Ce=>({id:Ce.id,text:Ce.text.substring(0,50)}))}),Qe.warning("Message not found",{description:"Could not locate the original message for this quote. The quote may have been paraphrased by the AI."}))},At=B=>{l(z=>{const re=new Set(z.map(le=>le.id)),me=B.filter(le=>!re.has(le.id));return[...z,...me]})},pn=async B=>{if(!e)return;const z=o.find(re=>re.id===B);if(z)try{"source"in z&&z.source==="generated"&&await vn.deleteKeyTheme(e,B),l(o.filter(re=>re.id!==B))}catch(re){console.error("Error deleting theme:",re),Qe.error("Failed to delete theme",{description:"There was an error removing the theme. Please try again."})}},Zt=v.useCallback(async(B,z)=>{if(e)try{await vn.setModeratorPosition(e,B,z),await E(),Qe.success("Moderator position updated",{description:"The moderator has been moved to the selected section."})}catch(re){console.error("Error setting moderator position:",re),Qe.error("Failed to update moderator position",{description:"There was an error updating the moderator position."})}},[e]),bn=v.useCallback(async B=>{if(e)try{await Ct.update(e,{discussionGuide:B}),u(z=>z?{...z,discussionGuide:B}:null)}catch(z){throw console.error("Error saving discussion guide:",z),z}},[e]),Xt=v.useCallback(()=>{P(B=>!B)},[]),yt=v.useCallback((B,z,re,me,le,Ue)=>{te({isOpen:!0,sectionId:B,itemId:z,content:re,sectionTitle:me,itemTitle:le,itemType:Ue})},[]),Rr=B=>{console.log("๐Ÿ” EXTRACT ASSET FILENAME DEBUG - Input content:",B);const z=[/'([^']*\.[a-zA-Z]{3,4})'/g,/"([^"]*\.[a-zA-Z]{3,4})"/g,/titled\s+['"]([^'"]*\.[a-zA-Z]{3,4})['"](?:\.|,|\s|$)/gi,/asset[:\s]+['"]?([^'"\s]*\.[a-zA-Z]{3,4})['"]?(?:\.|,|\s|$)/gi,/image[:\s]+['"]?([^'"\s]*\.[a-zA-Z]{3,4})['"]?(?:\.|,|\s|$)/gi,/file[:\s]+['"]?([^'"\s]*\.[a-zA-Z]{3,4})['"]?(?:\.|,|\s|$)/gi,/\b([a-zA-Z0-9_-]+\.[a-zA-Z]{3,4})\b/g];for(let re=0;re0){const Ue=le[0][1];if(console.log(`๐Ÿ” Pattern ${re+1} extracted filename:`,Ue),Ue&&Ue.includes("."))return console.log("โœ… EXTRACT ASSET FILENAME - Found:",Ue),Ue}}return console.warn("โŒ EXTRACT ASSET FILENAME - No filename found in content"),null},tt=()=>{if(g)return{sectionId:g.current_section_id,sectionTitle:g.current_section,itemId:g.current_item_id,itemTitle:g.current_item}},It=()=>{if(n.length!==0)return n[n.length-1].id},kt=()=>{const B=It();if(!B||n.length===0)return new Date;const z=n.find(re=>re.id===B);return z?z.timestamp:new Date},Dn=async()=>{if(e){pe(!0),Ae(!1),oe(!1),Qe.info("Analyzing discussion for key themes...",{description:"This may take a moment as we process the entire conversation."});try{const B=await vn.generateKeyThemes(e);B.data&&B.data.themes?(Ae(!0),Qe.success(`Generated ${B.data.themes.length} key themes`,{description:"New themes have been added to the analysis."}),l(z=>[...z,...B.data.themes])):(Ae(!0),Qe.warning("No new themes were generated",{description:"Try again when the discussion has more content."}))}catch(B){console.error("Error generating key themes:",B),oe(!0),Qe.error("Failed to generate key themes",{description:"There was an error analyzing the discussion. Please try again."})}}},q=()=>{pe(!1),Ae(!1),oe(!1)},we=()=>{Q||ee(new Date),Y(!0)},I=B=>{k(z=>[...z,B].sort((re,me)=>me.createdAt.getTime()-re.createdAt.getTime())),window.notesPanelAddNote&&window.notesPanelAddNote(B)},Z=B=>{const z=n.find(re=>re.id===B);z?(p("chat"),setTimeout(()=>{const re=document.getElementById(`message-${z.id}`);re&&(_||re.scrollIntoView({behavior:"smooth",block:"center"}),re.style.backgroundColor="#fbbf24",re.style.transition="background-color 0.3s ease",setTimeout(()=>{re.style.backgroundColor=""},2e3))},100)):Qe.info("Message not found",{description:"Could not locate the original message for this note."})};v.useEffect(()=>{n.length>0&&!Q&&ee(new Date)},[n.length,Q]),v.useEffect(()=>{O.current=_,_||E()},[_]);const ne=B=>{W(z=>z.includes(B)?z.filter(re=>re!==B):[...z,B])};return j?a.jsxs("div",{className:"min-h-screen bg-slate-50 pt-20 pb-16 px-4",children:[a.jsx(oa,{}),a.jsxs("div",{className:"max-w-7xl mx-auto text-center py-12",children:[a.jsx("div",{className:"flex justify-center items-center",children:a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}),a.jsx("p",{className:"mt-4 text-slate-600",children:"Loading focus group..."})]})]}):c?a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(oa,{}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center mb-4",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(se,{variant:"ghost",onClick:()=>t("/focus-groups"),className:"mr-2",children:a.jsx(nh,{className:"h-4 w-4"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"font-sf text-2xl font-bold text-slate-900",children:c.name}),a.jsx("p",{className:"text-slate-600",children:new Date(c.date).toLocaleString()}),a.jsxs("div",{className:"flex items-center mt-1",children:[a.jsx(bo,{className:"h-3 w-3 text-slate-500 mr-1"}),a.jsx(Yn,{variant:"secondary",className:"text-xs",children:c.llm_model==="gpt-4.1"?"GPT-4.1":"Gemini 2.5 Pro"})]})]})]}),a.jsxs("div",{className:"flex items-center space-x-4 mt-4 sm:mt-0",children:[a.jsxs(se,{variant:"outline",onClick:()=>b(!x),className:x?"bg-blue-50 text-blue-600":"",children:[a.jsx(qw,{className:"mr-2 h-4 w-4"}),"AI Dashboard"]}),a.jsxs(se,{variant:"outline",onClick:()=>R(!0),children:[a.jsx(EN,{className:"mr-2 h-4 w-4"}),"AI Model"]}),a.jsxs(se,{variant:"outline",onClick:Be,children:[a.jsx(ed,{className:"mr-2 h-4 w-4"}),"Download Transcript"]})]})]}),he&&a.jsx("div",{className:"mb-6",children:a.jsx(O_,{isActive:he,isComplete:ue,hasError:de,label:"Analyzing discussion for key themes",onComplete:q,className:"max-w-4xl mx-auto"})}),a.jsx(qEe,{discussionGuide:c.discussionGuide,moderatorStatus:g,onSectionSelect:Zt,onSetPosition:yt,onSave:bn,focusGroupId:e||"",isOpen:N,onToggle:Xt,onEditingChange:A}),a.jsxs("div",{className:"flex flex-col lg:flex-row gap-6 h-[calc(100vh-12rem)]",children:[a.jsx(fEe,{participants:d,selectedParticipantIds:fe,onToggleParticipantFilter:ne}),a.jsx("div",{className:"flex-1 flex flex-col",children:a.jsxs(Ho,{defaultValue:"chat",value:h,onValueChange:p,className:"w-full h-full flex flex-col",children:[a.jsxs($a,{className:"grid grid-cols-4 mb-4",children:[a.jsxs(Wt,{value:"chat",className:"flex items-center",children:[a.jsx(vs,{className:"h-4 w-4 mr-2"}),"Discussion"]}),a.jsxs(Wt,{value:"themes",className:"flex items-center",children:[a.jsx(Rl,{className:"h-4 w-4 mr-2"}),"Key Themes"]}),a.jsxs(Wt,{value:"notes",className:"flex items-center",children:[a.jsx(Rg,{className:"h-4 w-4 mr-2"}),"Notes"]}),a.jsxs(Wt,{value:"analytics",className:"flex items-center",children:[a.jsx(qw,{className:"h-4 w-4 mr-2"}),"Analytics"]})]}),a.jsx(Ht,{value:"chat",className:"m-0 flex-1 flex flex-col h-0",children:n.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[a.jsx("p",{className:"text-lg text-slate-600",children:"No messages yet. Start the session to begin the discussion."}),a.jsxs(se,{onClick:_e,size:"lg",className:"flex items-center gap-2",children:[a.jsx(Kw,{className:"h-5 w-5"}),"Start Session"]})]}):a.jsx(zEe,{messages:n,modeEvents:s,personas:d,isSpeaking:!1,focusGroupId:e||"",isAiModeActive:y,selectedParticipantIds:fe,onToggleHighlight:ie,onAdvanceDiscussion:()=>null,onNewMessage:Fe,onStatusChange:J,isEditingDiscussionGuide:_})}),a.jsx(Ht,{value:"themes",className:"m-0",children:a.jsx(VEe,{themes:o,messages:n,personas:d,focusGroupId:e||"",onThemesGenerated:At,onThemeDelete:pn,onQuoteClick:gt,onGenerateKeyThemes:Dn})}),a.jsx(Ht,{value:"notes",className:"m-0",style:{height:"calc(100% - 3.5rem)"},children:a.jsx("div",{className:"h-full",children:a.jsx(KEe,{focusGroupId:e||"",focusGroupName:c==null?void 0:c.name,onNoteClick:Z})})}),a.jsx(Ht,{value:"analytics",className:"m-0",children:a.jsx(WEe,{messages:n,themes:o,personas:d})})]})})]})]}),n.length>0&&a.jsx("div",{className:"fixed bottom-6 right-6 z-40",children:a.jsx(se,{onClick:we,className:"rounded-full h-12 w-12 p-0 shadow-lg",title:"Take a quick note",children:a.jsx(Rg,{className:"h-5 w-5"})})}),a.jsx(XEe,{isOpen:L,onClose:()=>Y(!1),focusGroupId:e||"",associatedMessageId:It(),sectionInfo:tt(),messageTimestamp:kt(),onNoteSaved:I}),a.jsx(wo,{open:xe.isOpen,onOpenChange:B=>te(z=>({...z,isOpen:B})),children:a.jsxs(la,{children:[a.jsxs(ca,{children:[a.jsx(ua,{children:"Set Moderator Position"}),a.jsxs(Cl,{children:['Are you sure you want to set the moderator position to "',xe.itemTitle,'" in section "',xe.sectionTitle,'"? This will make the moderator ask this question in the chat.']})]}),a.jsxs(jo,{children:[a.jsx(se,{variant:"outline",disabled:xe.isLoading,onClick:()=>te({isOpen:!1}),children:"Cancel"}),a.jsxs(se,{disabled:xe.isLoading,onClick:async()=>{var B,z,re,me,le,Ue,Ne,ze,Se;if(!(!e||!xe.sectionId||!xe.itemId||!xe.content)){te(at=>({...at,isLoading:!0}));try{await vn.setModeratorPosition(e,xe.sectionId,xe.itemId);let at=[],Ce=!1,ut=xe.content;const Tt=xe.content?Rr(xe.content):null,nr=!!Tt;if(console.log("๐Ÿ” MANUAL POSITION DEBUG:",{itemType:xe.itemType,hasImageAttached:nr,assetFilename:Tt,content:xe.content,sectionTitle:xe.sectionTitle,itemTitle:xe.itemTitle,contentLength:(B=xe.content)==null?void 0:B.length}),nr&&xe.content&&Tt)if(console.log("๐Ÿ” ASSET EXTRACTION DEBUG:",{originalContent:xe.content,extractedFilename:Tt,contentLength:xe.content.length}),Tt){at=[Tt],Ce=!0,console.log("๐ŸŽจ MANUAL POSITION: Creative review detected, will activate visual context for:",Tt);try{console.log("๐ŸŽจ MANUAL MODE: Requesting AI description for",Tt);try{console.log("๐Ÿ” TESTING: Calling test endpoint first...");const Pd=await qe.post(`/focus-groups/${e}/test-endpoint`,{test:"data"});console.log("โœ… TEST: Test endpoint response:",Pd.data)}catch(Pd){console.error("โŒ TEST: Test endpoint failed:",Pd)}const zt=await Ct.describeAsset(e,Tt);zt.data.description&&(ut=xe.content.replace(`'${Tt}'`,`'${Tt}' - ${zt.data.description}`),console.log("โœ… MANUAL MODE: Enhanced question with AI description"),console.log("๐Ÿ” Original:",xe.content),console.log("๐Ÿ” Enhanced:",ut))}catch(zt){console.error("โš ๏ธ MANUAL MODE: Failed to generate AI description:",zt),console.error("โš ๏ธ Error response data:",(z=zt.response)==null?void 0:z.data),console.error("โš ๏ธ Error status:",(re=zt.response)==null?void 0:re.status),console.error("โš ๏ธ Error headers:",(me=zt.response)==null?void 0:me.headers),console.error("โš ๏ธ Full axios error:",{message:zt.message,code:zt.code,status:(le=zt.response)==null?void 0:le.status,statusText:(Ue=zt.response)==null?void 0:Ue.statusText,url:(Ne=zt.config)==null?void 0:Ne.url,method:(ze=zt.config)==null?void 0:ze.method}),Qe.warning("AI description failed",{description:"Using original question text. Image will still be available to participants."})}}else console.warn("โš ๏ธ MANUAL POSITION: Creative review detected but no asset filename extracted from content");const Lt={id:`msg-${Date.now()}`,senderId:"moderator",text:ut,timestamp:new Date,type:"question"};try{const zt=await Ct.sendMessage(e,{senderId:"moderator",text:ut,type:"question",attached_assets:at,activates_visual_context:Ce});(Se=zt==null?void 0:zt.data)!=null&&Se.message_id&&(Lt.id=zt.data.message_id)}catch(zt){console.warn("Failed to save message to API, showing locally:",zt)}Fe(Lt),te({isOpen:!1}),setTimeout(async()=>{await E(),setTimeout(()=>E(),500)},200),Qe.success("Moderator position set",{description:`Position set to "${xe.itemTitle}" in "${xe.sectionTitle}"`})}catch(at){console.error("Error setting moderator position:",at),te(Ce=>({...Ce,isLoading:!1})),Qe.error("Failed to set moderator position",{description:"There was an error setting the moderator position."})}}},className:"flex items-center gap-2",children:[xe.isLoading&&a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),xe.isLoading?"Generating detailed image description...":"Confirm"]})]})]})}),a.jsx(wo,{open:M,onOpenChange:R,children:a.jsxs(la,{children:[a.jsxs(ca,{children:[a.jsx(ua,{children:"AI Model Settings"}),a.jsx(Cl,{children:"Choose which AI model to use for generating responses and discussion guides in this focus group."})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(bo,{className:"h-4 w-4 text-slate-500"}),a.jsx("span",{className:"text-sm font-medium",children:"Current Model:"}),a.jsx(Yn,{variant:"secondary",children:(c==null?void 0:c.llm_model)==="gpt-4.1"?"GPT-4.1":"Gemini 2.5 Pro"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium",children:"Select AI Model:"}),a.jsxs(On,{value:H,onValueChange:B=>{console.log("๐Ÿ”ง Model selection changed:",{from:H,to:B}),F(B)},children:[a.jsx(jn,{className:"mt-1",children:a.jsx(kn,{placeholder:"Select AI model"})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"gemini-2.5-pro",children:"Gemini 2.5 Pro"}),a.jsx(ye,{value:"gpt-4.1",children:"GPT-4.1"})]})]})]}),a.jsxs("div",{className:"text-xs text-slate-600",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"Gemini 2.5 Pro:"})," Google's advanced model, great for creative and analytical tasks."]}),a.jsxs("p",{children:[a.jsx("strong",{children:"GPT-4.1:"})," OpenAI's latest model, excellent for conversational and reasoning tasks."]})]})]}),a.jsxs(jo,{children:[a.jsx(se,{variant:"outline",onClick:()=>R(!1),disabled:V,children:"Cancel"}),a.jsxs(se,{onClick:()=>{console.log("๐Ÿ”ง Update button clicked:",{selectedModel:H,currentModel:c==null?void 0:c.llm_model,isDisabled:V||H===(c==null?void 0:c.llm_model)}),X(H)},disabled:V||H===(c==null?void 0:c.llm_model),children:[V&&a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"}),V?"Updating...":"Update Model"]})]})]})}),a.jsx(HEe,{focusGroupId:e,personas:d,isVisible:x,onToggle:()=>b(!x)})]}):a.jsxs("div",{className:"min-h-screen bg-slate-50 pt-20 pb-16 px-4",children:[a.jsx(oa,{}),a.jsxs("div",{className:"max-w-7xl mx-auto text-center py-12",children:[a.jsx("h1",{className:"text-2xl font-bold",children:"Focus group not found"}),a.jsx("p",{className:"mt-2 text-slate-600",children:"We couldn't find the focus group you're looking for."}),a.jsxs(se,{onClick:()=>t("/focus-groups"),className:"mt-4",children:[a.jsx(nh,{className:"mr-2 h-4 w-4"})," Back to Focus Groups"]})]})]})},ZEe=({title:e,description:t})=>a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center mb-8",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"font-sf text-3xl font-bold text-slate-900",children:e}),a.jsx("p",{className:"text-slate-600 mt-1",children:t})]}),a.jsxs("div",{className:"mt-4 sm:mt-0 flex gap-2",children:[a.jsx(se,{variant:"outline",children:"Export Data"}),a.jsx(se,{children:"Generate Report"})]})]}),zb=({title:e,value:t,changePercentage:n,icon:r})=>a.jsx(Ke,{className:"p-6 hover:shadow-md transition-shadow",children:a.jsxs("div",{className:"flex justify-between items-start",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-muted-foreground text-sm",children:e}),a.jsx("h3",{className:"text-2xl font-bold mt-1",children:t}),a.jsxs("p",{className:`${n>=0?"text-green-500":"text-red-500"} text-xs mt-1`,children:[n>=0?"โ†‘":"โ†“"," ",Math.abs(n),"% from last month"]})]}),a.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:a.jsx(r,{className:"h-6 w-6 text-primary"})})]})}),QEe=[{name:"Jan",users:20,groups:3,interactions:120},{name:"Feb",users:25,groups:4,interactions:160},{name:"Mar",users:30,groups:5,interactions:220},{name:"Apr",users:40,groups:6,interactions:280},{name:"May",users:45,groups:7,interactions:350},{name:"Jun",users:48,groups:7,interactions:420}],JEe=[{id:"1",title:"User Interface Feedback",description:"Users consistently mentioned difficulty with the navigation menu on mobile devices.",source:"Mobile App Focus Group",date:"2023-06-12",sentiment:"negative"},{id:"2",title:"Feature Adoption",description:'The new search functionality is well-received, with 85% of users rating it as "very useful".',source:"Product Testing Group",date:"2023-06-10",sentiment:"positive"},{id:"3",title:"Pricing Strategy",description:"Price-conscious users expressed willingness to pay up to 20% more for premium features.",source:"Pricing Model Analysis",date:"2023-06-08",sentiment:"positive"},{id:"4",title:"Competitive Analysis",description:"Users who switched from competitor products cited our streamlined onboarding as a key factor.",source:"Customer Journey Mapping",date:"2023-06-05",sentiment:"positive"}],eOe=()=>a.jsxs("div",{className:"space-y-6",children:[a.jsxs(Ke,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-semibold mb-4",children:"Research Activity"}),a.jsx("div",{className:"h-64",children:a.jsx(ha,{width:"100%",height:"100%",children:a.jsxs(Zz,{data:QEe,margin:{top:10,right:30,left:0,bottom:0},children:[a.jsx(lp,{strokeDasharray:"3 3"}),a.jsx(Ro,{dataKey:"name"}),a.jsx(Do,{}),a.jsx(mr,{}),a.jsx(ni,{type:"monotone",dataKey:"users",stackId:"1",stroke:"#8884d8",fill:"#8884d8",name:"Synthetic Users"}),a.jsx(ni,{type:"monotone",dataKey:"groups",stackId:"2",stroke:"#82ca9d",fill:"#82ca9d",name:"Focus Groups"}),a.jsx(ni,{type:"monotone",dataKey:"interactions",stackId:"3",stroke:"#ffc658",fill:"#ffc658",name:"Interactions"})]})})})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs(Ke,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-semibold mb-4",children:"Recent AI Insights"}),a.jsxs("div",{className:"space-y-4",children:[JEe.slice(0,3).map(e=>a.jsx("div",{className:"border-b pb-4 last:border-b-0 last:pb-0",children:a.jsxs("div",{className:"flex items-start",children:[a.jsx("div",{className:`p-2 rounded-full mr-3 ${e.sentiment==="positive"?"bg-green-100":e.sentiment==="negative"?"bg-red-100":"bg-slate-100"}`,children:a.jsx(ja,{className:`h-4 w-4 ${e.sentiment==="positive"?"text-green-600":e.sentiment==="negative"?"text-red-600":"text-slate-600"}`})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:e.title}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e.description}),a.jsxs("div",{className:"flex items-center text-xs text-muted-foreground mt-2",children:[a.jsx("span",{children:e.source}),a.jsx("span",{className:"mx-2",children:"โ€ข"}),a.jsx("span",{children:e.date})]})]})]})},e.id)),a.jsx(se,{variant:"ghost",className:"w-full text-sm",size:"sm",children:"View All Insights"})]})]}),a.jsxs(Ke,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-semibold mb-4",children:"Upcoming Research Tasks"}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start",children:[a.jsx("div",{className:"bg-blue-100 p-2 rounded-full mr-3",children:a.jsx(mm,{className:"h-4 w-4 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:"Website Redesign Feedback"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Focus group scheduled for Jun 20"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx("div",{className:"bg-purple-100 p-2 rounded-full mr-3",children:a.jsx(mm,{className:"h-4 w-4 text-purple-600"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:"Mobile App User Testing"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"8 participants needed by Jun 25"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx("div",{className:"bg-amber-100 p-2 rounded-full mr-3",children:a.jsx(mm,{className:"h-4 w-4 text-amber-600"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:"Pricing Strategy Evaluation"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Create discussion guide by Jun 22"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx("div",{className:"bg-green-100 p-2 rounded-full mr-3",children:a.jsx(mm,{className:"h-4 w-4 text-green-600"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:"Product Onboarding Flow"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Results analysis due Jun 30"})]})]}),a.jsx(se,{variant:"ghost",className:"w-full text-sm",size:"sm",children:"Manage Research Calendar"})]})]})]})]}),tOe=[{name:"18-24",value:15},{name:"25-34",value:35},{name:"35-44",value:25},{name:"45-54",value:15},{name:"55+",value:10}],nOe=()=>a.jsxs(Ke,{className:"p-6",children:[a.jsxs("div",{className:"flex justify-between items-center mb-4",children:[a.jsx("h3",{className:"font-sf text-lg font-semibold",children:"Synthetic Persona Analytics"}),a.jsx(se,{variant:"outline",size:"sm",children:"View Demographics"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Persona Demographics"}),a.jsx("div",{className:"h-60",children:a.jsx(ha,{width:"100%",height:"100%",children:a.jsxs(XP,{children:[a.jsx(mr,{}),a.jsx(hi,{data:tOe,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,fill:"#FFDEE2",label:!0})]})})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Persona Distribution"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Age: 25-34"}),a.jsx("span",{children:"35%"})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-pink-400 rounded-full",style:{width:"35%"}})})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Tech Savvy"}),a.jsx("span",{children:"72%"})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-pink-300 rounded-full",style:{width:"72%"}})})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Brand Loyal"}),a.jsx("span",{children:"58%"})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-pink-500 rounded-full",style:{width:"58%"}})})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Price Sensitive"}),a.jsx("span",{children:"67%"})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-pink-200 rounded-full",style:{width:"67%"}})})]})]})]})]}),a.jsx("div",{className:"flex justify-center mt-6",children:a.jsx(se,{onClick:()=>window.location.href="/synthetic-users",children:"Manage Synthetic Personas"})})]}),rOe=[{name:"Jan",users:20,groups:3,interactions:120},{name:"Feb",users:25,groups:4,interactions:160},{name:"Mar",users:30,groups:5,interactions:220},{name:"Apr",users:40,groups:6,interactions:280},{name:"May",users:45,groups:7,interactions:350},{name:"Jun",users:48,groups:7,interactions:420}],t$=[{name:"Very Positive",value:25,color:"#4ade80"},{name:"Positive",value:40,color:"#a3e635"},{name:"Neutral",value:20,color:"#93c5fd"},{name:"Negative",value:10,color:"#fb923c"},{name:"Very Negative",value:5,color:"#f87171"}],sOe=[{name:"Navigation",count:42},{name:"Performance",count:28},{name:"UX Design",count:36},{name:"Features",count:22},{name:"Onboarding",count:18}],iOe=()=>{const e=Rn();return a.jsxs(Ke,{className:"p-6",children:[a.jsxs("div",{className:"flex justify-between items-center mb-4",children:[a.jsx("h3",{className:"font-sf text-lg font-semibold",children:"Focus Group Insights"}),a.jsx(se,{variant:"outline",size:"sm",onClick:()=>e("/focus-groups"),children:"View All Sessions"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 mb-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Session Analytics"}),a.jsx("div",{className:"h-60",children:a.jsx(ha,{width:"100%",height:"100%",children:a.jsxs(Zz,{data:rOe,margin:{top:10,right:30,left:0,bottom:0},children:[a.jsx(lp,{strokeDasharray:"3 3"}),a.jsx(Ro,{dataKey:"name"}),a.jsx(Do,{}),a.jsx(mr,{}),a.jsx(ni,{type:"monotone",dataKey:"interactions",stroke:"#8884d8",fill:"#8884d8",name:"User Interactions"})]})})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Feedback Sentiment"}),a.jsx("div",{className:"h-60",children:a.jsx(ha,{width:"100%",height:"100%",children:a.jsxs(XP,{children:[a.jsx(mr,{}),a.jsx(hi,{data:t$,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,label:({name:t,percent:n})=>`${t} ${(n*100).toFixed(0)}%`,children:t$.map((t,n)=>a.jsx(Bp,{fill:t.color},`cell-${n}`))}),a.jsx(fa,{})]})})})]})]}),a.jsxs("div",{className:"mb-6",children:[a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Topic Frequency Analysis"}),a.jsx("div",{className:"h-60",children:a.jsx(ha,{width:"100%",height:"100%",children:a.jsxs(Xz,{data:sOe,margin:{top:5,right:30,left:20,bottom:5},children:[a.jsx(lp,{strokeDasharray:"3 3"}),a.jsx(Ro,{dataKey:"name"}),a.jsx(Do,{}),a.jsx(mr,{}),a.jsx(fa,{}),a.jsx(Yo,{dataKey:"count",name:"Mentions",fill:"#8884d8"})]})})})]}),a.jsx("div",{className:"flex justify-center",children:a.jsx(se,{onClick:()=>e("/focus-groups"),children:"Manage Focus Groups"})})]})},aOe=()=>{const[e,t]=v.useState("overview");return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(oa,{}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsx(ZEe,{title:"Dashboard",description:"Monitor and analyze your research insights"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 mb-8",children:[a.jsx(zb,{title:"Total Synthetic Users",value:48,changePercentage:12,icon:er}),a.jsx(zb,{title:"Active Focus Groups",value:7,changePercentage:5,icon:Na}),a.jsx(zb,{title:"Research Insights",value:124,changePercentage:18,icon:Rl})]}),a.jsxs(Ho,{value:e,onValueChange:t,className:"glass-panel rounded-xl p-6",children:[a.jsxs($a,{className:"grid w-full grid-cols-3 mb-6",children:[a.jsx(Wt,{value:"overview",children:"Overview"}),a.jsx(Wt,{value:"users",children:"Synthetic Users"}),a.jsx(Wt,{value:"focus-groups",children:"Focus Groups"})]}),a.jsx(Ht,{value:"overview",children:a.jsx(eOe,{})}),a.jsx(Ht,{value:"users",children:a.jsx(nOe,{})}),a.jsx(Ht,{value:"focus-groups",children:a.jsx(iOe,{})})]})]})]})};function oOe({persona:e}){const t=e.id==="0",n=e.id==="1";return a.jsxs(Ke,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsx("div",{className:"h-16 w-16 rounded-full bg-muted flex items-center justify-center",children:a.jsx("img",{src:sd(e),alt:e.name,className:"h-16 w-16 rounded-full object-cover"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"font-sf text-xl font-semibold",children:e.name}),a.jsx("p",{className:"text-muted-foreground",children:e.occupation})]})]}),a.jsxs("div",{className:"mt-6 space-y-4",children:[a.jsxs("div",{className:"sidebar-section",children:[a.jsx(er,{className:"sidebar-icon"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-sm",children:"Demographics"}),a.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:[e.age," ",e.gender?a.jsxs(a.Fragment,{children:["โ€ข ",e.gender]}):null,e.ethnicity?a.jsxs(a.Fragment,{children:[" โ€ข ",e.ethnicity]}):null]}),e.education&&a.jsx("p",{className:"sidebar-sub-item",children:e.education}),e.socialGrade&&a.jsxs("p",{className:"sidebar-sub-item",children:["Social Grade: ",e.socialGrade]}),e.householdIncome&&a.jsxs("p",{className:"sidebar-sub-item",children:["Household Income: ",e.householdIncome]}),e.householdComposition&&a.jsxs("p",{className:"sidebar-sub-item",children:["Household: ",e.householdComposition]})]})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(OR,{className:"sidebar-icon"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-sm",children:"Location"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:e.location}),e.livingSituation&&a.jsx("p",{className:"sidebar-sub-item",children:e.livingSituation})]})]}),e.interests&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(Mg,{className:"sidebar-icon"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-sm",children:"Interests"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:e.interests})]})]}),e.mediaConsumption&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(q0,{className:"sidebar-icon"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-sm",children:"Media"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:e.mediaConsumption})]})]}),a.jsxs("div",{className:"pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-sm mb-3",children:"Digital Behavior"}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Tech Savviness"}),a.jsxs("span",{children:[e.techSavviness,"%"]})]}),a.jsx("div",{className:"h-1.5 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-blue-500 rounded-full",style:{width:`${e.techSavviness}%`}})})]}),e.brandLoyalty!==void 0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Brand Loyalty"}),a.jsxs("span",{children:[e.brandLoyalty,"%"]})]}),a.jsx("div",{className:"h-1.5 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-purple-500 rounded-full",style:{width:`${e.brandLoyalty}%`}})})]}),e.priceConsciousness!==void 0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Price Sensitivity"}),a.jsxs("span",{children:[e.priceConsciousness,"%"]})]}),a.jsx("div",{className:"h-1.5 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-amber-500 rounded-full",style:{width:`${e.priceConsciousness}%`}})})]}),e.environmentalConcern!==void 0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Environmental Concern"}),a.jsxs("span",{children:[e.environmentalConcern,"%"]})]}),a.jsx("div",{className:"h-1.5 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-green-500 rounded-full",style:{width:`${e.environmentalConcern}%`}})})]}),e.deviceUsage&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-medium mt-3",children:"Device Usage"}),a.jsx("p",{className:"sidebar-sub-item text-xs",children:e.deviceUsage})]}),e.shoppingHabits&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-medium mt-3",children:"Shopping Habits"}),a.jsx("p",{className:"sidebar-sub-item text-xs",children:e.shoppingHabits})]})]})]}),a.jsxs("div",{className:"pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-sm mb-3",children:"Additional Information"}),a.jsxs("div",{className:"space-y-2",children:[e.brandPreferences&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(Mg,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:e.brandPreferences})]}),e.communicationPreferences&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(Dg,{className:"sidebar-icon"}),a.jsxs("span",{className:"text-muted-foreground text-sm",children:["Prefers: ",e.communicationPreferences]})]}),e.deviceUsage&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(PG,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:e.deviceUsage})]}),e.shoppingHabits&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(OG,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:e.shoppingHabits})]}),e.additionalInformation&&typeof e.additionalInformation=="string"&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(wG,{className:"sidebar-icon"}),a.jsx("div",{className:"sidebar-sub-item",children:e.additionalInformation.split(` +`).map((r,s)=>a.jsx("div",{className:"mb-1",children:r.trim().startsWith("โ€ข")||r.trim().startsWith("-")?r.trim():`โ€ข ${r.trim()}`},s))})]}),t&&a.jsxs("div",{className:"pt-2 space-y-2",children:[a.jsxs("div",{className:"sidebar-section",children:[a.jsx(UA,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Maintains an extensive network of financial and luxury industry contacts"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(Zw,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Owns vacation properties in the Cotswolds and South of France"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(q0,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Collector of rare first-edition books and limited-edition art prints"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(VA,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Significant investment portfolio with focus on sustainable luxury ventures"})]})]}),n&&a.jsxs("div",{className:"pt-2 space-y-2",children:[a.jsxs("div",{className:"sidebar-section",children:[a.jsx(q0,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Active in industry panels, luxury brand collaborations, follows influencers in luxury & design"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(Zw,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Modern flat in exclusive Chelsea, accessible to boutique services"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(VA,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Uses premium digital payment & secure banking for HNWIs"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(UA,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Respected network in London's luxury sector; attends exclusive events"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(Dg,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Seeks autonomy, bespoke service, and acknowledgment for taste"})]})]})]})]})]})]})}function lOe({persona:e}){var t,n,r,s,i,o,l,c,u;return a.jsxs("div",{className:"space-y-6",children:[a.jsx(Ke,{children:a.jsxs(lt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(ON,{className:"h-5 w-5 text-primary mr-2"}),a.jsx("h3",{className:"font-sf text-lg font-medium",children:"Goals"})]}),a.jsx("ul",{className:"space-y-2",children:(t=e.goals)==null?void 0:t.map((d,f)=>a.jsxs("li",{className:"flex items-start",children:[a.jsx("div",{className:"h-5 w-5 rounded-full bg-primary/10 flex items-center justify-center mt-0.5 mr-3",children:a.jsx("span",{className:"text-xs text-primary font-medium",children:f+1})}),a.jsx("p",{className:"text-sm",children:d})]},f))})]})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx(Ke,{children:a.jsxs(lt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(kN,{className:"h-5 w-5 text-amber-500 mr-2"}),a.jsx("h3",{className:"font-sf text-lg font-medium",children:"Frustrations"})]}),a.jsx("ul",{className:"space-y-2",children:(n=e.frustrations)==null?void 0:n.map((d,f)=>a.jsxs("li",{className:"text-sm flex items-start",children:[a.jsx("span",{className:"text-amber-500 mr-2",children:"โ€ข"}),a.jsx("span",{children:d})]},f))})]})}),a.jsx(Ke,{children:a.jsxs(lt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(Qi,{className:"h-5 w-5 text-green-500 mr-2"}),a.jsx("h3",{className:"font-sf text-lg font-medium",children:"Motivations"})]}),a.jsx("ul",{className:"space-y-2",children:(r=e.motivations)==null?void 0:r.map((d,f)=>a.jsxs("li",{className:"text-sm flex items-start",children:[a.jsx("span",{className:"text-green-500 mr-2",children:"โ€ข"}),a.jsx("span",{children:d})]},f))})]})})]}),a.jsx(Ke,{children:a.jsxs(lt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-medium mb-4",children:"Think, Feel, Do"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center mb-3",children:[a.jsx(ja,{className:"h-5 w-5 text-blue-500 mr-2"}),a.jsx("h4",{className:"font-medium text-sm",children:"Thinks"})]}),a.jsx("ul",{className:"space-y-2",children:(i=(s=e.thinkFeelDo)==null?void 0:s.thinks)==null?void 0:i.map((d,f)=>a.jsxs("li",{className:"text-sm bg-blue-50 p-2 rounded-md",children:['"',d,'"']},f))})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center mb-3",children:[a.jsx(Mg,{className:"h-5 w-5 text-red-500 mr-2"}),a.jsx("h4",{className:"font-medium text-sm",children:"Feels"})]}),a.jsx("ul",{className:"space-y-2",children:(l=(o=e.thinkFeelDo)==null?void 0:o.feels)==null?void 0:l.map((d,f)=>a.jsxs("li",{className:"text-sm bg-red-50 p-2 rounded-md",children:['"',d,'"']},f))})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center mb-3",children:[a.jsx(Qi,{className:"h-5 w-5 text-green-500 mr-2"}),a.jsx("h4",{className:"font-medium text-sm",children:"Does"})]}),a.jsx("ul",{className:"space-y-2",children:(u=(c=e.thinkFeelDo)==null?void 0:c.does)==null?void 0:u.map((d,f)=>a.jsxs("li",{className:"text-sm bg-green-50 p-2 rounded-md",children:['"',d,'"']},f))})]})]})]})})]})}function cOe({persona:e}){var n,r,s,i,o;const t=[{trait:"Openness",value:((n=e.oceanTraits)==null?void 0:n.openness)||50},{trait:"Conscientiousness",value:((r=e.oceanTraits)==null?void 0:r.conscientiousness)||50},{trait:"Extraversion",value:((s=e.oceanTraits)==null?void 0:s.extraversion)||50},{trait:"Agreeableness",value:((i=e.oceanTraits)==null?void 0:i.agreeableness)||50},{trait:"Neuroticism",value:((o=e.oceanTraits)==null?void 0:o.neuroticism)||50}];return a.jsx(Ke,{children:a.jsxs(lt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-medium mb-4",children:"OCEAN Personality Traits"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx("div",{className:"h-80",children:a.jsx(ha,{width:"100%",height:"100%",children:a.jsxs(Yz,{outerRadius:90,data:t,children:[a.jsx(FP,{}),a.jsx(sc,{dataKey:"trait"}),a.jsx(rc,{domain:[0,100]}),a.jsx(Nd,{name:"Personality",dataKey:"value",stroke:"#8884d8",fill:"#8884d8",fillOpacity:.5})]})})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Openness to Experience"}),a.jsxs("span",{className:"font-medium",children:[t[0].value,"%"]})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-purple-500 rounded-full",style:{width:`${t[0].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t[0].value>75?"Highly creative and curious":t[0].value>50?"Somewhat imaginative and open to new ideas":"Practical and prefers routine"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Conscientiousness"}),a.jsxs("span",{className:"font-medium",children:[t[1].value,"%"]})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-blue-500 rounded-full",style:{width:`${t[1].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t[1].value>75?"Highly organized and responsible":t[1].value>50?"Generally reliable and hardworking":"Spontaneous and flexible"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Extraversion"}),a.jsxs("span",{className:"font-medium",children:[t[2].value,"%"]})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-green-500 rounded-full",style:{width:`${t[2].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t[2].value>75?"Highly sociable and outgoing":t[2].value>50?"Moderately social and talkative":"Reserved and reflective"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Agreeableness"}),a.jsxs("span",{className:"font-medium",children:[t[3].value,"%"]})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-amber-500 rounded-full",style:{width:`${t[3].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t[3].value>75?"Highly cooperative and compassionate":t[3].value>50?"Generally kind and helpful":"Competitive and challenging"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Neuroticism"}),a.jsxs("span",{className:"font-medium",children:[t[4].value,"%"]})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-red-500 rounded-full",style:{width:`${t[4].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t[4].value>75?"Highly sensitive and prone to stress":t[4].value>50?"Moderately reactive to challenges":"Emotionally stable and resilient"})]})]})]})]})})}function uOe({persona:e}){var r;const t=(s,i)=>{const o=[a.jsx(SG,{className:"sidebar-icon"},"grid"),a.jsx(kG,{className:"sidebar-icon"},"smartphone"),a.jsx(jG,{className:"sidebar-icon"},"laptop"),a.jsx(bG,{className:"sidebar-icon"},"grid2x2")];return o[i%o.length]},n=()=>e.scenarioType?e.scenarioType:"Life Scenarios";return a.jsx(Ke,{children:a.jsxs(lt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-medium mb-4",children:n()}),a.jsx("div",{className:"space-y-4",children:(r=e.scenarios)==null?void 0:r.map((s,i)=>a.jsx("div",{className:"bg-slate-50 p-4 rounded-lg border",children:a.jsxs("div",{className:"sidebar-section",children:[t(s,i),a.jsxs("div",{children:[a.jsxs("h4",{className:"font-medium text-sm mb-2",children:["Scenario ",i+1]}),a.jsx("p",{className:"text-sm",children:s})]})]})},i))})]})})}function dOe(){const e=Rn();return a.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center",children:a.jsxs(Ke,{className:"w-96 text-center p-6",children:[a.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Persona Not Found"}),a.jsx("p",{className:"text-muted-foreground mb-6",children:"The persona you're looking for couldn't be found."}),a.jsx(se,{onClick:()=>e("/synthetic-users"),children:"Return to Personas"})]})})}function jt({className:e,...t}){return a.jsx("div",{className:Me("animate-pulse rounded-md bg-muted",e),...t})}function fOe(){return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(oa,{}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsxs("div",{className:"flex items-center mb-6 relative",children:[a.jsx(jt,{className:"absolute left-0 top-0 h-10 w-20"}),a.jsx(jt,{className:"h-8 w-48 mx-auto"}),a.jsx(jt,{className:"absolute right-0 top-0 h-10 w-32"})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 mt-10",children:[a.jsx("div",{className:"lg:col-span-1",children:a.jsxs(Ke,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsx(jt,{className:"h-16 w-16 rounded-full"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(jt,{className:"h-6 w-32 mb-2"}),a.jsx(jt,{className:"h-4 w-24"})]})]}),a.jsxs("div",{className:"mt-6 space-y-4",children:[a.jsxs("div",{className:"flex items-start",children:[a.jsx(jt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(jt,{className:"h-4 w-20 mb-2"}),a.jsx(jt,{className:"h-3 w-40 mb-1"}),a.jsx(jt,{className:"h-3 w-36"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx(jt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(jt,{className:"h-4 w-16 mb-2"}),a.jsx(jt,{className:"h-3 w-32"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx(jt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(jt,{className:"h-4 w-16 mb-2"}),a.jsx(jt,{className:"h-3 w-full"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx(jt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(jt,{className:"h-4 w-12 mb-2"}),a.jsx(jt,{className:"h-3 w-full"})]})]}),a.jsxs("div",{className:"pt-4 border-t",children:[a.jsx(jt,{className:"h-4 w-32 mb-3"}),a.jsx("div",{className:"space-y-3",children:[...Array(4)].map((e,t)=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx(jt,{className:"h-3 w-24"}),a.jsx(jt,{className:"h-3 w-8"})]}),a.jsx(jt,{className:"h-1.5 w-full rounded-full"})]},t))})]}),a.jsxs("div",{className:"pt-4 border-t",children:[a.jsx(jt,{className:"h-4 w-36 mb-3"}),a.jsx("div",{className:"space-y-2",children:[...Array(3)].map((e,t)=>a.jsxs("div",{className:"flex items-center",children:[a.jsx(jt,{className:"h-4 w-4 mr-2"}),a.jsx(jt,{className:"h-3 w-40"})]},t))})]})]})]})}),a.jsxs("div",{className:"lg:col-span-2",children:[a.jsxs("div",{className:"grid w-full grid-cols-3 gap-2 mb-6",children:[a.jsx(jt,{className:"h-10 w-full"}),a.jsx(jt,{className:"h-10 w-full"}),a.jsx(jt,{className:"h-10 w-full"})]}),a.jsx(Ke,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsx(jt,{className:"h-6 w-48"}),a.jsx(jt,{className:"h-4 w-full"}),a.jsx(jt,{className:"h-4 w-full"}),a.jsx(jt,{className:"h-4 w-3/4"}),a.jsxs("div",{className:"mt-8 space-y-4",children:[a.jsx(jt,{className:"h-6 w-32"}),a.jsx(jt,{className:"h-4 w-full"}),a.jsx(jt,{className:"h-4 w-full"}),a.jsx(jt,{className:"h-4 w-2/3"})]}),a.jsxs("div",{className:"mt-8 space-y-4",children:[a.jsx(jt,{className:"h-6 w-40"}),a.jsx(jt,{className:"h-4 w-full"}),a.jsx(jt,{className:"h-4 w-full"}),a.jsx(jt,{className:"h-4 w-5/6"})]})]})})]})]})]})]})}function hOe({message:e,onLoginSuccess:t,onCancel:n}){const{login:r}=Zl(),s=Rn(),[i,o]=v.useState("user"),[l,c]=v.useState("pass"),[u,d]=v.useState(!1),f=async()=>{if(!i||!l){ce.error("Please enter username and password");return}d(!0);try{await r(i,l),ce.success("Login successful"),t&&t()}catch(p){console.error("Login error:",p),ce.error("Login failed",{description:"Please check your credentials and try again"})}finally{d(!1)}},h=()=>{n?n():s("/synthetic-users")};return a.jsxs(Ke,{className:"max-w-md mx-auto shadow-lg",children:[a.jsxs(Fr,{children:[a.jsx(ts,{children:"Login Required"}),a.jsx(XN,{children:e||"You need to log in to save personas to the database"})]}),a.jsxs(lt,{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(ji,{htmlFor:"username",children:"Username"}),a.jsx(_t,{id:"username",placeholder:"Username",value:i,onChange:p=>o(p.target.value),disabled:u})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(ji,{htmlFor:"password",children:"Password"}),a.jsx(_t,{id:"password",type:"password",placeholder:"Password",value:l,onChange:p=>c(p.target.value),disabled:u})]}),a.jsx("div",{className:"text-sm text-muted-foreground",children:"Default credentials: user / pass"})]}),a.jsxs(YN,{className:"flex justify-between",children:[a.jsx(se,{variant:"outline",onClick:h,disabled:u,children:"Cancel"}),a.jsx(se,{onClick:f,disabled:u,children:u?a.jsxs(a.Fragment,{children:[a.jsx(Dl,{className:"h-4 w-4 mr-2 animate-spin"}),"Logging in..."]}):"Login"})]})]})}function pOe({persona:e,onSave:t,onCancel:n}){var _,A,O,T,k,M,R,H,F,V,$,L,Y,Q,ee,fe;const r={...e,education:e.education||"",interests:e.interests||"",brandLoyalty:e.brandLoyalty||0,priceConsciousness:e.priceConsciousness||0,environmentalConcern:e.environmentalConcern||0,hasPurchasingPower:e.hasPurchasingPower||!1,hasChildren:e.hasChildren||!1,goals:e.goals||[],frustrations:e.frustrations||[],motivations:e.motivations||[],scenarios:e.scenarios||[],oceanTraits:e.oceanTraits||{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},thinkFeelDo:e.thinkFeelDo||{thinks:[],feels:[],does:[]}},[s,i]=v.useState(r),[o,l]=v.useState(!1),[c,u]=v.useState(!1),[d,f]=v.useState(null);v.useState(!1);const{isAuthenticated:h,token:p}=Zl();v.useEffect(()=>{(async()=>{c&&h&&p&&(u(!1),d&&await P())})()},[h,p,c]);const g=(W,he)=>{i(pe=>({...pe,[W]:he}))},m=(W,he)=>{i(pe=>({...pe,oceanTraits:{...pe.oceanTraits,[W]:he}}))},x=W=>{i(he=>({...he,[W]:[...he[W]||[],""]}))},b=(W,he,pe)=>{i(ue=>{const Ae=[...ue[W]||[]];return Ae[he]=pe,{...ue,[W]:Ae}})},y=(W,he)=>{i(pe=>{const ue=[...pe[W]||[]];return ue.splice(he,1),{...pe,[W]:ue}})},w=(W,he,pe)=>{i(ue=>{const Ae={...ue.thinkFeelDo},de=[...Ae[W]||[]];return de[he]=pe,Ae[W]=de,{...ue,thinkFeelDo:Ae}})},j=W=>{i(he=>{var ue;const pe={...he.thinkFeelDo,[W]:[...((ue=he.thinkFeelDo)==null?void 0:ue[W])||[],""]};return{...he,thinkFeelDo:pe}})},S=(W,he)=>{i(pe=>{const ue={...pe.thinkFeelDo},Ae=[...ue[W]||[]];return Ae.splice(he,1),ue[W]=Ae,{...pe,thinkFeelDo:ue}})},N=()=>{d&&(ce.error("Login canceled - Persona changes not saved"),u(!1),f(null),n())},P=async()=>{if(d){l(!0);try{const W={...d};delete W._id,delete W.isDbPersona;const he=await $n.create(W),pe={...d,id:he.data._id||he.data.id,_id:he.data._id||he.data.id,isDbPersona:!0};ce.success("Persona saved to database successfully"),u(!1),f(null),t(pe)}catch(W){console.error("Error saving after login:",W),ce.error("Failed to save to database after login"),u(!1),f(null)}finally{l(!1)}}};return c?a.jsxs("div",{className:"max-w-5xl mx-auto bg-background p-6",children:[a.jsx("div",{className:"flex justify-between items-center mb-6",children:a.jsx("h2",{className:"font-sf text-2xl font-bold",children:"Authentication Required"})}),a.jsx("p",{className:"mb-6 text-muted-foreground",children:"Login is required to save personas to the database. You can either:"}),a.jsxs("ul",{className:"list-disc ml-6 mt-2 mb-6",children:[a.jsx("li",{children:"Log in to save this persona to the database"}),a.jsx("li",{children:"Cancel to discard your changes"})]}),a.jsx(hOe,{message:"Login is required to save your persona to the database",onLoginSuccess:P,onCancel:N})]}):a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(se,{variant:"ghost",onClick:n,className:"mr-2",children:a.jsx(nh,{className:"h-5 w-5"})}),a.jsx("h2",{className:"font-sf text-2xl font-bold",children:"Edit Persona"})]}),a.jsxs(se,{onClick:async()=>{l(!0);try{const W=s._id||s.id,he={...s};he._id&&delete he._id,delete he.isDbPersona;let pe;if(W&&typeof W=="string"&&W.startsWith("local-")){console.log("Creating new persona instead of updating local ID"),pe=await $n.create(he),ce.success("Persona saved to database");const ue={...s,id:pe.data._id||pe.data.id,_id:pe.data._id||pe.data.id,isDbPersona:!0};t(ue)}else if(W){pe=await $n.update(W,he),ce.success("Persona updated successfully");const ue={...s,isDbPersona:!0};t(ue)}else{pe=await $n.create(he);const ue={...s,id:pe.data._id||pe.data.id,_id:pe.data._id||pe.data.id,isDbPersona:!0};ce.success("Persona created successfully"),t(ue)}}catch(W){console.error("Error saving persona:",W),W.response&&W.response.status===401?h&&p?(console.log("Auth error despite having token - token likely invalid"),ce.error("Authentication error - saving locally instead"),t(s)):(f(s),u(!0)):(ce.error("Failed to save persona"),t(s))}finally{l(!1)}},disabled:o,children:[o?a.jsx(Dl,{className:"h-4 w-4 mr-2 animate-spin"}):a.jsx(CN,{className:"h-4 w-4 mr-2"}),o?"Saving...":"Save Changes"]})]}),a.jsxs(Ho,{defaultValue:"basic",children:[a.jsxs($a,{className:"grid w-full grid-cols-6",children:[a.jsx(Wt,{value:"basic",children:"Basic"}),a.jsx(Wt,{value:"cooper",children:"Cooper"}),a.jsx(Wt,{value:"personality",children:"Personality"}),a.jsx(Wt,{value:"demographics",children:"Demographics"}),a.jsx(Wt,{value:"lifestyle",children:"Lifestyle"}),a.jsx(Wt,{value:"extended",children:"Extended"})]}),a.jsx(Ht,{value:"basic",className:"mt-6",children:a.jsx(Ke,{children:a.jsx(lt,{className:"p-6",children:a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Name"}),a.jsx(_t,{value:s.name||"",onChange:W=>g("name",W.target.value)})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Age Range"}),a.jsxs(On,{value:s.age||"",onValueChange:W=>g("age",W),children:[a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select age range"})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"18-24",children:"18-24"}),a.jsx(ye,{value:"25-34",children:"25-34"}),a.jsx(ye,{value:"35-44",children:"35-44"}),a.jsx(ye,{value:"45-54",children:"45-54"}),a.jsx(ye,{value:"55-64",children:"55-64"}),a.jsx(ye,{value:"65+",children:"65+"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Gender"}),a.jsxs(On,{value:s.gender||"",onValueChange:W=>g("gender",W),children:[a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select gender"})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"Male",children:"Male"}),a.jsx(ye,{value:"Female",children:"Female"}),a.jsx(ye,{value:"Non-binary",children:"Non-binary"}),a.jsx(ye,{value:"Other",children:"Other"})]})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Occupation"}),a.jsx(_t,{value:s.occupation||"",onChange:W=>g("occupation",W.target.value)})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Education"}),a.jsxs(On,{value:s.education||"",onValueChange:W=>g("education",W),children:[a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select education level"})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"High School",children:"High School"}),a.jsx(ye,{value:"Some College",children:"Some College"}),a.jsx(ye,{value:"Associate's Degree",children:"Associate's Degree"}),a.jsx(ye,{value:"Bachelor's Degree",children:"Bachelor's Degree"}),a.jsx(ye,{value:"Master's Degree",children:"Master's Degree"}),a.jsx(ye,{value:"PhD",children:"PhD"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Location"}),a.jsx(_t,{value:s.location||"",onChange:W=>g("location",W.target.value)})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Ethnicity (Optional)"}),a.jsxs(On,{value:s.ethnicity||"",onValueChange:W=>g("ethnicity",W),children:[a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select ethnicity"})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"white",children:"White"}),a.jsx(ye,{value:"black",children:"Black"}),a.jsx(ye,{value:"asian",children:"Asian"}),a.jsx(ye,{value:"hispanic",children:"Hispanic/Latino"}),a.jsx(ye,{value:"native-american",children:"Native American"}),a.jsx(ye,{value:"middle-eastern",children:"Middle Eastern"}),a.jsx(ye,{value:"mixed",children:"Mixed"}),a.jsx(ye,{value:"other",children:"Other"}),a.jsx(ye,{value:"prefer-not-to-say",children:"Prefer not to say"})]})]})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Personality"}),a.jsx(et,{value:s.personality||"",onChange:W=>g("personality",W.target.value),rows:3})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Interests"}),a.jsx(et,{value:s.interests||"",onChange:W=>g("interests",W.target.value),rows:3,placeholder:"Tech, travel, cooking, etc."})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Tech Savviness"}),a.jsxs("span",{className:"text-sm",children:[s.techSavviness,"%"]})]}),a.jsx(Bn,{value:[s.techSavviness],onValueChange:W=>g("techSavviness",W[0]),max:100,step:1})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Brand Loyalty"}),a.jsxs("span",{className:"text-sm",children:[s.brandLoyalty||0,"%"]})]}),a.jsx(Bn,{value:[s.brandLoyalty||0],onValueChange:W=>g("brandLoyalty",W[0]),max:100,step:1})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Price Consciousness"}),a.jsxs("span",{className:"text-sm",children:[s.priceConsciousness||0,"%"]})]}),a.jsx(Bn,{value:[s.priceConsciousness||0],onValueChange:W=>g("priceConsciousness",W[0]),max:100,step:1})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Environmental Concern"}),a.jsxs("span",{className:"text-sm",children:[s.environmentalConcern||0,"%"]})]}),a.jsx(Bn,{value:[s.environmentalConcern||0],onValueChange:W=>g("environmentalConcern",W[0]),max:100,step:1})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("label",{className:"text-sm font-medium",children:"Purchasing Power"}),a.jsx(bh,{checked:s.hasPurchasingPower||!1,onCheckedChange:W=>g("hasPurchasingPower",W)})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("label",{className:"text-sm font-medium",children:"Has Children"}),a.jsx(bh,{checked:s.hasChildren||!1,onCheckedChange:W=>g("hasChildren",W)})]})]})]})]})})})}),a.jsxs(Ht,{value:"cooper",className:"mt-6 space-y-6",children:[a.jsx(Ke,{children:a.jsxs(lt,{className:"p-6",children:[a.jsxs("div",{className:"mb-4",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Goals"}),(s.goals||[]).map((W,he)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(_t,{value:W||"",onChange:pe=>b("goals",he,pe.target.value)}),a.jsx(se,{variant:"ghost",size:"icon",onClick:()=>y("goals",he),children:a.jsx(wn,{className:"h-4 w-4 text-muted-foreground"})})]},he)),a.jsxs(se,{variant:"outline",size:"sm",onClick:()=>x("goals"),className:"mt-2",children:[a.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Goal"]})]}),a.jsxs("div",{className:"mb-4 pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Frustrations"}),(s.frustrations||[]).map((W,he)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(_t,{value:W||"",onChange:pe=>b("frustrations",he,pe.target.value)}),a.jsx(se,{variant:"ghost",size:"icon",onClick:()=>y("frustrations",he),children:a.jsx(wn,{className:"h-4 w-4 text-muted-foreground"})})]},he)),a.jsxs(se,{variant:"outline",size:"sm",onClick:()=>x("frustrations"),className:"mt-2",children:[a.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Frustration"]})]}),a.jsxs("div",{className:"mb-4 pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Motivations"}),(s.motivations||[]).map((W,he)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(_t,{value:W||"",onChange:pe=>b("motivations",he,pe.target.value)}),a.jsx(se,{variant:"ghost",size:"icon",onClick:()=>y("motivations",he),children:a.jsx(wn,{className:"h-4 w-4 text-muted-foreground"})})]},he)),a.jsxs(se,{variant:"outline",size:"sm",onClick:()=>x("motivations"),className:"mt-2",children:[a.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Motivation"]})]})]})}),a.jsx(Ke,{children:a.jsxs(lt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Think, Feel, Do"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Thinks"}),(((_=s.thinkFeelDo)==null?void 0:_.thinks)||[]).map((W,he)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(_t,{value:W||"",onChange:pe=>w("thinks",he,pe.target.value)}),a.jsx(se,{variant:"ghost",size:"icon",onClick:()=>S("thinks",he),children:a.jsx(wn,{className:"h-4 w-4 text-muted-foreground"})})]},he)),a.jsxs(se,{variant:"outline",size:"sm",onClick:()=>j("thinks"),className:"mt-2",children:[a.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Thought"]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Feels"}),(((A=s.thinkFeelDo)==null?void 0:A.feels)||[]).map((W,he)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(_t,{value:W||"",onChange:pe=>w("feels",he,pe.target.value)}),a.jsx(se,{variant:"ghost",size:"icon",onClick:()=>S("feels",he),children:a.jsx(wn,{className:"h-4 w-4 text-muted-foreground"})})]},he)),a.jsxs(se,{variant:"outline",size:"sm",onClick:()=>j("feels"),className:"mt-2",children:[a.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Feeling"]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Does"}),(((O=s.thinkFeelDo)==null?void 0:O.does)||[]).map((W,he)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(_t,{value:W||"",onChange:pe=>w("does",he,pe.target.value)}),a.jsx(se,{variant:"ghost",size:"icon",onClick:()=>S("does",he),children:a.jsx(wn,{className:"h-4 w-4 text-muted-foreground"})})]},he)),a.jsxs(se,{variant:"outline",size:"sm",onClick:()=>j("does"),className:"mt-2",children:[a.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Action"]})]})]})]})}),a.jsx(Ke,{children:a.jsxs(lt,{className:"p-6",children:[a.jsx("div",{className:"space-y-4 mb-6",children:a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Scenario Section Title"}),a.jsx(_t,{value:s.scenarioType||"",onChange:W=>g("scenarioType",W.target.value),placeholder:"Life Scenarios"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:'Custom title for the scenarios section (e.g., "Customer Journey", "Use Cases")'})]})}),a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Usage Scenarios"}),(s.scenarios||[]).map((W,he)=>a.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[a.jsx(et,{value:W||"",onChange:pe=>b("scenarios",he,pe.target.value),rows:2}),a.jsx(se,{variant:"ghost",size:"icon",onClick:()=>y("scenarios",he),children:a.jsx(wn,{className:"h-4 w-4 text-muted-foreground"})})]},he)),a.jsxs(se,{variant:"outline",size:"sm",onClick:()=>x("scenarios"),className:"mt-2",children:[a.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Scenario"]})]})})]}),a.jsx(Ht,{value:"personality",className:"mt-6",children:a.jsx(Ke,{children:a.jsxs(lt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"OCEAN Personality Traits"}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Openness to Experience"}),a.jsxs("span",{className:"text-sm",children:[((T=s.oceanTraits)==null?void 0:T.openness)||50,"%"]})]}),a.jsx(Bn,{value:[((k=s.oceanTraits)==null?void 0:k.openness)||50],onValueChange:W=>m("openness",W[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Creativity, curiosity, and openness to new ideas"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Conscientiousness"}),a.jsxs("span",{className:"text-sm",children:[((M=s.oceanTraits)==null?void 0:M.conscientiousness)||50,"%"]})]}),a.jsx(Bn,{value:[((R=s.oceanTraits)==null?void 0:R.conscientiousness)||50],onValueChange:W=>m("conscientiousness",W[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Organization, responsibility, and self-discipline"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Extraversion"}),a.jsxs("span",{className:"text-sm",children:[((H=s.oceanTraits)==null?void 0:H.extraversion)||50,"%"]})]}),a.jsx(Bn,{value:[((F=s.oceanTraits)==null?void 0:F.extraversion)||50],onValueChange:W=>m("extraversion",W[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Sociability, assertiveness, and talkativeness"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Agreeableness"}),a.jsxs("span",{className:"text-sm",children:[((V=s.oceanTraits)==null?void 0:V.agreeableness)||50,"%"]})]}),a.jsx(Bn,{value:[(($=s.oceanTraits)==null?void 0:$.agreeableness)||50],onValueChange:W=>m("agreeableness",W[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Compassion, cooperation, and concern for others"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Neuroticism"}),a.jsxs("span",{className:"text-sm",children:[((L=s.oceanTraits)==null?void 0:L.neuroticism)||50,"%"]})]}),a.jsx(Bn,{value:[((Y=s.oceanTraits)==null?void 0:Y.neuroticism)||50],onValueChange:W=>m("neuroticism",W[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Emotional reactivity, anxiety, and sensitivity to stress"})]})]})]})})}),a.jsx(Ht,{value:"demographics",className:"mt-6",children:a.jsx(Ke,{children:a.jsxs(lt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Demographic Information"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Social Grade"}),a.jsxs(On,{value:s.socialGrade||"",onValueChange:W=>g("socialGrade",W),children:[a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select social grade"})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"A",children:"A - Higher managerial"}),a.jsx(ye,{value:"B",children:"B - Intermediate managerial"}),a.jsx(ye,{value:"C1",children:"C1 - Supervisory or clerical"}),a.jsx(ye,{value:"C2",children:"C2 - Skilled manual workers"}),a.jsx(ye,{value:"D",children:"D - Semi and unskilled manual workers"}),a.jsx(ye,{value:"E",children:"E - State pensioners, unemployed"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Household Income"}),a.jsxs(On,{value:s.householdIncome||"",onValueChange:W=>g("householdIncome",W),children:[a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select income range"})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"Under $25k",children:"Under $25,000"}),a.jsx(ye,{value:"$25k-$50k",children:"$25,000 - $50,000"}),a.jsx(ye,{value:"$50k-$75k",children:"$50,000 - $75,000"}),a.jsx(ye,{value:"$75k-$100k",children:"$75,000 - $100,000"}),a.jsx(ye,{value:"$100k-$150k",children:"$100,000 - $150,000"}),a.jsx(ye,{value:"$150k-$250k",children:"$150,000 - $250,000"}),a.jsx(ye,{value:"Over $250k",children:"Over $250,000"}),a.jsx(ye,{value:"Prefer not to say",children:"Prefer not to say"})]})]})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Household Composition"}),a.jsxs(On,{value:s.householdComposition||"",onValueChange:W=>g("householdComposition",W),children:[a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select household type"})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"Single person",children:"Single person"}),a.jsx(ye,{value:"Couple without children",children:"Couple without children"}),a.jsx(ye,{value:"Couple with children",children:"Couple with children"}),a.jsx(ye,{value:"Single parent",children:"Single parent"}),a.jsx(ye,{value:"Multi-generational",children:"Multi-generational"}),a.jsx(ye,{value:"Shared housing",children:"Shared housing"}),a.jsx(ye,{value:"Other",children:"Other"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Living Situation"}),a.jsxs(On,{value:s.livingSituation||"",onValueChange:W=>g("livingSituation",W),children:[a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select living situation"})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"Own home",children:"Own home"}),a.jsx(ye,{value:"Rent apartment",children:"Rent apartment"}),a.jsx(ye,{value:"Rent house",children:"Rent house"}),a.jsx(ye,{value:"Live with family",children:"Live with family"}),a.jsx(ye,{value:"Student housing",children:"Student housing"}),a.jsx(ye,{value:"Assisted living",children:"Assisted living"}),a.jsx(ye,{value:"Other",children:"Other"})]})]})]})]})]})]})})}),a.jsx(Ht,{value:"lifestyle",className:"mt-6",children:a.jsx(Ke,{children:a.jsxs(lt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Lifestyle & Behavior"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Media Consumption"}),a.jsx(et,{value:s.mediaConsumption||"",onChange:W=>g("mediaConsumption",W.target.value),rows:3,placeholder:"TV shows, podcasts, news sources, social media platforms"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Describe media consumption habits and preferences"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Device Usage"}),a.jsx(et,{value:s.deviceUsage||"",onChange:W=>g("deviceUsage",W.target.value),rows:3,placeholder:"Smartphone, laptop, tablet, smart TV, gaming console"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Primary devices and usage patterns"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Shopping Habits"}),a.jsx(et,{value:s.shoppingHabits||"",onChange:W=>g("shoppingHabits",W.target.value),rows:3,placeholder:"Online vs in-store, frequency, preferred retailers"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Shopping behavior and preferences"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Brand Preferences"}),a.jsx(et,{value:s.brandPreferences||"",onChange:W=>g("brandPreferences",W.target.value),rows:3,placeholder:"Favorite brands, brand values alignment"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Preferred brands and reasoning"})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Communication Preferences"}),a.jsx(et,{value:s.communicationPreferences||"",onChange:W=>g("communicationPreferences",W.target.value),rows:3,placeholder:"Email, phone, text, video calls, in-person"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Preferred communication methods and channels"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Payment Methods"}),a.jsx(et,{value:s.paymentMethods||"",onChange:W=>g("paymentMethods",W.target.value),rows:3,placeholder:"Credit cards, digital wallets, cash, BNPL"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Preferred payment methods and financial tools"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Purchase Behavior"}),a.jsx(et,{value:s.purchaseBehaviour||"",onChange:W=>g("purchaseBehaviour",W.target.value),rows:3,placeholder:"Research habits, decision factors, impulse vs planned buying"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"How they approach making purchase decisions"})]})]})]})]})})}),a.jsxs(Ht,{value:"extended",className:"mt-6 space-y-6",children:[a.jsx(Ke,{children:a.jsxs(lt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Extended Profile"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Core Values"}),a.jsx(et,{value:s.coreValues||"",onChange:W=>g("coreValues",W.target.value),rows:3,placeholder:"Key principles and values that guide decisions"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Lifestyle Choices"}),a.jsx(et,{value:s.lifestyleChoices||"",onChange:W=>g("lifestyleChoices",W.target.value),rows:3,placeholder:"Health, fitness, diet, work-life balance preferences"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Social Activities"}),a.jsx(et,{value:s.socialActivities||"",onChange:W=>g("socialActivities",W.target.value),rows:3,placeholder:"Social hobbies, community involvement, networking"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Category Knowledge"}),a.jsx(et,{value:s.categoryKnowledge||"",onChange:W=>g("categoryKnowledge",W.target.value),rows:3,placeholder:"Expertise in specific product/service categories"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Decision Influences"}),a.jsx(et,{value:s.decisionInfluences||"",onChange:W=>g("decisionInfluences",W.target.value),rows:3,placeholder:"What factors most influence their decisions"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Pain Points"}),a.jsx(et,{value:s.painPoints||"",onChange:W=>g("painPoints",W.target.value),rows:3,placeholder:"Common challenges and friction points"})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Journey Context"}),a.jsx(et,{value:s.journeyContext||"",onChange:W=>g("journeyContext",W.target.value),rows:3,placeholder:"Current life stage and contextual factors"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Key Touchpoints"}),a.jsx(et,{value:s.keyTouchpoints||"",onChange:W=>g("keyTouchpoints",W.target.value),rows:3,placeholder:"Important interaction points and channels"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h4",{className:"font-medium text-sm",children:"Self-Determination Needs"}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Autonomy"}),a.jsx(et,{value:((Q=s.selfDeterminationNeeds)==null?void 0:Q.autonomy)||"",onChange:W=>g("selfDeterminationNeeds",{...s.selfDeterminationNeeds,autonomy:W.target.value}),rows:2,placeholder:"Need for independence and self-direction"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Competence"}),a.jsx(et,{value:((ee=s.selfDeterminationNeeds)==null?void 0:ee.competence)||"",onChange:W=>g("selfDeterminationNeeds",{...s.selfDeterminationNeeds,competence:W.target.value}),rows:2,placeholder:"Need to feel capable and effective"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Relatedness"}),a.jsx(et,{value:((fe=s.selfDeterminationNeeds)==null?void 0:fe.relatedness)||"",onChange:W=>g("selfDeterminationNeeds",{...s.selfDeterminationNeeds,relatedness:W.target.value}),rows:2,placeholder:"Need for connection and belonging"})]})]})]})]})]})}),a.jsx(Ke,{children:a.jsx(lt,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Fears & Concerns"}),(s.fears||[]).map((W,he)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(_t,{value:W,onChange:pe=>b("fears",he,pe.target.value),placeholder:"Enter a fear or concern"}),a.jsx(se,{variant:"ghost",size:"icon",onClick:()=>y("fears",he),children:a.jsx(wn,{className:"h-4 w-4 text-muted-foreground"})})]},he)),a.jsxs(se,{variant:"outline",size:"sm",onClick:()=>x("fears"),className:"mt-2",children:[a.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Fear/Concern"]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Personal Narrative"}),a.jsx(et,{value:s.narrative||"",onChange:W=>g("narrative",W.target.value),rows:4,placeholder:"Personal story, background, key life experiences"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"A brief narrative that captures their personal story"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Additional Information"}),a.jsx(et,{value:s.additionalInformation||"",onChange:W=>g("additionalInformation",W.target.value),rows:4,placeholder:"Any other relevant details or context"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Additional context or details not covered elsewhere"})]})]})})})]})]})]})}function mOe(){const{id:e}=wR(),t=ci(),n=Rn(),[r,s]=v.useState(void 0),[i,o]=v.useState(!1),[l,c]=v.useState(!1),[u,d]=v.useState(!0);return v.useEffect(()=>{if(!e){d(!1);return}let p=!0;const m=new URLSearchParams(t.search).get("fromReview")==="true";return o(m),d(!0),(async()=>{try{const b=e.startsWith("local-")?e.substring(6):e,y=await $n.getById(b);if(y&&y.data){const w=y.data;if(p){console.log("Found persona in database:",w),s({...w,id:w.id||w._id,isDbPersona:!0}),d(!1);return}}console.error("Could not find persona with id:",e),p&&(s(void 0),d(!1),ce.error("Persona not found"))}catch(b){console.error("Error fetching persona:",b),p&&(s(void 0),d(!1),ce.error("Failed to load persona details"))}})(),()=>{p=!1}},[e,t.search]),{currentPersona:r,isEditing:l,isFromReview:i,isLoading:u,setIsEditing:c,handleGoBack:()=>{n(i?"/synthetic-users?mode=create&tab=ai&step=review":"/synthetic-users")},handleSaveEdit:async p=>{try{c(!1);const g=p.isDbPersona||e&&e.length===24&&/^[0-9a-f]{24}$/i.test(e),m={...p};if(m._id&&delete m._id,delete m.isDbPersona,g&&e&&e.length===24&&/^[0-9a-f]{24}$/i.test(e)){const x=await $n.update(e,m);console.log("Updated persona in database:",x);const b={...p,isDbPersona:!0};s(b),ce.success("Persona updated in database successfully")}else{const x=await $n.create(m);console.log("Created new persona in database:",x.data);const b={...p,id:x.data._id||x.data.id,_id:x.data._id||x.data.id,isDbPersona:!0};s(b),ce.success("Persona saved to database successfully")}}catch(g){return console.error("Error saving persona:",g),g.response&&g.response.status===401?ce.error("Authentication error - Please log in to save personas"):g.response&&g.response.status===404?ce.error("API endpoint not found - Database service may be unavailable"):ce.error("Failed to save persona to database: "+(g.message||"Unknown error")),!1}return!0}}}function n$(){const{currentPersona:e,isEditing:t,isFromReview:n,isLoading:r,setIsEditing:s,handleGoBack:i,handleSaveEdit:o}=mOe();return r?a.jsx(fOe,{}):e?a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(oa,{}),a.jsx("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:t?a.jsx(pOe,{persona:e,onSave:o,onCancel:()=>s(!1)}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center mb-6 relative",children:[a.jsx(se,{variant:"ghost",onClick:i,className:"absolute left-0 top-0 flex items-center",children:a.jsx(nh,{className:"h-5 w-5"})}),a.jsx("h1",{className:"font-sf text-3xl font-bold text-slate-900 mx-auto",children:"Persona Profile"}),a.jsxs(se,{onClick:()=>s(!0),className:"absolute right-0 top-0",children:[a.jsx($G,{className:"h-4 w-4 mr-2"}),"Edit Persona"]})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 mt-10",children:[a.jsx("div",{className:"lg:col-span-1",children:a.jsx(oOe,{persona:e})}),a.jsx("div",{className:"lg:col-span-2",children:a.jsxs(Ho,{defaultValue:"cooper-profile",children:[a.jsxs($a,{className:"grid w-full grid-cols-3",children:[a.jsx(Wt,{value:"cooper-profile",children:"Cooper Profile"}),a.jsx(Wt,{value:"personality",children:"Personality"}),a.jsx(Wt,{value:"scenarios",children:"Scenarios"})]}),a.jsx(Ht,{value:"cooper-profile",className:"mt-6",children:a.jsx(lOe,{persona:e})}),a.jsx(Ht,{value:"personality",className:"mt-6",children:a.jsx(cOe,{persona:e})}),a.jsx(Ht,{value:"scenarios",className:"mt-6",children:a.jsx(uOe,{persona:e})})]})})]})]})})]}):a.jsx(dOe,{})}const gOe=Re.object({username:Re.string().min(3,"Username must be at least 3 characters"),password:Re.string().min(4,"Password must be at least 4 characters")});function vOe(){var u;const e=Rn(),t=ci(),{login:n,isAuthenticated:r}=Zl(),[s,i]=v.useState(!1),o=((u=t.state)==null?void 0:u.from)||"/";console.log("Login page - destination path:",o),v.useEffect(()=>{r&&(console.log("User already authenticated, redirecting from login page"),e("/",{replace:!0}))},[r,e]);const l=tx({resolver:nx(gOe),defaultValues:{username:"",password:""}});async function c(d){i(!0);try{await n(d.username,d.password)?(console.log("Login successful, received token, navigating to:",o),e(o,{replace:!0})):(console.error("Login succeeded but no token received"),i(!1))}catch(f){console.error("Login error in form handler:",f),i(!1)}}return a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-gradient-to-br from-gray-100 to-gray-200 dark:from-gray-900 dark:to-gray-800 px-4",children:a.jsxs(Ke,{className:"w-full max-w-md",children:[a.jsxs(Fr,{className:"space-y-1",children:[a.jsx(ts,{className:"text-2xl font-bold text-center",children:"Sign In"}),a.jsx(XN,{className:"text-center",children:"Enter your credentials to access your account"})]}),a.jsx(lt,{children:a.jsx(sx,{...l,children:a.jsxs("form",{onSubmit:l.handleSubmit(c),className:"space-y-4",children:[a.jsx(ot,{control:l.control,name:"username",render:({field:d})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Username"}),a.jsx(st,{children:a.jsx(_t,{placeholder:"Enter your username",...d,disabled:s,autoComplete:"username"})}),a.jsx(it,{})]})}),a.jsx(ot,{control:l.control,name:"password",render:({field:d})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Password"}),a.jsx(st,{children:a.jsx(_t,{placeholder:"Enter your password",type:"password",...d,disabled:s,autoComplete:"current-password"})}),a.jsx(it,{})]})}),a.jsx(se,{type:"submit",className:"w-full",disabled:s,children:s?"Signing in...":"Sign In"})]})})}),a.jsxs(YN,{className:"flex flex-col space-y-2",children:[a.jsx("div",{className:"text-sm text-center text-gray-500 mb-2",children:"Default account: user / pass"}),!s&&a.jsxs("div",{className:"flex flex-col items-center justify-center gap-2",children:[a.jsx(se,{variant:"outline",onClick:()=>e("/",{replace:!0}),className:"mt-2",children:"Return to Home"}),a.jsx(se,{variant:"link",onClick:()=>{localStorage.setItem("offline_mode","true");const d={username:"guest",email:"guest@example.com",role:"user"};localStorage.setItem("auth_token","offline-mode-token"),localStorage.setItem("user",JSON.stringify(d)),Qe.success("Offline mode activated",{description:"Using demo account with limited functionality"}),e("/",{replace:!0})},className:"text-sm text-gray-500",children:"Use offline mode"})]})]})]})})}function pc({children:e}){const{isAuthenticated:t,isLoading:n}=Zl(),r=ci();return console.log("ProtectedRoute check:",{isAuthenticated:t,isLoading:n,path:r.pathname}),n?a.jsx("div",{className:"flex items-center justify-center min-h-screen",children:a.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-primary"})}):t?(console.log("User is authenticated, showing protected content"),a.jsx(a.Fragment,{children:e})):(console.log("Not authenticated, redirecting to login"),a.jsx(_R,{to:"/login",state:{from:r.pathname},replace:!0}))}const yOe=new lH,xOe=()=>a.jsx(uH,{client:yOe,children:a.jsx(iG,{basename:"/semblance",children:a.jsx(mK,{children:a.jsxs(FW,{children:[a.jsx(h7,{}),a.jsxs(QH,{children:[a.jsx(Ls,{path:"/",element:a.jsx(vK,{})}),a.jsx(Ls,{path:"/login",element:a.jsx(vOe,{})}),a.jsx(Ls,{path:"/synthetic-users",element:a.jsx(pc,{children:a.jsx(wee,{})})}),a.jsx(Ls,{path:"/synthetic-users/:id",element:a.jsx(pc,{children:a.jsx(n$,{})})}),a.jsx(Ls,{path:"/personas/:id",element:a.jsx(pc,{children:a.jsx(n$,{})})}),a.jsx(Ls,{path:"/focus-groups",element:a.jsx(pc,{children:a.jsx(dEe,{})})}),a.jsx(Ls,{path:"/focus-groups/:id",element:a.jsx(pc,{children:a.jsx(YEe,{})})}),a.jsx(Ls,{path:"/dashboard",element:a.jsx(pc,{children:a.jsx(aOe,{})})}),a.jsx(Ls,{path:"/old-path",element:a.jsx(_R,{to:"/",replace:!0})}),a.jsx(Ls,{path:"*",element:a.jsx(yK,{})})]})]})})})});_M(document.getElementById("root")).render(a.jsx(xOe,{})); diff --git a/dist/index.html b/dist/index.html index e02670a4..8316d569 100644 --- a/dist/index.html +++ b/dist/index.html @@ -7,7 +7,7 @@ - + diff --git a/src/components/AIRecruiter.tsx b/src/components/AIRecruiter.tsx index eae6681f..a849ad96 100644 --- a/src/components/AIRecruiter.tsx +++ b/src/components/AIRecruiter.tsx @@ -104,12 +104,16 @@ export default function AIRecruiter({ targetFolderId, targetFolderName }: AIRecr console.log("No target folder specified for new personas"); } + // Log which model is being used for generation + console.log(`๐Ÿค– Starting persona generation with model: ${values.llm_model || 'gemini-2.5-pro'}`); + const response = await generateSyntheticPersonas( values.audienceBrief, values.researchObjective, count, values.dataFile, - targetFolderId + targetFolderId, + values.llm_model ); // Extract personas from the response @@ -122,11 +126,14 @@ export default function AIRecruiter({ targetFolderId, targetFolderName }: AIRecr // Check for partial success (some personas generated, some failed) if (personas && personas.length > 0) { + // Log successful generation with model info + console.log(`โœ… Successfully generated ${personas.length} personas using model: ${values.llm_model || 'gemini-2.5-pro'}`); + // Check if we got a response with partial success info if (response.partial_success || (response.errors && response.errors.length > 0)) { // Some personas succeeded but others failed toast.success("Some personas generated successfully", { - description: `${personas.length} synthetic personas were created. ${response.errors?.length || 0} failed due to timeout or other errors.`, + description: `${personas.length} synthetic personas were created using ${values.llm_model || 'Gemini 2.5 Pro'}. ${response.errors?.length || 0} failed due to timeout or other errors.`, duration: 8000 }); @@ -142,7 +149,7 @@ export default function AIRecruiter({ targetFolderId, targetFolderName }: AIRecr } else { // All personas succeeded toast.success("Personas generated and saved successfully", { - description: `${personas.length} synthetic personas have been created and saved ${targetFolderId ? `to the "${targetFolderName}" folder` : 'to the database'}.` + description: `${personas.length} synthetic personas have been created using ${values.llm_model || 'Gemini 2.5 Pro'} and saved ${targetFolderId ? `to the "${targetFolderName}" folder` : 'to the database'}.` }); } @@ -152,7 +159,7 @@ export default function AIRecruiter({ targetFolderId, targetFolderName }: AIRecr throw new Error("No personas were generated"); } } catch (error) { - console.error("Error generating personas:", error); + console.error(`โŒ Error generating personas using model: ${values.llm_model || 'gemini-2.5-pro'}:`, error); let errorMessage = "Please try again or adjust your parameters"; let errorTitle = "Failed to generate personas"; diff --git a/src/components/FocusGroupModerator.tsx b/src/components/FocusGroupModerator.tsx index c92e3cdb..ee13396d 100644 --- a/src/components/FocusGroupModerator.tsx +++ b/src/components/FocusGroupModerator.tsx @@ -112,6 +112,7 @@ const formSchema = z.object({ duration: z.string().min(1, { message: "Duration is required.", }), + llm_model: z.string().optional(), }); // Sample discussion guide sections - We'll keep this but fetch real personas from the database @@ -509,6 +510,7 @@ export default function FocusGroupModerator({ draftToEdit, onDraftSaved }: Focus focusGroupName: "", discussionTopics: "", duration: "60", + llm_model: "gemini-2.5-pro", }, }); console.log('Form initialized successfully'); @@ -568,7 +570,8 @@ export default function FocusGroupModerator({ draftToEdit, onDraftSaved }: Focus description: values.researchBrief, objective: values.researchBrief, topic: values.discussionTopics, - duration: parseInt(values.duration) + duration: parseInt(values.duration), + llm_model: values.llm_model }; // Call API to generate discussion guide, with focus group ID if available @@ -663,6 +666,7 @@ ${values.researchBrief} topic: values.discussionTopics.split(',')[0].trim().toLowerCase().replace(/\s+/g, '-'), description: values.researchBrief, objective: values.researchBrief, + llm_model: values.llm_model, }; const savedDraft = await focusGroupsApi.create(draftData); @@ -719,7 +723,31 @@ ${values.researchBrief} } } - // Generate discussion guide based on form input (after assets are uploaded) + // Update focus group with current form values before generating guide + // This ensures the backend uses the latest model selection + if (focusGroupId) { + try { + const preUpdateData = { + name: values.focusGroupName, + participants: selectedParticipants, + participants_count: selectedParticipants.length, + duration: parseInt(values.duration), + topic: values.discussionTopics.split(',')[0].trim().toLowerCase().replace(/\s+/g, '-'), + description: values.researchBrief, + objective: values.researchBrief, + llm_model: values.llm_model + }; + + await focusGroupsApi.update(focusGroupId, preUpdateData); + console.log("Focus group updated with latest form values before guide generation"); + console.log(`๐Ÿ”„ Updated focus group ${focusGroupId} with model: ${values.llm_model}`); + } catch (error) { + console.error("Failed to update focus group before guide generation:", error); + // Continue anyway, as the generateDiscussionGuide will use form values as fallback + } + } + + // Generate discussion guide based on form input (after database is updated) const guide = await generateDiscussionGuide(values, focusGroupId); setDiscussionGuide(guide); @@ -735,6 +763,7 @@ ${values.researchBrief} topic: values.discussionTopics.split(',')[0].trim().toLowerCase().replace(/\s+/g, '-'), description: values.researchBrief, objective: values.researchBrief, + llm_model: values.llm_model, discussionGuide: guide }; @@ -1193,6 +1222,31 @@ true; )} /> + + ( + + AI Model + + + Choose which AI model to use for generating responses and discussion guides + + + + )} + /> diff --git a/src/components/ai-recruiter/AIRecruiterForm.tsx b/src/components/ai-recruiter/AIRecruiterForm.tsx index bb1197f6..1417cf04 100644 --- a/src/components/ai-recruiter/AIRecruiterForm.tsx +++ b/src/components/ai-recruiter/AIRecruiterForm.tsx @@ -19,6 +19,13 @@ import { } from "@/components/ui/form"; import { Input } from "@/components/ui/input"; import { Textarea } from "@/components/ui/textarea"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@/components/ui/select"; export const formSchema = z.object({ audienceBrief: z.string().min(10, { @@ -29,6 +36,7 @@ export const formSchema = z.object({ message: "Number of personas is required.", }), dataFile: z.instanceof(FileList).optional(), + llm_model: z.string().optional(), }); interface AIRecruiterFormProps { @@ -50,6 +58,7 @@ export default function AIRecruiterForm({ onSubmit, isGenerating }: AIRecruiterF audienceBrief: "", researchObjective: "", personaCount: "5", + llm_model: "gemini-2.5-pro", }, }); @@ -372,6 +381,32 @@ export default function AIRecruiterForm({ onSubmit, isGenerating }: AIRecruiterF )} + {/* LLM Model Selection */} + ( + + AI Model + + + Choose which AI model to use for generating personas + + + + )} + /> + {/* Number of Personas to Generate */} = React.memo(( }); }; - const deleteEditingSectionItem = (itemId: string, itemType: 'question' | 'activity') => { - if (!editingSection) return; + const deleteEditingSectionItem = async (itemId: string, itemType: 'question' | 'activity') => { + if (!editingSection || !structuredGuide || !onSave) return; const itemArray = itemType === 'question' ? 'questions' : 'activities'; const filteredItems = editingSection[itemArray]?.filter(item => item.id !== itemId) || []; - setEditingSection({ + const updatedEditingSection = { ...editingSection, [itemArray]: filteredItems - }); + }; + + // Update local state immediately + setEditingSection(updatedEditingSection); + + // Auto-save the changes to persist them immediately + try { + const updatedGuide = { + ...structuredGuide, + sections: structuredGuide.sections.map(section => + section.id === editingSection.id ? updatedEditingSection : section + ) + }; + + await onSave(updatedGuide); + toast.success('Item deleted successfully'); + } catch (error) { + console.error('Error deleting item:', error); + toast.error('Failed to delete item'); + + // Revert local state on error + setEditingSection(editingSection); + } }; const addEditingSectionItem = (itemType: 'question' | 'activity') => { diff --git a/src/components/focus-group-session/types.ts b/src/components/focus-group-session/types.ts index 959eb271..adf06152 100644 --- a/src/components/focus-group-session/types.ts +++ b/src/components/focus-group-session/types.ts @@ -13,6 +13,7 @@ export interface FocusGroup { duration: number; topic: string; discussionGuide?: string; + llm_model?: string; created_at?: string; created_by?: string; updated_at?: string; diff --git a/src/lib/api.ts b/src/lib/api.ts index e7aff058..2d0e24a8 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -21,6 +21,18 @@ api.interceptors.request.use( if (token) { config.headers.Authorization = `Bearer ${token}`; } + + // Debug logging for focus group updates + if (config.method === 'put' && config.url?.includes('/focus-groups/')) { + console.log('๐ŸŒ API Request:', { + method: config.method, + url: config.url, + baseURL: config.baseURL, + fullURL: `${config.baseURL}${config.url}`, + data: config.data + }); + } + return config; }, (error) => Promise.reject(error) @@ -206,16 +218,21 @@ export const aiPersonasApi = { researchObjective?: string, count: number = 5, temperature: number = 0.7, - customerDataSessionId?: string + customerDataSessionId?: string, + llmModel?: string ) => { try { + // Log the API call with model information + console.log(`๐Ÿ“ก API call to generate-basic-profiles with model: ${llmModel || 'gemini-2.5-pro'}`); + // First stage: Generate basic profiles const basicProfilesResponse = await api.post('/ai-personas/generate-basic-profiles', { audience_brief: audienceBrief, research_objective: researchObjective, count, temperature: 0.7, // Use 0.7 temperature for basic profiles - customer_data_session_id: customerDataSessionId + customer_data_session_id: customerDataSessionId, + llm_model: llmModel || 'gemini-2.5-pro' }, { timeout: 600000 // 10 minutes for basic profile generation }); @@ -225,12 +242,16 @@ export const aiPersonasApi = { const personaIds = []; const errors = []; + // Log the second stage API calls with model information + console.log(`๐Ÿ“ก API call to complete-and-save-persona with model: ${llmModel || 'gemini-2.5-pro'}`); + // Second stage: Complete each profile in parallel const completeRequests = basicProfiles.map(profile => api.post('/ai-personas/complete-and-save-persona', { basic_profile: profile, temperature, - customer_data_session_id: customerDataSessionId + customer_data_session_id: customerDataSessionId, + llm_model: llmModel || 'gemini-2.5-pro' }, { timeout: 600000 // 10 minutes for each persona completion }) @@ -290,13 +311,18 @@ export const aiPersonasApi = { }), // Batch generate summaries for download - batchGenerateSummaries: (personaIds: string[], temperature: number = 0.7) => - api.post('/ai-personas/batch-generate-summaries', { + batchGenerateSummaries: (personaIds: string[], temperature: number = 0.7, llmModel?: string) => { + // Log the API call with model information + console.log(`๐Ÿ“ก Frontend: API call to batch-generate-summaries with model: ${llmModel || 'gemini-2.5-pro'}`); + + return api.post('/ai-personas/batch-generate-summaries', { persona_ids: personaIds, - temperature + temperature, + llm_model: llmModel || 'gemini-2.5-pro' }, { timeout: 900000 // 15 minutes timeout for batch processing - }), + }); + }, // Upload customer data files for parsing uploadCustomerData: (files: FileList) => { diff --git a/src/pages/FocusGroupSession.tsx b/src/pages/FocusGroupSession.tsx index 05d37836..7ae1b2c5 100644 --- a/src/pages/FocusGroupSession.tsx +++ b/src/pages/FocusGroupSession.tsx @@ -8,12 +8,16 @@ import { ClipboardList, BarChart, PlayCircle, - StickyNote + StickyNote, + Settings, + Bot } from 'lucide-react'; import { toastService } from '@/lib/toast'; import { Button } from '@/components/ui/button'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from '@/components/ui/dialog'; +import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; +import { Badge } from '@/components/ui/badge'; import Navigation from '@/components/Navigation'; import ParticipantPanel from '@/components/focus-group-session/ParticipantPanel'; import DiscussionPanel from '@/components/focus-group-session/DiscussionPanel'; @@ -48,6 +52,11 @@ const FocusGroupSession = () => { // Notes-related state const [notes, setNotes] = useState([]); + + // Model settings state + const [showModelSettings, setShowModelSettings] = useState(false); + const [selectedModel, setSelectedModel] = useState(''); + const [isUpdatingModel, setIsUpdatingModel] = useState(false); const [isNoteModalOpen, setIsNoteModalOpen] = useState(false); const [sessionStartTime, setSessionStartTime] = useState(null); @@ -416,10 +425,12 @@ const FocusGroupSession = () => { date: data.date || new Date().toISOString(), duration: data.duration || 60, topic: data.topic || 'general', - discussionGuide: data.discussionGuide || '' + discussionGuide: data.discussionGuide || '', + llm_model: data.llm_model || 'gemini-2.5-pro' }; setFocusGroup(focusGroupData); + setSelectedModel(focusGroupData.llm_model || 'gemini-2.5-pro'); // Handle participants if (data.participants_data && Array.isArray(data.participants_data)) { @@ -466,6 +477,44 @@ const FocusGroupSession = () => { } }; + // Function to update the LLM model for this focus group + const updateFocusGroupModel = async (newModel: string) => { + console.log('๐Ÿ”ง updateFocusGroupModel called with:', { id, focusGroup: !!focusGroup, newModel }); + + if (!id || !focusGroup) { + console.log('โŒ updateFocusGroupModel: Missing id or focusGroup', { id, focusGroup: !!focusGroup }); + return; + } + + setIsUpdatingModel(true); + try { + console.log('๐Ÿ”ง Making API call to update focus group model:', { id, newModel }); + const response = await focusGroupsApi.update(id, { + llm_model: newModel + }); + + console.log('๐Ÿ”ง API response:', response); + + if (response && response.data) { + setFocusGroup(prev => prev ? { ...prev, llm_model: newModel } : null); + toastService.success('AI Model Updated', { + description: `Focus group will now use ${newModel === 'gemini-2.5-pro' ? 'Gemini 2.5 Pro' : 'GPT-4.1'} for AI responses` + }); + setShowModelSettings(false); + console.log('โœ… Model update successful'); + } else { + console.log('โŒ API response missing data:', response); + } + } catch (error) { + console.error('โŒ Error updating focus group model:', error); + toastService.error('Failed to update AI model', { + description: 'There was an error updating the AI model. Please try again.' + }); + } finally { + setIsUpdatingModel(false); + } + }; + useEffect(() => { console.log("Looking for focus group with ID:", id); @@ -498,10 +547,12 @@ const FocusGroupSession = () => { date: data.date || new Date().toISOString(), duration: data.duration || 60, topic: data.topic || 'general', - discussionGuide: data.discussionGuide || '' + discussionGuide: data.discussionGuide || '', + llm_model: data.llm_model || 'gemini-2.5-pro' }; setFocusGroup(focusGroupData); + setSelectedModel(focusGroupData.llm_model || 'gemini-2.5-pro'); // Handle participants if (data.participants_data && Array.isArray(data.participants_data)) { @@ -1440,6 +1491,12 @@ const FocusGroupSession = () => {

{focusGroup.name}

{new Date(focusGroup.date).toLocaleString()}

+
+ + + {focusGroup.llm_model === 'gpt-4.1' ? 'GPT-4.1' : 'Gemini 2.5 Pro'} + +
@@ -1453,6 +1510,14 @@ const FocusGroupSession = () => { AI Dashboard + + + + + + + {/* Autonomous Dashboard */} { const [isSummaryGenerating, setIsSummaryGenerating] = useState(false); const [summaryGenerationComplete, setSummaryGenerationComplete] = useState(false); const [summaryGenerationError, setSummaryGenerationError] = useState(false); + // LLM selection for download + const [downloadLlmModalOpen, setDownloadLlmModalOpen] = useState(false); + const [selectedDownloadLlmModel, setSelectedDownloadLlmModel] = useState('gemini-2.5-pro'); // Handle summary generation progress completion const handleSummaryProgressComplete = () => { @@ -943,18 +946,30 @@ true; // Download persona summary for current folder const downloadPersonaSummary = async () => { - const folderName = selectedFolder === DEFAULT_FOLDER_ID - ? 'All Personas' - : folders.find(f => f.id === selectedFolder)?.name || 'Unknown Folder'; - if (filteredPersonas.length === 0) { toastService.error("No personas to download"); return; } + // Show LLM selection modal immediately + setDownloadLlmModalOpen(true); + }; + + // Handle the actual download with selected model + const handleDownloadWithModel = async () => { + const folderName = selectedFolder === DEFAULT_FOLDER_ID + ? 'All Personas' + : folders.find(f => f.id === selectedFolder)?.name || 'Unknown Folder'; + // Extract persona IDs, using _id for database personas or id as fallback const personaIds = filteredPersonas.map(persona => persona._id || persona.id); + // Log user's model selection + console.log(`๐Ÿค– Frontend: User selected ${selectedDownloadLlmModel} for persona summary download`); + + // Close modal + setDownloadLlmModalOpen(false); + // Reset progress states and start generation setIsSummaryGenerating(true); setSummaryGenerationComplete(false); @@ -968,7 +983,7 @@ true; }); // Call the new API endpoint for batch summary generation - const response = await aiPersonasApi.batchGenerateSummaries(personaIds, 0.7); + const response = await aiPersonasApi.batchGenerateSummaries(personaIds, 0.7, selectedDownloadLlmModel); const { summaries, summary_stats, errors } = response.data; // Generate markdown content from LLM-processed summaries @@ -1034,20 +1049,32 @@ true; // Mark generation as complete setSummaryGenerationComplete(true); - // Show success toast with details + // Show success toast with details including model information + const modelDisplayName = selectedDownloadLlmModel === 'gpt-4.1' ? 'GPT-4.1' : 'Gemini 2.5 Pro'; if (summary_stats.total_successful === summary_stats.total_requested) { toastService.success("Persona summary downloaded", { - description: `Successfully processed all ${summary_stats.total_successful} persona${summary_stats.total_successful !== 1 ? 's' : ''} from "${folderName}"` + description: `Successfully processed all ${summary_stats.total_successful} persona${summary_stats.total_successful !== 1 ? 's' : ''} from "${folderName}" using ${modelDisplayName}` }); } else { toastService.success("Persona summary downloaded with warnings", { - description: `Processed ${summary_stats.total_successful} of ${summary_stats.total_requested} personas from "${folderName}"` + description: `Processed ${summary_stats.total_successful} of ${summary_stats.total_requested} personas from "${folderName}" using ${modelDisplayName}` }); } } catch (error) { console.error("Error generating persona summaries:", error); + // Log detailed error information + if (error.response) { + console.error("Error response data:", error.response.data); + console.error("Error response status:", error.response.status); + console.error("Error response headers:", error.response.headers); + } else if (error.request) { + console.error("Error request:", error.request); + } else { + console.error("Error message:", error.message); + } + // Mark generation as failed setSummaryGenerationError(true); @@ -1815,6 +1842,54 @@ true; + + {/* LLM Selection Modal for Download */} + + + + Select AI Model for Summary Generation + + Choose which AI model to use for generating persona summaries + + + +
+ +
+ + +
+
+ + +
+
+
+ + + + + +
+
diff --git a/src/utils/personaGenerator.ts b/src/utils/personaGenerator.ts index dd64361e..f2fbc63c 100644 --- a/src/utils/personaGenerator.ts +++ b/src/utils/personaGenerator.ts @@ -12,6 +12,7 @@ import { aiPersonasApi, personasApi } from "@/lib/api"; * @param count Number of personas to generate * @param file Optional data file to assist in generation (not currently used) * @param targetFolderId Optional folder ID to assign to generated personas + * @param llmModel Optional LLM model to use for generation * @returns Array of generated personas */ export async function generateSyntheticPersonas( @@ -19,10 +20,12 @@ export async function generateSyntheticPersonas( researchObjective?: string, count: number, file?: FileList, - targetFolderId?: string | null + targetFolderId?: string | null, + llmModel?: string ): Promise { - // Debug logging for folder + // Debug logging for folder and model console.log(`generateSyntheticPersonas called with targetFolderId: ${targetFolderId || 'none'}`); + console.log(`๐Ÿ”„ generateSyntheticPersonas using model: ${llmModel || 'gemini-2.5-pro'}`); try { // We'll use the two-stage approach which leverages parallel processing @@ -53,7 +56,8 @@ export async function generateSyntheticPersonas( researchObjective, // Pass the research objective for focused goals and scenarios count, // Number of personas to generate 0.8, // Temperature - slightly higher for more creativity - customerDataSessionId // Pass customer data session ID if available + customerDataSessionId, // Pass customer data session ID if available + llmModel // Pass the LLM model selection ); if (response.data) {